Testim Documentation

Welcome to the Testim documentation. You'll find comprehensive guides to help you get started quickly, example code snippets, and tips for being more productive. You will also find details about advanced features that allow you to customize Testim to fit your environment or special testing conditions. Don't worry, we'll support you if you get stuck. Let's jump right in!

Get Started    Guides

Parameter override rules

This document explains the different override rules that occur when using parameters

There are various ways we can use parameters within Testim.io. to name a few we have - Data-Driven Testing, Groups, Exports Parameters, Configuration Files and Run Hooks and the Params file. Each override touches the test in different times, usually for different purposes. Let's review them.

The overriding Rules

Just like in most programming languages, where you define a variable, and override is later, the variable comprises the last value assigned to it. Similarly, you can override a value in Testim.

Before the test starts:

Note: All parameters sent to a test have Local level visibility (the entire test though is considered one big group).

During test run

The three visibility scopes are:

  • Local - variable lives in a group, and not accessible when group is completed
  • Test - variable lives in entirely/solely in the duration of the test
  • Test Suite - variable lives across multiple test executions (passed from test to test)

Overriding rules

the more specific the visibility is, the higher its importance.I.e. If a variable is Local (most specific), it will always be used:

exports.x = "local"
exportsTest.x = "test"
exportsGlobal.x = "global"
console.log(x); // prints "local"


Data driven:
Mostly used to create default set of values, which are will be overridden by the config file or the hooks.

Note: you can provide a set of parameters (array of objects) which then run the same test several times.

Params file:
Similar to Data driven, but are not for a specific test. Those will be passed to all tests. E.g. common credentials

Config files:
Used to dynamically load a suite of parameters. You can run custom JS code, which is executed in node.js, thus giving you the ability to load and run any NPM package. Common cases are loading from DBs or CSV files. You can find code examples here.

Note: beforeTest and beforeSuite does NOT support returning a set of parameters (an array). If you pass an array, it will be treated as an object (i.e. in this context, return ["x", "y" "z"] is ALMOST equivalent to return {1: "x", 2: "y", ;3:"z"}).

In beforeSuite, please use the overrideTestData

beforeSuite() {    
  return {
       y: 5,
       overrideTestData: {
           "testname1": [{x: 6}, {x:7}] , // runs testname1 twice
           "testname2": {y:7}          // y will be 5 because the overrideTestData object winds

Parameter override rules

This document explains the different override rules that occur when using parameters

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.