By managing your tests with branches, you can get test results at a much earlier stage of development. In other words, when you use branches, you'll be able to test new features as they are being developed, instead of waiting for the final release.
When creating a branch, you "freeze" the state of the tests. Modifying a test in one branch does not affect how the test behaves in other branches.

Using Branches

  • As a starting point, each project is composed of a single "master" branch.
  • It's a good idea to create a new branch for every branch your team develops (e.g. your git branch), and test each branch independently.
  • You can switch branches at any time and modify tests within a branch as you like. Modifications in one branch will not affect other branches.
  • When you merge your (product) code, you should also merge your testing code (e.g. merge the feature branch into master). After the merge, consider deleting the branch.
    Webhooks allow you to automatically merge tests when you merge your code.

Popular use cases for using Branches

You'll probably want to use branches in the following use cases:

  • To sync with your development process - Creating branches according to your different development environments makes it easier to manage, track & modify your tests in parallel with the development releases.
  • To test a new feature in a "sterile" environment - If the feature may affect other tests, it's a good idea to test it independently. Once everything works fine, then merge it to with another branch.
  • To test Different stages - If your deployment process goes through several stages (e.g. Canary, Dev, Stable)

How to add a new Branch?

  • Click the "Fork" (i.e. "Add Branch") button in the menu.
  • Name your branch
  • Once, created you'll be able to modify your tests in the new branch. This will not affect the tests of the Master branch.
  • Any change you make to the tests will be automatically associated with the current branch. Other branches will not be affected.

Note: Test data, test configuration and labels are cross branches. Changing in one branch will affect all branches.

Switching Branches

  • Click on the dropdown to see the branches list & switch to the desired branch.
    The date near each branch name indicates when it was last modified.
  • Note: In case a test does not exist in the target branch, you'll be directed to the tests list - There you'll be able to see all the relevant tests that are associated with the current branch.

Merging Branches

Merging branches is done by:

  • Opening the branches dropdown
  • Choosing which branch you'd like to merge into

How Merge works

When merging two branches, we will choose the mix of steps which represent the latest version of each test (take the new step from each branch). In the case of a conflict, we'll choose the most recent one, with one exception: we will not delete a conflicting step (i.e. if a step was deleted in branch A and modified in branch B, the step will be taken from branch B, regardless of the change timestamp).

Running a test suite on a specific branch through the CLI

To run on a specific branch, use this parameter in your CLI

--branch <branch-name>

Branches integration with your CI

In order to run the appropriate test suite for the current development branch, you can either specify the branch name for that build (--branch) or if you are using one of the following: Jenkins, CircleCI or TravisCI, the Testim CLI will automatically run tests for the same branch if the following parameter is used.

--branch auto-detect 
Did this answer your question?