How to: Use the Load Test API
Visual Studio Team System Test Edition 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.
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.
To use the LoadTesting namespace in C#
Open a Test Project that contains a Web test.
For more information, see How to: Create a Test Project.
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.
Add a C# Class Library Project to your test solution.
Add a reference to the Microsoft.VisualStudio.QualityTools.LoadTestFramework 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.LoadTesting namespace.
Add a reference in the Test Project to the Class Library Project. Build both projects.
Open the Load test and select the root node of the load test.
Run your Load test.