Back Forward How to unit test a When Condition rule

About When condition rules

You can test a when condition rule as a unit, before or after it is integrated into the rest of the application you are developing.

Preparation

1. Review the Applies To key part and Pages & Classes tab of the rule, to identify the class of the pages it uses for input and the properties involved in the decision.

2. When feasible, perform any necessary processing to create or load a clipboard page or pages that supply some or all of the properties needed. For example, if the Applies To class involves a work type, you can open a work object of the corresponding class. Unit testing does not alter these pages.

3. For more comprehensive testing, create one or more model rules that load various sets of input values.

Test approach

For basics of unit testing, see How to unit test a rule with the Run toolbar button.

1. Save the rule form.

2. Click the Run toolbar button (Run) or the equivalent keyboard shortcut CTRL + R to open a guided test window.

3. The system presents a list of clipboard pages with a class that may match the Applies To key part. Select the clipboard page that is to be a major source of values for the rule. If no page of the appropriate type is present, select Create or Reset this Test page and specify a model.

4. Click  Create Page and Run Rule  . The system makes a temporary copy of the page you selected (or creates a new temporary page and applies the model rule), executes the decision table rule, and displays the result.

5. Repeat as desired with different model rules, or alter the clipboard contents and re-perform the test.

The original page is not altered.

zzz About When Condition rules