Skip to content
testmode

Variables: reuse values in tests

A variable is a named value, such as a search term or a support message, that you define once for a project and use in many tests as {{Name}}. When a test runs, Testmode replaces each variable with its current value, so changing the value in one place updates every test that uses it.

You manage variables for the current project under Settings > Variables. Every member can see the list and copy a variable’s syntax. Viewers don’t see Add Variable or the edit and delete icons.

Before you start: you need the Editor role or above.

  1. Open Settings in the sidebar and click the Variables tab.

  2. Click Add Variable.

  3. Enter a Name, for example Search Term.

  4. Enter the Value, for example hammer. It can span several lines.

  5. Optionally add a Description, for example Keyword used by catalogue search tests.

  6. Click Save.

Testmode shows “Variable created”. The list is sorted by name and shows each variable’s description and value.

Variables settings listing named values with descriptions, with a copy confirmation check mark next to Search Term.
Variables hold values you reuse across tests; copy the double-brace syntax with one click.

The Assistant and exploration proposals can also create variables for you. Both need the Editor role or above too.

If saving fails, the message says why. For example, “A variable with this name already exists” means the name is taken in this project, and a name with other characters is refused with “Name must start with a letter or underscore and contain only letters, numbers, spaces, dashes, and underscores”.

In the test case editor, the Insert Variable button sits on each step, on Expected Outcome and on Start Path. You need the Editor role or above to save the test case.

  1. Put the cursor where the value should go.

  2. Click Insert Variable.

  3. Search or scroll, then click the variable. Each one shows its description and current value.

The variable appears as a chip that shows its current value, for example hammer. Hover the chip to see “Variable: Search Term”. Click the X on a chip to remove it.

The Toolshop test case “Search finds hammers” uses {{Search Term}} in its first step. Saved, the step reads:

Type {{Search Term}} into the "Search" field and click "Search".

When the test runs, Testmode reads it as: Type hammer into the “Search” field and click “Search”.

On the Variables tab, click the copy icon next to a variable’s name. Testmode copies the name in double braces, such as {{Search Term}}, and shows “Copied to clipboard”. Paste it into any step, Expected Outcome or Start Path. If your browser blocks clipboard access, Testmode shows “Could not copy to clipboard” instead.

Before you start: you need the Editor role or above.

  • Edit: click the pencil on the row, change the name, value or description and click Save. Tests pick up the new value the next time they run.
  • Delete: click the trash icon, then Delete in the Delete variable? dialog. Testmode shows “Variable deleted”.

Renaming or deleting a variable does not update the tests that use it. They keep the old {{Name}} text, which is then no longer filled in (see the rules below). Search your test cases for the old name before you rename.

Rule Details Example
Syntax The exact name in double braces, with nothing else inside. {{Search Term}}
First character A letter or an underscore. Search Term, _basket
Other characters Letters, numbers, spaces, dashes and underscores. Contact Subject, order-2
Uniqueness One variable per name in a project.
Case Names match exactly, including letter case. {{search term}} does not match Search Term
Spaces in braces Spaces inside the braces become part of the name. {{ Search Term }} does not match
Unknown name Left in the text exactly as written, with no warning. {{Serch Term}} stays as typed
Value Any text, including several lines. It cannot be empty. My cordless drill stopped charging…

An unknown name does not make the test fail by itself. The agent receives the literal text, so a typo can lead to odd input or a failed test. Check spelling and case first when a test with variables misbehaves.

Filled in Not filled in
Steps of a test case Environment Base URL
Expected Outcome Credential fields (username, password, Login URL)
Start Path Test case names
Exploration start paths Tags

Testmode fills in values when each test starts executing, so a test always uses the latest value, even if you changed it after starting the run.

Variable values are plain text. Every member of the organization can read them on the Variables tab and in the test case editor. A value the agent types can also appear in the recorded Test Steps of a run.

Keep passwords out of variables. Store logins as credentials instead: their passwords are encrypted, never shown, and used only for automatic login.