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 means that there's an easy way to send HTTP requests within your tests.
This makes it easier to extract values returned from an API call and use them in UI related steps, and validate that the value in the backend correlates to the frontend.
As always, we differentiate between actions and validations:

  • API actions - Should be used when in need to get data and use it for calculation, 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 on the backend.

API Action

How to add

  1. Hover over the arrow menu where you want to add your API call.
  2. Click ‘+’ ⇒ ‘Actions’ ⇒ ‘Add API action’.

​3. 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 copies from the browser's devtools network panel.
  • Body: Select the data structure you want to send, and fill in the text box. Use the "Text" option for entering free text, e.g. sending a key and a value.
  • Send via web page (aka "send cookies"): Uncheck only 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.
    Keep this option checked if you need the API to also send browser information such as cookies (they are sent automatically).

​Run additional code

Used to run code after the API call. You can run any JavaScript code, and use the data returned from the API call.

  • 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 following steps.

Click here to run a demo test of this example.

Note: 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) values in the additional code section.
Read more about validations here.

How to add API steps

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


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

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

Using parameters in the HTTP response

Parameters added in the property panel will automatically be added to the function's signature. Plus you can also access any other variables in the test's scope.

Click here to run a demo test of this example.

Result Run

After running the step, you'll see the response returned from the API call on the "Response" tab, and sometime more info, such as response status code, call duration, and the size of the binary files.

Reusing API steps

API steps are reusable components similar to groups and custom actions.
Click here to read more about reusing steps.

Network Validation Step

You can validate your network requests by using "Add network validation" step. By adding this step, you will be able to run any additional code you would like on the networkRequests object.

The code step will receive an array (networkRequests) with objects with the following properties:

  • URL - the request URL
  • Source - page that generated the URL
  • Method - get/post/put/options etc.
  • Start time (number)
  • End time (number) - time when the whole request had finished loading
  • Tab number - which tab was the source of the request
  • Status code (number)
  • Status text (text)
  • Is blocked (boolean) - this can be either a request failure (for example, network issue), origin, corb etc.
  • Block reason - why was the request cancelled, if any - for example, by the ad block
  • Is done (boolean) - the request might still be pending
  • Type : XHR, document, Image etc. (from chrome)
  • Response size - the total size of the response (encoded, including the headers) in bytes.
  • Protocol - h2, http/1.1 (from chrome)

Updated 8 months ago

What's Next

API parameters

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.