I was asked by a colleague as to why I bothered writing a Fiddler IFiddlerWebTestPlugin when I could just as well write a simple VSTS WebTest based WebRequestPlugin, so I thought I might start answering the question...
In essence the difference between the two is: (One happens before code generation, the other at runtime)
- With the Fiddler plug-in you get the opportunity to insert/generate code at the source level when the .webtest xml file gets saved, which gives you plenty of opportunities to inject business related rules prior to the final code generation.
- With the VSTS WebRequestPlugin you are actually providing a run-time plug-in that one has to abide by certain rules imposed by the framework. So by the time your PreRequest(..) method gets called via the framework, the PerformDataBindings method has already been done, so if you wanted to change the actual content of your Request.Body.BodyString it is already too late to inject any DataSource Bindings... which is a pity... would have been nice, but I guess I can understand that by the time your plug-in gets called a lot of plumbing has already taken place by the framework, and if you now go and change the rules, it would have to start the whole cycle all over again... pity though...