Custom parameters
To define or redefine parameters in a stress test scene, use the custom parameter feature. This topic describes how to customize global parameters and serial link parameters.
Customize global parameters
Custom global parameters apply to the entire stress test scene. Perform the following steps:
-
Log in to the PTS console. In the left navigation bar, select Performance Testing > Create Scenario, and then click PTS Stress Test.
-
On the Create PTS Scene page, click Parameter List at the bottom. In the Custom Parameter tab of the dialog box, edit the parameter name and parameter logic, and then click OK.
Note-
Custom parameters can only contain strings and system functions. You cannot use file parameters or output parameters.
-
If a custom parameter that uses a system function is referenced by multiple APIs in the same serial link, all referencing APIs receive the same value during a single transaction by a single virtual user.
-
Customize serial link parameters
Use the data configuration directive in PTS to customize serial link parameters. These parameters apply to the entire serial link containing the directive. This feature is useful when you need to redefine global parameters and file parameters.
-
Log in to the PTS console. In the left navigation bar, select Performance Testing > Create Scenario, and then click PTS Stress Test.
-
On the Create PTS Scene page, click the drop-down arrow to the right of Add Directive, and then click Data Configuration.
-
In the Data Configuration section, click the Custom Parameter tab and edit the parameter name and parameter logic.
Note-
Custom parameters can only contain strings and system functions. You cannot use file parameters or output parameters.
-
If a custom parameter that uses a system function is referenced by multiple APIs in the same serial link, all referencing APIs receive the same value during a single transaction by a single virtual user.
-
Use cases
When you run stress tests across different environments, such as staging and production, API definitions are often the same while domain names differ. To manage this efficiently, define the domain name as a parameter, for example, domain, and specify the API endpoint as http://${domain}. This allows you to switch test environments by only updating the domain variable, which improves testing efficiency by modifying the domain name for all APIs simultaneously.
Define a custom parameter named domain.
In the Parameter List panel, on the Custom Parameter tab, set the parameter name to domain and the parameter logic to www.aliyun.com.
In the API configuration, use http://${domain}.