By running tests on branches, you can check changes and merge once you’re certain that both the tests and app under test don’t have any issues. This article explains how to configure tests to run on branches and how to prevent a test from running on a branch.
Configuring tests to run on branches
You can run branched test runs ad hoc, in a plan run, or as part of a deployment event.
Ad hoc runs
Go to the test details page for the test you’d like to run, and take the following steps:
- Select the desired branch from the branch dropdown at the top of the page.
- Click on the Run test button.
- Select Local run or Cloud run. Make any other configurations as needed.
- If you’re testing a preview environment, or any testing environment, with an arbitrary and changing URL, you can use the URL override option to specify the URL you want to use.
- Click the Start run button at the bottom. Cloud runs appear with a branching icon indicating that this run is not on the master branch.
Plan runs
To run a plan on a branch, go to the plan details page and take the following steps:
- Click the menu dropdown next to the Run button.
- Select “Configure plan run”.
- In the Configure plan run modal, choose the branch you’d like to run the plan on. You can override the testing environment URL if needed.
- Click Run now. If a plan is run on a branch, you will see it marked with a branch icon. If you hover over the icon, the name of the branch that the plan was triggered against will appear.
Branches and plans
Plans are not branched but they are branch aware. Practically speaking, this has the following implications:
- If a plan runs on a branch, the plan will use the latest version of each test on that branch.
- If one or more tests don’t exist on the branch, the plan will use the latest version on master for those tests.
- If a test exists neither on master nor on the branch in which the plan is running, it will be skipped.
- If a plan runs on master and one or more tests in the plan don’t have a version on the master branch, the plan will skip those tests.
Deployment events
Depending on how you are triggering the deployment event, you can use one of the following options to specify the branch that plans should run on:
Prevent a test from running on a branch
It is not possible to remove a test or flow from a specific branch. When you delete a test or flow, it is deleted across all branches.
If you want a test to stop running on a specific branch but continue running on other branches, you can disable it instead:
- Go to the test details page for the specific test.
- Select the branch where you want the test to stop running from the branch dropdown.
- Turn off the test using the toggle. This action prevents the test from running on the selected branch during plan runs.