Executing flow rule test cases
The Unit Test Manager is part of the Automated Testing facility.
When the Unit Test Manager is enabled, you can create and run test cases against flow rules.
The process of running a test case for a flow rule is quite different than for decision tree, decision table, or SOAP Service rules, since you must move through each step in the flow.
Suggested Approach
Running Test Cases for Flow Rules
To run a test case for a flow rule:
- Open the flow rule you want to test.
- Click the Run button. The Run Rule window appears.
- Select the Run against a saved test case option. Choose a test case from the drop down list.
- Click Run Test Case.
- Each step of the flow appears in sequence in the harness window and test navigation window. Click the Next Flow Step button to move through each step.
The Input Values Prior To Step Screen
At each step in the flow, the test navigation window displays all input values for that step. Here, any value that a user can enter that was changed is highlighted in green in the harness window. If you make any changes to the input values, you can save them by clicking the Save New Inputs button to add them to the test case.
You can also view a list of all values left blank in this test case by clicking on the Display Blank Values link. Once you have edited the inputs of the step, click Next Flow Step or the arrow button in the top right corner to move to the Results After Step window.
Validating Inputs
In the Input Values Prior To Step form, all input values for a step can be edited in the test navigation window. If a user must manually input a value, a validation can be used in place of a value.
For example, if you have a date field in your flow rule test case, you can validate that it is always a certain number of days ahead or behind the current date by using the following syntax,
$TODAY +/- X
where X is an integer value. By using this syntax, you can set the date field to always be five days later than the current date by entering:
$TODAY + 5
into the date field.
Calling Activities in Input Fields (Version 5.5+)
Version 5.5 supports the ability to call an activity which will fill in the value of an input field using the following syntax:
$<activity_name>()
The Results After Step window
After displaying the input values, the test navigation window then displays the results screen for that step. Process Commander compares the actual results to the saved results in the test case rule . The results appear in the test navigation window.
Any clipboard differences found are highlighted in red in both the harness window and the test navigation window. You can choose to view both the clipboard or database differences by either name or label.
By expanding the clipboard and database differences lists, you can choose to ignore each difference found clicking on the checkbox in the Ignore column. After viewing the differences found, you can save all ignored properties by clicking the Save Ignores button.
You can also view all ignored properties by selecting the Show/Hide Ignored Properties link in the test navigation window. You can then choose to view all properties that are ignored in the current test case or view all properties that are ignored across all test cases.
You can delete the current work object by checking the Delete Work Objects check box. Select the Finish button to return to the beginning of the current test case.
Any changes made in the previous forms can be added permanently to the test case by clicking on the Overwrite Step button.
Ignoring Differences
There are two ways to indicate that different values for a specific work object property should be ignored when a flow test case is running:
- For an individual test case, run the test case and specify which differences to ignore.
- For all flow test cases for a specific work class, create a model named AutoTestPropsToIgnore for the class.
Individual Test Cases
To specify which differences an individual test case should ignore, complete the following steps:
- From the Run Rule window of the flow you want to test, select the test case.
- Step through each form in the flow by clicking Next Flow Step. When Process Commander finds clipboard or database differences in a flow step, it displays them in the lower section of the Run Rule window.
You can choose to display the properties with differences by either their property name or by their label.
Select or clear the Ignore option as appropriate for each difference. Then click Save Ignores. Process Commander runs the comparison for that step again, this time ignoring the properties you specified.
- Click contract to close the differences list.
- Repeat steps 3 through 5 for each flow step that displays differences.
When the Automated Unit Test Manager runs a test case for a flow rule, it accesses a set of model rules named AutoTestPropsToIgnore. These model rules indicate which standard flow processing properties are to be ignored by default. The classes @baseclass, Work-, Assign-, andAssign-Worklist each contain an AutoTestPropsToIgnore model; your model can override the standard ones.
If you want Process Commander to ignore differences in additional work object properties when it runs any flow rule test case from a specific work class or class group, do the following:
- Create a model named AutoTestPropsToIgnore for that class (or class group).
- List the properties to ignore. Leave the value field blank for each property.
- Select the Call Superclass Model option.
View Flow Summary
At the end of the test case execution, you can view a summary containing the results for each step in the test case by clicking the View Flow Summary button.
The run flow summary window displays all clipboard and database differences found for each step during the play back of the test case. By expanding each step, you can view a list of all the differences found, their expected values, and their actual values.
Click Save to save the flow summary results. You can also choose to delete the work object that is created by checking the Delete Work Object checkbox.