Rule Testing Setup
A Decision Flow calls rules with inputs defined in a separate configuration Decision Table, and tells you which tests passed and which did not.
David Škarka
Template author
This Decision Flow functions as an automated testing engine that calls rules with inputs defined in a separate configuration Decision Table, and tells you which tests passed and which did not.
Solution components:
A Decision Table named 'Test Data Sets' defines the set of tests (ruleAlias), inputs, and appropriate expected outputs, which will be called from the workflow.
Two Decision Tables named 'To power of 2' and 'Add 10' serve as sample logical units, containing intentional mistakes for specific input values to demonstrate how the system handles and reports testing failures.
A Decision Flow named Testing orchestrates the validation process:
It prepares inputs for dynamic evaluation by retrieving the rows from the Test Data Sets Decision Table.
It iterates through the data sets and dynamically calls the specific rule (e.g., "To power of 2" or "Add 10") defined in each test case.
It compares the actual output from the rule against the expected output defined in the dataset; if the values match, the test is recorded in the passedTests list.
If the values do not match, the workflow captures the discrepancy (expected vs. got) and appends it to the failedTests list.
Use this Decision Flow as a regression testing tool to ensure your business rules maintain logic consistency by simply adding new test scenarios to the configuration table and running the workflow.
More Templates
See Other Templates
A/B Testing
Discover a simple way to assign a test group for performing A/B Testing on your decisions.
Risk Based Pricing
Discover a simple way to apply a suitable Risk Based Pricing matrix based on a type of client.
Eligibility and Policy Rules
Discover a simple way to define and execute various sets of rules and get the final decision outcome.