共用方式為


TestStartingEventArgs 類別

更新:2007 年 11 月

包含 TestStarting 事件的引數。

命名空間:  Microsoft.VisualStudio.TestTools.LoadTesting
組件:  Microsoft.VisualStudio.QualityTools.LoadTestFramework (在 Microsoft.VisualStudio.QualityTools.LoadTestFramework.dll 中)

語法

Public Class TestStartingEventArgs _
    Inherits EventArgs

Dim instance As TestStartingEventArgs
public class TestStartingEventArgs : EventArgs
public ref class TestStartingEventArgs : public EventArgs
public class TestStartingEventArgs extends EventArgs

備註

TestStartingEventArgs 會建立用來將資料提供給這些測試 (包含於某個載入測試中) 的其他路徑。TestStarting 事件的事件處理常式,可以包含將資料加入至這個載入測試中之個別測試的程式碼。這個資料會被加入至 Web 測試中的 WebTestContext 或是單元測試中的 TestContext

範例

下列程式碼片段會示範如何使用 TestStartingEventArgs,將資料加入至載入測試中的起始測試反覆運算。您必須將這個程式碼寫入至載入測試外掛程式中。

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

執行緒安全

這個型別的任何 Public static (在 Visual Basic 中為 Shared) 成員都具備執行緒安全。並非所有的執行個體成員都是安全執行緒。

請參閱

參考

TestStartingEventArgs 成員

Microsoft.VisualStudio.TestTools.LoadTesting 命名空間

其他資源

HOW TO:建立負載測試外掛程式

瞭解負載測試