Create and execute test cases for decision tree and decision table rules
Summary
You can unit test an individual rule on its own before testing it in the context of the entire application you are building. With Automated Unit Testing, you can save the test data that you use as test case rules. Then, the next time you test that rule, you can run the test case rather than manually re-entering the test data.
Suggested Approach
Creating Test Cases for Decision Trees and Decision Tables
To record and save a test case:
- Open the decision tree or decision table rule you want to test.
- Click the Run toolbar icon. The Run Rule window appears.
- Go to the Test Cases tab of the opened rule.
- Click Record New Test Case. The Run Rule window appears.
Starting with step 4, the rest of the steps for creating a test case are the same for V6.1.
- In the Test Page section, specify which page to use as the main page.
- In the Result section, enter the test data and click Run Again.
- Examine the results and determine whether the test data used generated the expected results.
- When you are satisfied with the results, click Save Test Case . The New Test Case dialog box appears.
- Enter the name of the test case, a short description, and the appropriate RuleSet and version; then click Create.
Running Test Cases
After you create a test case for a rule, it appears in the list of saved test cases in the Run Rule window for the tested rule.
To run a test case:
- Open the rule you want to test.
- Click the Run button. The Run Rule window appears.
To run a test case in V6.1:
- Go to the Test Cases tab of the opened rule.
- Click the name of the test case.
The Run Rule window appears, with the name of the test case already selected. The system runs the test case, and displays the results in the Result section of the window. If any differences are found, a message states that the results are unexpected.
Step 5 in this article is the same for V6.1.
- Select the run against a saved test case option and choose a test case from the list.
Because the test case rule contains the initial pages that were created, loaded, or copied before the rule was run, you do not have to recreate the initial conditions before running the test case.
- Click Run Test Case. Process Commander runs the test case and displays the results in the Result section of the Run Rule window. If there are any differences found, a message states that the results were unexpected.
- Click Save Results to save the descriptions of any differences found between the current results and those stored in the test case.
In the case of unexpected results, you can examine the rule history of the rule by clicking View Rule History.
Additionally, if the new results are valid, you can overwrite the test case so it uses the new information by clicking Overwrite Test Case.