Skip to main content

Improving test maintainability with reusable tests

Written by Callum Whitfield

When testing a feature, you often repeat the same steps across multiple tests. Keeping those steps in sync becomes a maintenence burden whenever they need updating. Reusable tests allows users to have the same test steps in many places - reuse anywhere, update once.

When to use reusable tests

A reusable test is a good fit when both of these are true:

  • Common - the steps will be used in more than one tests (e.g., shared set-up steps)

  • Isolated - the steps can run on their own. They execute regardless of the initial screen, and don't depend on any information defined outside of the test.

Note: a reusable test cannot contain test cases, and any variables used in a reusable test are only accessible within that test.

Adding a reusable test to another test

You can either insert an existing test at the start of a test by clicking on 'Insert existing test':

Or you can insert a test in the middle of another test:

Then, select one or more tests to insert:

Note: only eligible tests appear here. Tests that reference other tests, or contain multiple test cases, are hidden.

Updating reusable tests

Changing a step in a reusable test impacts all future runs of every test that uses it, so check the affected tests before making changes.

To see where a reusable test is used, click Usages at the top of the page:

Each entry lists a test that uses this reusable test, along with how many times it references it:

Did this answer your question?