All Products
Search
Document Center

Performance Testing:Header definition

Last Updated:Nov 01, 2024

You can define a header to specify a special request for a stress testing task initiated by using Performance Testing Service (PTS). This topic describes how to define a header in scenario settings.

Background information

Actual stress testing scenarios require specific requests. For example, when you perform stress testing on a web page logon, you must specify a request that passes the authentication. All stress testing tasks initiated by using PTS receive HTTP requests. When you configure a scenario, you can specify the key and value of a header to specify a special access request. To specify a request in a more accurate manner, you can define a request body. For more information, see Body definition.

To ensure that the API header definition takes effect in different scopes, use one of the following methods:

Note
  • If the keys of the headers specified by using the preceding methods are the same, the header definition with a smaller scope takes effect.

  • Otherwise, all header definitions take effect.

Define a header for an API

If you define a header for a stress testing request, you must change the Key and Value values on the Header Definition tab of each API.

  1. Configure the basic HTTP request information. For more information, see Basic request information.

  2. On the Header Definition tab in the API configuration section, configure the parameters described in the following table.image

    Parameter

    Description

    Value

    The parameterized expression.

    For more information about how to write advanced parameters, such as combining functions and strings, see How do I combine parameterized system functions and strings?

    Key

    The HTTP request header that accurately matches the specified value. PTS performs fuzzy matching for common HTTP request headers based on the specified value to help you quickly select the required header.

  3. (Optional) Click Text Format in the upper-right corner of the Header Definition tab to view the entered keys and values. You can also write multiple headers at the same time in the Text Format field.

    Note

    On the Body Definition tab, you must configure the Content-Type parameter.

Define a header for a business session

If multiple stress testing APIs in a business session need to use the same header, you can share the header by using link headers.

To define a header for a business session, perform the following steps:

  1. Choose Add Instruction > Header.image

  2. Configure the parameters described in the following table.image

    Parameter

    Description

    Value

    The parameterized expression.

    For more information about how to write advanced parameters, such as combining functions and strings, see How do I combine parameterized system functions and strings?

    Key

    The HTTP request header that accurately matches the specified value. PTS performs fuzzy matching for common HTTP request headers based on the specified value to help you quickly select the required header.

  3. (Optional) Click Text Format in the upper-right corner of the Header Definition tab to view the entered names and values. You can also write multiple headers at the same time in the Text Format field.

    Note

    On the Body Definition tab, you must configure the Content-Type parameter.