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 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 can proactively monitor the availability and performance of services, ensure the normal operation of complex processes, and issue timely alerts when problems occur.
Create¶
Click Tasks > Create > Multistep Tests.
1. Basic Information¶
- Define the test task name.
- Fill in the description as needed.
2. Select Test Nodes¶
Currently, Guance has covered 14 test nodes globally. You can select one or more nodes in China or overseas (only for Commercial Plan and above users) to quickly start site service quality monitoring.
3. Select Test Frequency¶
Select the execution frequency of the test task, with the following options supported:
- 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 minute, hour, day, month, and week cycles.
4. Define Request Steps¶
Click Create First Request.
Name¶
Define the request name.
Define Request Format¶
- Define the request URL.
- 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 tasks, the script mode allows you to achieve the following functions by writing Pipeline scripts:
- Set judgment conditions: Customize complex judgment logic based on business requirements, supporting single or multiple condition combinations.
- Process result data: Customize the processing of test results, including data cleaning and format conversion.
- Extract fields and define variables: Extract specific fields from the response and define them as variables for reuse in subsequent steps.
The script mode can flexibly meet the needs of extracting specific fields from the response 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, first use load_json to parse the response content into a JSON object, then judge whether the response status code is 200. If it is 200, extract the token from the response content and store it through vars for use in subsequent requests; otherwise, set result's is_failed to true and error_message to the message in the response content.
For more reading, refer to Custom Test Tasks.
Local Variables¶
Local variables defined in the current Multistep Tests task can be referenced in subsequent request steps.
Note
Corresponding fields must be extracted in the script before defining variables.
- Enter the variable name, generally supporting uppercase letters, numbers, and underscores, and cannot be duplicated.
- Select the variable value, i.e., the field defined as a variable in the script mode.
- Optionally choose to encrypt the variable value. After checking, the current variable value will be hidden in the test results.
The created variables are displayed in the "Variables" area in the upper left corner.
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, and its value is dashboard_id. In request 2, you can directly reference the variable value in the URL.
To manage these variables, click the button on the right side of the "Local Variable Configuration" area to edit or delete them.
Note
- After deleting a local variable, requests in the current Multistep Tests task that reference this variable will no longer be able to use it.
- After modifying the local variable name, steps that reference the original name will no longer recognize the variable.
Execution Settings¶
Select "If this step fails, continue to the next step" to skip errors and continue executing subsequent steps when the current step fails.
Test¶
After the task steps are created, click the "Test" button to quickly verify the test results. The system will synchronously provide the following information for reference:
- Test performance: Display performance metrics during the test.
- Response details: Provide detailed response content to help troubleshoot issues.
- Variables: View the 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 Waiting Step".
Note
A maximum of 10 steps can be created (including HTTP requests and waiting)
Waiting Step¶
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 the request steps are created, click Save.
For the created tasks, you can manage them through the following operations:
- Click the drag icon on the left side of the task to change the order of the call steps.
- Click the on the right side of the task to choose 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.








