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:
Define a header for an API: The header takes effect only on the current API.
Define a header for a business session: The header is automatically added to all APIs of the current business session during stress testing.
Define a global header: The header is automatically added to all APIs involved in the whole scenario during stress testing.
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.
Configure the basic HTTP request information. For more information, see Basic request information.
On the Header Definition tab in the API configuration section, configure the parameters described in the following table.
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.
(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.
NoteOn 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:
Choose Add Instruction > Header.
Configure the parameters described in the following table.
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.
(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.
NoteOn the Body Definition tab, you must configure the Content-Type parameter.