This should be the most complete, detailed explanation of Fiddler mobile App capture package, after reading it, you will not come to me...


foreword

What is packet capture?

Use specific tools to capture the data packets sent and returned between the client and the server.

The purpose is to analyze the protocol and content of the data packet, so as to judge whether the design of the interface meets the requirements, such as capturing the request parameters and response parameters of a request to check whether the parameters are correct.

In which scenarios do you need to capture packets?

For beginners or students who have not been exposed to interface testing, they may not understand why it is necessary to learn to capture interface data when doing interface testing or interface automation testing.

So in which scenarios do you need to capture packets to obtain request data?

1. When reproducing the bug, it is necessary to intercept the data to locate the problem;
2. When judging whether the problem is a front-end bug or a back-end bug;
3. When doing interface testing, but the development does not provide interface documents, it is necessary to capture packets to obtain interface information;
4. When we don’t know which interfaces are called in a certain functional scenario or certain functional scenarios, or when we don’t know the sequence of interface calls;

When it is necessary to modify the return parameters (for mock or other scenarios)
, in the actual testing process, the most commonly used scenarios are 1, 2, 3, and 4.

Fiddler capture packet

There are many kinds of packet capture tools, such as Wireshark, Fiddler, Charlse, Tcpdump, browser tools (F12), etc., but in software testing, the packet capture objects are generally HTTP protocol interfaces, so the most common ones are browser tools, Fiddler/Charlse .

The features of Fiddler are briefly summarized as follows:
Fiddler can capture HTTP/HTTPS requests between the client and the server, set breakpoints on interface requests, and even modify input and output data;

Fiddler can only capture HTTP/HTTPS protocols;
Fiddler can not only capture packets on PC browsers, but also supports capturing packets on mobile terminals;

Download and install

Enter the official website to download, the address is: https://www.telerik.com/download/fiddler

After downloading, get the installation file FiddlerSetup.exe, and install it all the way for fools. The currently downloaded version is Progress Telerik Fiddler Classic.

After the installation is complete, open Fiddler, the main interface is as follows:

B1

Fiddler mobile terminal capture

Let's first repeat the general idea of ​​capturing packets on the mobile terminal:

Fiddler needs to be set to allow remote computer connections, that is, to allow the mobile phone to capture packets;
set the mobile proxy network proxy to make the mobile phone send HTTP requests through the Fiddler proxy (that is, Fiddler acts as an intermediary for data transmission and reception);
HTTPS request packet capture settings (if only capture To fetch http requests, the above two-step settings are enough, but in actual work, it is often necessary to fetch https request data).

According to the above ideas, we start to make specific settings.

Step 1: Allow remote computers to connect
Setting steps: Tools–>Options–>Connections–>check Allow remote computers to connect–>click OK, other defaults are fine, as shown in the figure below:

B2

After checking, if there is a pop-up confirmation page, click [OK]. By the way, 8888 in the check page above is the default port number, which needs to be used in the second step of setting.

Step 2, set up the mobile phone network proxy
First, you need to obtain the IPv4 address of the computer where Fiddler is installed, and enter ipconfig in cmd, as shown in the following figure:

B3

Then, find the corresponding WLAN network on the mobile phone, and set the network proxy. Taking the Honor V20 mobile phone as an example, the operation steps are shown in the figure below:

Phone System Settings –> WLAN –> Modify Network –> Advanced Options –> Proxy –> Select Manual –> Hostname fills in the previous step IPv4 –> Port fills in the default 8888 –> Save

B4

Note:
The mobile phone must be connected to the same network as the computer, that is, a WIFI or a hotspot directly connected to the computer with the mobile phone, and then configure the proxy settings for this network, otherwise the data cannot be captured.

Step 2 When you choose to modify the network, different mobile phone models may require different operations to enter the modify network page.

At this point, after restarting Fiddler, you can capture the http request on the phone. If you can't grab it, you can save the proxy settings in the above picture again in your phone, and then make a request.

After reaching this step, open the APP operation on the mobile phone, and capture the http request of the packet, as shown in the following figure:

B5

It can be seen that only http requests are captured here. If you want to capture https requests, you need to perform the following operations.

Step 3, Allow the capture of HTTPS connections
Setting steps: Tools–>Options–>HTTPS–>check Decrypt HTTPS traffic–>check Ignore server certificate errors–>click OK

B6

Note: Fiddler needs to be restarted after saving the settings to take effect.

Step 4, install the certificate on the mobile phone
The steps are as follows:
select any browser on the mobile phone, enter the proxy address set in the second step, host is the IPv4 address of the computer where Fiddler is installed, and the port number is the default 8888 opened in
1 Click FiddlerRoot certificate on the webpage to download the certificate

B7

This step is enough for Android mobile phones. Apple mobile phones still need to trust the downloaded certificate in the mobile phone settings. The operation steps of trusting the certificate will not be explained here.

After completing these two steps, we can capture both the http requests sent by the mobile phone and the https requests sent by the mobile phone. Open the Toutiao APP on your mobile phone and verify as follows:

B8

At this point, the Fiddler mobile terminal packet capture setting is complete.

Attach the description of the session window icon, as follows:

B9

B10

The following is the most complete software test engineer learning knowledge architecture system diagram in 2023 that I compiled

1. From entry to mastery of Python programming

Please add a picture description

2. Interface automation project actual combat

Please add a picture description

3. Actual Combat of Web Automation Project

Please add a picture description

4. Actual Combat of App Automation Project

Please add a picture description

5. Resume of first-tier manufacturers

Please add a picture description

6. Test and develop DevOps system

Please add a picture description

7. Commonly used automated testing tools

Please add a picture description

Eight, JMeter performance test

Please add a picture description

9. Summary (little surprise at the end)

In the vast sea of ​​people, bravely pursue the inner voice. Struggle is not only for success, but also for achieving a better self. Adhere to the dream, go beyond the limit, and create a brilliant life with sweat and hard work. Believe in yourself, burn your passion, you are the creator of infinite possibilities! Struggle unceasingly, dream blossoms!

Go forward bravely and never give up; fight hard and chase your dreams. Even if the road is bumpy, we must persist in moving forward. Only struggle can create brilliance. Believe in your own abilities, release your inner passion, and you will achieve an extraordinary and magnificent life!

Don't be dragged down by failure, overcome challenges with wisdom and perseverance. The road of struggle may be lonely, but every step is one step closer to success. Persist in your dreams and pursue them bravely, and you will be able to write your own brilliant life!

Guess you like

Origin blog.csdn.net/m0_70102063/article/details/132146040