A first step in
analyzing results of executing Decision Services is to gain visibility to the rules that
fired. With rule tracing, you can see which rules and Rulesheets fired in processing a
work document. The Rule trace viewer lets you:
See the sequence of actions that took place in a Ruletest.
Sort the columns of the Rule Trace View.
Export the view contents.
Click on a line to highlight it the Ruletest Output.
Double-click on a line to open the related Rulesheet at the rule that was
applied.
Make and apply changes to the Rulesheet, and then save it.
Run the Ruletest again to see the change applied, and marking the differences in
the Expected column.
Filter the view content to focus on specific lines.
Note: The following examples use the
Advanced Tutorial's Ruleflow as the test subject. The Ruleflow has three Rulesheets,
each with conditional and non-conditional rules. Here is the output of the checkout.ert Ruletest:
You can reduce the time it takes diagnose rule execution problems by
efficiently analyzing the Ruletest as it executes to trace all the rules that fired. Run
a Ruletest with the additional functionality of the Rule Trace Viewer by just clicking a
button: The Ruletest runs the test as well a rule trace across all Rulesheets,
and then presents the results in the Rule Trace tab, as shown:
The results of a rule trace are dynamic.
Highlight—Click anywhere on a line to
highlight that element in the Testsheet output. Click on any item in the Ruletest
to see all the lines related to that element highlighted in the Rule Trace Viewer,
as illustrated where a filter was applied to see only the lines that contain
Shop in the viewer:
Sort—Click on any column header in the Rule Trace tab to sort the tab content in ascending order.
Click again to sort into descending order.
Locate—Double-click on any line to open
the related Rulesheet positioned at the Action line and rule. In the Ruletest,
copy the Output to the Expected column so you can see changes. On the Rulesheet
shown here, the discount was modified from 2% to 5%:
Without saving the Rulesheet, run the Ruletest again.
The change and its impact are highlighted. You can choose to save the
modified Rulesheet or close it so that the change is ignored.
Exporting Rule Trace output
You can output the Rule Trace data to a .csv file so that you can use
your tools to analyze the data. Just right-click anywhere on the Rule Trace panel, and
then click Export Rule Trace Data to file, as shown:
The
output of this example in Excel is:
Filtering Rule Trace output
When you have very large data sets in the Rule Trace view, you can filter the Rule Trace
view table data.
The type filter text box at the top of the Rule Trace panel lets you enter a
value to match in the Rule Trace View output:
You can construct complex filters with regular expressions.
^ = beginning of line
$ = end of line
[] = any of the listed comma-separated characters
\[ or \] = escaped special characters
As an example for Cargo, you could to
search for Cargo [2] or Cargo [4] by using
Cargo \[[2,4]\]
Note: The Rule Trace Viewer is based
on JSON. If you have the Studio property com.corticon.tester.ccserver.execute.format set to XML (instead of the default, JSON), the
Rule Trace Viewer function is inoperative.