A client asked me how to create and run Visual Studio web performance tests using something other than Internet Explorer. (His web app only runs in a particular browser, and it’s not IE.) Here’s my answer.
Recording a web performance test using a browser other than Internet Explorer
The Web Test recorder in Visual Studio is going to open up Internet Explorer for recording. Period.
If you want to use some other browser (I used Firefox in my example) as the recording environment instead of Internet Explorer, you can use Fiddler 2.0 (http://www.fiddler2.com/fiddler2/) to capture the HTTP traffic. Once you’ve gone through the web user scenario in the browser of your choice, in Fiddler go to File > Export Sessions > All Sessions . . . > Select Export Format > Visual Studio Web Test
Fiddler 2.0 captured the HTTP traffic generated from Firefox browser. I’m about to export it.
Then in Visual Studio, open the webtest file you exported from Fiddler.
- In VS, create a test project
- Right click on the test project > Add > Existing item . . .
- Browse to the webtest file you exported from Fiddler (make sure your filter is set to “(*.webtest)” as shown below)
- Select your webtest file and open it.
Here’s the webtest file I created using Fiddler and Firefox, opened in Visual Studio. Looks kind of normal, doesn’t it?
Running a webtest using a browser other than Internet Explorer
In a web performance test, you can change the Browser type for an individual run, but that setting is not permanent. It resets to the default after the test completes.
Changing the browser type for an individual web test run
If you want to make the change effective across multiple runs, you need to change the test settings via Test > Edit Test Settings. See images below. These changes will be saved until you change them again. Note: you can have multiple testsettings definitions. For more info about testsettings, see: http://msdn.microsoft.com/en-us/library/ee256991.aspx. You need to be sure which testsettings file you’ve set to active. That’s managed from Test > Select Active Test Settings.
Changing the browser type “permanently”
Here’s the web test, paused just before running, showing Firefox 2.0 is the browser type:
And here’s the test run after completion. (Notice that I ran my test against my local TFS instance?) :)
It’s as easy as that.
Additional background information regarding the Web Performance Test Engine: http://msdn.microsoft.com/en-us/library/ff520100.aspx
Hope this helps!