All Products
Search
Document Center

Performance Testing:Use a parameter command instruction

Last Updated:Nov 01, 2024

You can use a parameter command instruction after you add an API to redefine data export parameters and response parameters of the previous API. The redefined parameters can be used for subsequent APIs of the same business session. This topic provides an example on how to use a parameter command instruction to redefine the response parameters of the previous API.

Background information

You can add one or more parameter command instructions for a business session. Parameter command instructions cannot be used to process global file parameters and global custom parameters.

A business session includes the following APIs: Browse a product, add the product to the shopping cart, and complete the payment. The subsequent APIs use the product ID specified for the previous API, and the first five characters of the product ID are extracted as a parameter. Adding a product to the shopping cart and completing the payment are considered subsequent APIs, and browsing a product is considered the previous API.

Procedure

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

  2. Create and configure APIs that are used to browse a product, add the product to the shopping cart, and complete the payment. For more information, see HTTP APIs.

  3. Configure response parameters for the API that is used to browse a product. For more information, see Operation response parameters.

    image

  4. In the Business Session section, click the Add Instruction drop-down list and select Parameter Command.

  5. Expand Parameter Command and configure the Parameter Name and Parameter Logic parameters.

    In this example, you can use the ${sys.substring("${ProductID}", 0, 4)} expression to extract the first five characters of a product ID as a parameter. In the preceding expression, ${ProductID} indicates the response parameter defined in the business session.

    image