Integration of Pega unit tests with CI/CD
The Pega unit test framework that is available with Pega Platform™ out-of-the-box, helps you create automated unit tests for your Pega Platform applications. It provides different means of running the Pega unit test cases.
You can run test cases individually or in bulk from the UI after logging into the specific application. You can also run the test cases using the REST services provided by the framework. You can integrate these REST services with any continuous integration and delivery (CI/CD) pipeline. If the DevOps pipeline is a Deployment Manager pipeline, tasks such as Run Pega unit tests and Run Pega units on branch are available. These tasks run the Pega unit test cases that are present in the candidate application.
Details of the REST services
The main REST service is an asynchronous POST service that starts the execution of test cases and provides an ID as a response. The GET service uses the ID that the POST service provides to obtain the status or results of the execution.
Details of POST service that starts the execution
Path: /prweb/api/v1/pegaunits/execute
Method: POST
The details of the input parameters of POST service are described in the following table:
Parameter | Required/Optional | Description | Parameter Type | Data Type |
---|---|---|---|---|
AccessGroup | Optional |
If you enter the access group, this service runs the Pega unit tests for the given AccessGroup. Else, the service uses the default AccessGroup that is tagged to the operator to run the Pega unit tests. |
Query | String |
LocationOfResults | Optional |
If you enter the location to store the execution results of the Pega unit test, then the POST service stores them at that location. | Query | String |
TestSuiteID |
Optional | If you enter the InsName of the TestSuiteID (for example, @baseclass!TS_SampleSuiteName), then the POST service runs Pega unit tests in that suite only. | Query | String |
ApplicationInformation |
Optional |
If you enter the application information and do not provide the access group parameter, then the Pega unit tests of this application run. The associated access group of the application must be available to the authenticated operator. The application format is applicationname:version (sampleapp:01.01.01). When you do not provide both the application and the access group, the system selects the default application of the authenticated user to run the Pega units. |
Query | String |
RunWithCoverage | Optional | If you enter the value as true, the service runs the Pega units with test coverage. |
Query | String |
BranchID | Optional | If you enter a specific branch ID, then the POST service runs the Pega units present in the branch. | Query | String |
Details of the GET service that obtains the status/results of the Pega units execution
Path: /prweb/api/v1/pegaunits/execute/{ID}/results
Method: GET
The details of the input parameters of GET service are described in the following table:
Parameter | Required/Optional | Description | Parameter type | Data type |
---|---|---|---|---|
ID | Required | The polling ID that the asynchronous service returns. The service retrieves the status of the Pega units execution that corresponds to the given ID. | Query | String |
Check your knowledge with the following interaction:
This Topic is available in the following Module:
Want to help us improve this content?