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.

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

  1. Open a Test Project that contains a Web test.

    For more information, see How to: Create a Test Project.

  2. Add a C# or a Visual Basic Class Library Project to your test solution.

  3. Add a reference in the Test Project to the Class Library Project.

  4. Add a reference to the Microsoft.VisualStudio.QualityTools.WebTestFramework dll in the Class Library project.

  5. In the class file located in the Class Library project, add a using statement for the Microsoft.VisualStudio.TestTools.WebTesting namespace.

  6. 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.

  7. Run your Web test.

See Also

Tasks

How to: Use the Load Test API
How to: Create a Web Test Plug-In

Reference

Microsoft.VisualStudio.TestTools.WebTesting