Show
all
With Automated Unit Testing, you can simplify and increase the speed of unit testing certain aspects of your Process Commander applications. As a result, you can be more agile about determining when corrective action is necessary within your development process.
For example, a typical situation has an application with a number of work object types and the flows that process those work objects, and subsequent development work makes changes to one of those flows.
Those intended changes made to one flow might have unintended impacts on the other work object types and flows of the application. In this type of situation, the ability to efficiently unit test for unexpected results and assess the extent of the impacts is important, so that corrective action can be taken if the new behavior is not desired. Automated Unit Testing provides the ability to quickly discover and address such unanticipated effects.
For examples and additional information, see Pega Developer Network article PRKB-25092 About Automated Unit Testing, which links to additional articles.
What you can do with Automated Unit Testing
If your operator ID has the AutomatedTesting privilege through an access role, you can use Automated Unit Testing to perform and automate unit testing of the following rule types:
- Activities
- Decision tables
- Decision trees
- Flows
- Service SOAP
You can:
- Record a test run through an individual rule, and then save the data you used and the results of the run as a test case. If a rule is subsequently modified and you want to verify its behavior, you can run its saved test case rather than manually entering
the test data again. See About test
case rules.
- Specify that a group of test cases are to be run together, potentially in a
specific sequence, by creating a unit test suite. See About unit
test suite rules.
- Schedule unit test suites to be run, for one-time runs or periodically.
See Application — Automated Unit Testing landing page.
- View reports that display the results of running unit test suites in the Automated Unit Testing landing page.
Obtaining the AutomatedTesting privilege
An operator ID has the AutomatedTesting privilege when the privilege is assigned in at least one of the access roles that are listed in the operator's associated access group. Use one of the following methods:
- Add the standard PegaRULES:AutoTest access role to your access group.
- Create a new role, add the AutomatedTesting privilege to that role, and add the new role to your access group.
- Add the AutomatedTesting privilege to your existing role.
If you are unable to modify your operator ID's access group or to modify your access role or create a new one, you might not have the system authorities to perform those operations; contact your system administrator.
To add the PegaRULES:AutoTest access role to your access group, open the access group form, add a new line to the Roles array, select PegaRULES:AutoTest in the new line, and save the form. See Access Group form — Completing the Layout tab.
To obtain the AutomatedTesting privilege by adding it to your existing role or to a new role:
- Identify the access roles assigned to your profile to see if you have an existing one to which you can add the privilege. One way to see your assigned roles is to open your profile and see what is listed in the Roles list (see Profile).
- Open the Roles for Access list by selecting > Org & Security > Tools > Security > Role Names.
- If you want to add the privilege to one of your assigned roles, click its name in the list. Otherwise, to add the privilege to a new role, click New... and create a new access role.
Creating a new access role in this step provides the way to assign the AutomatedTesting privilege to your operator ID (see About the Access Role Editor).
At the end of this step, the elements of the access role are displayed in a new window.
- If @baseclass is not displayed in the list of classes, add it by selecting
@baseclass
in the Add a class field and clicking Add.
- Add the AutomatedTesting privilege to @baseclass:
- In the Privileges column for @baseclass, click [add].
- In the Update window, select
AutomatedTesting
in the Add a privilege field and click Add. - In the Level field, select a value. A typical level for this privilege is
2
. - Click Update to save your selections.
- In the window displaying the access role elements, click Update to save your selections, then close the window.
- If you added the privilege to one of your existing assigned roles, log off and log back in to refresh your profile with the new privilege.
If you created a new access role in the preceding steps, add it to your access group:
- Select Profile from your profile menu and click the name of your access group to open its rule form.
- In the Roles list, click to add a new row, select your role from the list in that new row, and save the form.
- Log off and log back in to refresh your profile with the new privilege.
After logging back in, verify that you have the AutomatedTesting privilege by selecting > Application; see if the Automated Unit Testing landing page appears in the list. If not, check with your system administrator.
Test cases
To work with the individual test cases for a specific rule, use the Test Cases tab of the rule form for that rule.
Test cases save both the test data and the results of that test data.
When you run a test case, Process Commander uses the saved test data to
run 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 whether there is a problem to be resolved.
Unit test suites
A unit test suite is a group of test cases that you want to have running together. Whether you want to run a unit test suite only once or schedule it to run periodically, you use the Schedule gadget on the Automated Unit Testing landing page to run a unit test suite. The unit test suite runs as a background process. An agent activity in the Pega-AutoTest agents rule checks for unit test suite requests every five minutes
and runs those that are due. When the agent activity finishes running a
unit test suite, it sends an email message with the results to the person
who scheduled the request.
Test Management Framework
Pegasystems offers an optional application to support testing, known
as the Test Management Framework. Contact your Pegasystems representative to
learn more.
Related PDN articles
-
PRKB-26115 How to enable Automated Unit Testing (V6)
-
PRKB-26165 Creating a testing application and RuleSet for test cases and unit test suites (V6)