All Products
Search
Document Center

Performance Testing:Use a data export instruction

Last Updated:Nov 01, 2024

In stress testing scenarios, you can export data such as cookies, response parameters, and parameters defined by parameter command instruction from a business session. You can use the exported data for other business sessions to facilitate global data sharing. This topic provides an example on how to use a data export instruction to export the response parameters of an API.

Background information

In a specific business scenario, the following business sessions exist:

  • Business session A: Access the logon page and use the logon account to log on to the console.

  • Business session B: View the product details, add the product to the shopping cart, and then submit the order.

  • Business session C: View the favorite list, add the product to the shopping cart, and then submit the order.

The logon information used in Business sessions B and C is obtained from the token information in the response body of the logon request in Business session A. You must export the token information from Business session A and use the token information for the APIs of Business sessions B and C. The following section describes the procedure to configure a stress testing scenario.

Procedure

  1. Log on to the PTS console, choose Performance Test > Create Scenario, and then click PTS.

  2. Add and configure Business sessions A, B, and C and the required APIs. For more information, see HTTP APIs.

  3. In the Business Session A section, click the Add Instruction drop-down list and select Data Export.

  4. Expand Export Data, select the data that you want to export, and then configure the Export Level parameter.

    Usage notes:

    • Only one data export instruction can be configured for a stress testing scenario.

    • Up to five data records can be exported at a time. The data records include cookies, response parameters, and parameters defined by parameter command instructions.

    • The export level refers to the number of data records that can be exported. Up to 100 million data records can be exported.

    • After cookies are exported, the cookies are automatically included in other sessions. After parameters are exported, you must specify the parameters, such as ${token}, in required formats.

    • The parameters that are exported by using data export instructions are array parameters. If data traversing is required, you must use data export instructions to export parameters and specify the parameters as array parameters. You can export only one data object. If you want to export response parameters, make sure that the data of a response parameter does not exceed 10 KB in size. If you want to precisely manage the export level, you must use data files.

References

Use exported cookies to simulate a logon scenario. For more information, see Use cookies to simulate a logon scenario.

If you want the exported cookies to be polled only once in subsequent sessions, use a parameter instruction. For more information, see Use a parameter instruction.