We have 2 types of exports parameters:

  • Local export: Allow you to pass parameters between steps in the same test.
  • Global export: Allow you to pass parameters between tests in the same test plan or test suite. 

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. 

  1. Start a new test.
  2. Add a new custom action and type the following in the editor:

JavaScript

For Local export:      exports.bestTestingTool = "Testim";
For Global export:    exportsGlobal.bestTestingTool = "Testim";

3. Add a new custom validation and type the following in the editor:

JavaScript

 if (bestTestingTool !== "Testim") {
     throw new Error("choose Testim!");
}

4. 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.

JavaScript Expressions

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

  1. Click on the last step and add a 'js Param'.

2. Change the name of the param to "WhoIsAwesome".
3. Change the value of the param in the text box to - bestTestingTool+" is awesome!"

In the editor change the previous code to:

JavaScript

 if (WhoIsAwesome !== "Testim is awesome!") {
  throw new Error("choose Testim!");
}

4. Run the test and see that it is successful.

Did this answer your question?