WebTestContext 类

表示 WebTest 可用的上下文。

继承层次结构

System.Object
  Microsoft.VisualStudio.TestTools.WebTesting.WebTestContext

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

语法

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

WebTestContext 类型公开以下成员。

属性

  名称 说明
公共属性 AgentCount 获取当前测试运行中使用的代理总数。
公共属性 AgentId 获取当前代理的从零开始的索引。
公共属性 AgentName 获取在其上运行 WebTest 的代理计算机的名称。
公共属性 ControllerName 获取测试控制器计算机的名称。
公共属性 CookieContainer 获取或设置 Web 性能测试中的先前请求使用的 Cookie。
公共属性 Count 获取 WebTestContext 中的键/值对元素的数目。
公共属性 IsNewUser 获取一个值,该值指示 Web 性能测试是否正在目标网站的新用户的上下文中运行。
公共属性 IsReadOnly 获取一个值,该值指示 WebTestContext 是否为只读。
公共属性 Item 获取或设置与来自 WebTestContext 对象的指定键关联的值。
公共属性 Keys 获取 WebTestContext 中的所有键的集合。
公共属性 LastRequestOutcome
公共属性 LastResponse 获取或设置最后一个 WebTestResponse
公共属性 ValidationLevel 获取当前测试运行的验证级别。
公共属性 Values 获取 WebTestContext 中的所有值的集合。
公共属性 WebTestIteration 获取此 Web 性能测试变化的迭代数。
公共属性 WebTestUserId 获取一个值,在负载测试中运行 Web 性能测试时,该值唯一标识模拟的虚拟用户。

页首

方法

  名称 说明
公共方法 Add(KeyValuePair<String, Object>) KeyValuePair<TKey, TValue> 对象添加到 WebTestContext 中。
公共方法 Add(String, Object) 在 WebTestContext 中添加一个具有所提供的键和值的元素。
公共方法 Clear 从 WebTestContext 中移除所有元素。
公共方法 Contains 确定 WebTestContext 是否包含指定的键/值对。
公共方法 ContainsKey 确定 WebTestContext 是否包含具有指定键的元素。
公共方法 CopyTo 将 WebTestContext 元素复制到 KeyValuePair<TKey, TValue> 对象数组。
公共方法 Equals 确定指定的 Object 是否等于当前的 Object。 (继承自 Object。)
受保护的方法 Finalize 允许对象在“垃圾回收”回收之前尝试释放资源并执行其他清理操作。 (继承自 Object。)
公共方法 GetEnumerator 返回包含 WebTestContext 元素的 IEnumerator<T>
公共方法 GetHashCode 用作特定类型的哈希函数。 (继承自 Object。)
公共方法 GetType 获取当前实例的 Type。 (继承自 Object。)
受保护的方法 MemberwiseClone 创建当前 Object 的浅表副本。 (继承自 Object。)
公共方法 Remove(KeyValuePair<String, Object>) 从 WebTestContext 中移除 KeyValuePair<TKey, TValue>
公共方法 Remove(String) 从 WebTestContext 中移除包含指定键的元素。
公共方法 ToString 返回表示当前对象的字符串。 (继承自 Object。)
公共方法 TryGetValue 获取与指定的键相关联的值。

页首

显式接口实现

  名称 说明
显式接口实现私有方法 IEnumerable.GetEnumerator 返回一个循环访问 WebTestContext 元素集合的枚举器。

页首

备注

用于每一个 Web 性能测试,并包含描述 Web 性能测试的上下文的数据。 此信息包括有关数据绑定值的数据、有关当前运行的信息(如 AgentIdControllerName)以及其他上下文信息。

该类不提供任何公共构造函数。

线程安全

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

请参见

参考

Microsoft.VisualStudio.TestTools.WebTesting 命名空间

其他资源

Working with Web Tests