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

Exports Parameters

Learn how to pass parameters between different steps in a test or between different tests

We have 3 types of exports parameters:

  • Local export: Allow you to pass parameters between steps in the same scope (i.e. export parameter in a group allows you to pass parameters between steps in the same group).
  • Test export: Allow you to pass parameters between steps and groups in the same test.
  • Global export: Allow you to pass parameters between tests in the same test plan or test suite.

🚧

Global export

Globally exported parameters will be available only in remote runs.

Adding export parameter

Let's see how to use export parameters. We will add a local export parameter in a custom action and use it later in a custom validation in the same test.

  • Start a new test.
  • Add a new custom action and type the following in the editor:
//For Local export:     
exports.bestTestingTool = "Testim";
//For Test  export:      
exportsTest.bestTestingTool = "Testim";
//For Global export:     
exportsGlobal.bestTestingTool = "Testim";
  1. Add a new custom validation and type the following in the editor:
if (bestTestingTool !== "Testim") {
     throw new Error("choose Testim!");
}
  1. Run the test and see that it is successful.
    Note:
  • When you need to use parameters inside a group in your test, also use exportsGlobal.
  • The export parameter will only be available for use after the step, so if you want to use it at the same step it was set, you can do the following:
var local = "Testim";
console.log(local);
exports.bestTestingTool = local;

You can also use the export parameter in your JavaScript param.

  1. Click on the last step and add a 'js Param'.
  1. Change the name of the param to "WhoIsAwesome".
  2. Change the value of the param in the text box to - bestTestingTool+" is awesome!"
  1. In the editor change the previous code to:
if (WhoIsAwesome !== "Testim is awesome!") {
  throw new Error("choose Testim!");
}
  1. Run the test and see that it is successful.

Note:

  • The exports variables support the following:
  1. Primitive types - number, string, boolean, etc.
  2. Arrays
  3. JSON object
  • Global export per step is limited to 2MB

Updated 2 months ago

Exports Parameters


Learn how to pass parameters between different steps in a test or between different tests

Suggested Edits are limited on API Reference Pages

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