Performance Testing Service (PTS) allows you to import Postman (JSON), HTTP Archive (.har), YAML (.yml), and Swagger (.json) scripts to scenarios and convert them to PTS-native formats for performance testing. PTS provides the requests per second (RPS) performance testing mode, allows real-time adjustment of the testing parameters, and can track performance metrics of individual APIs.
Scripts
To conduct performance testing on HTTP or HTTPS applications, PTS can extract and convert essential request information from scripts in various formats, including Postman (JSON), HTTP Archive (.har), YAML (.yml), and Swagger (.json) into API fields suitable for the performance testing scenarios.
Mappings between Postman script fields and PTS API fields
Postman script field | PTS API field | |
info.name | The name of the session. | |
item[] | The APIs. | |
item[0].name | The name of the API. | |
item[0].request.method | The request method. | |
item[0].request.url.raw | The requested URL. | |
item[0].request.header | key | The key of the header. |
value | The value of the header. | |
item[0].request.body | For a POST request, the Content-Type header in the request specifies how the body data is interpreted or displayed on the receiving end. |
In a Postman (JSON) script, multiple info.name objects can exist at the same level but the item objects cannot be at the same level as the info.name objects.
To export Collections from a Postman (JSON) script, use version 2.1.
You can specify only the GET, POST, PUT, and DELETE HTTP methods in Postman (JSON) scripts.
You cannot specify the file mode in Postman (JSON) scripts.
You cannot specify file uploading or binary Content-Type header in Postman (JSON) scripts.
Mappings between YAML script fields and PTS API fields
YAML script field | PTS API field |
Relations | The sessions. |
Relation | The session. |
Disabled | Specifies whether the session is disabled. |
ID | The ID of the session. |
Name | The name of the session. |
Nodes | The nodes. |
Name | The name of the node. |
NodeId | The ID of the node. |
NodeType | The type of the node. |
Config | The node settings. |
YAML script field | PTS API field |
chain | The API node |
wait | The think time node. |
condition | The conditional jump node. |
dam | The rendezvous point. |
dataInit | The data configuration node. |
dataStore | The data export node. |
dataDefine | The data command node. |
delay | The delay node. |
repeatBegin | The looping command start node. |
repeatEnd | The looping command end node. |
ifBegin | The condition-based command start node. |
ifEnd | The condition-based command end node. |
Category | YAML script field | PTS API field |
chain | accessId | The ID of the protocol. |
beginStep | Specifies the initial number of virtual users on the session in the virtual user mode and the initial requests per second (RPS) on the API in the RPS mode. | |
checkPoints | The checkpoints.
| |
endStep | Specifies the maximum number of virtual users on the session in the virtual user mode and the maximum RPS on the API in the RPS mode. | |
headers | The HTTP header settings.
| |
method | The request method. Valid values: GET, POST, PUT, and DELETE. | |
postActions | Post-testing actions:
| |
body | The request body. This field is available only for the POST or PUT method.
| |
preActions | Pre-texting actions: | |
protocol | The protocol type. Default: http. | |
redirectCountLimit | Specifies whether to redirect the requests. A value of 0 indicates that the requests are not redirected. A value of 10 indicates that the requests are redirected. | |
timeoutInMilliSeconds | The timeout period. Unit: milliseconds. | |
condition | defaultAction | The default action. Valid values:
|
actions | The added condition. | |
dam | type | The rendezvous point type.
|
target | The load level. | |
datalnit | definitions | The key-value pair structure, corresponding to custom parameters. |
references | The referenced file parameters.
| |
dataDefine | definitions | The key-value pair structure. |
dataStore | dataSize | The data export level. |
dataConfig | The data export setting.
| |
delay | duration | The delayed amount of time. Unit: milliseconds. |
ifBegin | ifEndNodeId | The ID of the end node of the condition-based command. |
operator | The operator. | |
param | The expression. | |
value | The comparison value. | |
ifEnd | ifBeginNodeId | The ID of the start node of the condition-based command. |
repeatBegin | repeatEndNodeId | The ID of the end node of the looping command. |
repeatEnd | repeatBeginNodeId | The ID of the start node of the looping command. |
repeatCount | The repeated number of times. | |
wait | type |
|
base | Specifies the constant delay value if type is set to FIXED, the baseline delay if type is set to NORMAL, and the average or mean delay if type is set to UNIFORM. | |
scope | The field is irrelevant if type is set to FIXED, the variable range around the base if type is set to NORMAL, and the variance if type is set to UNIFORM. |
Mappings between the Swagger script fields and PTS API fields
Swagger script field | PTS API field |
paths.key | The requested URL. |
paths.key.key | The request method. |
paths.key.key.parameters | The request parameters or request body. |
definitions | The schema used in the request body. |
tags[0].name | The name of the session. |
Procedure
On the Create Scenario page, select a script type, upload a script, and then click OK.
After the script is imported, you can see that the script content is converted into the corresponding API performance testing information on the Create PTS Scenario page.
The valid script types are Postman (JSON), HTTP Archive (.har), YAML (.yml), and Swagger (.json). You can import only one script to a performance testing scenario. Before you save the scenario configuration, you can upload another script to override the imported script.
For information about the scripts that can be imported to PTS and the description of script fields, see Scripts. Do not import a script that contain types or protocols that are not supported by PTS. If you upload a non-compliant script, an error dialog box appears in the PTS console.