Export (0) Print
Expand All

WebTest Class

Base class for all Web performance tests. Coded Web performance tests that are written in C# derive directly from this class.

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

[SerializableAttribute]
public abstract class WebTest : IEnumerable

The WebTest type exposes the following members.

  NameDescription
Protected methodWebTestInitializes a new instance of a class that is derived from WebTest class.
Top

  NameDescription
Public propertyContextGets or sets an object that contains context variables that are available to the Web performance test at run time.
Public propertyDataSourcesGets the collection of data sources that are defined for the Web performance test.
Public propertyGuidGets or sets a GUID that uniquely identifies each instance of a WebTest.
Public propertyInheritFromWebTestGets the WebTest object for the parent Web performance test when this Web performance test is included in another Web performance test and inherits properties from the parent Web performance test.
Public propertyLastRequestOutcome
Public propertyLastResponseGets the last response that was received for a top-level request in this Web performance test.
Public propertyNameGets the name of the test case.
Public propertyOutcomeGets or sets the Pass or Fail outcome of the Web performance test.
Public propertyPasswordGets and sets the password that is used for authentication.
Public propertyPreAuthenticateGets or sets a value that indicates whether to pre-authenticate all requests in the Web performance test.
Public propertyProxyGets or sets a value that represents a proxy server for the Web performance test to use.
Public propertyRequestBodyCaptureLimitGets or sets the limit, in bytes, that is used to capture request data.
Public propertyResponseBodyCaptureLimitGets or sets the limit, in bytes, that is used to capture response data.
Public propertyStopOnErrorGets or sets the indication of whether the test should stop running when an error occurs.
Public propertyUserNameGets and sets the user name that is used for authentication.
Public propertyValidationRuleReferencesGets the collection of references to Web performance test-level validation rules.
Public propertyWebProxyGets or sets the Web proxy for this Web performance test to use.
Public propertyWebTestPluginReferencesGets the collection of references to Web performance test plug-ins.
Top

  NameDescription
Public methodAddCommentToResultAdds a comment to the Web performance test result that follows the most recently completed Web performance test request, transaction, or included Web performance test.
Public methodAddDataSource(String, String, DataBindingAccessMethod, String[])Adds a data source to the data collection that is contained by the Web performance test.
Public methodAddDataSource(String, String, String, DataBindingAccessMethod, String[])Adds a data source to the data collection that is contained by the Web performance test.
Public methodAddDataSource(String, String, String, DataBindingAccessMethod, DataBindingSelectColumns, String[])
Public methodAddDataSourceBindingDefines a binding relationship and adds it to the data source binding collection for the Web performance test.
Public methodBeginCondition
Public methodBeginLoop
Public methodBeginTransactionStarts a transaction timer by using the specified name.
Public methodEndCondition
Public methodEndLoop
Public methodEndTransaction(String)Ends a transaction timer with the specified name.
Public methodEndTransaction(String, Boolean)Ends the specified transaction.
Public methodEqualsDetermines whether the specified Object is equal to the current Object. (Inherited from Object.)
Public methodExecuteConditionalRule
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodGetDataTableRowCount
Public methodGetEnumeratorGets an Enumerator that enumerates the items in the Web performance test.
Public methodGetHashCodeServes as a hash function for a particular type. (Inherited from Object.)
Public methodGetRequestEnumeratorWhen overridden in a derived class, returns an IEnumerator<T> interface that supports a simple iteration over a generic collection of WebTestRequest.
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodIncludeWebTest(String)Calls a coded Web performance test from within a coded Web performance test.
Public methodIncludeWebTest(WebTest)Calls a coded Web performance test from within a coded Web performance test.
Public methodIncludeWebTest(String, Boolean)Calls a coded Web performance test from within a coded Web performance test.
Public methodIncludeWebTest(WebTest, Boolean)Calls a coded Web performance test from within a coded Web performance test.
Public methodInitializeDataBindingAdds data source and data binding information from attributes to the current instance.
Public methodInternalSetOutcome
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodMoveDataTableCursor(String, String)Advances the cursor in the data table to the next record.
Public methodMoveDataTableCursor(String, String, Int32)
Public methodRegisterDataSourceInLoop
Public methodReloadDataTable
Public methodStopStops the current Web performance test.
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Top

  NameDescription
Public eventPostPage
Public eventPostRequestOccurs after each request that this Web performance test runs.
Public eventPostTransaction
Public eventPostWebTestOccurs after the Web performance test runs.
Public eventPrePage
Public eventPreRequestOccurs before each request this Web performance test runs.
Public eventPreRequestDataBinding
Public eventPreTransaction
Public eventPreWebTestOccurs before the Web performance test runs.
Public eventValidateResponseOccurs when the response to a Web performance test request has been received and is ready to be validated.
Public eventValidateResponseOnPageComplete
Top

To create a coded Web performance test in Visual Basic 2005, see ThreadedWebTest.

For a list of initial property values for an instance of WebTest class, see the WebTest constructor.

For more information about how to run a test outside Visual Studio 2005 Team System, see Running Automated Tests from the Command Line.

This class is serializable.

Notes to Inheritors

When you inherit from WebTest, you must override GetRequestEnumerator.

The following Web performance test extracts values that represent the status of check boxes and adds the values to the context.

namespace TestProject1
{
    using System;
    using System.Collections.Generic;
    using Microsoft.VisualStudio.TestTools.WebTesting;
    using ClassLibrary2;

    public class MyWebTest : WebTest
    {
        public MyWebTest()
        {
            this.PreAuthenticate = true;
        }

        public override IEnumerator<WebTestRequest> GetRequestEnumerator()
        {
            WebTestRequest request1 = new WebTestRequest("http://localhost/ts");
            ExtractCheckBoxes rule1 = new ExtractCheckBoxes();
            rule1.FindCheckedBoxes = true;
            rule1.ContextParameterName = "CheckedBoxes";
            request1.ExtractValues += new EventHandler
                <ExtractionEventArgs>(rule1.Extract);
            ExtractCheckBoxes rule2 = new ExtractCheckBoxes();
            rule2.FindCheckedBoxes = false;
            rule2.ContextParameterName = "";
            request1.ExtractValues += new EventHandler
                <ExtractionEventArgs>(rule2.Extract);
            yield return request1;
        }
    }
}

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

Community Additions

ADD
Show:
© 2015 Microsoft