Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

How to: Use the Load Test API

 

Visual Studio Enterprise 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.

System_CAPS_ICON_tip.jpg Tip

Use the object browser to examine the Microsoft.VisualStudio.TestTools.LoadTesting namespace. Both the Visual C# and Visual Basic editors offer IntelliSense support for coding with the classes in the namespace.

You can also create plug-ins for Web performance tests. For more information, see How to: Create a Web Performance Test Plug-In and How to: Create a Request-Level Plug-In.

Requirements

  • Visual Studio Enterprise

To use the LoadTesting namespace

  1. Open a Web performance and load test Project that contains a load test.

    For more information, see Create and run a load test.

  2. Add a Visual C# or a Visual Basic class library project to your test solution.

  3. Add a reference in the Web performance and load test project to the class library project.

  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 public class that implements the ILoadTestPlugin interface.

  7. Build the project.

  8. Add the new load test plug-in using the Load Test Editor:

    1. Right-click the root node of the load test and then choose Add Load Test Plug-in.

    2. The Add Load Test Plug-in dialog box is displayed.

    3. In the Properties for selected plug-in pane, set the initial values for the plug-in to use at run time.

      System_CAPS_ICON_note.jpg Note

      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 load test plug-in properties later using the Properties window.

  9. Run your Load test.

    For an implementation of ILoadTestPlugin, see How to: Create a Load Test Plug-In.

Microsoft.VisualStudio.TestTools.LoadTesting
Create custom code and plug-ins for load tests
How to: Use the Web Performance Test API
How to: Create a Load Test Plug-In

Show: