How to unit test a section with the Run Rule feature |
The Run Rule feature enables you to test a section individually before testing it in the context of the application you are developing. You specify a test page for the rule to use, provide sample data as the input, run the rule, and examine the results.
Before you begin, determine how you will provide the sample data to use when testing the rule. If possible, open a work item of the appropriate work type.
For general information about the Run Rule feature, including a list of the clipboard pages that are generated when a rule runs, see How to test a rule with the Run Rule feature.
To run the rule, complete the following steps:
1. Save the rule.
2. Complete any preprocessing necessary to create the appropriate clipboard context and, if the rule is circumstanced or time-qualified, to set the conditions you want to test.
3. Click the Run toolbar action. The Run Rule window appears.
4. In the Test Page section, specify which page to use as the main page. Do one of the following:
If the rule being tested is circumstance-qualified, select Set circumstance properties to run exact version of rule.
If the rule being tested contains one or more parameter definitions on the Parameters tab, you are prompted for parameter values. Supply a text value for any required parameters.
5. In the lower section of the Run Rule window click Execute. The system runs the section and displays the results.