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

线程安全

此类型的任何公共 static(在 Visual Basic 中为 Shared) 成员都是线程安全的。但不保证所有实例成员都是线程安全的。

另请参见

参考

TestStartingEventArgs 成员

Microsoft.VisualStudio.TestTools.LoadTesting 命名空间

其他资源

如何:创建负载测试插件

了解负载测试