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:
- Obtain the appropriate access.
- Enable the Pega-AutoTest agents.
- Optional: Enable email notification of unit test suite results.
- Optional: Customize the email notification message.
For configuration steps in releases before V6.1, see How to enable Automated Testing (PRPC 5).
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.
Add the standard PegaRULES:AutoTest access role to your Operator ID's access group.
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.
- Save the form.
- 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.
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:
To enable these agents:
- In the Rules Explorer, select SysAdmin > Agent Schedule to see the list of agent schedule instances.
- 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.
- On the Schedule tab, enable the agent activities using the Enabled? check boxes.
- 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).
- Save the form.
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:
- The IP address or domain name of your email server.
- The email account (email address and password) that Process Commander is to use to send these emails.
- Whether the host is configured to use Secured Socket Layer (SSL).
To configure the outbound email account for this purpose:
- In the Designer Studio, select > Integration > Email > Outbound Email.
- 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.
To test the connectivity of an account:
- Click its name in the table on the Outbound email gadget to open its email account form.
- In the email account form, click Test Connectivity. A window displays stating whether the test is successful.
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:
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:
- Using the Rules Explorer, select Process > Correspondence to see the list of correspondence rule instances. Open the Data-AutoTest-Result-Suite.CompletedTestSuite rule.
- 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.
- 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:
- Open the Resource URLs gadget by selecting > System > Settings > URLs.
- Verify that the URL in the PublicLinkURL field is the appropriate value for your system.