Defines an interface that is implemented to allow a user written class to handle events that occur as the load test, and the tests contained within the load test, are run.
Assembly: Microsoft.VisualStudio.QualityTools.LoadTestFramework (in Microsoft.VisualStudio.QualityTools.LoadTestFramework.dll)
This can be implemented by a user-written class to plug user-written code into the load test run time engine on the agent. This plug-in is specified in the load test editor.
You can create a load test plug-in to run code at different times while a load test is running, such as after a threshold is violated, before a load test starts and after a load test finishes, before a test iteration starts and after it finishes, when a load test aborts, or when the load in the test has changed. The events that the implementation of may handle are: LoadTestStarting, LoadTestFinished, LoadTestWarmupComplete, TestStarting, TestFinished, TestSelected, ThresholdExceeded, HeartBeat, and LoadTestAborted.
An implementation of a load test plug-in can be used to extend or modify the behavior of a load test as it runs. The following list contains some possible uses of a load test plug-in:
Start an external process such as a monitoring tool just before the load test starts, and stop it when the load test completes.
Provide programmatic control over the user load used as the load test runs; overriding the user load specified in the load test editor.
Provide programmatic control over the selection of an individual test to run within the load test; overriding the default test selection algorithm.
Abort the load test if the value of a performance counter causes the failure of a threshold rule defined in the load test.
Maintain a shared variable across all test iterations in a load test. To do this, the load test plug-in implements a variable as a static property that is accessed by the tests under load. The variable is initialized in the Initialize method of the load test plug-in. An event handler is added for the LoadTestFinished event that can be used to access the final value for reporting purposes.
When the load test is running on multiple agents, the load test plug-in class is instantiated on all of the agents. If the load test plug-in needs to perform an operation on only one agent, it should check the AgentId property of the LoadTestContext object and only perform the operation if the value of AgentId is 1.