Defining expected test results with assertions
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.
- 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