Introduction to Apex Testing in Copado
As with any other language or code, testing is an essential part of Apex development, especially when you are delivering features to customers, in which case you want to make sure all the features are working as expected before actually deploying them.
When working with Copado, there are different places where you can set up the minimum code coverage that will apply to Apex development, the user story and the environment.
To specify the minimum code coverage on a particular environment, follow these steps:
- Navigate to an existing Environment record.
- Click on Edit and specify a value in the Minimum Apex Test Coverage field:
The minimum code coverage you set on the environment will be used as the default code coverage on the user story.
There might be occasions, for instance if you are working on a critical feature, where you may want to specify a higher code coverage on the user story. If this is the case, follow the steps below to set up the minimum code coverage on a user story:
- Navigate to a User Story record.
- Scroll down to the Apex Code Coverage section.
- Add the percentage in the Minimum Apex Code Coverage field:
As you keep developing code, you can run Apex tests to ensure the features you are creating are working as designed before you deliver them to your customers.
Copado allows you to execute Apex tests on a user story, on an org credential or while doing a deployment. For more information about these options, please check out the articles Apex Tests Run while Deploying and User Stories - Apex Test Results.
Additionally, you can schedule Apex tests on a daily, weekly or monthly basis in any of your orgs, or use Copado Continuous Delivery to automate Apex tests throughout your release management process. For more information about how to set up this quality gate with Copado Continuous Delivery, take a look at the Pipeline Configuration article.