CER allows you to output HTML documentation regarding a session ("SessionDoc").
This documentation provides a record of all the rule objects created during the session, and when used in conjunction with your tests can be a powerful debugging aid.
It can be useful to use JUnit's tearDown hook point to force all the test methods in your test class to output their SessionDoc:
@Override protected void tearDown() throws Exception { /* * Write out SessionDoc, to a directory named after the test * method. */ final File sessionDocOutputDirectory = new File("./gen/sessiondoc/" + this.getName()); sessionDoc.write(sessionDocOutputDirectory); super.tearDown(); }
Here is the main SessionDoc page for a testSelfMadeMillionaireScenario test :
Some key details on this page are:
Clicking on the link for the sole rule set FlexibleRetirementYearRuleSet shows its rule objects:
This page shows:
Clicking on the details link for the sole FlexibleRetirementYear rule object shows its SessionDoc:
At the top (not shown) are summary details for the rule object, and then every rule attribute on the rule object is listed, with the following details:
The name of the rule attribute;
The type of the rule attribute as declared in the rule set. The actual runtime value may be from a subtype of this declared type;
The state of the value, i.e. whether it was:
Calculated by rules;
Explicitly specified by client code, replacing any defined calculation, or initialized1as part of a create expression;
Not explicitly specified, not calculated during rules execution (because the value was never requested by any other calculations or tests); or
An error occurred during the calculation of the value (see the application logs or console output for details and calculation stack of the error).
A display representation of the value. If the value was never calculated (NOT_YET_CALCULATED), or is in error (ERROR) then "?" will be displayed. If the value is a rule object, then the value will be shown as a navigable hyperlink so that you can see the details of that rule object; and
The RuleDoc derivation of the attribute (without any links). For more information on RuleDoc, see RuleDoc.
Links to the attributes which were used to calculate this value.
(Optional) Links to the attributes which used this value when calculating their values.
If you are running SessionDoc against a large database, then it may be useful to suppress the output of "used by" links, since the inclusion of such links might cause very many rule objects to be output by SessionDoc. To suppress the output of "used by" links, use the curam.creole.execution.session.SessionDoc.write(File, boolean), passing false as the second parameter.
For rule objects that are stored on CER's database tables, you can create SessionDoc for these stored rule objects by running the curam.creole.util.DumpOutRuleObjects class, with a single argument being the name of a directory in which to create the SessionDoc. The DumpOutRuleObjects utility retrieves all rule objects from CER's database tables, and thus the action for each external rule object will be "retrieved". Any internal rule objects will be created (as they are not stored) and thus will show an action of "created".
You can browse the rule objects to see the values of calculated attributes on rule objects, together with a technical view of how any calculation result was arrived at.