Skip to main content

Specifying Apex Tests for a Pull Request in Gearset Pipelines

Find out more about adding Apex tests to be executed in your pipeline for a specific Pull Request

Gino Toro avatar
Written by Gino Toro
Updated this week

What license do I need to use this feature?

The use of Specify Apex Test for a Pull Request is tied to the Automation Starter, Teams, and Enterprise Add-on tiers.

Overview

Gearset now supports specifying Apex tests in Pipelines. This allows you to add Apex tests to a PR when you create it or while the PR is in progress. When promoting changes in the pipeline, these tests are included in validation and when running unit tests.

Apex tests specified on the PR and Apex tests configured in your environment will be combined to ensure better coverage of unit tests.

Adding Apex tests to your PR

You can add Apex tests to your PR when creating it in the Pipelines UI. During the PR creation process, you can switch to the Tests tab to begin the process of specifying additional Apex tests for your PR.

​

You will be able to type in one or more test classes to be validated or ran in every environment. You can specify multiple test classes using commas or new lines. Note: Test class names are not verified against any Salesforce orgs, make sure they are correctly spelt.

Any tests specified will be validated and ran in addition to what is configured in each environment. For example, if your specify "AccountControllerTests" on your PR and the environment is Don't run any tests we will still validate and run "AccountControllerTests". If you specify "OpportunityControllerTests" on the environment, Gearset will validate and run both tests.

You can read more about setting Apex tests levels for more details on the environment.

Adding Apex tests to your PR from an Environment

You can also specify additional Apex tests to run in any environment after validation has been completed for the PR. When selecting a PR on an environment. You can specify additional Apex tests in the Testing panel and click Specify tests.

There are multiple ways to specify tests. Gearset will suggest Apex tests that are included or that are detected from the package or target environment.

Or alternatively, you can specify one or multiple Apex tests manually by typing in test class names with a comma or new line separator.

Before promoting the PR, you can rerun validation with tests to ensure deployments will succeed with specified tests and the specified tests for the environment.

Once the deployment is complete, the specified Apex tests will remain until it is promoted into production. However, you can modify the selection at any point by clicking Specify tests again and modify the selection.

Releases

When Releases are created in Gearset, any specified tests defined in any of the PRs will be lost. The ability to use specified tests from the PRs into a release will be included in a future update.

Note: You are able to promote individual PR with specified tests into production by clicking Promote changes.

Long-term Projects

You can specify Apex tests in PRs within a long-term project in the same way as other PRs.

However, tests on the PRs will not migrate out of long-term projects. This will be included in a future update.

Back propagation

When back propagation PRs created, the specified tests on the original PR will be copied over.

You can specify Apex tests for PRs created from back propagation, using the same steps as any PR.

Note: We do not support Specify Tests for Developer Sandbox updates.

Did this answer your question?