The Run Rule feature enables
you to test a decision tree rule 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. Additionally, if Automated
Testing is enabled, you can save the test data and its
results as a test case
rule.
Before you begin
Before you begin, determine how you will provide the sample
data to use when testing the rule. Can you provide all the data
directly in the Run Rule window? Or does the rule need specific
pages to be on the clipboard to return a decision?
- Examine the rule. Review the Applies To
key part, Table tab and
Pages & Classes tab of the
rule, to identify the classes of the pages it uses for input
and the properties involved in the decision.
- The Run Rule feature can create or copy a page to use as
the test page, as appropriate for the rule you are testing.
The page class of the test page is the Applies
To class of the rule. If necessary, you can create a
model to set initial values for the page.
- If the rule requires input from several pages, determine
how to mimic the processing that creates them so the
clipboard has the initial context you need to run the rule.
For example, you can run an activity that creates the pages
or start a flow and stop it at the appropriate point.
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.
Run the rule
To run the rule, complete the following steps:
- Save the rule.
- 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.
- Click the Run toolbar button . The Run Rule window appears.
- In the Test Page section, specify which page to use as
the main page. Do one of the following:
-
- select Create or Reset Test page.
Then, in the Apply field, select the
model to use for the test page.
- In the lower section of the Run Rule window,
enter the test data and click
Run Again.
The system runs the decision tree rule and displays
the results.
-
- Click Run Rule Again as necessary, selecting
other model rules or providing other input
values.
- If automated testing is enabled, select
Run Against a Saved Test
Case. Then choose an individual test case or all
test cases from the drop-down list.
- If Automated
Testing is enabled, you can click the
Save as Test Case button to create a test
case rule that holds the test data and the results.
For information about running test cases, see the
Pega Developer Network article PRKB-25096 How to create and execute
test cases for decision tree and decision table
rules.
- Optional. Click the Result Decision
Paths link to go directly to the row on the
Decision tab that produced the
test result.
- Optional. Click Show
Clipboard to
open the Clipboard and examine the pages. Click the
Hide
Clipboard button
to close the tool. For information about the clipboard pages that
are generated, see How to test a rule with
the Run Rule feature.
Debugging decision tree rules with the
Tracer
If your decision tree rule does not give you
the results you expect and you cannot determine the problem by
running the rule and examining the clipboard pages, run the
Tracer tool. With the Tracer you can watch each step in the
evaluation of a decision tree rule as it occurs.
Complete the following steps:
- From then menu, select the Run >
Tracer.
- In the Tracer window, click the Options button
().
- In the Event Types to Trace section,
select Decision Tree.
- Select the RuleSet that contains the rule to be
traced.
- Click OK .
- Return to the main portal and run the decision tree
rule.
- Watch the Tracer output as the rule runs.
About Decision Tree rules