Data export directive
In a performance test, you can export data from one serial link, making it available to other serial links. This data can include items like a cookie, an output parameter, or a parameter defined by a data directive. This topic demonstrates how to use the data export directive with an example of exporting an API's output parameter.
Background
Consider a typical e-commerce scenario that involves multiple user journeys, represented as serial links:
Serial link A: Opens a login page and authenticates the user.
Serial link B: Views product details, adds the item to the cart, and submits the order.
Serial link C: Views the favorites list, adds an item to the cart, and submits the order.
In this case, serial links B and C both require the user to be logged in. The authentication token, which is returned in the response body of the login request in serial link A, must be exported so it can be used by the APIs in serial links B and C. Follow these steps to configure this performance test scenario.
Procedure
Log in to the PTS console. Add and configure the three serial links (A, B, and C) and their corresponding APIs. For more information, see HTTP node overview.
In the serial link A section, click the drop-down arrow next to Add Command, and then click Data Export.
Click the
icon next to Data Export, and then configure the data to export and the export volume in the expanded section.Usage notes:
A scenario can have only one data export directive.
You can export up to five data items at a time. These can be cookies or parameters, such as output parameters or parameters defined by a data directive.
The export size is unlimited, but the total number of data entries cannot exceed 1,000,000.
After a cookie is exported, other serial links automatically include the cookie without manual configuration. After a parameter is exported, you must reference it using the parameter syntax, such as ${token}.
To iterate through data, use a data export directive and configure the parameter as an array parameter. You can select only one object for export. If you export an output parameter, ensure its data size does not exceed 10 KB. To precisely control the export volume, associate a data file.
Example
To learn how to use an exported cookie to simulate a login scenario, see Simulate a login scenario by using cookies.
To ensure an exported cookie is used only once by subsequent serial links, use a data configuration directive. For more information, see Data configuration directive.