How to: Use the Web Test API
You can write code for your Web tests. The Web test API is used to create coded Web tests, Web 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 tests.
You can also use the Web test API to programmatically create and save declarative Web tests. To do this, use the T:Microsoft.VisualStudio.TestTools.WebTesting.DeclarativeWebTest and T:Microsoft.VisualStudio.TestTools.WebTesting.DeclarativeWebTestSerializer classes.
Tip
Use the object browser to examine the Microsoft.VisualStudio.TestTools.WebTesting namespace. Both the C# and Visual Basic editors offer IntelliSense support for coding with the classes in the namespace.
You can also create plug-ins for load tests. For more information, see How to: Create a Load Test Plug-In.
Using the Web test API
Open a test project that contains a Web test.
For more information, see How to: Create a Test Project.
Add a 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 located in the class library project, add a using statement for the Microsoft.VisualStudio.TestTools.WebTesting namespace.
Implement any of the core classes in the namespace in the class library project. For an example implementation of WebTestPlugin, see How to: Create a Web Test Plug-In. You can write the rest of the code that you need, and then build the project.
Run your Web test.
See Also
Tasks
How to: Create a Web Test Plug-In