Parameter description
This topic describes the rules for using parameter file URLs and invoking dynamic parameters in microservice stress testing.
Parameter File URL: Provide a URL for a publicly downloadable file
The platform distributes the parameter file to each load generator. For each call, the application reads a line from the file in sequential order. The file also supports dynamic function parameters.
- Method parameter type: A JSON array of strings. Each element in the array represents the parameter type at the corresponding position. For types other than Java primitive data types, enter the full class path.
- Method parameter: A JSON array of strings. Each element in the array represents the parameter at the corresponding position.
The details are as follows:
| Method | Parameter type format | File parameter format |
| String sayHello(String name) | ["java.lang.String"] | ![]() |
| String helloBean(HelloBean helloBean) | ["com.alibaba.pts.dubbo.api.DemoService"] | ![]() |
| String helloList(List helloList1, List helloList2) | ["java.util.List","java.util.List"] | ![]() |
| String sayHello(String name) | ["java.lang.String"] | ![]() |
Dynamic parameters
PTS microservice stress testing includes several built-in functions to generate simple random parameters.
Each time the platform calls an API, it first generates the actual parameters from a dynamic parameter template and then invokes the API with these parameters. A dynamic parameter starts with the identifier ${__ and ends with the identifier }. At runtime, the platform replaces the identifiers and the entire string between them with a dynamically generated string. All other strings remain unchanged.
- Generate random numbers
Example input Result Description ${__Random(1,1000)} - First time: 3454
- Second time: 67
- Third time: 53
A random number between 1 and 1000. ["Tom",463${__Random(5,10)}] - First time: ["Tom",4635]
- Second time: ["Tom",4637]
- Third time: ["Tom",4638]
A random number between 5 and 10. The strings outside the dynamic parameter, `["Tom",` and `463]`, remain unchanged. - Generate the current time in different formats
Example input Result Description ${__time(,)} 1450056496991 Gets the number of milliseconds from January 1, 1970, to the present. ${__time(yyyyMMdd,)} 20151214 Formats the current time as YYYYMMDD. ${__time(HHmmss,)} 092816 Formats the current time as HHmmss. ${__time(yyyyMMdd-HHmmss,)} 20151214-092816 Formats the current time as YYYYMMDD-HHmmss. ["time":"${__time(HHmmss,)}.log"] ["time":"053816.log"] Strings that are not dynamic parameters, such as ["time", "and.log"], remain unchanged. - Generate random strings
Example input Result Description ${__RandomString(5)} faAfg A random string of 5 uppercase and lowercase English letters. ${__RandomString(5,abcd)} aabdc A random string of 5 English letters selected from a, b, c, and d. ["name":"${__RandomString(5)}"] ["name":"abddc"] Strings that are not dynamic parameters, such as ["name", "and"], remain unchanged. - Generate a random string or number from a specified list
Example input Result Description ${__RandomSpecifiedString(aaa;;;bbb;;;ccc)} bbb Randomly selects a string from aaa, bbb, or ccc. ${__RandomSpecifiedString(111;;;222;;;333)} 333 Randomly selects a string from 111, 222, or 333. ["name":"${__RandomSpecifiedString(aaa;;;bbb;;;ccc)}"] ["name":"ccc"] Strings other than dynamic parameters, such as ["name", "and"], are preserved. - MVEL expressions
Example input Transformation result Description ${__Expression(3+5)} 8 Gets the value of the expression 3+5. ${__Expression(${__RandomSpecifiedString(100;;;200;;;300)}+5)} 105 Nested expressions. A number is randomly selected from 100, 200, or 300 and added to 5. The result can be 105, 205, or 305. ["time":"${__Expression(3*5)}"] ["time":"15"] Strings that are not dynamic parameters, such as ["time", "and"], are not modified.
- API function call:
String sayHello(String name) - Dynamic parameter format:
["${__RandomString(4,abcdefg)}-${__RandomSpecifiedString(aaa;;;bbb;;;ccc)}-${__Expression(3+5)}"] - Actual parameter:
["adag-ccc-8"]



