LoadTestContext 类

封装负载测试在其中运行的上下文的相关信息。

继承层次结构

Object
  Microsoft.VisualStudio.TestTools.LoadTesting.LoadTestContext

命名空间:  Microsoft.VisualStudio.TestTools.LoadTesting
程序集:  Microsoft.VisualStudio.QualityTools.LoadTestFramework(在 Microsoft.VisualStudio.QualityTools.LoadTestFramework.dll 中)

语法

声明
<SerializableAttribute> _
Public Class LoadTestContext _
    Implements IDictionary(Of String, Object),  _
    ICollection(Of KeyValuePair(Of String, Object)), IEnumerable(Of KeyValuePair(Of String, Object)),  _
    IEnumerable
[SerializableAttribute]
public class LoadTestContext : IDictionary<string, Object>, 
    ICollection<KeyValuePair<string, Object>>, IEnumerable<KeyValuePair<string, Object>>, 
    IEnumerable
[SerializableAttribute]
public ref class LoadTestContext : IDictionary<String^, Object^>, 
    ICollection<KeyValuePair<String^, Object^>>, IEnumerable<KeyValuePair<String^, Object^>>, 
    IEnumerable
[<SerializableAttribute>]
type LoadTestContext =  
    class 
        interface IDictionary<string, Object>
        interface ICollection<KeyValuePair<string, Object>>
        interface IEnumerable<KeyValuePair<string, Object>>
        interface IEnumerable 
    end
public class LoadTestContext implements IDictionary<String, Object>, ICollection<KeyValuePair<String, Object>>, IEnumerable<KeyValuePair<String, Object>>, IEnumerable

LoadTestContext 类型公开以下成员。

属性

  名称 说明
公共属性 AgentCount 获取负载测试运行中使用的代理总数。
公共属性 AgentId 获取当前代理的从一开始的索引。
公共属性 AgentName 获取当前代理的名称。
公共属性 ControllerName 获取作为负载测试运行的控制器的计算机的名称。
公共属性 Count 获取 LoadTestContext 对象中包含的元素数。
公共属性 IsLocalRun 获取一个值,该值指示测试是在本地还是在远程运行。
公共属性 IsReadOnly 获取一个值,该值指示 LoadTestContext 是否为只读。
公共属性 Item 获取或设置具有指定键的 LoadTestContext 元素。
公共属性 Keys 获取一个 ICollection,其中包含 LoadTestContext 元素的键。
公共属性 LoadTestRunId 获取与该载入测试运行相关联的 ID。Set 存取器设置为内部。
公共属性 Values 获取在 LoadTestContext 元素中包含值的ICollection

页首

方法

  名称 说明
公共方法 Add(KeyValuePair<String, Object>) 向 LoadTestContext 中添加 KeyValuePair 项。
公共方法 Add(String, Object) 将具有所提供键和值的元素添加到 LoadTestContext。
公共方法 Clear 从 LoadTestContext 中移除所有项。
公共方法 Contains 确定 LoadTestContext 是否包含特定值。
公共方法 ContainsKey 指示 LoadTestContext 是否包含具有指定键的元素。
公共方法 CopyTo 从特定的 [Array] 索引处开始,将 T:Microsoft.VisualStudio.TestTools.LoadTesting.LoadTestContext 的元素复制到一个 Array 中。
公共方法 Equals 确定指定的对象是否等于当前对象。 (继承自 Object。)
受保护的方法 Finalize 在垃圾回收将某一对象回收前允许该对象尝试释放资源并执行其他清理操作。 (继承自 Object。)
公共方法 GetEnumerator 返回循环访问 LoadTestContext 的枚举数。
公共方法 GetHashCode 作为默认哈希函数。 (继承自 Object。)
公共方法 GetType 获取当前实例的 Type。 (继承自 Object。)
受保护的方法 MemberwiseClone 创建当前 Object 的浅表副本。 (继承自 Object。)
公共方法 Remove(KeyValuePair<String, Object>) 从 LoadTestContext 中移除特定对象的第一个匹配项。
公共方法 Remove(String) 从 LoadTestContext 中移除具有指定键的元素。
公共方法 ToString 返回表示当前对象的字符串。 (继承自 Object。)
公共方法 TryGetValue 获取与指定的键关联的值。

页首

显式接口实现

  名称 说明
显式接口实现私有方法 IEnumerable.GetEnumerator

页首

备注

这是用于存储负载测试所用信息的上下文项和负载测试配置的集合。

线程安全

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

请参阅

参考

Microsoft.VisualStudio.TestTools.LoadTesting 命名空间

其他资源

Working with Load Tests Overview