Export (0) Print
Expand All

ThreadedWebTest Class

Represents a base class for a coded Web performance test that uses a single thread per Web performance test iteration.

System.Object
  Microsoft.VisualStudio.TestTools.WebTesting.WebTest
    Microsoft.VisualStudio.TestTools.WebTesting.ThreadedWebTest

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

public abstract class ThreadedWebTest : WebTest

The ThreadedWebTest type exposes the following members.

  NameDescription
Protected methodThreadedWebTestInitializes a new instance of the ThreadedWebTest class.
Top

  NameDescription
Public propertyContextGets or sets an object that contains context variables that are available to the Web performance test at run time. (Inherited from WebTest.)
Public propertyDataSourcesGets the collection of data sources that are defined for the Web performance test. (Inherited from WebTest.)
Public propertyGuidGets or sets a GUID that uniquely identifies each instance of a WebTest. (Inherited from 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. (Inherited from WebTest.)
Public propertyLastRequestOutcome (Inherited from WebTest.)
Public propertyLastResponseGets the last response that was received for a top-level request in this Web performance test. (Inherited from WebTest.)
Public propertyNameGets the name of the test case. (Inherited from WebTest.)
Public propertyOutcomeGets or sets the Pass or Fail outcome of the Web performance test. (Inherited from WebTest.)
Public propertyPasswordGets and sets the password that is used for authentication. (Inherited from WebTest.)
Public propertyPreAuthenticateGets or sets a value that indicates whether to pre-authenticate all requests in the Web performance test. (Inherited from WebTest.)
Public propertyProxyGets or sets a value that represents a proxy server for the Web performance test to use. (Inherited from WebTest.)
Public propertyRequestBodyCaptureLimitGets or sets the limit, in bytes, that is used to capture request data. (Inherited from WebTest.)
Public propertyResponseBodyCaptureLimitGets or sets the limit, in bytes, that is used to capture response data. (Inherited from WebTest.)
Public propertyStopOnErrorGets or sets the indication of whether the test should stop running when an error occurs. (Inherited from WebTest.)
Public propertyUserNameGets and sets the user name that is used for authentication. (Inherited from WebTest.)
Public propertyValidationRuleReferencesGets the collection of references to Web performance test-level validation rules. (Inherited from WebTest.)
Public propertyWebProxyGets or sets the Web proxy for this Web performance test to use. (Inherited from WebTest.)
Public propertyWebTestPluginReferencesGets the collection of references to Web performance test plug-ins. (Inherited from WebTest.)
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. (Inherited from WebTest.)
Public methodAddDataSource(String, String, DataBindingAccessMethod, String[])Adds a data source to the data collection that is contained by the Web performance test. (Inherited from WebTest.)
Public methodAddDataSource(String, String, String, DataBindingAccessMethod, String[])Adds a data source to the data collection that is contained by the Web performance test. (Inherited from WebTest.)
Public methodAddDataSource(String, String, String, DataBindingAccessMethod, DataBindingSelectColumns, String[]) (Inherited from WebTest.)
Public methodAddDataSourceBindingDefines a binding relationship and adds it to the data source binding collection for the Web performance test. (Inherited from WebTest.)
Public methodBeginCondition (Inherited from WebTest.)
Public methodBeginLoop (Inherited from WebTest.)
Public methodBeginTransactionStarts a transaction timer by using the specified name. (Inherited from WebTest.)
Public methodEndCondition (Inherited from WebTest.)
Public methodEndLoop (Inherited from WebTest.)
Public methodEndTransaction(String)Ends a transaction timer with the specified name. (Inherited from WebTest.)
Public methodEndTransaction(String, Boolean)Ends the specified transaction. (Inherited from WebTest.)
Public methodEqualsDetermines whether the specified Object is equal to the current Object. (Inherited from Object.)
Public methodExecuteConditionalRule (Inherited from WebTest.)
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 (Inherited from WebTest.)
Public methodGetEnumeratorGets an Enumerator that enumerates the items in the Web performance test. (Inherited from WebTest.)
Public methodGetHashCodeServes as a hash function for a particular type. (Inherited from Object.)
Public methodGetRequestEnumeratorInfrastructure. This method returns the next request to be submitted in a Web performance test for Web performance tests that extend the ThreadedWebTest class. (Overrides WebTest.GetRequestEnumerator().)
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. (Inherited from WebTest.)
Public methodIncludeWebTest(WebTest)Calls a coded Web performance test from within a coded Web performance test. (Inherited from WebTest.)
Public methodIncludeWebTest(String, Boolean)Calls a coded Web performance test from within a coded Web performance test. (Inherited from WebTest.)
Public methodIncludeWebTest(WebTest, Boolean)Calls a coded Web performance test from within a coded Web performance test. (Inherited from WebTest.)
Public methodInitializeDataBindingAdds data source and data binding information from attributes to the current instance. (Inherited from WebTest.)
Public methodInternalSetOutcome (Inherited from WebTest.)
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. (Inherited from WebTest.)
Public methodMoveDataTableCursor(String, String, Int32) (Inherited from WebTest.)
Public methodRegisterDataSourceInLoop (Inherited from WebTest.)
Public methodReloadDataTable (Inherited from WebTest.)
Public methodRunWhen overridden in a derived class, runs the coded Web performance test of the user.
Public methodSendSends a WebTestRequest to be run by the Web performance test engine.
Public methodStop (Overrides WebTest.Stop().)
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Top

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

This should always be the base class for all coded Web performance tests that are written in languages that do not support Visual C# iterator-like syntax. To write a Web performance test in Visual C#, see WebTest for an example. To run a test outside Visual Studio 2005 Team System, see Running Automated Tests from the Command Line for more information.

This class must be inherited; it cannot be instantiated.

Notes to Inheritors

When you inherit from ThreadedWebTest, you must override Run.

The following is a coded Web performance test called MyCodedWebTest that inherits from ThreadedWebTest. The second request posts the form information that is contained in three controls back to the server.

Option Strict Off
Option Explicit On

Imports Microsoft.VisualStudio.TestTools.WebTesting
Imports Microsoft.VisualStudio.TestTools.WebTesting.Rules
Imports System
Imports System.Collections.Generic

Namespace TestProject2
    
    Public Class MyCodedWebTest
        Inherits ThreadedWebTest
        
        Public Sub New()
            MyBase.New
            Me.PreAuthenticate = true
            Me.Proxy = "myproxy.com:80"
        End Sub
        
        Public Overrides Sub Run()
            Dim request1 As WebTestRequest = New WebTestRequest _
                ("http://localhost/MyWebSite")
            request1.ThinkTime = 1
            Dim rule1 As ExtractHiddenFields = New ExtractHiddenFields
            rule1.ContextParameterName = "1"
            AddHandler request1.ExtractValues, AddressOf rule1.Extract
            MyBase.Send(request1)

            Dim request2 As WebTestRequest = New WebTestRequest _
                ("http://localhost/MyWebSite/Default.aspx")
            request2.Method = "POST"
            Dim request2Body As FormPostHttpBody = New FormPostHttpBody
            request2Body.FormPostParameters.Add("__VIEWSTATE", "{{$HIDDEN1" + _
                ".__VIEWSTATE}}")
            request2Body.FormPostParameters.Add("Button1", "Button")
            request2Body.FormPostParameters.Add("TextBox1", "Hello text")
            request2.Body = request2Body
            Dim rule2 As ExtractHiddenFields = New ExtractHiddenFields
            rule2.ContextParameterName = ""
            AddHandler request2.ExtractValues, AddressOf rule2.Extract
            MyBase.Send(request2)
        End Sub
    End Class
End Namespace

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