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

API testing

Easily call server APIs from your UI test for validation or data inquiry

API testing uses API calls (HTTP requests) within your tests. This functionality can be used to perform actions, for example, to retrieve data that can be used in UI-related steps. In addition, it can be used to perform validations, for example, to validate whether a value in the backend correlates with a value in the frontend.
As always, we differentiate between actions and validations:

  • API actions - should be used when you want to get data that is returned from an API call. You can use this data just to check that it is returned. In addition, you can optionally use the returned data as part of additional functions, which will be added to the "Run additional code" section. For example, the returned data can be used for calculations, or to save it for later use in the test.
  • API validations - should be used to validate data returned from an API call. Usually validating data in the backend.

API Action

To add an API Action:

  1. Hover over the arrow menu where you want to add your API call.
  2. Click the ‘M’ ⇒ ‘Actions’ ⇒ ‘Add API action’.
  3. Enter a name for the step.
  1. Fill the following data:
  • Method: Get /Post/ Put/ Patch/ Delete/ Copy/ Head/ Options
  • URL: Needless to explain :)
  • Header: Fill the keys and values that need to be sent to your API. The 'Raw' switch will allow you to enter the values in their raw format e.g. when copying from the browser's devtools network panel.
  • Body: In the drop-down menu, select the data format you want to send and enter the Body of your call in the box below. For example, use the "Text" option for entering free text, e.g. sending a key and a value.
  1. In the Properties panel, in the Send via web page checkbox:
    • Deselect the checkbox - if you want to send the API call outside the browser context so that browser-restrictions do not apply to it. For example, if your API doesn't support CORS.
    • Select the checkbox - if you need the API to also send browser information such as cookies (they are sent automatically).
  1. Select the ​Run additional code checkbox if you want to run code that will use the returned data from the API call. You can run any JavaScript code, and use the data returned from the API call, including the
    • Status code
    • Response Body
    • Response Headers
      If the "Response Body" content type is XML/JSON, the parameter type will be an Object, otherwise the parameter type is String.

As any JS step, you can export the returned value from the API to be use in the subsequent steps. The parameter can be specified to run on a local, test or global scope.

Click here to run a demo test of this example.


If you're running via a webpage, and the page has not finished loading, this step can fail. If the previous step requires loading, add a wait for before the API step to verify that the page has finished loading.

API Validation

Use an API validation step to validate the returned value or to validate them against elements in the UI. As in every custom (JS) validation, it is necessary to return a boolean (truthy/falsy in JS) value in the Run additional code on request result section.
Read more about validations here.

To add an API Validation:

  1. Hover over the arrow menu where you want to add your API call.
  2. Hover the ‘>’ ⇒ ‘Validations’‘Validate API’.
  3. Fill the data as described in API Action API action section above.
  4. Fill the Run additional code on request result section so it returns True/False value.

Using Parameters

You can use parameters in the API step as you would in any other custom (JS) step. Either in-param, as dependency injection, or out-param via the exports/exportsGlobal. You can also access any other variables in the test's scope. Instead of using parameters in JS code, you can use double\triple curly brackets around the parameters.
Read more about parameters options here.

Using parameters in the sent HTTP request

Parameters can also be used in the header, body, and URL.
Since those sections are cumbersome to write in JS, we made it easy for you. In these sections you will need to add double\triple curly brackets around the parameters.

For example:


You can use triple brackets if you do not want the parameters to be encoded. e.g {{{param}}}

If you want to send the API call to an API that uses the same URL as the test's base URL, instead of writing the entire URL you can use the Base URL parameter, by writing {{{BASE_URL}}} in the URL field, followed by the rest of the URL.

Using parameters in the HTTP response

Parameters added in the Properties panel will be automatically added to the function's signature.

Click here to run a demo test of this example.

Viewing the result after the run

After running the step, you'll see the response returned from the API call in the Response tab, along with additional info, such as response status code, call duration, and the size of the binary files.

Updated 10 months ago

API testing

Easily call server APIs from your UI test for validation or data inquiry

Suggested Edits are limited on API Reference Pages

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