How to: Use the Web Performance Test API
This topic applies to:
Visual Studio Ultimate
Visual Studio Premium
Visual Studio Professional
Visual Studio Express
You can write code for your Web performance tests. The Web performance test API is used to create coded Web performance tests, Web performance test plug-ins, request plug-ins, requests, extraction rules, and validation rules. The classes that make up these types are the core classes in this API. The other types in this API are used to support creating WebTest, WebTestPlugin, WebTestRequestPlugin, WebTestRequest, ExtractionRule, and ValidationRule objects. You use the Microsoft.VisualStudio.TestTools.WebTesting namespace to create customized Web performance tests.
Use the object browser to examine the Microsoft.VisualStudio.TestTools.WebTesting namespace. Both the Visual C# and Visual Basic editors offer IntelliSense support for coding with the classes in the namespace.
To use the WebTesting namespace
Open a test project that contains a Web performance test.
For more information, see Creating and Editing Web Performance Tests.
Add a Visual C# or a Visual Basic class library project to your test solution.
Add a reference in the test project to the class library project.
Add a reference to the Microsoft.VisualStudio.QualityTools.WebTestFramework dll in the class library project.
In the class file that is located in the class library project, add a using statement for the Microsoft.VisualStudio.TestTools.WebTesting namespace.
Create a class that implements the WebTestPlugin interface.
Build the project.
Add the new Web performance test plug-in by using the Web Performance Test Editor:
Click Add Web Test Plug-in on the toolbar.
The Add Web Test Plug-in dialog box is displayed.
Under Select a plug-in, select your Web performance test plug-in class.
In the Properties for selected plug-in pane, set the initial values for the plug-in to use at run time.
You can expose as many properties as you want from your plug-ins; just make them public, settable, and of a base type such as Integer, Boolean, or String. You can also edit the Web performance test plug-in properties later by using the Properties window.
Run your Web performance test.