Running models with test data

You can test a model by creating and running test data sets that validate specific scenarios. Test data can be entered either through a form or directly in JSON format.

Procedure

  1. Optional: If you are testing a task model, select a function to choose the ruleflow that you want to run.
  2. Click Add test data set.
  3. In the Input tab, select data items from the generated form to add them to the data set and enter values for each item. If you prefer to edit the content of the data set in JSON, use the content switcher to open the rich JSON editor Content switcher button.

    In decision and predictive models, you can click the icon at the top of the data set to learn more about supported data formats.

  4. Click Run to run the model with the data set.

Results

The run report is displayed in the results pane. The content of this report varies slightly depending on the type of model.

Table 1. Run report details for decision and predictive models
Section Description
Assertion results Displays the results of any defined assertions. If no assertions are defined, this section remains collapsed and shows a No assertions defined tag.
Decision output Displays the output of each end decision. For each decision node, the report shows its name and the JSON output it produced.
Messages Displays printed messages that are extracted from the run history, useful for debugging and understanding the execution flow.
Run history Provides detailed information for all nodes in the decision or predictive model, traced from end decisions back to start nodes:
Decision nodes
Shows the node name, number of executed rules, interaction policy, and output. You can click the arrow icon next to the node name to view details on the executed rules.
Input data nodes
Shows the node name and output.
Statistics Displays execution metrics such as compilation time and execution time.

You can also click Show JSON output to view all input, output, and execution data in a single JSON structure. The JSON output is organized into four main sections: payload, infos, statistics, and messages. payload corresponds to the Decision output section, and infos corresponds to the Run history section.

Table 2. Run report details for task models
Tab Description
Decision output Displays the final output of the task model in JSON format.
Assertion results Displays the results of any defined assertions. If no assertions are defined, the tab remains empty.
Messages Displays printed messages that are extracted from the run history, useful for debugging and understanding the execution flow.
Run history Provides a detailed execution trace of the task model. The trace includes:
  • The full execution hierarchy across the ruleflow, tasks, and rules
  • Input and output data at each step of execution
  • Execution metrics
  • Details about executed and skipped rules
  • Printed messages captured during execution
  • Any recorded exceptions
Statistics Displays execution metrics such as compilation time and execution time.

Example

Open the Approval decision model available in the Loan Approval decision service in the Banking sample, and click the Run tab. You can see data sets that correspond to different test scenarios. When you run the Mr Doe loan data set, the loan is approved and you get the following result:

{
    "approved" : true,
    "message" : "Congratulations! Your loan has been approved"
}

In this data set, look for the Yearly income field and change its value from 100000 to 80000. When you run the data set with this new value, the loan is not approved and you get the following result:

{
    "approved" : false,
    "message" : "Too big Debt/Income ratio: 0.45597806940658686"
}

This result validates that the yearly income of the borrower influences the approval of the loan. The number of months during which the borrower repays the loan is also supposed to influence this approval. If you change the value of the number of monthly payments from 72 to 120 and run this data, the loan is now approved again:

{
    "approved" : true,
    "message" : "Congratulations! Your loan has been approved"
}

This result validates that the number of monthly payments influences the approval of the loan, and that it can compensate for a yearly income that might be too low.