Configure your build environment so that it can call the Execute Tests service and run all the unit test cases or a test suite in your application. Your configuration depends on the external validation engine that you use.
For example, the following procedure describes how to configure the Jenkins server to call the service.
- Open a web browser and go to the location of the Jenkins server.
- Install the HTTP request plug-in for Jenkins to call the service and the JUnit
plug-in so that you can view reports in xUnit format.
- Click Manage Jenkins.
- Click Manage Plugins.
- On the Available tab, select the HTTP Request Plugin and the JUnit Plugin check boxes.
- Specify whether to install the plug-in without restarting Jenkins or to download the plug-in and install it after restarting Jenkins.
- Configure the Pega Platform credentials for the operator who authenticates the
Execute Tests service.
- Click Credentials, and then click System.
- Click the drop-down arrow next to the domain to which you want to add credentials, and click Add credentials.
- In the Username field, enter the operator ID that is used to authenticate the service. This operator should belong to the access group that is associated with the application for which you want to run test cases and test suites.
- In the Password field, enter the password.
- Click OK.
- Configure the Jenkins URL that runs the service.
- Click Manage Jenkins, and then click Configure System.
- In the Jenkins Location section, in the Jenkins URL field, enter the URL of the Jenkins server.
- Click Apply, and then click Save.
- Add a build step to be run after the project is built.
- Open an existing project or create a project.
- Click Configure.
- In the Build section, click Add build step, and select HTTP Request from the list.
- In the HTTP Request section, in the URL field,
enter the endpoint of the service. Use one of the following
- http://<your application URL>/prweb/PRRestService/Pega unit/Rule-Test-Unit-Case/pzExecuteTests
- http://<your application URL>/prweb/PRRestService/Pega unit/Rule-Test-Unit-Case/pzExecuteTests?AccessGroup=<access_group_name:accessgroup_group_users>
- http://<your application URL>/prweb/PRRestService/Pega unit/Rule-Test-Unit-Case/pzExecuteTests?TestSuiteID=<pxInsName>
- http://<your application URL>/prweb/PRRestService/Pega unit/Rule-Test-Unit-Case/pzExecuteTests?ApplicationInformation?=ApplicationInformation:<application_name:application_version>
If you are using multiple parameters, separate them with the ampersand (&) character, for example, http://<your application URL>/prweb/PRRestService/Pega unit/Rule-Test-Unit-Case/pzExecuteTests?ApplicationInformation?=ApplicationInformation:<application_name:application_version>&TestSuiteID=<pxInsName>
- From the HTTP mode list, select POST.
- Click Advanced.
- In the Authorization section, from the Authenticate list, select the Pega Platform operator ID that authenticates the service that you configured in step 3.
- In the Response section, in the Output response to file field, enter the name of the XML file where Jenkins stores the output that it receives from the service. This field corresponds to the LocationOfResults request parameter. In the Post-build Actions section, from the Add post build section list, select Publish Junit test result report and enter **/*.xml in the Test Report XML field. This setting configures the results in xUnit format, which provides information about test results, such as a graph of test results trends. These results are displayed on your project page in Jenkins.
- Click Apply, and then click Save.