By default, when you run the When rule, the result assertion uses the input value that you enter and the result that the test returns. The system generates the assertion when you convert this test to a test case.
- In the navigation pane of Dev Studio, click Records.
- Expand the Decision category, and then click When.
- In the list of When rule instances, click the rule that you want to test.
- In the rule form header, click .
- In the Run window, in the Run context pane, in the Thread list, select the thread in which you want to run the rule.
- In the Page list, select whether to copy parameter values from
an existing page or to create an empty page:
- To use parameter values from a clipboard page in the selected thread, click
Copy existing page, and then, in the Page to
copy field, select the page that you want to use.
For example, you can select a clipboard page to test specific values.
- To start a test from a page that contains no parameter values, click Empty test page.
Note: The system runs the rule instance on the RunRecordPrimaryPage clipboard page, regardless of the page that you select from this list. If you convert this test run to a test case and the RunRecordPrimaryPage clipboard page requires initial values, configure the clipboard to populate the page with initial values. For more information, see Setting up your test environment.
- To use parameter values from a clipboard page in the selected thread, click Copy existing page, and then, in the Page to copy field, select the page that you want to use.
- Optional: To apply a data transform to copy values for the test, select the Apply data transform checkbox, and then select the transform to apply.
- Optional: To change the values that the rule uses during the test, enter the new values on the main test page.
- Start the test by clicking Run.
- Optional: To convert the test run into a Pega unit test case,
click Convert to test, and then configure the test case.For more information, see Creating unit test cases for rules.
- Optional: To view the pages that the unit test generates, click
Clipboard.For more information, see Clipboard pages created by the Run Rule feature.