License requirements:
This feature is available to all customers having any tier of the Automation add-on license (Starter, Teams or Enterprise).
Overview
You can now specify Apex tests on a pull request (PR) when you create it in Pipelines or while it is in progress. These tests are included when validating and deploying the PR, depending on the environment’s CI test setting.
PR-specified tests are normally combined with the tests configured for the environment. There are two exceptions:
Only run the tests specified on individual PRs in your pipelineruns only PR-specified Apex tests, nothing else.Relevant Testslets Salesforce select the tests, so PR-specified tests aren’t included.
Only run tests specified on individual PRs
Select Only run the tests specified on individual PRs in your pipeline in the CI job’s Test settings to control test selection entirely through your PRs.
If a PR contains Apex or Flow changes, you must specify tests. Otherwise, validation and deployment runs fail before Gearset sends the deployment package to Salesforce. Add tests to the PR before retrying the run.
See Setting Apex test levels for production coverage requirements and details of the available settings.
Adding Apex tests to your PR
Please note that if your CI job setting is set to RunRelevantTests, this feature will not work. This is because test selection is handled by Salesforce, and any additional tests specified on individual pull requests in Gearset will not be included.
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 run 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 spelled.
Unless you select Only run the tests specified on individual PRs in your pipeline, PR-specified tests run in addition to the environment’s configured tests, where the test setting supports this. 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
When selecting a PR on an environment, you can also specify additional Apex tests by opening the Testing panel and clicking Specify tests.
There are multiple ways to specify tests. If the PR has completed a validation, Gearset will suggest Apex tests that are included or that are detected from the package or target environment.
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.
Releases
You can specify tests for releases by going to the Checks section and clicking Specify tests.
When Releases are created in Gearset, any specified tests defined in any of the PRs will be carried over to the new release. Any specified tests in a PR will also be carried over when adding it to an existing release.
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.









