A collegue asked me to solve some “strange problems” with VS Web Test: hidden fields are treated in a semi-random fashion and not all http request seems to be tracked effectively. After some googling, I’ve found the following links:
Summarizing, VS Web Test doesn’t behave like a proxy to intercept request, but instead it hooks inside Internet Explorer’ event system and so tracks only calls corresponding to user-generated events: that has the advantage to skip all related requests (mainly static files, like js and css,) but has the side effect to skip the Ajax calls not directly related to user actions.
So here comes a simple question: in a world that is going more and more toward an application-in-a-browser mode (so essentially based on Ajax), why Microsoft opted for this solution that in not Ajax-friendly? The other side effect, i.e. the fact that it works only with Internet Explorer, is less misterious to me.
The second problem, related to hidden fields, is quickly explained: it’s a bug. It originates from a smart feature: extraction rules, that helps the tester cope with hidden fields containing session-related data (like view state): the bug causes all hidden fields to be treated like session-related ones, causing in practice that their values are lost, so recorded tests cannot be run without manually editing it.
There are two workarounds to these problems:
- you can use Fiddler, a proxy-based recorder that can save recorded sessions in VS Web Test format; a smart tool with a strange user interface
- if you want to record with VS Web Test, you can use a trick: record normally, the save the recorded session in Visual Studio before stopping it in Internet Explorer, then stop it, and close the file responding “No” to the save request.
In both case, the workaround can be not functioning, because sometimes Fiddler, which works like a charm, cannot save the session in VS Web Test format, giving an error not clear related to XML correctness; on the other side, a session successfully recorded with VS Web Test doesn’t work with the web app without editing its source form.
More to come, if I find some clever solution.