Udostępnij za pośrednictwem


Using Visual Studio Team System for Testers for automating web application tests

I was recently using VSTS for testers edition which has some nice feature for testing web applications: composing individual tests by recording IE sessions, composing load tests, and structuring your test case scenarios in an automated manner. This allows to make a "daily build run" on an automated manner each day that composes of standard application use cases. This lets you quickly locate any regression bugs that might pop up.

What I wanted to share is fiddler (https://www.fiddlertool.com). Use this tool for capturing your traffic, as the capture tool included in VSTS has some issues with recording the sessions (at least for the case of my ASP.NET 2.0 application). Next, if you are using windows integrated authentication remember to TURN OFF the pre-authenticate option when supplying the credentials. This is because FIDDLER will catch all traffic including 401 responses to first anonymous attempts. Therefore either switch off the pre-authenticate option in your VSTS webtest, or make a filter in FIDDLER to disable 401's. You can do that by e.g. modifying the "Hide all 200's" rule:

if (m_Hide200s && oSession.responseCode == 401){

            oSession["ui-hide"] = "true";

         }

I suggest the first option as the one that emulates the HTTP sequences 1:1. The next useful thing I started using is storing your credentials in a DB. This is especially comfortable if you want to go through each test case scenario for each user role. Once you get used to this setup VSTS will come in handy for those automated tests.

Something I forgotted to add in this entry - it's "think times". Without those load tests do not make sense. Think time is the time a user spends at a website before submitting a new request. Unfortunately Fiddler does not record those. But you can go into the .webtest file once imported to the VSTS test project and from there edit in an XML editor. You can then do mass replace on "ThinkTime"=0 to a value you need. Typically you would only change that on several requests and not all, e.g.:

"https://server/appname//Webpage.aspx" ThinkTime="0"