All Products
Search
Document Center

Performance Testing:Use PTS to parameterize requests to simulate multi-user registrations or logons

Last Updated:Nov 01, 2024

If you want to perform stress tests on services that involve user logons and registrations, you can use the file parameter feature of Performance Testing Service (PTS) to simulate multi-user logons and registrations. This topic describes how to initiate a stress test on the user registration or logon interface by using dynamically changing URLs that are constructed by the file parameter feature.

Prerequisites

  • PTS is activated. For more information, see Activate PTS.

  • A parameter file in the CSV format is prepared. The following sample code provides an example of the content format. For information about the requirements for parameter files, see Parameter file conventions.

    username,password
    user1,Password1
    user2,Password2
    user3,Password3
    

Procedure

If you want to simulate multi-user registrations or logons during a stress test, you can import the parameter file that contains the usernames and passwords in the stress testing scenario and associate the imported parameters with the relevant APIs.

For information about PTS support for logon scenarios, see Use cookies to simulate logons.

The following scenarios describe how to parameterize requests to simulate multi-user registrations or logons:

Scenario 1: Simulate multi-user registrations

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

  2. Import a parameter file to add a data source.

    1. Click Data Sources. On the Files tab, click + Upload File and select an on-premises parameter file that you want to upload.

    2. After you upload the parameter file, select Use First Row as Parameter Name. If you select this option, you do not need to define parameter names. The data in the first row of the parameter file is ignored when PTS reads the file.

    3. Select Use First Row as Parameter Name. After you select this option, you do not need to specify the parameter names. The data in the first row is used as the parameter names. When PTS reads the parameter file, PTS ignores the data in the first row. If the data in the first row of the parameter file is not parameter names, you must specify a parameter name for each column based on your business scenario.image

  3. Add a parameter node.

    1. On the Scenario Settings tab, add a stress testing API, click the drop-down arrow next to Add Instruction, and then select Parameter.

    2. On the Data Source Parameters tab, select existing parameter names.

      Note
      • If you want to use each row only once to assemble requests, select Use Once. When the required data is polled once, the stress testing scenario stops generating new stress testing requests, regardless of the configured load level.

      • If you want to recycle parameters during a stress test, do not select Use Once.

      • You can select Use Once or Baseline Column, but not both for parameters. If you select Use Once, you cannot select Baseline Column.

      image

  4. Configure API parameters.

    • Test URL: Enter the URL that you want to test. In this example, http://web.example.com/register is used.

    • Request Method: Select POST.

    • Body definition: Set the Content-Type parameter to x-www-form-urlencoded, click Text Format in the upper-right corner of the text editor, and then enter {"username":"${username}","password":"${password}"} in the text editor. image

    (Optional) In actual scenarios, you may need to configure more complex configurations. For more information, see HTTP nodes, Parameters, and Commands.

  5. Configure stress mode settings.

    Set the maximum number of virtual users (VUs) to 10 and the total test duration to 1 minute. Use the default settings for other parameters. You are charged for stress tests. We recommend that you configure a load level based on your business requirements. For more information, see Billing overview and Configure the stress testing model and level. image

  6. (Optional) Configure the Bound Domain Name parameter in the Advanced Settings section. This way, you can quickly switch the endpoint that is being tested during multiple stress tests.

  7. Debug and start a stress test

    1. You can debug the scenario to check whether the configurations are valid and prevent test failures. We recommend that you debug the scenario. For more information, see Debug a scenario.

    2. Click Save and Test. In the Note dialog box, select Execute Now and The test is permitted and complies with the applicable laws and regulations and then click Start.

Scenario 2: Simulate multi-user logons

The configurations for parameterizing requests to simulate multi-user logons and multi-user registrations are the same, except for the API configurations. Example:

Test URL: Enter the URL that you want to test. In this example, http://web.example.com/login is used.

Request Method: Select POST.

Body definition: Set the Content-Type parameter to x-www-form-urlencoded, click Text Format in the upper-right corner of the text editor, and then enter {"username":"${username}","password":"${password}"} in the text editor.

image

Analyze the stress testing results

After the stress test is complete, the system obtains the data generated during the test, such as the stress testing scenario metrics, business details, monitoring details, and API sampling logs, and then generates a stress testing report. You can view the report on the Reports page. For more information, see View a PTS-based stress testing report. image