Test automation introduction
Having an effective automation test suite for your Pega application ensures that the features and changes you deliver to your customers are high quality and do not introduce regressions.
At a high level, this is the recommended test automation strategy for testing your Pega applications:
- Create your automation test suite based on industry best practices for test automation.
- Build up your automation test suite by using Pega Platform™ capabilities.
- Run the right set of tests at different stages.
- Test early and test often.
Industry best practices for test automation can be graphically shown as a test pyramid. Test types at the bottom of the pyramid are the least expensive to run, most straightforward to maintain, require the least amount of time to run, and represent the most significant number of tests in the test suite. Test types at the top of the pyramid are the most expensive to run, hardest to maintain, require the most time to run, and represent the least number of tests in the test suite. The higher up the pyramid you go, the higher the overall cost and the lesser the benefits.
UI-based functional and scenario tests
Use UI-based functional tests and end-to-end scenario tests to verify that end-to-end cases work as expected. These tests are the most expensive to run. Pega Platform supports automated testing for these types of tests through the TestID property in user interface rules. For more information, see Test ID and Tour ID for unique identification of UI elements. Using the TestID property to identify a user interface element uniquely, you can write dependable automated UI-based tests against any Pega application.
API-based functional tests
Perform API-based testing to verify that the integration of underlying components works as expected without going through the user interface. These tests are useful when the user interface changes frequently. You can validate case management workflows through the service API layer using the Pega API in your Pega application. Similarly, you can perform API-based testing on any functionality that is exposed through REST and SOAP APIs.For more information on the Pega API, see Getting started with the Pega API.
Use unit tests for most of your testing. Unit testing looks at the smallest units of functionality and are the least expensive tests to run. In an application, the smallest unit is the rule. You can unit test rules as you develop them by using the PegaUnit test framework. For more information, see PegaUnit testing.
Automation test suite
Use both Pega Platform capabilities and industry test solutions, such as JUnit, RSpec, and SoapUI to build your test automation suite. When you create your automation test suite, run it on your pipeline. During your continuous integration stage, the best practice is to run your unit tests, guardrail compliance, and critical integration tests. These tests ensure that you get sufficient coverage, quick feedback, and fewer disruptions from test failures that cannot be reproduced. A best practice is to run all your remaining automation tests during the continuous delivery stage to guarantee that your application is ready to be released. Such tests include acceptance tests, full regression tests, and non-functional tests such as performance and security tests.
You receive the following benefits by running the appropriate tests at each stage of development:
- Timely feedback
- Effective use of test resources
- Reinforcement of testing best practices