Adding an IE7 Browser Template for use by Web Tests

This post walks you through the process of adding a new IE7 browser template that can be used by your web tests when running them stand alone or inside of a load test. When you run a web test, the test will appear as if it is coming from one of the predefined browsers. By default, they will simulate IE6. But this can be changed by opening the run configuration file, clicking on the web test tab and selecting a new browser type. When running a web test inside of a load test, you can add a mix of browser types that the web test will simulate. The way a web test simulates different browsers is by adding a set of headers to the request. The main header is the user-agent header which indicates the browser.

 

Here are the steps for creating a new template:

1) Go to the location the templates are stored in: Program Files\Microsoft Visual Studio 8\Common7\IDE\Templates\LoadTest\Browsers

2) Copy the IE6.browser file and rename it IE7.browser

3) Open the IE7.browser file.

4) Change the name attribute on the Browser element to Internet Explorer 7.0

5) Change the value attribute for the User-Agent header to: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)

6) Save file

 

Let’s verify the new template can be read in.

1) Close and re-open Visual Studio

2) Open a test project or create a new one

3) Add a web test to the test project

4) Open the LocalTestRun.testrunconfig file under the Solution Items folder

5) Click the web test tab

6) Click the drop down for Browser Type and select Internet Explorer 7.0

7) Save the test run configuration file

8) Run the web test

9) Click on any request once the test is complete

10) Click on the request tab in the web test playback UI

11) You should see the user agent header set to the value above.

 

You can also add this new template to a load test. When you are on the browser tab of the load test wizard, this new template will be one of the available browsers available. This same process can be used to add additional browser types that you want to simulate.