Why Proxy Tools for QA
HTTP proxy tools sit between the client and server, giving you complete visibility and control over network traffic. For QA engineers, they are indispensable for debugging mobile apps (where you cannot see network requests directly), testing edge cases (by modifying server responses), and simulating network conditions (throttling, latency).
Unlike browser DevTools that only show traffic from the browser, proxy tools capture traffic from any application — mobile apps, desktop software, CLI tools, and background services. This makes them essential for testing applications beyond web browsers.
Common QA Use Cases
- Debugging mobile apps: See every API call the app makes
- Testing error handling: Modify responses to return errors, empty data, or malformed JSON
- Simulating slow networks: Throttle bandwidth to test under 3G/4G conditions
- Verifying API contracts: Inspect exact request/response payloads
- Testing without backend changes: Replace server responses with local files
Charles Proxy and Fiddler
Charles Proxy (macOS/Windows/Linux)
Charles is the most popular GUI proxy for QA engineers. Key features:
Setup:
- Install Charles Proxy
- Configure browser/device to use Charles as HTTP proxy (usually
localhost:8888) - For HTTPS: Install Charles root certificate and enable SSL proxying for target domains
Essential Features:
| Feature | Purpose | QA Use Case |
|---|---|---|
| SSL Proxying | Decrypt HTTPS traffic | Inspect API request/response details |
| Breakpoints | Pause request/response | Modify data before it reaches client/server |
| Map Local | Replace response with local file | Test with mock data |
| Map Remote | Redirect to different server | Route production URLs to staging |
| Rewrite | Modify headers/body with rules | Add/remove headers, change status codes |
| Throttle | Simulate network conditions | Test under slow network |
| Repeat | Resend a captured request | Quick API retesting |
Breakpoints Example:
- Enable breakpoints on
api.example.com/users - Make the request from the app
- Charles pauses the response before forwarding
- Modify the response body (e.g., change user count to 0)
- Forward the modified response to test empty state handling
Fiddler (Windows, .NET-based)
Fiddler provides similar functionality to Charles with stronger Windows integration. Its key advantages include FiddlerScript (JavaScript-based rules engine) and better .NET application debugging.
mitmproxy for Automation
mitmproxy is a command-line proxy tool that can be scripted with Python — making it perfect for CI/CD integration and automated testing.
Installation and Basic Usage
# Install
pip install mitmproxy
# Start interactive console mode
mitmproxy
# Start web interface mode
mitmweb
# Start dump mode (non-interactive, for scripting)
mitmdump
Python Addon Script
# modify_response.py — Inject error conditions for testing
from mitmproxy import http
def response(flow: http.HTTPFlow):
# Simulate server error on specific endpoint
if "/api/v1/checkout" in flow.request.pretty_url:
flow.response.status_code = 500
flow.response.text = '{"error": "Internal Server Error"}'
# Add latency header for performance monitoring
if flow.response:
flow.response.headers["X-Proxy-Latency"] = str(
flow.response.timestamp_end - flow.request.timestamp_start
)
# Run with addon script
mitmdump -s modify_response.py
Charles Proxy Rewrite Rule Example
Replace production API URL with staging in a mobile app without code changes:
- Open Rewrite Settings (Tools > Rewrite)
- Add new rule: Match
api.production.comin Host - Replace with
api.staging.com - The mobile app now hits staging while thinking it is production
Advanced Proxy Techniques
Mobile App Proxy Setup
iOS:
- Connect to the same WiFi as your proxy machine
- Settings > WiFi > HTTP Proxy > Manual: set proxy IP and port
- Visit
chls.pro/sslto install Charles root certificate - Settings > General > About > Certificate Trust Settings > Enable Charles root
Android:
- For Android 7+, apps ignore user-installed certificates by default
- Add network security config to allow proxy certificates:
<!-- res/xml/network_security_config.xml -->
<network-security-config>
<debug-overrides>
<trust-anchors>
<certificates src="user" />
</trust-anchors>
</debug-overrides>
</network-security-config>
- This requires a debug build of the app — coordinate with developers
WebSocket and gRPC Inspection
- Charles Proxy can inspect WebSocket frames (visible in the session view)
- mitmproxy supports WebSocket inspection with dedicated event hooks
- gRPC traffic (HTTP/2 + protobuf) requires proto definition files for readable inspection
Automated Response Recording for Mock Servers
Record proxy sessions and export them as mock data:
# Record all responses to a file
mitmdump -w recorded_session.flow
# Replay recorded responses (acts as mock server)
mitmdump --server-replay recorded_session.flow
This creates instant mock servers from real traffic — invaluable for offline testing and CI environments.
Performance Profiling with Proxy Timing
Proxy tools capture precise timing data for every request. Use this to:
- Identify the slowest API calls in a user flow
- Compare response times before/after code changes
- Detect unexpected API calls (apps making more requests than expected)
- Verify request batching and caching behavior
Hands-On Exercise
Set up Charles Proxy and perform these tasks:
- Configure SSL proxying for
api.example.com - Capture traffic from a mobile app or web browser
- Use breakpoints to modify an API response (change a status code to 500)
- Use Map Local to return mock data from a local JSON file
- Throttle connection to simulate 3G conditions and observe app behavior
Solution Approach
- Proxy > SSL Proxying Settings > Add
api.example.com:443 - Configure device proxy to
your-ip:8888, install Charles certificate - Proxy > Breakpoints > Add
api.example.com/endpoint> Edit response - Tools > Map Local > Map URL pattern to local
.jsonfile - Proxy > Throttle Settings > Enable, select “3G” preset
Pro Tips
- Always remember to disable proxy settings after testing — leftover proxy configs cause mysterious failures
- Use Map Local to test frontend against mock API responses without a backend
- Record proxy sessions for bug reports — they capture exact request/response data
- For mobile testing, use Android network security config to allow proxy certificates
- mitmproxy scripts can be integrated into CI for automated traffic manipulation tests
Key Takeaways
- Proxy tools provide unmatched visibility into client-server communication for debugging
- Request/response modification enables testing edge cases impossible to create through the UI
- mitmproxy’s scriptability bridges the gap between manual investigation and CI automation
- Mobile app testing almost always requires proxy configuration for network-level inspection