TestStartingEventArgs Class

TestStartingEventArgs Class

Contains the arguments for the TestStarting event.

System.Object
  System.EventArgs
    Microsoft.VisualStudio.TestTools.LoadTesting.TestStartingEventArgs

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

public class TestStartingEventArgs : EventArgs

The TestStartingEventArgs type exposes the following members.

  NameDescription
Public propertyIsInitializeTestGets a value that indicates whether the test that is starting is the InitializeTest that was specified in the load test scenario's test mix.
Public propertyIsTerminateTestGets a value that indicates whether the test that is starting is the TerminateTest that was specified in the load test scenario's test mix.
Public propertyScenarioNameGets the scenario name that contains the test that is starting.
Public propertyTestContextPropertiesGets an IDictionary<TKey, TValue> that contains data available to individual tests in a load test.
Public propertyTestIterationNumberGets a value that represents the number of tests that have run within the load test on a particular agent.
Public propertyTestNameGets the name of the test that is starting.
Public propertyUserContextGets the LoadTestUserContext that represents the virtual user that is running the test that is starting.
Top

  NameDescription
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.)
Top

TestStartingEventArgs establishes an additional pathway for providing data to tests that are contained in a load test. An event handler for the TestStarting event can contain code to add data to the individual tests in the load test. The data is added to the WebTestContext in a Web test or the TestContext in a unit test.

The following code snippet gives a simple example of how to use the TestStartingEventArgs to add data to the starting test iteration in the load test. You write this code in a load test plug-in.

private void TestStarting(object source, TestStartingEventArgs testStartingEventArgs)
{
    testStartingEventArgs.TestContextProperties.Add("WebUser", GetNextWebUser());
}
private MyWebUser GetNextWebUser()
{
    /// Insert code here to read a user definition from some data source

    /// construct user object with data read from data source
    return new MyWebUser( ... );
}

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

Community Additions

ADD
Show:
© 2016 Microsoft