Create test step

Step is smallest test assert part and is used in test case.

Step details

To define the test yaml type as test step it is mandatory to set step constant value to test parameter.
Example: test: step

To access test step from test case you need to set step name.
Example: name: <step name>

Request details

Using apimation you can send request with different HTTP methods, multiple query parameters and headers. Description of the main request parameters:

  • method: available methods are GET, POST, PUT, DELETE, HEAD, OPTIONS. If method is not set, GET method will be pre-set as default method.
  • url: set your request URL.
  • headers: you can set any key-value pair as the header. This parameter is optional.
  • queryParams: you can set any key-value pair as the URL parameters. This parameter is optional.
  • maxHttpRedirects: you can set max http redirect count. This parameter is optional.

Step types

You can use different types of steps. Type of step, mandatory for POST method.

  • x-www-form-urlencoded type: used if you want to send simple text/ASCII data. All characters are encoded before sent (spaces are converted to "+" symbols, and special characters are converted to ASCII HEX values)
  • form-data type: no characters are encoded. This value is required when you are using forms that have a file upload control.
  • raw type: used if you want to send plain text or JSON or any other kind of string.
  • binary type: used to send image, audio, video and text files.
  • assert type: used for non-http request steps to test string/int/float assertions.
  • system-cmd type: used to be able to use shell scripts or system commands in 'body' property of step definition.


In the test step you can use variables defined in test case or test environment.
Example: variable $url defined in test environment and query parameter variable $query defined in test case can be used in the following way:

url: $url
  query: ["$query"]


To find and save data from response to variable you can use greps. You can use following types: json, xml, text, headers, status, rtt and rsize.

  • json and xml will enable usage jsonpath and xpath expressions.
  • text type is used to extract everything that is in the response body and it possible to use regex groups to extract specific parts of it.
  • headers is used to get specific header value.
  • status used to get response status message.
  • rtt is round trip time i.e. response time in milliseconds.
  • rsize is response packet size in bytes.


Apimation offer two types of asserts:

  1. assertQuick by using this assert you can assert response status and response time.
  2. assert by using this assert you can assert json, xml, text, headers, status, rtt, rsize, string, int, float, cmd.

There are two options to create test step:

  1. Generate test step using Apimation CLI client by execute following command:

    apimation generate step <step name> -f <feature name>

    You also can generate test step type with defined type using flag -t or --type:

    apimation generate step <step name> -t <type name> -f <feature name>

    Available test step types: x-www-form-urlencoded, form-data, raw, binary and system-cmd.

  2. Create new YAML test step manually:
    Create <step name>.yaml file in steps folder with following content:

    test: step
    name: <step name>
     name: Feature1
    method: GET
    url: $url
    - Content-Type: application/json
    - varname: $id
      type: json
      expression: $.[0].id
    - key: $.[0].title
      type: json
      expected: $bookTitle
      operator: eq

Test step advanced documentation available here

results matching ""

    No results matching ""