Task: Develop Rule Unit Tests
The goal of this task is to track down anomalies in the rules such as conflicts, redundancies or overlaps.
Disciplines: Rule Authoring
Purpose


Relationships
RolesPrimary Performer: Additional Performers:
Main Description

Rule Unit Testing is the process of testing a specific rule in the context of the rule set in which it is deployed. Rule Unit Testing allows rule writers to:

  • Validate each rule in the context of its rule set
  • Control the rule set quality
  • Conduct some impact analysis when rules are in conflict
  • Helps to have non-regression tests

There is a major difference between testing a code, and a rule. A rule engine per design may not put a rule in the agenda if the conditions are not matched. This means that when the rule writer write a new rule, even if the data are sent to trigger the execution of this new rule it is possible that a rule fired before the new one, with change the condition of the data so that this new rule will never be eligible. Developing a complete set of unit test is an efficient way to see this problem, and to improve the rule set design. Some powerful BRMS platform has rules consistency checking which helps to do some static analysis of those potential conflict by analyzing the conditions and the actions of the rules. For sure real test cases will complete the picture.



Using a Test Driven Development approach rule writer can develop the test script preparing the data to trigger each rule, depending of the BRMS platform used, the script generation can be done automatically or not. What is important is develop reusable test case organized in test suite which include assertion statement to validate the expected results. This is efficient tool to put in place automatic non regression tests.