Creating unit test cases for rules
For most rules, you can create a reusable test case by converting a unit test to a test case, configuring case details, and then defining expected test results with assertions (test conditions). When the test case runs, the test results are compared to the expected results defined for the rule’s assertions. If the test results do not meet the defined assertions, then the test fails.
To modify the rule or class that is used for the test, in the upper-right corner of the Definition tab, click the Gear icon, select the rule or class and then click Submit.
If you are testing a strategy rule, then the componentName and pzRandomSeed parameters are also displayed. If you change either of these parameters, the test case does not return the expected results.
- componentName – The name of the component (for example, Switch) that you are testing.
pzRandomSeed – Internal parameter, which is the random seed for the Split and Champion Challenger shapes.
To prevent the test from being run as part of a test suite or from a REST service, on the Definition tab, select the Disable check box.
The test case will be run only when you click.
In the Expected results section, add assertions that define the expected results of the test. For more information about creating assertions, see Defining expected test results with assertions.
On the Setup & Cleanup tab, configure the actions to perform and the objects and clipboard pages to be available before and after the test runs. You can also clean up the clipboard after the test is run by applying additional data transforms or activities. For more information, see Setting up your test environment.
In the Details dialog box, enter a label that identifies the test case. The test case identifier is generated based on the label and cannot be modified after it is saved.