When you create a system function, you can use the function generator in the Performance Testing (PTS) console to generate the function, and then combine, replace, nest, or append the required strings based on your business requirements. This topic describes how to use a system function to parameterize the body of an API request.
Procedure
Log on to the PTS console, choose , and then click PTS.
On the Scenario Settings tab, configure the basic request information. For more information, see HTTP nodes.
NoteIn this example, the body of an API request is parameterized and the request method is POST or PUT. In actual stress testing, select the objects to be parameterized and the request method based on your business requirements.
In the lower part of the PTS Scenario page, click System Functions to view the functions supported by the system.
In the System Function panel, click the name of the function that you want to use or click the icon that corresponds to the function to copy the function.
(Optional) If the functions in the System Function panel do not meet your requirements, you can use the function generator to generate a custom function.
In the lower part of the System Function panel, click Function Generator or click the icon that corresponds to a function.
In the Function Generator panel, select a function type, edit the function expression, and then replace the sample values with the actual values used in stress testing.
Click Debug to check whether the debugging results meet your expectations.
Select Add as A Global Custom Parameter and enter a global parameter name.
If you define a function as a global custom parameter, the function is added to the global parameter list, which can be called by the entire stress testing scenario.
Click Copy to copy the function expression.
In the body field of the API, paste the function content and edit the body content based on your business requirements, such as combining strings, parameters, or functions. For information about how to define a body, see Body definition.
You can use four operations to combine functions. For more information, see Use four operations.
NoteNested parameters in system functions take effect only when the parameters are enclosed in double quotation marks (""). For more information, see How do I combine parameterized system functions and strings?