Skip to content

Automated Testing with Fiddler

A probe droid from Star Wars

Harry Robinson likens his Computer-Aided Exploratory Testing to using probe droids

Exploratory testing isn’t necessarily all manual testing. In fact, I’m always looking for opportunities to extend my reach and increase my efficiency with automation. It’s like putting on a pair of night vision goggles: it’s still me and my brain, simultaneously learning, designing, and executing tests, only able to see things from more perspectives at once.

If you’re not familiar with the Fiddler Web Debugger, its core features are:

  • inspecting HTTP traffic
  • setting breakpoints
  • manipulating (“fiddling” with) data

I don’t believe it’s traditionally thought of as a web automation tool (like Selenium or JMeter), but there’s a customizable rules file named, oddly enough, CustomRules.js that can be modified to perform automation as you perform manual exploratory testing. Below are two extremely simple modifications I’ve made that have aided my exploratory testing a great deal. Please feel free to copy, modify, be inspired by them!

Example #1: JSON-RPC error detection

// Is this the domain we're interested in (, and is this a JSON response?
if (oSession.HostnameIs("") && oSession.oResponse.headers.ExistsAndContains("Content-Type", "application/json")) {
  // "error:null" is present in the response
  if (oSession.utilFindInResponse("\"error\":null", false) > -1) {
    // Turn the line in Fiddler green
  // "error:null" is *not* present in the response
  else {
    //Turn the line in Fiddler red

A few of our applications use the JSON-RPC standard for their web services. A rule of thumb I’ve developed is: if an error occurs, something other than “error: null” will be present in the response. When added to the OnBeforeResponse function in CustomRules.js, this code simply turns the request green or red in the session list based upon this rule:

A JSON-RPC error highlighted in red in Fiddler

With Fiddler up on my other screen, any time unexpected behavior is exhibited by the front-end, I only need to glance over and look for red to see whether or not the back-end web services are somehow involved.

Example #2: tracking request highlighting

if (oSession.HostnameIs("")) {
  //Turn the line in Fiddler gold

Every web application we build has some form of tracking (sometimes only in certain environments), and whether it’s event tracking, tracking activity within a Flash interface, or just normal page tracking, it’s been valuable for me to have these requests stand out in the Fiddler session list, like so:

Tracking request highlighted in gold in Fiddler

When added to the OnBeforeRequest function in CustomRules.js, the code above simply turns any request to Google Analytics gold in the session list. If selected, Fiddler’s WebForms view then provides an easy way to inspect the parameters being sent (which can be useful if you don’t have access to the analytics tool itself).

Categories: Testing.

Tags: , ,

No responses (yet)