Help Center/ CodeArts PerfTest/ User Guide/ Reference/ Modifying an Exported Project File
Updated on 2024-06-06 GMT+08:00

Modifying an Exported Project File

Table 1 Request composition of think time

Parameter

Description

name

Can be modified.

t

*Duration (ms)

Think Time refers to the waiting time between two consecutive operations performed by a user, such as the interval between login and search.

Suppose that the response time for each running of a transaction is 0.5s.

  • To execute two transaction requests per second, do not set the Think Time request composition.
  • To execute only one transaction request per second, set Think Time to 1s. If the think time is set to 1s and the response time is longer than 1s, the think time will not take effect, and pressure test requests are sent according to the response time.
Table 2 Request composition of packet

Parameter

Description

name

Can be modified.

http_version

Indicates the protocol type.

HTTP, HTTPS, TCP, and UDP protocols are supported.

When Protocol Type is HTTP or HTTPS, set the following parameters.

method

GET, POST, PATCH, PUT, and DELETE are supported.

return_timeout

Indicates the timeout interval for waiting for a response from the server when a request is sent.

If this parameter is not set, the default response timeout interval (5,000 ms) is used.

URL

URL for sending a request, for example, http://domain name/path, or http://domain name/path?key1=value1&key2=value2.

headers

Headers consist of keywords and values and are used to notify servers of clients' requests. For details about headers, see Header Description.

Packet content

The body of an entity contains a data block consisting of random data. Not all packets contain the body of an entity.

If global variables have been set or local variables have been set for response extraction, variables can be used in the packet content. During a pressure test, variables in the packet content will be replaced with specified values.

When Protocol Type is TCP, set the following parameters.

NOTE:

TCP packets do not support the response extraction and checkpoint functions.

IP

IP address of the tested server to which requests are sent.

port

Port number of the tested server to which requests are sent.

connect_timeout

Timeout duration for the server's response after a connection is initiated.

return_timeout

Timeout duration for waiting for the server's response after a connection is established.

Connection Settings

  • Repeated use: When a request response is complete, the connection remains and is used to send and receive the next request response.
  • Close: When a request response is complete, the connection is closed and re-established next time.

check_end_type

Used to judge whether a request response has been received.

  • Length of returned data: length of the returned data, in bytes. When a response of this length is received, data receiving is complete.
  • End-of-text character: ending mark of the returned data. When an end-of-text character is received, data receiving is complete.
NOTE:

It is recommended that a unique end-of-text character be set. If there are multiple such characters in a response, when the first character is received, the response is considered to have been received. As a result, the received response data is incomplete.

body

The body of an entity contains a data block consisting of random data. Not all packets contain the body of an entity.

Content format: Select character strings or a hexadecimal code stream based on the service request content of the tested server.

NOTE:

A hexadecimal code stream can contain only numbers 0–9 and letters a–f. The total number of characters must be an even number.

If global variables have been set or local variables have been set for response extraction, variables can be used in the packet content. During a pressure test, variables in the packet content will be replaced with specified values.

Table 3 Request composition of response extraction

Parameter

Description

name

Must be unique. The value of the response extraction is assigned to this variable.

range

Range of the content to be extracted.

  • Packet content
  • Header
  • URL
  • Response Code

The packet content, header, and URL can be extracted using regular expressions.

regexp

A regular expression specifies a type of logical expressions performed on strings. In a regular expression, you use certain predefined strings and a combination of these strings to form a rule string that is used to specify a specific filtering logic.

A complete regular expression consists of two types of characters: special characters (also called meta characters) and literal or common text characters (such as letters, numbers, and underscores). For details about meta characters, see Regular Expression Metacharacters.

NOTE:

() indicates extraction. Enclose the content to be extracted in parentheses. The content between each () indicates a sub-expression.

match_index

This parameter indicates the sequence number of the matched content extracted through a regular expression.

Value: a positive integer

NOTE:

This parameter cannot be set to 0.

exp_index

This parameter indicates the sequence number of the parsed sub-expression.

Value range: natural numbers

NOTE:

Value 0 indicates that the entire regular expression is matched.

Value 1 indicates that the first sub-expression of the regular expression is matched, that is, the content extracted by the first "()".

After extracting content through Regular Expression and Sequence Number of Matching Item, use Expression Value to obtain the final content.

JSON Key Name

Enter the key name to be obtained.

For example, {key:{"key1":"v1","key2":["v2","v3"]}}. If you want to obtain v2, enter key.key2[0].

default

Indicates the value returned when a regular expression match fails.

Table 4 Request composition of checkpoint

Parameter

Description

name

Can be modified.

value

This parameter is used to respond to HTTP, HTTPS, TCP and UDP response status codes carried in a packet, including 1XX, 2XX, 3XX, 4XX, and 5XX.

header_checks

Headers of the HTTP, HTTPS, TCP, and UDP.

body_checks

Body parts of HTTP, HTTPS, TCP, MQTT, and UDP, namely the load parts of the requests and responses.

Table 5 Adding a test project

Parameter

Description

name

Indicates the test project name.

description

Indicates description of the test project.

Table 6 Adding a transaction

Parameter

Description

name

Indicates the transaction name.

contents

Request content.

You can add transaction requests under a transaction based on service requirements.

Table 7 Adding a transaction

Parameter

Description

issue_num

Number of concurrent users.

The number of concurrent users refers to the number of users performing operations on the system at the same time. In CodeArts PerfTest, it is the number of virtual users set when you define test task phases.

name

Indicates the phase name.

Set a name for the service scenario, for example, homepage test.

time

Duration (second).

The maximum time for performing a pressure test in the current phase.

count

Total number of transmissions.

During the running of a task, the transaction is calculated based on the number of running times. When the specified value is met, the performance test of the transaction under the task is terminated.

Table 8 Adding a global variable

Parameter

Description

name

Global variable name.

variable

Global variable value.

variable_type

NOTE:

Variable content is transmitted in plain text during the pressure test. Exercise caution when entering the content.

Global variable type.

When the variable type is Integer, enter the value range of the variable.

A pressure test task reads the value range of the corresponding global variable when it is running. For each virtual user, the variable value is polled. That is, the first virtual user obtains the first value of the variable, and the second virtual user obtains the second value. If the values are exhausted, the next virtual user obtains the first value again.

Add multiple variables as required.

A pressure test task reads the value range of the corresponding global variable when it is running. For each virtual user, the variable value is polled. That is, the first virtual user obtains the first value of the variable, and the second virtual user obtains the second value. If the values are exhausted, the next virtual user obtains the first value again.