Skip to main content

         This documentation site is for previous versions. Visit our new documentation site for current releases.      

This content has been archived and is no longer being updated.

Links may not function; however, this content may be relevant to outdated versions of the product.

How to enable Automated Unit Testing (6.1)

Updated on September 10, 2021


Before you can take advantage of Automated Unit Testing with your applications, certain configuration steps are necessary. This article presents the steps for configuring those areas of a 6.1 system that enable you to make full use of Automated Unit Testing:

For configuration steps in releases before V6.1, see How to enable Automated Testing (PRPC 5).

Suggested Approach

You must obtain the appropriate access for your Operator ID and enable the Pega-AutoTest agents:

  • Access to use the main features of Automated Unit Testing such as test cases and running unit test suites comes from having the AutomatedTesting privilege. The standard PegaRULES:AutoTest access role provides this privilege.
  • Enabling the Pega-AutoTest agents is required for the automation features of running unit test suites and scheduling recurrent runs. To take full advantage of the power of automating unit regression testing, enable the Pega-AutoTest agents.

While configuring the elements for email notification of unit test suite results is optional, such notification facilitates the best practices of automated unit regression testing. If a unit test suite run results in differences, you and others can be alerted by email of the need to investigate.

Obtain the appropriate access

Add the standard PegaRULES:AutoTest access role to your Operator ID's access group.

If you are unable to modify your Operator ID's access group, contact your system administrator.
To add the PegaRULES:AutoTest access role to your access group:
  1. Open the Access Group form.
  2. Add a new line to the Roles array.
  3. Select PegaRULES:AutoTest in the new line.

  1. Save the form.
  2. Log off and log back in to refresh your profile.

After logging back in, verify that you have the AutomatedTesting privilege by selecting > Application. Confirm that the Automated Unit Testing landing page appears in the list. If not, check with your system administrator.

Enable the Pega-AutoTest agents

You schedule runs of unit test suites using the Schedule gadget in the Automated Unit Testing landing page. When you schedule a unit test suite to run (instead of running it immediately), it runs as a background process. The Pega-AutoTest agent activities that initiate these backend processes must be enabled to run. These activities are:

  • Rule-AutoTest-Case.RunTestSuitesFromAgent
  • Rule-AutoTest-Case.RunRecursiveTestSuites
To enable these agents:
  1. In the Rules Explorer, select SysAdmin > Agent Schedule to see the list of agent schedule instances.
  2. Select the Pega-AutoTestagent schedule in the list to open its rule form.

    If your system has more than one node, there are multiple Pega-AutoTest agent schedule instances listed. Select any one.

    If there are no agent schedule instances listed, this system might have all agents disabled system-wide. If you encounter this situation, check with your system administrator to ensure that the prconfig.xml file for your system does not contain the following line:
    <env name="agent/enable" value="false" />
    If the prconfig.xml file contains that line, then all of the agents in the system are disabled. Set the value equal to trueto enable agents in your system.
  3. On the Schedule tab, enable the agent activities using the Enabled? check boxes.

  1. Optionally set the time interval that determines how frequently the agent activities run. By default, it is set to run every five minutes (300 seconds).
  2. Save the form.

Enable email notification of unit test suite results

You can configure the system so that when a unit test suite has unexpected results, the Pega-AutoTest agents send a completion email message with the results of the unit test suite run. The email message is sent to the email address in your Operator ID, and additionally to any email addresses specified in the schedule for that unit test suite run. This completion email message provides an alert to any issues encountered in the run.

For this email notification to work, a standard outbound email account instance needs to be configured:

  • In a Version 6.1 or 6.1 SP1 system: configure the Default email account.
  • In a Version 6.1 SP2 system: configure the AutomatedUnitTesting email account.
Before you begin, gather the following information:
  1. The IP address or domain name of your email server.
  2. The email account (email address and password) that Process Commander is to use to send these emails.
  3. Whether the host is configured to use Secured Socket Layer (SSL).
To configure the outbound email account for this purpose:
  1. In the Designer Studio, select > Integration > Email > Outbound Email.
  2. Verify that the values of the standard email account — either Default for a 6.1 or 6.1 SP1 system or AutomatedUnitTesting for a 6.1 SP2 system — are appropriate to your organization's email system. For example, confirm that the Host Namefield matches the domain name of your email server machine.

    If there are no values displayed for Email Address or Host Name, click the email account name and specify the appropriate values in the email account form, and save.

For example, in the following image from a 6.1 SP2 system, click AutomatedUnitTesting to open its form and specify its values.

Outbound email gadget with accounts listed

To test the connectivity of an account:
  1. Click its name in the table on the Outbound email gadget to open its email account form.
  2. In the email account form, click Test Connectivity. A window displays stating whether the test is successful.

Customize the email notification message

Automated Unit Testing uses a standard correspondence rule, CompletedTestSuite, to generate the email message that the agent sends if there are unexpected results from a unit test suite. The default email message looks similar to this one:

Completion email message from unit test suite run

Some standard features of this email message are:

  • The email address in the From: field of the message is the one specified in the Default outbound email instance.
  • The email address in the To: field is the one specified in the operator ID of the operator who scheduled the unit test suite to run. (If additional email addresses are specified in the schedule for the unit test suite run, they also appear in the To: field).
  • The link in the "Click here..." sentence is set to the value of the dynamic system setting named PublicLinkURL of your Process Commander system. This setting provides for direct Web access to your system. For the link in the message to work correctly, that URL value must be valid and accessible to the recipient of the email message.
To customize the contents of the standard message:
  1. Using the Rules Explorer, select Process > Correspondence to see the list of correspondence rule instances. Open the Data-AutoTest-Result-Suite.CompletedTestSuite rule.
  2. Using the Save As icon, save a copy of this rule into one of your application's RuleSets. Do not alter any of the other fields besides the RuleSet and Version fields. A best practice is to save it to the same RuleSet where the test case rules and unit test suite rules are saved.
  3. Update the content on the Corrtab to define the contents of the email message.

    The sentence "Click here for the test suite results display." is defined using JSP tags, and is not displayed in the Corr tab in design mode. To view and update the JSP tags and HTML code, click to enter source mode. For information about typical JSP tags used in correspondence, see Correspondence Reference.

A best business practice for automated email messages is to include a sentence on how the recipient can communicate with the source organization in case questions or concerns arise. Depending on the nature of your business, you might also want to include your organization's confidentiality statement. Here is an example of a customized CompletedTestSuite rule:

To ensure that the link in the JSP-tagged "Click here..." sentence works correctly for the recipient, verify that the value specified for the dynamic system setting named PublicLinkURL is valid for your system:

  1. Open the Resource URLs gadget by selecting > System > Settings > URLs.
  2. Verify that the URL in the PublicLinkURL field is the appropriate value for your system.

Have a question? Get answers now.

Visit the Support Center to ask questions, engage in discussions, share ideas, and help others.

Did you find this content helpful?

Want to help us improve this content?

We'd prefer it if you saw us at our best. is not optimized for Internet Explorer. For the optimal experience, please use:

Close Deprecation Notice
Contact us