Testing rulesets in Rule Designer
To validate rulesets against scenarios, you set up and run a testing configuration.
About this task
You can generate a template of the scenarios file where you enter the values that you want to test. Then, you set up the testing configuration by specifying a decision operation and the Excel file that contains the scenarios.
For a demonstration on testing rulesets Rule Designer, watch the following video:
Procedure
- If you don't already have one, create a scenario file. To generate a template scenario file, see Generating an Excel scenario file.
- Optional: You can add breakpoints in various artifacts of the project to pause the execution of the test in strategic places for debugging purposes. To learn more about breakpoints, see Breakpoints.
- Right-click the project that you want to test and select .
- In the list of configurations, right-click Testing decision operation and click New.
- Give this configuration a name and specify the Excel file that contains the scenarios and the decision operation to use.
- Click Debug.
Results
The results for the scenarios use the following statuses:
- Successful: A test is successful when the expected results match the actual results.
- Unsuccessful: A test is unsuccessful when the expected results are different from the actual results.
- Error: An error is reported when the test cannot run the scenarios, for example, when an entry in the scenario file is not correctly formatted.
If there are breakpoints in the rules of the project, the execution stops when it encounters one and the Debug view opens. You can then see which breakpoints stopped the execution and you can continue the resume the execution until the next breakpoint.
Example
********************************************************
Scenario Number 0 : 'Rejected loan' = Success
Time = 16, Nb Executed Rules = 1, Nb Executed Tasks = 3
********************************************************
Scenario Number 1 : 'Big amount loan' = Failure
Expected result 'the loan is approved equals ': Failed
Time = 0, Nb Executed Rules = 1, Nb Executed Tasks = 2
********************************************************
Scenario Number 2 : 'Approved loan' = Success
Time = 0, Nb Executed Rules = 0, Nb Executed Tasks = 3
********************************************************
Nb Executed 3
Nb Failures 1
Nb Errors 0
End running the JVM for testing
The
Rejected loan
scenario and the Approved loan
scenario were
successful, meaning that the expected values defined in the scenarios match the actual results of
the tests. The Big amount loan
scenario failed because the rule that approves the
loan did not produce the expected result.