Built-in variables

In any test step, you can use variables such as which will automatically replace a value and use it inside your runs. This way, your runs will be completely independent.

E.g. if you test an item creation functionality on your web application, and you give it a name such as “Item 13”, then later expect the success form to display “Item 13 successfully created!”, it is completely fine the first time. However, if item names are unique in your application, you have to create a new uniquely named item every test run, so using the name “Item {{job_id}}” and the expectation for “Item {{job_id}} successfully created!” is best.

The following variables are available to you using the {{ }} syntax:

  • test_name: the name of the test you are running
  • timestamp: timestamp of the test run
  • job_id: most commonly used. The job ID is unique for each run (combination of browser/resolution/device). All tests from a run have the same job id, so you can share the same value between tests from a single test suite
  • screen_width and screen_height: screen size being used for the current run

In web browser runs, the following variables are available:

  • browser_name and browser_version: the name and version of the browser used for the current run

For mobile and tablet devices, you have the following options:

  • mobile_device_platform: e.g. apple, google, samsung
  • mobile_device_name: the actual name of the platform e.g. pixel, galaxy_s3

If you try using a mobile-only variable on a browser run, or vice-versa, the variable syntax will be kept and used as is: e.g. {{browser_version}} instead of being replaced with the actual version, since it is not defined nor relevant to the current run.

Powered by BetterDocs