Enhanced web test support in Fiddler

If you have ever had trouble recording a web site with the web recorder included in VSTS, then we have probably suggested recording the same site with fiddler and looking for requests that the VSTS recorder did not capture. If you are not familiar with Fiddler, here is a short description from the fiddler site, “Fiddler is a HTTP Debugging Proxy which logs all HTTP traffic between your computer and the Internet. Fiddler allows you to inspect all HTTP Traffic, set breakpoints, and "fiddle" with incoming or outgoing data.” The author of fiddler included the ability to save a fiddler recording session to a VSTS .webtest file. Although the file saved was a valid web test, there were a few problems.

1. The saved test included all dependent requests such as images, css file, js files, etc.

2. It included requests that were the results of a redirect.

3. The test did not correlate any hidden fields for you. i.e. viewstate

So although you could save a test, it was not saved the same way the VSTS recorder would save it.

I have been working with the owner of Fiddler to add enhanced web test support and he just recently released the updated version of fiddler to the web. You can get the updated version at https://www.fiddler2.com/fiddler2/. Here is a list of the new features:

· Ability to filter out dependent requests

· Only first request in a redirect chain will be saved.

· Automatic correlation of view state and event validation fields

· Plug-in architecture that allows you to write your own custom code that can change how a web test is saved.

I will discuss the last point in detail in a later post. I will walk through the other changes below.

First I am going to launch fiddler and check to make sure that the version of fiddler is 2.0.8.8 or later. You can do this by going to Help -> About Fiddler. After launching fiddler I am going to launch IE and record a simple web test. The web test will include a script against the IBuySpy web site, which is a sample shopping cart application. I will add an item to the cart and then complete the purchase. This set of steps includes 6 different top level requests. Here is a screen shot from fiddler after recording the script:

As you can see there are many more than the 6 top level requests. Now I am going to save this test with the old version of fiddler to show you what the resulting web test looks like. See the below screen shot. As you can see each of the requests that existed in the fiddler UI are now in the web test. You would need to modify this web test prior to using it, by deleting the dependents and correlating hidden fields.

Now let’s walk through the new method of saving the test. Select all requests in the fiddler UI and then go to File - > Save -> Sessions -> as Visual Studio Web Test. First you will be prompted for where you want to save the test.

 Next you will be prompted for which FiddlerWebTestPlugins you want to execute. This dialog will look like it the screen shot below:

A FiddlerWebTestPlugin is a class that has access to the fiddler sessions and can modify how the web test is saved. If you are familiar with VSTS web test plugins, these are implemented in a similar manner. I will go into much more detail about the plugins in my next blog post. For now accept all the available plugins and click OK. When you do, the resulting web test will look like the following:

As you can see there are only 6 requests in my web test. Now look at the viewstate parameters. You can see from the screen shot below, that they are automatically correlated for you.

This web test is ready for use without any modifications. Now it should be much easier to record and save a web test using fiddler.