Rules Test Screen
|
The Rules Test screen is your prime tool for testing the Rules before deploying them. It is located under the “Test” tab and allows executing the current rule set against an application XML document sample. The Rules as well as all the other objects must be saved before running a test.
The test screen consists of the 3 sections:
To execute the BRE against your data, copy your data document into the top left textbox and click the “Run Test” button. The execution log will be displayed in the Parser log box and the State document will be displayed in the State XML box. If any assignments took place, they will be reflected in the data XML document. At this point, you can activate the second BRE pass by clicking the “Run Test” button again. The updated data XML document along with the current State document will be supplied as the subsequent pass input. Prior to executing a subsequent pass, you can modify the input data XML as well as the State XML document (see “Changing State Fields”).
If you wish to restart the BRE, click the “Reset” button. It will restore the input data XML back to the previously pasted (unedited) text and erase the State information.
If syntax errors were detected in your XML data, the BRE Status document will be displayed within the BRE State textbox. You will have to “Reset” the BRE screen before submitting another test.
The Log displayed by the Test provides wealth of information about each operator execution. If at any time you feel that your rules yield the result you did not expect, simply create data sample, run it and examine the Log. There you will find every logical operator result (true/false), predicate execution results, formula calculations, application and rule data comparisons and more. Just like most of the RuleLab.Net outputs, the Log is clickable which enables quick navigation to the entity definition (rule, atom, fact). If you detect a problem with your rules, change/save the rules, reset the Test and run it again. The results you should be looking for are the proper data assignments in the input XML and the rule execution matching the anticipated outcome. |
|
You can control the BRE State content using the “details” checkboxes above the “XML State Document” section. For more information please see the “Options Header” section of the Web Service specification.
Please note that Test execution time may be considerably longer than of a similar BRE call made via the Web Service. Test screen involves various validations and the log generating which can be quite time consuming. Please do not judge the BRE performance by the response time of the Test screen.
Along with the Log box, you will find the “BRE Reasoning” tab. It is there to help you follow the logic of the BRE arriving at a particular decision.
The BRE Reasoning allows you to backchain the rules that produced the given assignment. A list of the assignments made during the last BRE pass is displayed in the dropdown. Note that this list is only populated after you run a test. If you would like to examine a particular Atom assignment, select it and click the “Show Reasoning” button. You will get a tree of Atoms that were changed along with the Rules that fired and changed them. At the root level is your target Atom while the leaves point to Atoms that were altered first.
Note that Reasoning logic utilizes the BRE State XML therefore do not modify the “BRE State XML Document” prior to clicking the “Show Reasoning” button.
If you would like your application to be able to show similar explanation logic to a user, please refer to the Web Service documentation on Reasoning. The Web Service allows your application to receive Reasoning XML. There is a source code sample in the BREClient.cs file that shows how to render Reasoning XML document in HTML. The source code file is part of the Client Application download available from the product demo page.