The most complete interface test in history - summary of common functions of Fiddler packet capture (super detailed)


foreword

The commonly used functions in Fiddler are as follows:
stop capturing packets; clear the content of the session window; filter requests; decode; set breakpoints

1. Stop capturing packets

B1

2. Clear the session window

Method 1, toolbar tools:

B2

Method 2, command line form:

B3

Of course, the command line tool also supports the input of other commands, so I won’t explain too much here.

3. Filter requests

When you open Fiddler to capture packets, the session window will display a lot of requests, but we only need to capture the target request data, then we can set up filtering.

Filtering can be divided into two methods: only displaying target requests, and only grabbing target-side requests. The difference is that the former captures all requests but only displays the number of target requests, while the latter only captures the request data of a certain end.

①Only display the target request
The operation steps are as follows:

B4

As shown at the bottom of the right side of the interface, you can also check more conditions to filter and display. I won’t explain too much here, and those who are interested can try it by themselves.

②Only capture requests from the target end
For example, when we only want to capture packets from the mobile end, we can set only to capture requests from the mobile end, and set as follows:

B5

4. Decoding

When grabbing some requests, you will find garbled characters in the returned content, as shown in the following figure

B6

This is the reason why HTML is compressed, we can decompress it in two ways.

Method 1, click Responsebody is encoded.Click to decode., as follows:

B7

Method 2, first select Decode in the toolbar, and then request packet capture, so that the displayed request result is the decoded result. as follows:

B8

The decoded result is shown in the figure below:

B9

5. Set breakpoints

Sometimes when debugging, we need to forge client requests and server responses, then we need to set breakpoints at this time.

Forging a client request
Forging a client request means modifying the original request parameters before sending the request after the client clicks on the request and before sending the request to the server. This requires setting the breakpoint to Before Requests. The steps are as follows:

Set through the menu option or the shortcut key F11, as shown in the following steps, click to select Before Requests

B10

After the first step of setting, we go to capture the packet again, and we will find that in the left session window, all requests are marked as interrupted, the request was not sent successfully but was interrupted by Fiddler, and the client can see the data at this time Load exception.

Find the corresponding request in the session window, click to select, select Inspectors on the right, and a row of operation bars will be displayed, click Run to Completion to continue sending the interrupted request.

B11

But our purpose is to modify the request data after the breakpoint and then send the request.

Find the corresponding request and modify the request data

Take logging in to Testerhome as an example, first set the breakpoint to Before Requests, enter the correct account number and password in the browser, click Login, then find the request in Fiddler, clear the password, and then click Run to Completion to continue sending the request. Let's verify what kind of result the server will return.

B12

It can be seen that if the browser enters the correct account and password, the login should be successful, but after we interrupt the point through Fiddler, we modify the request parameters of the login interface before requesting, and return an error: account number or password is wrong, please Retry.

Forged server response
Forged server response, that is, before the response is returned to the client, the response content is modified and then returned, which requires setting the breakpoint to After Responses. Next, take the login interface of the TestHome website as an example to modify its response content. Proceed as follows:

First set the breakpoint rule to After Responses, as follows:

B13

After a normal login, it will jump to the homepage of the TesterHome website, but at this time we can modify the return parameters to make it jump to the Baidu page after login, and the settings are as follows:

B14

As shown in the figure above, change the return parameter in the figure to Baidu address (the return parameter can be modified in the TextView form), and then click Run to Completion, we will see that after successful login, we will jump to the Baidu page instead of the TestHome home page.

Precautions:

The function of setting breakpoints should have the following attention:
In Inspectors, request parameters can be modified in the request parameter display window WebForms, and return parameters can be modified in the response parameter display window TextView.

The breakpoint setting through the menu option or the shortcut key F11 is globally effective, that is, all HTTP requests will be marked with breakpoints

If you only need to set a breakpoint on a request from a certain server, you can use the command line tool of Fiddler to enter commands. The Before Requests command is the bpu server address, and the After Response command is the bpafter server address, as shown in the following figure:

B15

After setting the breakpoint, you need to cancel the breakpoint setting, you need to set the breakpoint to Disabled, the operation is as follows:

B16

You can also use the shortcut tool to set the breakpoint, as shown in the figure below, click to switch:

B17

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)

Every drop of sweat is the birth of a dream; every persistent step is a glorious journey. No matter how thorny the road ahead is, we must go forward bravely, light up our lives with struggle, and create a magnificent chapter of our own. Believe in your ability, dare to challenge, and achieve extraordinary results!

On the stage of life, struggle is the most shining motto. No matter what challenges you face, stick to your dreams and take brave steps. Only by working hard can we surpass ourselves and make the brilliant future a reality.

Every effort is an accumulation, and every struggle is a progress. Perseverance, the pace of chasing dreams will never stop. Even if there are many difficulties, you must go forward bravely, because only by struggling can you write your own brilliant life and let your dreams shine!

Guess you like

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