Technology Sharing

Detailed explanation of Fiddler usage: network debugging and analysis tool (interface testing, breakpoint debugging, weak network testing)

2024-07-12

한어Русский языкEnglishFrançaisIndonesianSanskrit日本語DeutschPortuguêsΕλληνικάespañolItalianoSuomalainenLatina


Summary

Fiddler is a powerful network debugging tool that can record, inspect, modify and resend all HTTP/HTTPS traffic passing through a computer. This article will introduce the installation, configuration and usage tips of Fiddler in detail to help developers and testers better understand network requests and responses.

1. Introduction to Fiddler

Fiddler is a free network debugging tool developed by Telerik and is widely used in Web development and testing.

2. Fiddler’s main features

  • Capture all client and server HTTP/HTTPS communications.
  • Modify request and response data.
  • Support breakpoint debugging.
  • Supports session management.
  • Support performance testing.
  • Supports script extensions.

3. Install and configure Fiddler

3.1 Install Fiddler

accessTelerik official websiteDownload the latest version of Fiddler and follow the prompts to complete the installation.

3.2 Configure Fiddler

  • Set the type of traffic that Fiddler captures.
  • Configure decoding options such as character set, automatic decompression, etc.
  • Configure HTTPS decryption and capture HTTPS traffic.

4. Use Fiddler to capture network requests

4.1 Start Fiddler

Open Fiddler and it will automatically start capturing all HTTP/HTTPS traffic passing through your computer.

4.2 View Session

In Fiddler's main interface, you can see all captured network requests and responses, arranged in chronological order.

4.3 Filtering Sessions

Use the filters on the toolbar to quickly filter sessions of a specific type, such as only showing image requests, error requests, etc.

5. Edit and debug network requests

5.1 Modification Request

Right-click the request line and select "Edit" to modify the request URL, method, header information, or body.

5.2 Setting breakpoints

Right-click the request line, select "Breakpoints", set a breakpoint, and Fiddler will pause before the request is sent.

5.3 Resend Request

Right-click the request line and select "Resend" to modify the parameters and resend the request.

6. HTTPS traffic capture and decryption

6.1 Configure HTTPS decryption

In Fiddler's "Tools" > "Options" > "HTTPS", check "Capture HTTPS CONNECTs" and "Decrypt HTTPS traffic".

6.2 Trust Fiddler root certificate

Install and trust Fiddler's root certificate in order to capture HTTPS traffic.

7. Use Fiddler for performance testing

Use Fiddler's "Timeline" view to analyze the response time of network requests and identify performance bottlenecks.

8. Fiddler script extension

By using Fiddler's scripting function, you can implement automated testing, custom processing logic, etc.

9. Common Problems and Solutions

  • How to fix the problem that Fiddler cannot capture certain traffic?
  • How do I configure Fiddler proxy for use on mobile devices?

10. Conclusion

Fiddler is a powerful and easy-to-use network debugging tool. Through the detailed introduction in this article, I hope that readers can master the basic usage of Fiddler and give full play to its powerful functions in actual work.

11. References

  • Fiddler official documentation
  • Fiddler GitHub repository
  • It is a common practice to use Fiddler for interface testing because it provides the ability to capture, inspect, modify, and resend HTTP/HTTPS requests. The following are the basic steps for using Fiddler for interface testing:

Fiddler for interface testing

1. Start Fiddler

First, start the Fiddler tool. Fiddler listens to port 8888 by default.Tools > Options > Connectionsto confirm or change.

2. Configure the system proxy

Make sure your operating system or specific application's proxy settings point to Fiddler. Typically this is set to:

  • HTTP Proxy:127.0.0.1
  • port:8888

3. Capture interface requests

Initiate an interface request in a browser or other client. The request will be captured by Fiddler and displayed on the main interface of Fiddler.

4. Check the request and response

  • Request Details: Select a session and view theInspectors > Request, which displays detailed information of the request, including HTTP method, URL, request header, request body, etc.
  • Response Details: In the same session, viewInspectors > Response, which shows the server's response, including status code, response header, response body, etc.

5. Modification Request

If you need to test different request parameters or header information, you can select the session and thenRequestAfter modification, you can use the right-click menuResendto resend the request.

6. Modify the response

In some testing scenarios, you may need to simulate server responses.ResponseModify the response content in the tab page and passResendResend the modified response to the client.

7. Use breakpoints

Fiddler allows you to set breakpoints at the request or response stage. Select the session and clickBreak on RequestorBreak on Responsebutton. As the request or response passes through, Fiddler will pause execution, allowing you to view or modify the request/response in real time.

8. HTTPS request decryption

If the interface is HTTPS, make sureTools > Options > HTTPSCheckedCapture HTTPS CONNECTsandDecrypt HTTPS traffic. Also, make sure the client trusts Fiddler's root certificate.

9. Save and share sessions

You can save a specific session for later testing or to share with others. Right-click the session and selectSave > Selected Sessions…and select the saving format and location.

10. Script Automation

Fiddler supports automated testing using scripts.QuickExecorCustomize Rules, you can write scripts to automatically handle sessions.

11. Performance Testing

Using FiddlerTimelineFunction, you can perform performance analysis on interface requests and view request and response times.

12. Cleaning up after testing

After the test is completed, remember to turn off the Fiddler proxy in the proxy settings to avoid affecting normal network access.

Using Fiddler for interface testing can greatly improve testing efficiency, help developers quickly locate problems and optimize interface performance. Remember to make full use of the various functions and options provided by Fiddler during use.

Using Fiddler for breakpoint debugging is a very practical feature that allows you to pause a request before it is sent to the server or before the response is returned, so that you can modify the request or response. The following are the steps for using Fiddler for breakpoint debugging:

1. Start Fiddler

First, make sure the Fiddler tool is started.

2. Set breakpoints

In Fiddler, you can set breakpoints in the following ways:

  • Request breakpoint:existRules > Automatic BreakpointsCheckBefore requests
  • Responsive breakpoints:existRules > Automatic BreakpointsCheckAfter responses
  • Manually set breakpoints: Right-click a session in the session list and selectBreakpoints > set URL, enter a specific URL or use wildcards.

3. Configure the system proxy

Make sure your browser or application's proxy settings point to Fiddler so that the traffic can be captured.

4. Send the request

Sends a request in the browser or application. If a breakpoint is set, the request will pause before it is sent or before it returns.

5. Review and modify requests

After you request a pause, you canInspectors > RequestView and modify request details, including:

  • HTTP Methods
  • URL
  • Request Header
  • Request Body

6. Check and modify the response

If you set a responsive breakpoint, you canInspectors > ResponseView and modify the details of the response, including:

  • status code
  • Response Headers
  • Response Body

7. Continue execution

After modifying a request or response, clickRunbutton (or press F10), Fiddler will continue executing the request or response.

8. Resend the modified request

If necessary, right-click the session and selectResendto send the modified request.

9. Disable breakpoints

After debugging is complete, remember toRules > Automatic BreakpointsUncheck the corresponding breakpoint option in to avoid breakpoints for all requests.

10. Use command to execute script

Fiddler allows the use ofExecute JavaScriptorExecute C#command to execute a script, which can automatically perform some actions when a request or response is paused.

11. Use FiddlerScript

FiddlerScript allows you to write JavaScript code that will be executed on each session handle and can be used to modify requests or responses.

12. Save and share debugging results

You can save debugging sessions or export them as HTML reports for sharing or archiving.

13. Notes

  • When debugging at a breakpoint, make sure not to modify sensitive information such as authentication tokens or personal information.
  • Breakpoint debugging may affect the performance of network requests because it pauses the sending of requests or the receiving of responses.

By using Fiddler's breakpoint debugging function, you can gain a deeper understanding of and control the process of network requests, which is very helpful for development and testing.


Fiddler provides the function of simulating a weak network environment, which can help test the performance of the application under different network conditions. The following are the steps for using Fiddler to perform a weak network test:

1. Start Fiddler

First, open the Fiddler tool. Make sure Fiddler is running, as it will capture all traffic going through the proxy.

2. Set up a proxy

Make sure your browser or application is set up to proxy through Fiddler. Typically this is set up as:

  • HTTP Proxy:127.0.0.1
  • port:8888

3. Enter simulation settings

In Fiddler, click Rules menu and selectPerformance > Simulate Modem Speeds

4. Enable simulation

In the dialog box that pops up, check Simulate low bandwidth andSimulate high latency option. This will simulate a low bandwidth and high latency network environment.

5. Configure simulation parameters

  • Bitrate: Set the download speed (bits per second).
  • Latency: Set the delay time (milliseconds).
  • Packet loss: Set the packet loss rate (percentage).

After the settings are completed, click OK Save Settings.

6. Run the test

Now, when you make requests through your browser or application, Fiddler will simulate the specified network conditions.

7. Observation results

Observe the performance of the application in a weak network environment, check the loading time, response speed, etc.

8. Adjust parameters

Adjust the simulated network parameters as needed to test application performance under different network conditions.

9. Disable simulation

After the test is completed, you can Rules > Performance UncheckSimulate Modem Speedsto restore normal network speed.

10. Analysis and Recording

Record test results and perform analysis and optimization based on observed issues.

By using Fiddler's weak network simulation function, you can evaluate the behavior of the application under different network conditions during the development and testing phases, thereby optimizing the user experience.