Debugging Webtests with Fiddler

I ran into a scenario where I had no clue why my Webtest was failing even though I did everything to make it work.. Like correlating all values that possibly needed correlation and getting all necessary plug-ins and rules in place. I would run that webtest again 'n' again and at the same time run a fiddler trace for the same user name to see what was there in the actual request that my Webtest was not making.

Given the complexity of the WebTest and it's sheer length with all the dependant requests that it has for each of the requests I was indeed having a tough time doing a request to request match between my Webtest run and the corresponding Fiddler run. I was getting nowhere. Probably all I needed was a little more patience :-)

But anyways a small & a simple trick did all that I needed at that moment.

I could make a guess which request in my Webtest could be making the incorrect HTTP Requests that was making the tests to fail. I wanted only that selected bunch of requests to show up in FIDDLER when I ran the webtest. If I had that, then I could actually compare that request with the one that Fiddler actually captured when i manually stepped through the steps.

I wrote up a simple Pre-Request Plug-In to do this for me.

public

class AddFiddlerProxy : WebTestRequestPlugin

{

public override void PreRequest(object sender, PreRequestEventArgs e)

{

e.WebTest.Proxy =

"127.0.0.1:8888";

}

}

This did all that I wanted