Nanny-Level Tutorials of "Burst Liver Tidying" - Playing with Charles Packet Grabbing Artifact Tutorial (12) - How Charles Uses the Repeat Function to Perform a Simple Stress Test

1. Foreword  

Li Si: "I'm so tired today, my fingers are swollen from clicking. I have been asked to repeatedly send requests to colleagues on the back-end interface to debug the interface."

Charles: "Oh, classmate Li Si, how can you manually send one by one? I have a super tool: load testing."

2. Introduction

The English meaning of Repeat is: repetition, as the name suggests: it is to repeat the request interface, which can be requested once, only once at a time, or multiple times, multiple requests by one thread, or concurrent requests of multiple threads can be set. Next, Brother Hong will introduce them one by one.

2.1 Application scenarios

◾Development requires another request, then use the tool directly;

◾Simulate N client colleagues to send network requests to the server;

If you want to learn interface automation testing, here I recommend a set of videos for you. This video can be said to be the number one interface automation testing tutorial on the entire network at station B. At the same time, the number of online users has reached 1,000, and there are notes to collect and use. Technical exchanges of various masters: 798478386    

[Updated] The most detailed collection of practical tutorials for automated testing of Python interfaces taught by station B (the latest version of actual combat)_哔哩哔哩_bilibili [Updated] The most detailed collection of practical tutorials for automated testing of Python interfaces taught by station B (actual combat) The latest version) has a total of 200 videos, including: 1. [Interface Automation] The current market situation of software testing and the ability standards of testers. , 2. [Interface Automation] Fully skilled in the Requests library and the underlying method call logic, 3. [Interface Automation] interface automation combat and the application of regular expressions and JsonPath extractors, etc. For more exciting videos, please pay attention to the UP account. https://www.bilibili.com/video/BV17p4y1B77x/?spm_id_from=333.337&vd_source=488d25e59e6c5b111f7a1a1a16ecbe9a

3. Repeat single request

Repeat: This function is especially useful for testing classmates, and can verify the robustness of the interface. The value for the front end is that you don’t need to refresh the page, you only need to repeat the request, such as checking whether the proxy is successful, executing after modifying the request, etc. How to use: After selecting the request, right-click Repeat to send the request repeatedly.

Repeat single request Charles has two operation modes. The specific operation method is as follows:

3.1 The first type

1. Select one or more interfaces, and click the shortcut button on the main navigation bar, as shown in the figure below:

 

3.2 The second type

1. Select one or more interfaces, right-click, and select Repeat, as shown in the figure below:

2. The comparison pictures before and after Repeat, according to the selection of the original request data of the 1801 interface, initiate the request again , as shown in the following figure: 

 

3. Then show a scene of Repeat multiple interfaces, as shown in the following figure:

Four, Repeat multiple requests

Advanced Repeat can customize the number of repetitions and the repetition interval, and send multiple requests repeatedly. You can simply test the concurrent processing capability of the server. The method is as follows: we right-click on the network request (POST or GET request) that we want to suppress, and then select the "Repeat Advanced" menu item. Then, in the dialog box that pops up, select the number of concurrent threads to suppress and the number of suppression times. After confirming, you can start suppression. (iteration: the number of iterations, Concurrency: the number of concurrency, repeat is the time interval).

1. Select an interface, right click, and select Repeat Advanced, as shown in the figure below:

 

2. The Advanced Repeat setting interface will pop up, as shown in the figure below:

 

Advanced Repeat configuration parameter description:

Repeat 1 request  : Repeat 1 request, because 1 request is selected, if 5 requests are selected, Request 5 requests will be displayed here

Iterations  : Set how many times each interface requests

Concurrency : The word means concurrency, and it can also be understood as how many threads are set to complete the request amount set by Iterations

show results in new Session  : Display the concurrent request content data in a new session, which can also be understood as reopening a window to display the Repeat request content.

Repeat delay (ms)  : Set how long each repeat request is delayed before starting the next request. The unit is ms. You can choose whether to use a fixed value or a random value range.

4.1 Single interface

1. Follow the previous method to set the concurrency of a single interface, as shown in the figure below:

 

2. After the setting is complete, click "OK". Display the result of a single interface, as shown in the following figure:

 

4.2 Multiple interfaces

1. Press and hold the keyboard Ctrl to select the concurrency settings of multiple interfaces, as shown in the following figure:

 

2. After the setting is complete, click "OK". Display the results of multiple single interfaces, as shown in the following figure:

 

 

V. Summary

Although charles can also perform concurrent interface testing, it is relatively simple and cannot obtain relevant performance indicators. Generally, Jmeter is used for interface performance testing. However, the concurrent operations of Charles are sufficient to simply suppress the stability of the server in daily testing work.

Guess you like

Origin blog.csdn.net/m0_73409141/article/details/131880810