How to: Use the Web Performance Test API
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.
- Visual Studio Ultimate
To use the WebTesting namespace
Open a Web performance and load 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 Web performance and load 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:
Choose 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.