TestStartingEventArgs Class
The document is archived and information here might be outdated

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)

public class TestStartingEventArgs : EventArgs

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( ... );
}

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

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