Unit testing strategy rules
Perform a single case run to test your strategy against a specific record. You can test whether the strategy that you created is set up correctly and delivers expected results.
Note: You can run single case tests on data sets and data flows with multiple key
properties.
- Search for and open a Strategy rule.
- On the right side of the strategy canvas, expand the Test run panel.
- In the panel, click the Single case tab.
- Expand the Settings section.
-
Select the source and the subject of the test run from the following options:
- Select Data Transform and specify a data transform instance as the source of the test run.
- Select Data set and specify a data set instance as the source and a value for each key property as the subject of the test run.
- Select Data flow and specify a data flow instance as the source and a value for each key property as the subject of the test run.
Note: For the Subject ID field, the interface displays the first ten customer IDs that are available for selection. Select a different ID by typing its name. -
If the Strategy rule that you are testing uses external input from another Strategy
rule, perform the following actions:
- In the For external inputs use strategy field, enter the name of the Strategy rule that generates the input.
- Optional:
To obtain the input directly from the component that generates it, select the
Specify a single component within the strategy check box and
then select the component.
If you do not specify a component, the application obtains the input from the results component of the Strategy rule that generates the input.
-
Run the test by performing one of the following actions:
- On a checked-out Strategy rule, click Save and Run.
- On a checked-in Strategy rule, click Run.
- Analyze the results.
- Optional:
To see if a component was optimized, at the top of the strategy canvas, click
Show optimization.
Result: The following symbols appear on strategy components:
- A check mark for optimization
- A warning sign for a lack of optimization
- Optional: To see the results for a specific non-optimized strategy component, click that component.
- Optional:
To convert the test into a PegaUnit test case, click Convert to
test.
A test case allows you to compare the expected output of a test to actual test results. For information about configuring test cases, see Modifying PegaUnit test cases.
- Optional:
To view the performance of the entire strategy run, access a downloadable report file
by performing the following actions:
- Click Actions > Run.
- In the Run window, define the Run context and then click Run.
- Click Download strategy execution profile (xls).