How to store metadata of a multi-step request (aka scenario) in TFML

Testfully supports a concept called multi-step request (or scenario). A multi-step request consists of multiple individual API calls that are executed in a specific order. Each step in the scenario can have its own metadata, allowing for a more organized and manageable way to handle complex workflows.

Defining a multi-step request in TFML

To define a multi-step request in TFML, you should create a .tfml file in any folder within your collection. The file can have any name, which represents the request name, except for the echo_request.toml file, which is reserved for defining collections and folders.

The .tfml file can contain the following fields:

FieldTypeDescription
nameStringThe name of the multi-step request.
seqIntegerThe sequence of the request in the parent folder or collection. This is useful for ordering requests when they are executed in serial mode.
requestArray of ObjectsAn array of steps within the multi-step request, each step being an object with its own metadata.

name field

The name field is a string that defines the name of the multi-step request. It is mandatory.

Example below defines a multi-step request named "My Multi-Step Request":

# my-multi-step-request.tfml
name = "My Multi-Step Request"

seq field

The seq field is an integer that defines the sequence of the request in the parent folder or collection. It is useful for ordering requests when they are executed in serial mode. If not specified, the request will be executed after all requests that do not have a seq field defined.

Example below defines a multi-step request with a sequence of 1:

# my-multi-step-request.tfml
seq = 1

request field

The request field is an array of objects, where each object represents a step within the multi-step request. Each step can have its own metadata, such as method, URL, headers, body, etc. The steps are executed in the order they are defined in the array.

Example below defines a multi-step request with two steps:

# my-multi-step-request.tfml
name = "My Multi-Step Request"
[[request]]
name = "Step 1"
method = "GET"
url = "https://httpbin.org/get"
[[request]]
name = "Step 2"
method = "POST"
url = "https://httpbin.org/post"
json = """
{
"message": "Hello, Testfully!"
}
"""

To learn more about the fields that can be used in each step of the multi-step request, check out the TFML for API Requests section.