Back Forward About Automated Unit Testing

  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:

You can:

 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:

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:

  1. 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).
  2. Open the Roles for Access list by selecting > Org & Security > Tools > Security > Role Names.
  3. 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.

  4. If @baseclass is not displayed in the list of classes, add it by selecting @baseclass in the Add a class field and clicking Add.
  5. Add the AutomatedTesting privilege to @baseclass:
    1. In the Privileges column for @baseclass, click [add].
    2. In the Update window, select AutomatedTesting in the Add a privilege field and click Add.
    3. In the Level field, select a value. A typical level for this privilege is 2.
    4. Click Update to save your selections.
  6. In the window displaying the access role elements, click Update to save your selections, then close the window.
  7. 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:

    1. Select Profile from your profile menu and click the name of your access group to open its rule form.
    2. In the Roles list, click to add a new row, select your role from the list in that new row, and save the form.
    3. 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

Definition Test Management Framework
Related topics About test case rules
About unit test suite rules
Understanding the Pega-AutoTest agents