How to: Parameterize the URL for a Web Performance Tests Web Server

This topic applies to:

Visual Studio Ultimate

Visual Studio Premium

Visual Studio Professional 

Visual Studio Express

Topic applies Topic does not apply Topic does not apply Topic does not apply

You can parameterize the URL for your Web server. The purpose of parameterization is to make it easy to change the Web server that your tests target. A test, either recorded or coded, can run against various servers. When you use parameterization, you can easily change servers by re-mapping the Web server context parameter to another server. You do not have to re-record or re-write the test.

This is useful when, for example, you want to run tests on a Web server that has one name in your non-production environment and another name in your production environment. In this case, both the Web servers are active Web servers.

You can also have Web Performance tests target the ASP.NET Development Web Server on your local computer. You can create Web services on your local computer that use the ASP.NET Development Server to host your Web application. For more information about ASP.NET Development Server, see Web Servers in Visual Studio for ASP.NET Web Projects.

Additionally, if your test will run on a designated test Web server for build verification, the target Web site can be identified outside the actual Web Performance test. Identifying the Web server outside the test lets you avoid editing any part of the test that is under source code control.


A load test context parameter overrides a Web performance test context parameter of the same name.

To create a context parameter for a Web server

  1. Open a Web Performance test.

  2. Click the Parameterize Web Servers button.

  3. In the Parameterize Web Servers dialog box, select the Web server that you want to parameterize and then click Change.

    The Change Web Server dialog box appears.

  4. In the Change Web Server dialog box, type a name for the Context parameter name.

  5. Select either Use Web server or ASP.NET Development Server.

  6. If you choose ASP.NET Development Server, you must indicate the path to the Web site on your local computer and the Web application root.


    You can parameterize the path to the Web site by using an environment variable, such as Test.WebServer1. For example, from a command line, type set Test.WebServer1=http://MyProductionServer. Then, if you run the Web Performance test from the command line by using MSTest.exe, the environment variable will be in effect for that test run. For more information about how to run tests from a command line, see How to: Run Automated Tests from the Command Line Using MSTest.

  7. Click OK.

  8. If you have more than one Web server to map, you can select it, and then repeat the procedure. When you have finished mapping the Web servers to context parameter names, click OK.

    The context parameters are visible in the Web Performance test. You can see the mappings between the context parameter name and the Web server.


    The ASP.NET Development Servers are automatically started and stopped at the end of the test run.

See Also


Unit Tests for ASP.NET Web Services

Web Servers in Visual Studio for ASP.NET Web Projects

Unit Tests for ASP.NET Web Services

Other Resources

Customizing Web Performance Test Recordings Using Web Performance Test Editor