You can significantly improve the debugging and testing process for complex decision services, especially those with hundreds of rulesheets or nested ruleflows. Where you might rely on full system tests of decision services to validate rules, that makes it difficult to isolate problems within individual rulesheets or nested ruleflows. The ability to generate unit tests for each step (rulesheet, sub-flow, or other step) within a ruleflow, allows for more targeted testing, and thereby make it easier to detect and isolate issues within specific parts of a decision service.

Generate Ruletests from the AI Assistant

Note: Generating Ruletests from the AI Assistant has limitations--Ruleflows are not supported, and Ruletests are supported only for test sheets with a Rulesheet as a test subject.

To have the AI assistant generate ruletests for a selected Ruletest

  1. Open a Ruletest (.ert) document.
  2. Open the AI Assistant panel.
  3. Choose either
    • Generate test cases for rules so that all the rules will execute. Here is how the AI Assistant responded:

      The following rules were added:


    • Generate Negative Test Cases with at least one negative case for each rule. Here is how the AI Assistant responded:

    • The following rule was added:


  4. Review the AI generated response.

Generate Multiple Unit Ruletests in the Ruleflow Editor

To generate ruletests for a selected Ruleflow

  1. Open a Ruleflow (.erf) document, for example:

  2. Choose the Ruleflow menu command Generate Ruletests for this file:


  3. In the Generate Ruletests dialog, the Ruleflow opens with these fields:
    • Test Payload A valid JSON or XML payload for the tests
    • Ruletest Prefix Your preferred name for the ruletest results
    • Output Folder Preset to the project folder
    • Max Testsheets per Ruletest A value between 1 and 50
    • Trace Execution In the Ruletest results, to perform Trace Execution on each testsheet
  4. Click Finish
  5. The new Ruletest is created. On it, you see that the test has been transformed into a set of Testsheets:

    Each Testsheet is a unit test where each unit test corresponds to a single step in a Ruleflow.

    Each generated rule test has its input and output set to the data seen by that step during the execution of the Ruleflow. The Expected column for each generated rule test is set to the Output column data.

    If the expected column in the final generated rule test in the Ruleflow is correct, you can infer that each step in the ruleflow is executing correctly.

How to prepare your files for Ruletest Generation

Ruletest generation has some limitations, yet they have workarounds:
  • Handling of branches—When you have a branch in a ruleflow such as:


    The workaround is to convert whatever component it does not recognize into a ruleflow wrapper it then saves as a ruleflow. That ruleflow replaces the branch in the central ruleflow:


  • Handling of iterations—If a rulesheets uses iterations, create a ruleflow with the iterations as separate objects, and then add that ruleflow to the central ruleflow. An iteration like this:

  • Iterations might be wrappered as TrueFalseIterate_wrapper like this:


    When that generates the Ruletest, it properly iterates:

  • Handling of service callouts—When a ruleflow node is a service callout, each one needs a wrapper. In this example, three nodes are service callouts:

    By wrappering each service callout in a ruleflow, the ruletest generation function works.