Поделиться через


How to: Visual Studio web performance tests – not using Internet Explorer

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 (https://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

clip_image005
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.

  1. In VS, create a test project
  2. Right click on the test project > Add > Existing item . . .
  3. Browse to the webtest file you exported from Fiddler (make sure your filter is set to “(*.webtest)” as shown below)
    clip_image006
  4. 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?

clip_image007

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.

clip_image002
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: https://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.

clip_image003

clip_image004
Changing the browser type “permanently”

Here’s the web test, paused just before running, showing Firefox 2.0 is the browser type:

clip_image008

And here’s the test run after completion. (Notice that I ran my test against my local TFS instance?)  :) 

clip_image009

It’s as easy as that.

Additional background information regarding the Web Performance Test Engine: https://msdn.microsoft.com/en-us/library/ff520100.aspx

Hope this helps!

-bliz