How to: Use the Load Test API

Visual Studio 2005 Team Edition for Testers supports load test plug-ins which can control or enhance a load test. Load test plug-ins are user defined classes which implement the ILoadTestPlugin interface found in the Microsoft.VisualStudio.TestTools.LoadTesting namespace. Load test plug-ins allow for custom load test control, such as, aborting a load test when a counter or error threshold is met. Use the properties on the LoadTest class to get or set load test parameters from user defined code. Use the events on the LoadTest class to attach delegates for notifications when the load test is running.

NoteTip

Use the object browser to examine the Microsoft.VisualStudio.TestTools.LoadTesting 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 Web tests. For more information, see How to: Create a Web Test Plug-In and How to: Create a Web Test Request Plug-In.

To use the LoadTesting namespace in C#

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

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

  2. Add a Load test to the Test Project and configure it to run a Web test.

    For more information, see How to: Launch the Load Test Wizard.

  3. Add a C# Class Library Project to your test solution.

  4. Add a reference to the Microsoft.VisualStudio.QualityTools.LoadTestFramework 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.LoadTesting namespace.

  6. Create a class that implements the ILoadTestPlugin interface. For an implementation of ILoadTestPlugin, see How to: Create a Load Test Plug-In.

  7. Add a reference in the Test Project to the Class Library Project. Build both projects.

  8. Open the Load test and select the root node of the load test.

  9. Run your Load test.

See Also

Community Additions

ADD
Show: