Automated unit testing is a key stage of a continuous development and continuous integration model of application development. With continuous and thorough testing, issues are identified and fixed prior to releasing an application, which improves the application quality.
Automated unit testing involves creating unit test cases for tests that are run against individual rules, grouping multiple test cases into test suites, running the tests, and viewing the results. When the tests run, the results are compared to the expected results that are defined in assertions.
- Understanding unit test cases
A test case identifies one or more testable conditions (assertions) that are used to determine whether a rule returns an expected result. Reusable test cases support the continuous delivery model, providing a way to test rules on a recurring basis to identify the effects of new or modified rules.
- Grouping test cases into suites
You can group related unit test cases or test suites into a test suite so that you can run multiple test cases and suites in a specified order. For example, you can run related test cases in a regression test suite when changes are made to application functionality.
- Setting up and cleaning the context for a test case or test suite
You can set up the environment and conditions required for running a test case, determine how to clean up test data at the end of the test run, and set pages on which to automatically run rules.
- Viewing unit test reports
View a graph with test pass rate trend data, a summary of Pega unit tests that were run, and an overview of Pega unit test compliance for currently included applications on the Reports tab on the Unit Testing landing page.
- Viewing unit tests without rules
On the Application: Unit testing landing page you can display a list of unit tests that are not associated with any rule and export this list to an XLS or a PDF file. You should deactivate these unit tests because they will always fail.
- Running test cases and suites with the Execute Tests service
You can use the Execute Tests service (REST API) to validate the quality of your code after every build is created by running unit test cases that are configured for the application.
- Understanding Pega Platform 7.2.2 and later behavior when switching between Pega unit testing and Automated Unit Testing features
Beginning with Pega 7.2.2, you can use Pega unit testing to create test cases to validate the quality of your application by comparing the expected test output with results that are returned by running rules.
- Working with the deprecated AUT tool
In older versions of Pega Platform, automated unit tests were created using the Automated Unit Testing (AUT) tool, which has since been replaced by PegaUnit testing. If you have automated unit tests that were created using AUT and they haven't been changed to PegaUnit test cases, then you can switch back to AUT to manage those tests.