Sniffers are special tools that allow testers to intercept and analyze requests that pass through them. Such technologies are quite useful when a user needs to get some data or configure the required response from a server. These methods of working with requests allow not only performing unit testing but also working with different versions of the web product.
We will analyze the performance, configuration features, and advantages of sniffers using the example of a popular HTTP/HTTPS traffic monitoring tool – Charles Proxy. It is usually used as a special proxy server between software under test and a server on the back-end.
The advantage of using sniffers, in general, and Charles Proxy, in particular, is that you can view the whole traffic from both locale machines and mobile devices. This greatly facilitates the life of a QA specialist when performing client-server work.
Using Charles Proxy While Testing Mobile Software
Let’s imagine that our task is to test mobile software. To do this, we have to run Charles Proxy on a PC that is in the same local network with a product under test. Such a connection is established over a Wi-Fi network.
So, after we established a connection, Charles Proxy can start reading out the HTTP traffic of tested software. But to decrypt it, you will have to use additional tools (for example, download the Charles Proxy SSL certificate in any mobile browser).
Also, note that in Android, all the certificates are verified in Settings > Trusted Credentials in the User tab.
Using the Program on PC
Charles Proxy has a lot of options for filtering requests. It is possible to perform their analysis in the following ways:
- Using the Structure tab. First of all, you can copy the host and paste it into the Filter field. This procedure allows seeing the requests of this host.
- Using the Sequence tab. Here we can not only view the information about requests but also work with regular expression statements. The autoscroll parameter allows you to select the required number of lines that you can/need to process during testing.
Moreover, Charles Proxy allows you to filter not just the display but the process of recording requests. To set this configuration, go to Proxy > Record Settings and manually specify test conditions in the Include or Exclude tab. Such manipulation allows you to enable or disable the process of recording requests for the selected host.
How to View SSL Traffic
After we installed the SSL certificate, we need to activate SSL proxying for the required host directly in Charles Proxy to analyze encrypted traffic. We can do all this in a special context menu of a particular host.
If it is inconvenient to enable each host separately, you can go to the Proxy > SSL Proxying settings menu and activate the Enable SSL Proxying item in the first tab.
Working with Breakpoints
Particular attention should be given to setting up breakpoints that help users to intercept specific requests. It’s possible to do that using the context menu of the selected request.
After these manipulations, all similar requests will be intercepted automatically. A user can optionally view or edit them.
Additionally, we’d like to consider the problem of testing software with a bad connection. Charles Proxy’s system capabilities allow you to test a service under such conditions using a simple throttling configuration.
This function is extremely useful for testing a variety of desktop utilities since the communication level for portable gadgets can be edited through the developer panel.
By the way, to set such a process, go to Proxy > Throttling Settings. You can enable limits for both hosts from the suggested list and all the intercepted requests.
To Sum Up
In general, Charles Proxy is a first-class tool that addresses the minimum needs for interacting with network requests. With its help, users can not only test requests but also perform all kinds of configuration settings for their own needs and tasks.