Skip to main content

I/O Request Test Components

I/O request components, available in your tests' Compose tab (aka Composer), enable you to perform the I/O operations GET, POST, PUT, PATCH, and DELETE. This guide describes each component and shows you how to add them to tests.

Assertion Components

What You'll Need#

I/O Components#

GET#

Performs a GET method request. See Adding I/O Components to a Test for an example.

POST#

Performs a POST method request.

Param#

  1. Click Add Param.
    Post
  2. Fill in the Name and Value fields.
    Post
Fields
Name

| REQUIRED | STRING |

Value

| REQUIRED | STRING or VARIABLE |


Body#

  1. Click Add Body.
    Post
  2. Fill in the Content Type and Content fields.
    Post
Fields
Content-Type

| REQUIRED | STRING |

Content

| OPTIONAL | STRING |

PUT#

See Parameters and Body.

PATCH#

See Parameters and Body.

DELETE#

See Parameters and Body.

GitHub#

This Github component is meant to simplify the process of retrieving a file from Github and use it as a data source. Some examples of files to use would be CSV or JSON files. Here is a tutorial on how to use it as part of a test.

GitHub Component

The Base URL, Branch, and Ref fields will auto-populate, but you can still edit them. You'll need to fill in the following fields:

Fields
Account

Your GitHub username

Repository

The name of the repository that your data file is pushed to

Branch

The repository branch that the desired version of the data file is in

Token

The token described above, generated in the GitHub platform

Variable

The variable that the payload will be stored under

Path

The name of the file in the repository

Mode

The filetype of the file in the repository

I/O Component Fields#

The fields apply to all I/O request components except GitHub.

Url#

| REQUIRED |

In this field, enter the url of the resource you want to test. It could be the full url of the resource (i.e., https://domain/endpoint) or a string with variables (i.e., https://${domain}${endpoint}).
Request-1024x281.jpg

Variable#

| REQUIRED |

In this field, enter the name of the variable that contains the response (value must be a string). It will be the name you will refer during the test.

Expect#

| OPTIONAL |

Fill out this field only if the expected behavior differs from a positive response (i.e., 404,500 vs. 200,201). This can be useful when looking to test negative responses and validate error messages. Value must be a string. Possible values are <statusCode>|VALID or <statusCode>|INVALID. VALID means the payload type is the one selected in the mode field (explained in the next step), while INVALID means the opposite. Some examples:

  • 404|VALID: 404 is expected with valid payload
  • 422|VALID: 422 is expected with valid payload
  • 500|INVALID: 500 is expected with invalid payload

Multiple status codes can be expected by adding them all (i.e., 200|302|400|500|VALID)

Mode#

| REQUIRED |

Enter the type of the response you want to test (must be 'json','xml', 'html',or 'text').

Query Params#

| OPTIONAL |

This refers to the Query Params section. Enter any params you want to add to the query string.

  1. To add, click Add parameter.
    I/O Config

  2. Fill in the fields.
    I/O Config

    • String value: the value will always be the same for all of the requests. To do so, enter the value in the related field, then choose String value from the dropdown menu.
    • Variable: the value will be taken dynamically and could changed from time to time. To do so, enter the name of the variable in the field, then choose Variable from the dropdown menu.
      requestWithParams-1024x485.jpg

    Using the above example, let's say that you define varName as a boolean value (possible values are 'true' or 'false'). In this case, there will be two requests:

    • The first one will be a GET request to https://mydomain/endpoint?firstParam=paramValue&secondParam=true, parsing it as json and saving it in the payload variable.
    • The second will be a GET request to https://mydomain/endpoint?firstParam=paramValue&secondParam=false, parsing it as 'json' and saving it in the 'payload' variable.
Fields
Name

| REQUIRED | STRING |

Value

| REQUIRED | STRING or VARIABLE |

Header#

  1. Click Add Header.
    I/O Header
  2. Fill in the Name and Value fields.
    I/O Header
Fields
Name

| REQUIRED | STRING |

Value

| REQUIRED | STRING or VARIABLE |

Authentication#

This refers to the Authentication config section, included in each of the I/O request components. If required for your API tests, enter your authentication credentials here.

  1. Click Add Authentication.
    I/O Authentication
  2. From here, you'll see three options:
    I/O Authentication
    • Config: configure non-default behavior for this component
      I/O Authentication
    • Basic Authentication: add a basic authentication header
      I/O Authentication
    • Header: add a header to a request operation, such as GET or POST
      I/O Authentication

Editing Components#

Once you've created a component and wish to edit (i.e., need to add headers, params or a body):

  1. Click on the request so that it becomes highlighted.
    subComps.jpg
  2. Click Add component.
    subComps.jpg
  3. Now you'll see the components available sub-components for that operation.
    subComps.jpg