Test step

Description

test: step `mandatory property key and constant value to define the test yaml type as test step`
name: string `Name label of test step`
collection:
    name: string `(mandatory) Name label of collection to which the step belongs (like a category)`
exitOnFail: bool `Set to true if test case execution needs to be stopped after this step failure`
method: string("GET"|"POST"|"PUT"|"DELETE"|"HEAD"|"OPTIONS") `http method for the http request, if not set GET is default`
url: string `URL value for http request`
requestTimeout: int `overrides default value of 30 seconds, or either the value assigned in case and the one in Global Variables as $requestTimeout` [optional]
type: ("x-www-form-urlencoded"|"form-data"|"raw"|"binary"|"assert"|"system-cmd") `Type of step, mandatory for POST method; For non-http request steps: use 'assert' to test string/int/float assertions; use 'system-cmd' to be able to use shell scripts or system commands in 'body' property of step definition`
queryParams: `Dictionary with query parameters` [optional]
    (paramname:string): [(paramvalue:string),...]
headers: `Dictionary of http headers` [optional]
    (headername:string): (headervalue:string)
    ...
delay: int `step execution delay after the previous step in seconds` [optional]
#Depending on type use the according content
#if type=="x-www-form-urlencoded"
urlEncodedParams: `Dictionary of url encoded parameters` [optional]
    (paramname:string): [(paramvalue:string|int),...]
    ...
#if type=="form-data"
formData: `List of form data parameters` [optional]
    - name: string
      value: string `if not specified it will look for the filename as if it is the relative path to the file from your project root` [optional]
      type: ("file"|"text")
      contentType: string
      filename: string
    -   ...
#if type=="raw"
body: string `Raw body of string or multiline strings` [optional]
#if type=="binary"
binaryContent: `Binary data body option` [optional]
    value: string `Content of binary data in base64`
    filename: string
maxHttpRedirects: integer `max allowed http redirects, set to any non-negative integer (10 by default)` [optional]
greps: `List of greps -> apimation way of calling extracts from any part of the response` [optional]
    - varname: string `name of apimation variable in which the extracted value will be saved, points to variable position when used together with listname`
      type: ("json"|"xml"|"text"|"headers"|"status"|"rtt"|"rsize") `Type of extraction; 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`
      expression: "$.webhook.id" `For json use jsonpath expression, for xml use xpath expression, for text use string values or regex expression with group
, for headers use header name, index and regex if needed, i.e. Location{http://(\d+)}, for status, rtt and rsize expression is not needed,`
      listname: string `name of apimation list that the value will be saved into`
    -   ...
assertQuick: `shortcuts of asserts` [optional]
    status: string `Response status assertion`
    responseTime: string `Response time assertion`
asserts: `List of assertions` [optional]
    -key: string `depends on type, see greps section expression property`
     type: ("json"|"xml"|"text"|"headers"|"status"|"rtt"|"rsize"|"string"|"int"|"float"|"cmd") `string, int, float types are used to compare given value in 'key' property to 'expected' property value; 'cmd' is used to assert either cmd output or exitCode, for other types see grep type section`
     operator: ("eq"|"ne"|"gt"|"lt"|"ge"|"le"|"regex") `operator values`
     expected: string `expected value`
     description: string `description of assert`
     jsonValueType: ("value"|"count") `only for json type: by default set to value, set to count if length comparison needed`
conditionalGreps: `conditional grep is used to filter an array of json or xml object nodes by a given node property and saeach of filtered nodes expected property value into a json array list which is then saved to an apimation variable` [optional]
    -type: ("json"|"xml") `see information on types of 'greps' property`
     srcPath: string `xpath or jsonpath that points to the list of json or xml objects, the one that will be filtered`
     dstVar: string `apimation var list in which the filtered values will be saved, the list format is json array`
     positionVar: string `variable name used by load test to iterate through the apimation var list provided`
     srcField: string `node property name to filter by`
     operator: ("eq"|"ne"|"gt"|"lt"|"ge"|"le"|"regex") `operator values`
     expected: string `expected value to compare the srcField to`
     resultField: string `node property to extract and save into the list if the condition is true`
loop: `Holds step loop conditions` [optional]
    interval: int `loop interval in seconds`
    loop: boolean `set if loop is needed`
    count: int `maximum loop count`
    conditions: `loop exit conditions, has same properties as assert object`
        -   ...
nostore: boolean `false by default, set to true if step does not need to be saved into the specified collection` [optional]
load: boolean `false by default, set to true if step needs to be loaded` [optional]
append: boolean `false by default, set to true if given step properties need not to be overwritten or else those step properties that are defined will be appended` [optional]

Example 1

test: step
name: GET $userRole
collection:
  name: user
url: $mainURL/user
queryParams:
  query: ["$userRole"]
assertQuick:
  status: 200 OK
greps:
  - varname: $userName
    type: json
    expression: $.name
  - varname: $userId
    type: json
    expression: $.id
asserts:
  - key: $.role
    operator: eq
    expected: $userRole     
  - key: $.age
    operator: eq
    expected: $assertAge
  - key: $.serverTime
    operator: eq
    expected: $assertEpochDate  
  - key: $.description
    operator: eq
    expected: $assertUserDescription

Example 2: SOAP

test: step
name: example_post_call
collection:
  name: user
method: POST
url: $mainURL/user
type: raw
headers:
  Authorization: Bearer $bearer
assertQuick:
  status: 200
asserts:
  - key: //xml/path
    type: json
    operator: regex
    expected: $assertUserDescription
body: |-
  <xmltag>
    <body/>
  </xmltag>
greps:
  - varname: $memberId
    type: json
    expression: //id

Example 3: REST

test: step
name: example_post_call
collection:
  name: user
method: POST
url: $mainURL/user
type: raw
headers:
  Authorization: Bearer $bearer
assertQuick:
  status: 200
asserts:
  - key: $.json[0].path
    type: json
    operator: regex
    expected: $assertUserDescription
body: |-
  {
    "role": "$memberRole",
    "email": "$memberEmail"
  }
greps:
  - varname: $memberId
    type: json
    expression: $.id

results matching ""

    No results matching ""