Partilhar via


WebTestContext Class

Represents the context available to a WebTest.

Inheritance Hierarchy

Object
  Microsoft.VisualStudio.TestTools.WebTesting.WebTestContext

Namespace:  Microsoft.VisualStudio.TestTools.WebTesting
Assembly:  Microsoft.VisualStudio.QualityTools.WebTestFramework (in Microsoft.VisualStudio.QualityTools.WebTestFramework.dll)

Syntax

'Declaration
<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

The WebTestContext type exposes the following members.

Properties

  Name Description
Public property AgentCount Gets the total number of agents used in the current test run.
Public property AgentId Gets the zero-based index for the current agent.
Public property AgentName Gets the name of the agent computer on which the WebTest is running.
Public property ControllerName Gets the name of the test controller computer.
Public property CookieContainer Gets or sets the cookies used by previous requests in the Web performance test.
Public property Count Gets the number of key/value pair elements in the WebTestContext.
Public property IsNewUser Gets a value that indicates whether the Web performance test is being run in the context of a new user of the target Web site.
Public property IsReadOnly Gets a value that indicates whether the WebTestContext is read-only.
Public property Item Gets or sets the value associated with the specified key from the WebTestContext object.
Public property Keys Gets a collection of all the keys in the WebTestContext.
Public property LastRequestOutcome
Public property LastResponse Gets or sets the last WebTestResponse.
Public property ValidationLevel Gets the validation level for the current test run.
Public property Values Gets a collection of all the values in the WebTestContext.
Public property WebTestIteration Gets the iteration number of this Web performance test variation.
Public property WebTestUserId Gets a value that uniquely identifies a simulated virtual user when you run the Web performance test in a load test.

Top

Methods

  Name Description
Public method Add(KeyValuePair<String, Object>) Adds a KeyValuePair object to the WebTestContext.
Public method Add(String, Object) Adds an element with the provided key and value to the WebTestContext.
Public method Clear Removes all the elements from the WebTestContext.
Public method Contains Determines whether the WebTestContext contains the specified key/value pair.
Public method ContainsKey Determines whether the WebTestContext contains an element with the specified key.
Public method CopyTo Copies the WebTestContext elements to an array of KeyValuePair objects
Public method Equals Determines whether the specified object is equal to the current object. (Inherited from Object.)
Protected method Finalize Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public method GetEnumerator Returns an IEnumerator that contains the WebTestContext elements.
Public method GetHashCode Serves as the default hash function. (Inherited from Object.)
Public method GetType Gets the Type of the current instance. (Inherited from Object.)
Protected method MemberwiseClone Creates a shallow copy of the current Object. (Inherited from Object.)
Public method Remove(KeyValuePair<String, Object>) Removes a KeyValuePair from the WebTestContext.
Public method Remove(String) Removes the element with the specified key from the WebTestContext.
Public method ToString Returns a string that represents the current object. (Inherited from Object.)
Public method TryGetValue Gets the value associated with the specified key.

Top

Explicit Interface Implementations

  Name Description
Explicit interface implemetationPrivate method IEnumerable.GetEnumerator Returns an enumerator that iterates through a collection of WebTestContext elements.

Top

Remarks

Used for every Web performance test and contains data that describes the context of the Web performance test. This information includes data about data-bound values, information about the current run such as the AgentId and ControllerName, and other contextual information.

This class does not provide any public constructors.

Thread Safety

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

See Also

Reference

Microsoft.VisualStudio.TestTools.WebTesting Namespace

Other Resources

Working with Web Tests