Unit test a decision table or decision tree
Unit test a decision table or decision tree
Testing a decision table or decision tree on its own before testing it in the context of the entire application is called unit testing. Since decisions are evaluated automatically, they can have a significant impact on case processing. Ensuring that the decision logic is correct helps avoid troubleshooting the process if you get unexpected results. You can unit test decision rules by testing the logic, checking for conflicts in the logic, and checking for completeness.
Test for logic
You can test the logic of a decision rule by entering test values and running the rule to observe the results. If you do not see the expected results, make sure that the properties and comparison operators are correct.
To test for logic, on a decision rule form, select Actions > Run. The system displays a test page for entering test values. On the form, click Run Again after you enter each value as shown in the following example.
After you have entered values for all the conditions and click Run Again, the form returns the corresponding result from the decision table or tree. The following logic test shows that the input values returned the correct result.
Test for conflicts
Checking for conflicts shows you if your decision rule prevents one or more of its rows or branches from ever being used. For example, assume your decision table contains a row that tests for purchase requests that exceed USD300. The next row tests for purchase requests that exceed USD500. The second row may never be evaluated, because the upper row includes that condition.
To test for conflicts, on the decision form, click Show Conflicts. If a conflict exists, a warning is displayed on the row causing the conflict. In the following example, the condition Credit Score >1000 cannot be evaluated because it is a larger value than the 900 condition that is evaluated first.
Test for completeness
To test for completeness, on the decision form, click Show completeness. The system adds rows to indicate values that will not be evaluated. The results are suggestions. You can add return results to additional rows if you think the decision rule needs a more detailed evaluation of the values.