All Products
Search
Document Center

Performance Testing:Stress testing example for online education

Last Updated:Feb 28, 2026

This topic describes how to create and run a multi-step stress testing scenario in Performance Testing (PTS). In this example, you simulate an online education course selection workflow to test system performance under load.

What you will learn

By following this tutorial, you will:

  • Chain multiple API requests into a stress testing scenario (login, browse, submit)

  • Pass data between requests using output parameters and session parameters

  • Parameterize test data from a CSV file

  • Validate API responses with checkpoints (assertions)

Scenario description

An online education website needs to perform stress testing on its course selection pages. The workflow consists of three sequential API operations:

  1. Log on to the system: Construct a login request with a username and password from a CSV data source. The logon information is stored in cookies and automatically shared with subsequent requests.

  2. View the list of courses: Query available courses and extract a course ID from the JSON response. This course ID is passed to the next request as an output parameter.

  3. Submit selected courses: Use the extracted course ID to submit a course selection. A checkpoint verifies that the submission is successful.

The following diagram shows the data flow across these three steps:

CSV File (username, password)
      |
      v
[Login API] --cookies--> [Course List API] --course ID--> [Submit API]
                               |                               |
                          output: ID                    checkpoint: success

The following figure shows the basic settings of the stress testing scenario.

Scenario configuration overview

Prerequisites

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

  • A parameter file in CSV format is prepared. In this scenario, the file contains usernames and passwords for the simulated login requests. The following example shows the required format. For more information about parameter file requirements, see Parameter file conventions.

      username,password
      user1,Password1
      user2,Password2
      user3,Password3
  • You have a basic understanding of HTTP methods and JSON syntax.

Step 1: Configure the stress testing scenario

1. Create a scenario

Log on to the PTS console. In the left-side navigation pane, choose Performance Test > Create Scenario, and then click PTS.

2. Upload a data source file

  1. Click Data Sources. On the Files tab, click + Upload File and select the CSV parameter file from your local machine.

  2. Select Use First Row as Parameter Name. When this option is selected, PTS treats the first row of the CSV file as parameter names (for example, username and password) and skips it when reading test data. If the first row of your CSV file contains actual test data instead of parameter names, do not select this option and manually specify a parameter name for each column.

    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 the parameter names that you uploaded.

    Note

    - To use each row of data only once, select Use Once. After all rows are consumed, PTS stops generating new requests regardless of the configured load level. - To recycle parameter data throughout the stress testing, do not select Use Once. - Use Once and Baseline Column are mutually exclusive. You cannot select both options for the same parameter.

    image

4. Configure API operations

4a. Configure the login API

Configure the first API operation to simulate user login.

  • Test URL: Enter the URL of the login endpoint. In this example, http://web.example.com/login is used.

  • Request Method: Select POST.

  • Body definition: Set Content-Type to x-www-form-urlencoded, click Text Format in the upper-right corner of the text editor, and enter the following content: The ${username} and ${password} variables are automatically replaced with values from the CSV data source during stress testing.

      {"username":"${username}","password":"${password}"}
image
Note

Cookies set by the login response are automatically shared with all other API operations in the scenario. You do not need to manually configure authentication for subsequent requests.

4b. Configure the course list API

Click Add API and select HTTP to add a second API operation. Configure the request as follows:

  • Test URL: Enter the course list endpoint URL. In this example, http://web.example.com/mocks/online/list is used.

  • Request Method: Select POST.

To pass a course ID to the next request, you must extract it from this API's response. Click the Output Parameter Definition tab and configure the following fields:

Output parameter definition
  • Output Parameter Name: Enter a custom name for the parameter.

  • Source: Select the response parsing format. For this example, select Body: JSON.

  • Parsing expression: Enter a JSON path expression based on the response structure.

For example, if the API returns the following JSON response:

{
  "schedule_list": [
    {
      "Name": "math",
      "ID": "001"
    },
    {
      "Name": "english",
      "ID": "002"
    },
    {
      "Name": "science",
      "ID": "003"
    }
  ]
}

To extract the second course ID (002), use the expression schedule_list[1].ID. The array index starts from 0, so [1] refers to the second element.

Note

You can use the expression debugging feature to verify your parsing expressions before running the stress testing. For more information, see Debug a stress testing scenario.

4c. Configure the submit courses API

Click Add API and select HTTP to add a third API operation. Configure the request as follows:

  • Test URL: Enter the submit endpoint URL. In this example, http://web.example.com/mocks/online/submit is used.

  • Request Method: Select POST.

Configure the request body

Click the Request Body Definition tab to pass the course ID extracted from the previous API:

Request body configuration
  • Content-Type: Select x-www-form-urlencoded.

  • Key: Enter a custom key name. For example, ID_from_last_api.

  • Value: Click Parameters at the bottom of the page. In the Parameters panel, click the Session Parameters tab, find the output parameter (such as ID) from the previous API, and click the copy icon. Paste the copied value into the Value field.

Configure an output parameter

Click the Output Parameter Definition tab to extract the submission result:

Output parameter definition for submit API
  • Output Parameter Name: Enter a name, for example, result.

  • Source: Select Body: TEXT.

  • Parsing expression: Enter a regular expression. In this example, the response body is result:success, so the parsing expression is result:(.+).

Note

For this API, you must select Body: TEXT as the source because the response is plain text, not JSON. You can verify this expression using the expression debugging feature.

Configure a checkpoint

Click the Check Point (Assertion) tab to validate that the course submission is successful:

Checkpoint configuration
  • Check Point Type: Select Output Parameters.

  • Check Object: Select result.

  • Condition: Select Equal To.

  • Content: Enter success.

When the checkpoint passes, the API request is counted as successful. When it fails, the request may be counted as a business failure in the stress testing report.

Step 2: Configure the stress testing mode and load level

After you configure the stress testing scenario, configure the stress testing parameters in the Stress Mode Configuration and Load Level Configuration sections on the Create PTS Scenario page.

  • Stress Mode Configuration: Select a stress mode, such as VU Mode or RPS Mode (Requests Per Second), depending on your testing objective.

  • Load Level Configuration: Set parameters such as Max VUs, Total Test Duration, and Starting Percentage.

For more information about these settings, see the PTS documentation.

Step 3: Debug the scenario and start stress testing

  1. Debug the scenario (recommended). Before running the full stress testing, debug the scenario to verify that all API configurations, parameter extractions, and checkpoints work as expected. For more information, see Debug a scenario.

  2. Start the stress testing. In the lower part of the PTS Scenario page, click Save and Start. In the Note dialog box, set the Execution Cycle parameter to Execute Now, select the check box for The test is permitted and complies with the applicable laws and regulations, and then click Start Test.

Analyze the stress testing results

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

image

To verify that the test was successful, check the following in the report:

  • The success rate for each API operation meets your baseline threshold.

  • The checkpoint on the submit courses API passes.

  • Response times are within acceptable thresholds for your application.