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!

Guides    Changelog

Configuration file & run hooks

Control how to run your test suite

The configuration file is a common JS containing all the required parameters to run your test suite and (optional) run hooks which can be used to set up the application backend before/after a single test or all tests.

The configuration file needs to export all properties in a JSON named config.

Here is an example of a configuration file:

exports.config = {

    project: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
    token: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
    // Specify which label you would like to run. All tests with the 
    // specified label will be executed
    label: "sanity",
    // Your Selenium grid
    grid: "<Your grid name>",
    // Override the base URL defined in the test in order to run it again a     // different envinronment
    baseUrl: 'http://staging.example.com',

    // =====
    // Hooks
    // =====
    // Testim provides several hooks you can use to interfere the test 
    // process in order to enhance it and build services around it.
    // Hook that gets executed before the suite starts
    beforeSuite: function (suite) {
        console.log("beforeSuite", suite);
    // Function to be executed before a test starts.
    beforeTest: function (test) {
        console.log("beforeTest", test);
    // Function to be executed after a test starts.
    afterTest: function (test) {
        console.log("afterTest", test);
    // Hook that gets executed after the suite has ended
    afterSuite: function (suite) {
        console.log("afterSuite", suite);

Note: For the grid name, read Grid Management how to set up your grid.

The configuration file supports all the properties described in the CLI actions
The name structure of the property is slightly different, replace the hyphen(-) with a capital letter. For example: base-url => baseUrl.

When you need to send more than one value to a parameter, use an array.
For example: label: ["a" , "b"]

Global exports parameters

In "afterSuite" function you can use exports global parameters exported at your run.
Syntax: suite.exportsGlobal.<param_name>
Read more about exports global parameters here.

How to use it

  1. Create your configuration file (e.g. testimConfig.js)
  2. Pass it to the Command Line (CLI) runner as a parameter:
  3. Make sure to indicate the path to the file if needed.
testim -c "testimConfig.js"
  1. If you want to override one of the values in the configuration file, simply pass it explicitly to the CLI, like this:
testim -c "testimConfig.js" --label "nightly"

Updated 2 years ago

Configuration file & run hooks

Control how to run your test suite

Suggested Edits are limited on API Reference Pages

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