SessionDoc

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 :

Figure 1. SessionDoc for the testSelfMadeMillionaireScenario testThis image displays the generated SessionDoc.

Some key details on this page are:

Clicking on the link for the sole rule set FlexibleRetirementYearRuleSet shows its rule objects:

Figure 2. Rule Objects for the FlexibleRetirementYearRuleSet rule setThis image displays the generated rule object.

This page shows:

Clicking on the details link for the sole FlexibleRetirementYear rule object shows its SessionDoc:

Figure 3. SessionDoc for the FlexibleRetirementYear rule objectThis image displays the generated rule objects.

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:

Tip: Implementation of a description rule attribute on each rule class may make your SessionDoc easier to understand. See The description Rule Attribute for more details.

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".

Tip: The DumpOutRuleObjects utility can be a useful way of "browsing" the rule objects stored on CER's database tables, and can be a useful debugging aid once you have reached the point of integrating CER rules into your online application.

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.

1 Prior to Cúram V6, the state INITIALIZED was used. From Cúram V6, the state SPECIFIED is used instead.