After reading it, you will analyze the whole process from packet capture to interface testing!

1. Why capture packets

1. From the perspective of functional testing

View hidden fields by capturing packets

There are many hidden fields in web forms, and these hidden fields generally have some special purposes, such as collecting user data, preventing CRSF attacks, preventing web crawlers, and some other purposes. These hidden fields cannot be seen on the interface. If you want to detect these fields, you must use a packet capture tool.

2. Understand the content of the agreement through the packet capture tool

Facilitate interface and performance testing

In terms of performance testing, performance testing is actually a large number of simulated user requests, so we must know the content and characteristics of the protocol in the request in order to better simulate user requests. To analyze the protocol, we need to use a packet capture tool; in terms of interface testing, in When testing the interface, although we try to require a complete interface document. But in many cases, it is impossible for interface documents to cover all situations, or because the documents are lagging behind, in the process of interface testing, it is sometimes necessary to use packet capture tools to assist us in interface testing.

3. You need to use the packet capture tool to check the data encryption

In terms of security testing, we need to check whether sensitive data is encrypted during transmission, and we also need to use packet capture tools to check.

4. Handle the dispute over the ownership of front-end and back-end bugs

When we submit bugs, there are often disputes between the front-end (client display) and the back-end (server-side logic), so we can use the packet capture tool to determine whether it is a data transmission problem or a front-end display problem. If there is a problem with the captured data, it is generally a back-end problem; if the captured data is correct, it can basically be concluded that it is a problem with the front-end display.

5. Through packet capture analysis

better understanding of the system

Frequent use of packet capture tools to assist testing can give a good understanding of the entire system, such as the relationship between the front and back ends of the data transmission process, and the structure of the entire system. Especially for products with the current microservice architecture, packet capture can better sort out and grasp the relationship between various services in the entire system, greatly increasing the coverage of tests. In addition, it can also improve the understanding of code and HTTP protocol knowledge.

2. How to capture packets

Commonly used packet capture tools include Fiddler, wireshark, Charles, and the browser's own F12 and other tools. So here I will show you how to use the browser's own F12 to capture packets.

➤Step 1: After opening the browser, press F12, select the network--click the setting button--check the continuous record

➤Step 2: Operate on the browser, and you can see the HTTP request information in the network (login operation)

➤Step 3: Find the request information for the operation (login operation)

➤Step 4: Obtain the four elements of the request for interface testing

1- Request address:

wy.lemonban.com:3000/callCompone…

2- Request method: post

3- Request parameters:

{"logo":"HC","username":"wuye_kemi","passwd":"xxxx","validateCode":"LEMON","errorInfo":""}
  • username: username when logging in

  • passwd: password when logging in

  • validateCode: verification code when logging in

4- Response result:

{"userName":"wuye_kemi","userId":"302021110504836175","token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJqY"}

3. Postman interface test actual combat

After capturing packets through F12, we have obtained the relevant interface information, and then we can use the postman interface tool to test the interface.

Fill in the request address, request method, and request parameters in the postman tool in turn, click Send to send, and then check the response result and the packet capture response result. In this way, a simple interface debugging is completed.

Four. Summary

If you want to perform interface testing by capturing packets, you need to have a certain network protocol foundation, which allows you to quickly find request and interface information.

Secondly, in the process of interface testing, we'd better communicate with the developers, because they are more aware of the meaning and type constraints of each parameter. If they want a more comprehensive test interface, they can organize the packet capture information into documents and communicate with the developers. Communicate and improve documentation.

It is a standard test process to carry out use case design and interface execution after having interface documents.

If the article is helpful to you, remember to like, bookmark, and add attention. I will share some dry goods from time to time...

END Supporting Learning Resources Sharing

Finally:  In order to give back to the die-hard fans, I have compiled a complete software testing video learning tutorial for you. If you need it, you can get it for free 【保证100%免费】

Software Testing Interview Documentation

We must study to find a high-paying job. The following interview questions are the latest interview materials from first-tier Internet companies such as Ali, Tencent, and Byte, and some Byte bosses have given authoritative answers. Finish this set The interview materials believe that everyone can find a satisfactory job.

insert image description here

How to obtain the full set of information:

Guess you like

Origin blog.csdn.net/m0_58026506/article/details/131260715