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.

TestStartingEventArgs Class

 

Contains the arguments for the TestStarting event.

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

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

public ref class TestStartingEventArgs : EventArgs

NameDescription
System_CAPS_pubpropertyIsInitializeTest

Gets a value that indicates whether the test that is starting is the InitializeTest that was specified in the load test scenario's test mix.

System_CAPS_pubpropertyIsTerminateTest

Gets a value that indicates whether the test that is starting is the TerminateTest that was specified in the load test scenario's test mix.

System_CAPS_pubpropertyScenarioName

Gets the scenario name that contains the test that is starting.

System_CAPS_pubpropertyTestContextProperties

Gets an IDictionary<TKey, TValue> that contains data available to individual tests in a load test.

System_CAPS_pubpropertyTestIterationNumber

Gets a value that represents the number of tests that have run within the load test on a particular agent.

System_CAPS_pubpropertyTestName

Gets the name of the test that is starting.

System_CAPS_pubpropertyUserContext

Gets the LoadTestUserContext that represents the virtual user that is running the test that is starting.

NameDescription
System_CAPS_pubmethodEquals(Object^)

(Inherited from Object.)

System_CAPS_protmethodFinalize()

(Inherited from Object.)

System_CAPS_pubmethodGetHashCode()

(Inherited from Object.)

System_CAPS_pubmethodGetType()

(Inherited from Object.)

System_CAPS_protmethodMemberwiseClone()

(Inherited from Object.)

System_CAPS_pubmethodToString()

(Inherited from Object.)

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.

Legacy Code Example

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.

Return to top
Show: