The Run Rule feature enables
you to test a decision table 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 enter all the data
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 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 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 table rule and displays the results.
- If automated testing is enabled, select Auto-generate Test Cases. This will
generate all test cases for this decision table. For more
information, see the Pega Developer Network article
PRKB-25098 How to
auto-generate test cases for a decision table.
- If automated testing is enabled, select
Run Against a Saved Test
Case. Then choose an individual test case, all
test cases, or all auto-generated 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 document 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
Table tab that produced the test
result. If the Evaluate All Rows option on
the Results tab is selected, all
the rows that are true are highlighted.
- Optional. Click Show
Clipboard to
open the Clipboard and examine the pages. Click Hide
Clipboard to
close the tool. For information about the clipboard pages that
are generated, see How to test a rule with
the Run Rule feature.
- Repeat as necessary, selecting other model rules or
providing other input values.
Debugging decision table rules with the
Tracer
If your decision table 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:
- Select Run > Tracer.
- In the Tracer window, click the Options button
().
- In the Event Types to Trace section,
select Decision Table.
- Select the RuleSet that contains the rule to be
traced.
- Click OK .
- Return to the main portal and run the decision table
rule.
- Watch the Tracer output as the rule runs.
About Decision Table rules