Short-circuiting

Rather than relying on the Rule API assertions to raise errors and skips with pre-defined messages, you can cause the rule execution to stop at any point based on certain conditions in your custom rule definitions. The message you construct will be displayed to end-user on the UI.

Failing

You can cause an assertion to fail with an arbitrary failure message using the following call:

  • fail(arbitrary message)

Rule execution will stop at the point where this call is placed. The value provided in arbitrary message will be shown on the UI as the assertion failure message.

../../_images/assertion_fail_groovy.png ../../_images/assertion_fail_a1.png

Warning

You can cause an assertion to stop with an arbitrary warning message using the following call:

  • warn(arbitrary message)

Rule execution will stop at the point where this call is placed. The value provided in arbitrary message will be shown on the UI as the assertion warning message. Note that the test script execution will be marked as Passed with warning(s) in this case (provided no failures took place).

../../_images/assertion_warn_groovy.png ../../_images/assertion_warn_a1.png

Skipping

You can cause an assertion to skip with an arbitrary message using the following call:

  • skip(arbitrary message)

Rule execution will stop at the point where this call is placed. The value provided in arbitrary message will be shown on the UI as the assertion skipped message. Note that the test script execution will be marked as Skipped in this case (provided no failures took place).

../../_images/assertion_skip_groovy.png ../../_images/assertion_skip_a1.png