We recommend using Visual Studio 2017
This documentation is archived and is not being maintained.

LoadTest Class

Represents the load test being run.


Namespace:  Microsoft.VisualStudio.TestTools.LoadTesting
Assembly:  Microsoft.VisualStudio.QualityTools.LoadTestFramework (in Microsoft.VisualStudio.QualityTools.LoadTestFramework.dll)

public class LoadTest

The LoadTest type exposes the following members.

Public methodLoadTestInitializes a new instance of the LoadTest class.

Public propertyContextGets the LoadTestContext for the current load test run.
Public propertyNameGets the name of the load test.
Public propertyRunSettingsGets the run settings used for the current load test run.
Public propertyScenariosGets a collection of scenarios within the load test.

Public methodAbort()Stops the load test on all agents.
Public methodAbort(Exception)Stops the load test on all agents and specifies the exception that caused the abort.
Public methodEqualsDetermines whether the specified object is equal to the current object. (Inherited from Object.)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodGetHashCodeServes as a hash function for a particular type. (Inherited from Object.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)

Public eventHeartbeatOccurs once every second.
Public eventLoadTestAbortedOccurs when the load test is aborted.
Public eventLoadTestFinishedOccurs when the load test has stopped running on the agent.
Public eventLoadTestStartingOccurs just before the load test begins to run on the agent.
Public eventLoadTestWarmupCompleteOccurs when the warm-up period has completed.
Public eventTestFinishedOccurs when an iteration of one of the tests contained within the load test finishes.
Public eventTestSelectedOccurs every time an iteration of one of the tests contained within the LoadTest is selected.
Public eventTestStartingOccurs when an iteration of one of the tests contained within the load test is started.
Public eventThresholdExceededOccurs when a threshold rule is exceeded.

Load testing is useful for predicting the impact on the performance of an application during high user workloads. This simulates realistic user volumes to define real world conditions that can be used for changing requirements and application design to meet expected quality standards for the software product. Load tests can include both Web and unit tests.

Load test settings can be accessed through the UI or with a load test plug-in. For more information, see How to: Create a Load Test Plug-In.


It is a good practice to run a smoke test before running any intensive load test. For more information, see Guidelines for Smoke Testing. This helps validate configurations and expected behavior of the test.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.