Skip to content

Multistep Tests


Multistep Tests is an advanced monitoring tool that simulates complex business processes or user operation paths by chaining multiple API requests. It allows you to create tests using the response data of multiple API connections, thereby verifying critical business transactions, simulating end-to-end user journeys, and supporting authentication and authorization. This testing method helps proactively monitor service availability and performance, ensure the normal operation of complex workflows, and trigger timely alerts when issues arise.

Create

Click Tests > Create > Multistep Tests.

1. Basic Information

  1. Define the test name;
  2. Optionally fill in a description.

2. Select Synthetic Nodes

Currently, Guance covers 14 synthetic nodes globally. You can select one or more nodes in China or overseas (Commercial Plan and above only) to quickly start site quality monitoring.

3. Select Test Frequency

Select the execution frequency of the test. The following options are supported:

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

In addition to the predefined options, you can also enter a custom crontab schedule to configure timed task execution based on minute, hour, day, month, week, and other periods.

4. Define Request Steps

Click Create the first request.

Name

Define the request name.

Define the Request Format

  1. Define the request URL;
  2. Optionally configure Advanced Settings.

Success Criteria

Default Mode

Define the success condition of the test result by adding judgment criteria.

You can select "All" or "Any" to implement AND or OR logic between multiple conditions.

Type Operator
Response Body contains, does not contain, equals, does not equal, matches regex, does not match regex
Response Header contains, does not contain, equals, does not equal, matches regex, does not match regex
Response Time less than
Status Code equals, does not equal, matches regex, does not match regex
Script Mode

In Multistep Test tasks, Script Mode allows you to write Pipeline scripts to achieve the following:

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

Script Mode flexibly meets the need to extract specific fields from the response or perform complex condition evaluations.

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 script above, load_json is first used to parse the response content into a JSON object. Then, the code checks whether the response status code is 200. If it is 200, the token from the response content is extracted and stored via 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 information, refer to Custom Dial Tests.

Local Variables

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

Note

You must first extract the corresponding field in the script before defining the variable.

  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 Script Mode.
  3. Optionally choose to encrypt the variable value. When checked, the current variable value will be hidden in the test results.

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

You can reference local variables in the request headers under Advanced Settings > Define Request Format.

As shown in the figure, a local variable {{DS_ID}} (with value dashboard_id) is defined in Step 1. In Request 2, you can directly reference the variable value in the URL.

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

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

Execution Settings

Select "If this step fails, continue to the next step" to skip the error and proceed with subsequent steps when the current step fails.

Test

After creating the task step, click the "Test" button to quickly verify the test result. The test task runs asynchronously. After execution, the system displays the following information:

  • Test Performance: Performance metrics during the test.
  • Response Details: Detailed response content to help troubleshoot.
  • Variables: View the variables configured in the request and URL of the current task.

If you start testing from a step after the first request, you can test the current task directly, 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 step, you can continue to Create HTTP Request or Create Wait Step.

Note

You can create up to 10 steps (including HTTP requests and waits).

Wait Step

Wait for a specific duration before proceeding to the next step. The duration options are: 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 existing tasks, you can manage them through the following operations:

  • Drag the icon on the left side of the task to change the order of the steps.
  • Click the :material-dots-vertical: icon on the right side of the task to clone or delete the step.
  • Click "Batch" to clone or delete multiple tasks.
Note

When cloning request steps, local variables are not cloned along with them.

Feedback

Is this page helpful?