Adding a Test Task
Procedure
- Locate the row that contains Web-test, and click Edit Test Task.
- On the Test Tasks tab, click Add Task. Enter a task name (for example, taskA) and benchmark concurrency, and click OK.
- Click Add Case.
- In the Add Case dialog box, enter a case name, select a case type, and click OK.
- In the case, click Add Request.
- Enter a request name and add requests. You can add multiple requests based on requirements.
- Think time
(Optional) To better simulate user behavior, it is necessary to simulate the waiting time between different operations. For example, when you receive data from a server, you may wait for several seconds to view the data before responding. This latency is called Think Time.
Set Think Time based on requirements. For more effective testing, do not set a long think time. You are advised to test the server for the worst case scenario.
Select Think Time for Request Composition, set Duration to 1000 ms.
- Packet
(Mandatory) Packets are data blocks sent between HTTP applications.
Select Packet for Request Composition, and set packet parameters based on the actual service to be tested.
For example, if you press F12 during login, the API data is shown as in Figure 1. You can configure packets as shown in the following figure.
Figure 1 Packet configuration example
- Response extraction
(Optional) If a case contains multiple packets, the output of the previous packet, which is extracted by a regular expression, is used as the input of the next packet.
Select Response Extraction for Request Composition and set parameters.
- Checkpoint
(Optional) If a checkpoint is set, the number of transactions passing the checkpoint are defined as the number of normal returns. If no checkpoint is set, Checkpoint is 2XX by default.
Select Checkpoint for Request Composition and set parameters.
- Think time
- Click OK.
- In the case, click Add Phase.
Multiple phases can be added based on requirements. Each phase can be used to simulate different numbers of concurrent users. The recommended number of concurrent users is as follows:
- New system: There is no historical data for reference. Ask the relevant business department to estimate the number.
- Old system: Select a tenth of the number of users who use the system over a certain period during peak hours. For example, if the number of users who use the system in thirty minutes is 10,000, the number of concurrent users for the pressure test is 1000.
- Click OK.
- Procedure