Note: This article describes how Automated Unit Testing works in Process Commander versions prior to Version 6.1. For information about how Automated Unit Testing works as of Version 6.1, consult How Automated Unit Testing works (V6.1).
Part of Automated Unit Testing, the Test Manager is supported by the following items:
- Three rule types – test case (Rule-AutoTest-Case), test suite (Rule-AutoTest-Suite) and flow marker (Rule-AutoTest-Case-FlowMarker).
- Test Manager – A dashboard that you can use to schedule test suites and examine their results.
- Test suite processing – An agent activity ( RunTestSuitesFromAgent) that runs test suites in the background.
- Email processing – An activity (RunTestSuitesFromAgent) that generates email messages that summarize test suite results for an operator.
The Run Rule feature enables you to test an individual rule on its own before testing it in the context of the entire application you are building. When Automated Testing is enabled, you can save the test data that you used for certain types of rules 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.
Test case rules contain the clipboard and database pages that existed when the test case was created, the user input, and the results. When you run a test case, Process Commander uses the saved test data when testing the rule and then compares the results to those saved in the test case. If the results do not match, you investigate the tested rule to see what changed and determine if there is a problem.
Test case rules exist only in the context of the rule they test. You can create test cases from the Run Rule window only.
Test suite rules identify:
- A set of test cases and their RuleSets
- An operator ID used to run the test cases (in V5.4, the access group is used instead)
You can create a test suite that includes all the test cases for a specific rule type or you can select individual rules and specify the sequence in which to run them.
When you run individual test cases from the Run Rule window of a rule, the test case runs in your session as your requestor ID. Test suites are , however, run in the background as the batch requestor of the Pega-ProCom agent. When the agent runs the test suite, it uses the access group specified in the test suite rather than the access group specified for the Batch requestor type data instance or for the agent queue.
You use the Test Manager window to schedule a test suite and examine its results. The Test Manager contains three tabs:
- The Dashboard tab lists the results of all the test suites that have been scheduled during the past five days. Also, if you ran all test cases for a specific rule, those results are also listed in this window.
- The Suites tab displays the results of a specific test suite from each time it was run in the past week.
- The Schedule tab lists all the test suites the user has access to and all test suites that are currently scheduled to run. Use this tab to schedule when to run test suites.
To access the Test Manager, select Run > Test Manager.
The Pega-ProCom agent activity named RunTestSuitesFromAgent runs test suites. When you schedule a test suite, a schedule request is created and queued up. When the agent activity runs, it runs any test suite request whose scheduled time is due.
When more than one instance of the Pega-ProCom agent is running on multiple-node systems, Process Commander uses queue and test suite locking. While an agent instance is selecting a suite request from the queue, the entire queue is locked so other agents cannot select a request. After the agent selects a request, it releases the lock on the queue but it holds a lock on the test suite request.
When the test suite completes its run, the RunTestSuitesFromAgent activity uses an email correspondence rule named CompletedTestSuite to generate an email message that contains the results of the test. The agent then uses the standard outbound email account named Default.Notify to send the message to the operator who scheduled the test suite.
When you run a test case, Process Commander displays the differences in the lower section of the Run Rule window.
Each time the agent runs a test suite, Process Commander records the results in an instance of the Data-AutoTest-Result-Case class.
When a flow rule test case is included in a test suite, the agent runs through the entire test case unless it finds a difference between the current results and those stored in the test case. If the agent finds differences in the flow rule test case, the agent stops running that test case and begins running the next test case in the test suite.
A flow marker allows you to jump directly to a specific point in the flow process without having to input the same information every time in order to reach that point.
In versions prior to V6.1, to use a flow marker you have created, in the Test Page section of the Run Rule window, select which flow marker you want to jump to and click the Jump to Flow Marker button.
You will be brought to the step saved in the flow marker. From that step you can continue testing the flow rule normally.