Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
ThreadedWebTest Class
Collapse the table of content
Expand the table of content

ThreadedWebTest Class

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

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 propertyContext (Inherited from WebTest.)
Public propertyDataSources (Inherited from WebTest.)
Public propertyGuid (Inherited from WebTest.)
Public propertyInheritFromWebTest (Inherited from WebTest.)
Public propertyLastRequestOutcome (Inherited from WebTest.)
Public propertyLastResponse (Inherited from WebTest.)
Public propertyName (Inherited from WebTest.)
Public propertyOutcome (Inherited from WebTest.)
Public propertyPassword (Inherited from WebTest.)
Public propertyPreAuthenticate (Inherited from WebTest.)
Public propertyProxy (Inherited from WebTest.)
Public propertyRequestBodyCaptureLimit (Inherited from WebTest.)
Public propertyResponseBodyCaptureLimit (Inherited from WebTest.)
Public propertyResultsLocale (Inherited from WebTest.)
Public propertyStopOnError (Inherited from WebTest.)
Public propertyUserName (Inherited from WebTest.)
Public propertyValidationRuleReferences (Inherited from WebTest.)
Public propertyWebProxy (Inherited from WebTest.)
Public propertyWebTestPluginReferences (Inherited from WebTest.)
Top

  NameDescription
Public methodAddCommentToResult (Inherited from WebTest.)
Public methodAddDataSource(String, String, DataBindingAccessMethod, String[]) (Inherited from WebTest.)
Public methodAddDataSource(String, String, String, DataBindingAccessMethod, String[]) (Inherited from WebTest.)
Public methodAddDataSource(String, String, String, DataBindingAccessMethod, DataBindingSelectColumns, String[]) (Inherited from WebTest.)
Public methodAddDataSourceBinding (Inherited from WebTest.)
Public methodBeginCondition (Inherited from WebTest.)
Public methodBeginLoop (Inherited from WebTest.)
Public methodBeginTransaction (Inherited from WebTest.)
Public methodEndCondition (Inherited from WebTest.)
Public methodEndLoop (Inherited from WebTest.)
Public methodEndTransaction(String) (Inherited from WebTest.)
Public methodEndTransaction(String, Boolean) (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 methodGetEnumerator (Inherited from WebTest.)
Public methodGetHashCodeServes as the default hash function. (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) (Inherited from WebTest.)
Public methodIncludeWebTest(WebTest) (Inherited from WebTest.)
Public methodIncludeWebTest(String, Boolean) (Inherited from WebTest.)
Public methodIncludeWebTest(WebTest, Boolean) (Inherited from WebTest.)
Public methodInitializeDataBinding (Inherited from WebTest.)
Public methodInternalSetOutcome (Inherited from WebTest.)
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodMoveDataTableCursor(String, String) (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 eventPostRequest (Inherited from WebTest.)
Public eventPostTransaction (Inherited from WebTest.)
Public eventPostWebTest (Inherited from WebTest.)
Public eventPrePage (Inherited from WebTest.)
Public eventPreRequest (Inherited from WebTest.)
Public eventPreRequestDataBinding (Inherited from WebTest.)
Public eventPreTransaction (Inherited from WebTest.)
Public eventPreWebTest (Inherited from WebTest.)
Public eventValidateResponse (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.
Show:
© 2015 Microsoft