Skip to main content


         This documentation site is for previous versions. Visit our new documentation site for current releases.      
 

Defining expected test results with assertions

Updated on April 8, 2022

Use unit test cases to compare the expected output of a rule to the actual results returned by running the rule. To define the expected output, you configure assertions (test conditions) on the test cases that the test, when run, compares to the results returned by the rule.

When a test runs, it applies assertions in the order that you define them on the Definition tab of the test case. All assertions, except for run time assertions, must pass for the test to be successful.

For example, an account executive wants to ensure that a 10% discount is applied to all preferred customers. You can create a test case that verifies that this discount is applied to all preferred customers in the database. If the test does not pass, the results indicate where the 10% discount is not applied.

Note: On decision trees and decision rules, you cannot configure properties from a read-only data page or a data page that is a declarative target.
  • Configuring activity status assertions

    You can verify that an activity returns the correct status when it runs by configuring an activity status assertion. You can also assert if an activity has an error and, if it does, what the message is so that you can validate that the message is correct.

  • Configuring assigned to assertions

    For flows and case types, you can use the assigned to assertion to verify that an assignment is routed to the appropriate work queue or operator.

  • Configuring attachment exists assertions

    For flows and case types, you can verify that the flow or case type has an attachment of type file or note (attached using the Attach Content shape) or email (attached using the Send Email shape) attached.

  • Configuring case instance count assertions

    For flows and case types, you can verify the number of cases that were created when the case type or flow was run.

  • Configuring case status assertions

    You can configure a case status assertion on a flow or case type to verify the status of the case.

  • Configuring decision result assertions

    After you create a unit test case for a decision table or decision tree, the system generates a decision result assertion. This assertion displays the input values for testing the rule, and the result that is generated by the rule.

  • Configuring expected run-time assertions

    You can create an assertion for the expected run time of the rule. The expected run-time assertion is less than or equal to an amount of time that you specify, in seconds.

  • Configuring list assertions

    You can create list assertions for page lists on a rule to determine if either the expected result is anywhere in the list of results returned by the rule. Even if the order of results changes, the test will continue to work.

  • Configuring page assertions

    Some rules, such as activities and data transforms, can create or remove pages from the system. You can create page assertions to determine whether or not a page exists after a unit test case runs. You can also assert if a property has an error and, if it does, what the message is so that you can validate that the message is correct.

  • Configuring property assertions

    You can configure property assertions to validate that the actual values of properties returned by a rule are the expected values. You can also assert if a property has an error and, if it does, what the message is so that you can validate that the message is correct.

  • Configuring result count assertions

    You can configure assertions to compare the number of items returned in a page list, page group, value list, or value group on the rule to the result that you expect to see on the clipboard.

  • Previous topic Excluding work class properties from flows and case type tests
  • Next topic Configuring activity status assertions

Have a question? Get answers now.

Visit the Support Center to ask questions, engage in discussions, share ideas, and help others.

Did you find this content helpful?

Want to help us improve this content?

We'd prefer it if you saw us at our best.

Pega.com is not optimized for Internet Explorer. For the optimal experience, please use:

Close Deprecation Notice
Contact us