Skip to content

Multistep Tests


Multistep Tests are advanced monitoring tools that simulate complex business processes or user operation paths by chaining multiple API requests. They allow the creation of tests using response data from multiple API connections, thereby validating critical business transactions, simulating end-to-end user journeys, and supporting authentication and authorization. This testing method proactively monitors service availability and performance, ensures the normal operation of complex processes, and alerts promptly when issues arise.

Create

Click Tasks > Create > Multistep Tests.

1. Basic Information

  1. Define the test task name.
  2. Fill in the description as needed.

2. Select Testing Nodes

Currently, TrueWatch has covered 14 testing nodes globally. You can select one or more nodes in China or overseas regions (only for Commercial Plan and above users) to quickly start monitoring site service quality.

3. Select Testing Frequency

Choose the execution frequency of the test task. Supported options include:

  • 1 minute (only for Commercial Plan and above users)
  • 5 minutes (only for Commercial Plan and above users)
  • 15 minutes (only for Commercial Plan and above users)
  • 30 minutes
  • 1 hour
  • 6 hours
  • 12 hours
  • 24 hours

In addition to the specific options provided by the system, you can also input custom crontab tasks to configure scheduled task execution based on minutes, hours, days, months, weeks, etc.

4. Define Request Steps

Click Create the First Request.

Name

Define the request name.

Define Request Format

  1. Define the request URL.
  2. Perform Advanced Settings as needed.

Availability Judgment

Default Mode

Define the success conditions of the test results by adding judgment conditions.

Multiple conditions can be combined using "All" or "Any" to achieve AND or OR logical relationships.

Type Operator
Response Body Contains, Does not contain, Is, Is not, Regex match, Regex does not match
Request Header Contains, Does not contain, Is, Is not, Regex match, Regex does not match
Response Time Less than
Status Code Is, Is not, Regex match, Regex does not match
Script Mode

In Multistep Tests, the script mode allows the following functions by writing Pipeline scripts:

  • Set judgment conditions: Customize complex judgment logic based on business needs, supporting single or multiple condition combinations.
  • Process result data: Customize the processing of test results, including data cleaning, format conversion, etc.
  • Extract fields and define variables: Extract specific fields from the response and define them as variables for reuse in subsequent steps.

The script mode flexibly meets the needs of extracting specific fields from responses or performing complex condition judgments.

Example:

body = load_json(response["body"])

if body["code"] == 200 {
  result["is_failed"] = false
  vars["token"] = body["token"]
} else {
  result["is_failed"] = true
  result["error_message"] = body["message"]
}

In the above script, load_json is first used to parse the response content into a JSON object. Then, it checks if the response status code is 200. If it is, the token from the response content is extracted and stored in vars for use in subsequent requests. Otherwise, result["is_failed"] is set to true, and result["error_message"] is set to the message from the response content.

For more reading, refer to Custom Test Tasks.

Local Variables

Local variables defined in the current Multistep Test task can be referenced in subsequent request steps.

Note

Corresponding fields must be extracted in the script before defining variables.

  1. Enter the variable name. Generally, uppercase letters, numbers, and underscores are supported. Duplicate names are not allowed.
  2. Select the variable value, i.e., the field defined as a variable in the script mode.
  3. Optionally choose to encrypt the variable value. Once checked, the current variable value will be hidden in the test results.

Created variables are displayed in the "Variables" area at the top left.

You can reference local variables in Define Request Format > Advanced Settings > Request Header.

As shown in the figure, the local variable {DS_ID} has been defined in Step 1, with the value dashboard_id. In Request 2, this variable value can be directly referenced in the URL.

To manage these variables, click the button on the right in the "Local Variables Configuration" area to edit or delete them.

Note
  • After deleting a local variable, requests in the current Multistep Test that reference this variable will no longer be able to use it.
  • After modifying a local variable name, steps that reference the original name will not recognize the variable.

Execution Settings

Select "If this step fails, continue to the next step" to skip errors in the current step and continue executing subsequent steps.

Test

After creating the task steps, click the "Test" button to quickly verify the test results. The system will provide the following information for reference:

  • Test performance: Displays performance metrics during the test.
  • Response details: Provides detailed response content to help troubleshoot issues.
  • Variables: Displays variables configured in the current task's requests and URL.

If you start testing from a step after the first request task, you can directly test the current task or choose to start testing from the first task.

If the test fails, there may be unknown variables. Click the "Test from the first step to the current request" button to re-initiate the test for troubleshooting.

Continue Creating Request Steps

After creating the first test task, you can continue to "Create HTTP Request" or "Create Wait Step".

Note

A maximum of 10 steps can be created (including HTTP requests and waits).

Wait Step

This indicates waiting for a specific duration before continuing to the next step. The duration can be selected as 1 second, 5 seconds, 15 seconds, 30 seconds, 1 minute, 2 minutes, or 3 minutes.

Manage Tasks

After creating the request steps, click Save.

For created tasks, you can manage them through the following operations:

  • Click the drag icon on the left of the task to change the order of the steps.
  • Click on the right of the task to clone or delete this step.
  • Click "Batch" to clone or delete tasks in bulk.
Note

When cloning request steps, local variables cannot be cloned together.