Adding Request Information (Packet)
Packets are data blocks transmitted between HTTP/HTTPS/TCP/UDP/HLS/RTMP/WebSocket/HTTP-FLV/MQTT-based applications. These data blocks start with text metadata that describes the packet content and meaning. The text metadata is followed by optional data. Packets are transmitted among clients, servers, and agents.
Procedure
- Log in to the CodeArts PerfTest console and choose PerfTest Projects in the left navigation pane.
- Click the name of the desired PerfTest project to go to the details page.
- On the Cases tab, select the desired test case in the case list on the left.
- On the Case Script tab page, select a case, and click Add Request.
- On the Packet tab page, select a protocol type based on the service protocol type. Currently, HTTP, HTTPS, TCP, UDP, HLS, RTMP, WebSocket, MQTT, and HTTP-FLV are supported. Set the basic information according to the following packet parameter tables.
Table 1 HTTP and HTTPS packet parameters Parameter
Description
Request mode
GET, POST, PATCH, PUT, or DELETE.
Request URL
URL for sending a request, for example, http://domain name/path, or http://domain name/path?key1=value1&key2=value2.
Variables can be inserted. For details, see Inserting a Variable.
Response Timeout (ms)
Timeout period for waiting for a response from the server when a request is sent. The timeout ranges from 20 ms to 5 min.
If this parameter is not set, the default response timeout interval (5,000 ms) is used.
Carried cookie
NOTE:At least one request exists in the case. Set parameters when adding new requests.
- Obtain automatically: Use the cookie set in the response.
- Obtain manually: Use the cookie in the header of the current request.
Automatic Redirection
Whether to redirect to the redirection address. The function is enabled by default, that is, the redirection address is automatically redirected to.
Request Parameter
Set the parameters in the request URL.
Click Add Request Parameter and set Name and Value. Select Url Encode if necessary. By default, Url Encode is not selected. If Url Encode is selected, URL encoding is performed on the values of request parameters.
If you do not need to add a request parameter, click Delete to delete it.
RequestHeader
Add headers and contents based on the headers to be verified or used by a pressure test server. Headers are not mandatory. Only user-defined headers are transparently transmitted to the pressure test server. For details about Header, see Header Description.
Click Add Header and set Header and Value. If you do not need to add header information, click Delete to delete the packet header.
You can click Bulk Edit to edit multiple headers at a time in the text box. You can click Key-Value Edit to return to the key-value pair editing mode.
NOTE:If the request mode is POST or PUT and Header is Content-Type, variables can be inserted, and Value can be one of the three following types:
- Customize: Enter a value in the text box.
- application/x-www-form-urlencoded: The request body is a key value pair that can be added. The value is text.
- multipart/form-data: The request body is a key-value pair that can be added. The value can be text or a file. If the value is a file, the body can be imported.
Body
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.
- Enter $ in the request content input box.
- In the Insert Variable dialog box, set parameters. For details, see Inserting a Variable.
- Click Select.
Table 2 TCP packet parameters Parameter
Description
IP
IP address of the tested server to which requests are sent.
Port Number
Port number of the tested server to which requests are sent.
Connection Timeout
Timeout duration for the server's response after a connection is initiated. The connection timeout value ranges from 20 ms to 60s.
Response Timeout
Timeout duration for waiting for the server's response after a connection is established. The response timeout value ranges from 20 ms to 60s.
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.
Return Settings
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.
Content Format
Select String or Hexadecimal code stream data 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.
- Enter $ in the request content input box.
- In the Insert Variable dialog box, set parameters. For details, see Inserting a Variable.
- Click Select.
Table 3 UDP packet parameters Parameter
Description
IP
IP address of the tested server to which requests are sent.
Port Number
Port number of the tested server to which requests are sent.
Return Settings
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.
Content Format
Select String or Hexadecimal code stream data 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.
- Enter $ in the request content input box.
- In the Insert Variable dialog box, set parameters. For details, see Inserting a Variable.
- Click Select.
Table 4 HLS packet parameters Parameter
Description
Streaming media address
Address of the video source, for example, http://domain name/path.
Play Duration (s)
Duration of simulated playback.
NOTE:During case debugging, the playback duration is set to 3 seconds.
Retry Delay (ms)
Interval for obtaining new data in live streaming when the video playback source does not have new data.
Retry Times
Maximum number of attempts to obtain new data in live streaming when the video playback source does not have new data. If the number of attempts exceeds the maximum, the system determines that the attempt fails.
Table 5 RTMP packet parameters Parameter
Description
Request Mode
- Stream pushing: a process of transmitting onsite video signals to the network.
- Stream pulling: a process of pulling streaming media video files from a server using a specified address.
When Request Mode is Stream pushing, set the following parameters.
Streaming server address
IP address of the tested streaming media server.
Port Number
Listening port number of the tested streaming media server. The default value is 1935 for RTMP.
App name
AppName in the stream URL, that is, the path for storing live streaming media files, for example, live.
Streaming name
StreamName in the stream URL, which uniquely identifies a live stream, for example, livestream.
Push duration (s)
Duration for simulating stream pushing, in seconds.
Video source address
OBS address for storing video source files for simulating live stream pushing. Currently, only .flv files are supported. Non-standard H.265-encoded .flv files are not supported.
When Request Mode is Stream pulling, set the following parameters.
Streaming server address
IP address of the tested streaming media server.
Port Number
Listening port number of the tested streaming media server. The default value is 1935 for RTMP.
App name
AppName in the stream URL, that is, the path for storing live streaming media files, for example, live.
Streaming name
StreamName in the stream URL, which uniquely identifies a live stream, for example, livestream.
Play Duration (s)
Simulated duration of live stream watching, in seconds.
Table 6 WebSocket packet parameters Parameter
Description
Request mode
Connect: Establish a WebSocket connection with the pressure test website.
DisConnect: Close the connection to the pressure test website.
Pong: Send pong to the pressure test website.
Ping&Pong: Send pong to the pressure test website and expect to return ping.
Request: Send a request to the pressure test website and receive a response.
ReadOnly: Only receive information sent by the pressure test website.
WriteOnly: Only send information to the pressure test website.
Request connection address
URL of the WebSocket connection, for example, ws://domain name/path. Encrypted requests are supported, such as wss://domain name/path.
Connection Timeout (ms)
Timeout duration for the server's response after a connection is initiated. The connection timeout value ranges from 20 ms to 60s.
NOTE:This parameter needs to be set only when the request mode is Connect.
Status Code
Status code for closing a connection. The default value is 1,000. The value range is 0–4,999.
NOTE:This parameter needs to be set only when the request mode is DisConnect.
Request Type
Select Text or Binary based on the service request content of the tested server.
NOTE:- Binary indicates hexadecimal.
- This parameter needs to be set only when the request mode is Request or WriteOnly.
Bodys
Enter the packet content of request information based on the specified request type.
NOTE:- This parameter needs to be set only when the request mode is Request or WriteOnly.
- When the request content is text, you can enter variables. For details, see Inserting a Variable.
Response Type
Select Text or Binary based on the service response content of the tested server.
NOTE:- Binary indicates hexadecimal.
- This parameter needs to be set only when the request mode is Request or ReadOnly.
Response Timeout (ms)
Timeout duration for waiting for the server's response after a connection is established. The response timeout value ranges from 20 ms to 60s.
Request Header
Add headers and contents based on the headers to be verified or used by a pressure test server. Headers are not mandatory. Only user-defined headers are transparently transmitted to the pressure test server. For details about Header, see Header Description.
Click Add Header and set Header and Value. If you do not need to add header information, click Delete to delete the packet header.
You can click Bulk Edit to edit multiple headers at a time in the text box. You can click Key-Value Edit to return to the key-value pair editing mode.
Table 7 HTTP-FLV packet parameters Parameter
Description
Streaming media address
Address of the video source, for example, http://{Video source IP address}:8080/live/stream.flv.
Play Duration (s)
Duration of simulated playback.
NOTE:During case debugging, the playback duration is set to 3 seconds.
- Click Save.
Filling in a Packet
Packets refer to all click operations performed by users on the website interface. The process of sending a packet: A click operation is edited to a code stream complying with protocol specifications and carrying a user's request before the code stream is sent to a third party, leading to a correct or failed response.
Press F12 or use a packet-capturing tool (such as Wireshark) to check how a packet is requested and fill in the packet to be tested according to the actual service.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot