ThreadedWebTest Class
Represents a base class for a coded Web performance test that uses a single thread per Web performance test iteration.
Inheritance Hierarchy
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)
Syntax
'Declaration
Public MustInherit Class ThreadedWebTest _
Inherits WebTest
public abstract class ThreadedWebTest : WebTest
public ref class ThreadedWebTest abstract : public WebTest
[<AbstractClass>]
type ThreadedWebTest =
class
inherit WebTest
end
public abstract class ThreadedWebTest extends WebTest
The ThreadedWebTest type exposes the following members.
Constructors
Name | Description | |
---|---|---|
ThreadedWebTest | Initializes a new instance of the ThreadedWebTest class. |
Top
Properties
Name | Description | |
---|---|---|
Context | (Inherited from WebTest.) | |
DataSources | (Inherited from WebTest.) | |
Guid | (Inherited from WebTest.) | |
InheritFromWebTest | (Inherited from WebTest.) | |
LastRequestOutcome | (Inherited from WebTest.) | |
LastResponse | (Inherited from WebTest.) | |
Name | (Inherited from WebTest.) | |
Outcome | (Inherited from WebTest.) | |
Password | (Inherited from WebTest.) | |
PreAuthenticate | (Inherited from WebTest.) | |
Proxy | (Inherited from WebTest.) | |
RequestBodyCaptureLimit | (Inherited from WebTest.) | |
ResponseBodyCaptureLimit | (Inherited from WebTest.) | |
ResultsLocale | (Inherited from WebTest.) | |
StopOnError | (Inherited from WebTest.) | |
UserName | (Inherited from WebTest.) | |
ValidationRuleReferences | (Inherited from WebTest.) | |
WebProxy | (Inherited from WebTest.) | |
WebTestPluginReferences | (Inherited from WebTest.) |
Top
Methods
Name | Description | |
---|---|---|
AddCommentToResult | (Inherited from WebTest.) | |
AddDataSource(String, String, DataBindingAccessMethod, array<String[]) | (Inherited from WebTest.) | |
AddDataSource(String, String, String, DataBindingAccessMethod, array<String[]) | (Inherited from WebTest.) | |
AddDataSource(String, String, String, DataBindingAccessMethod, DataBindingSelectColumns, array<String[]) | (Inherited from WebTest.) | |
AddDataSourceBinding | (Inherited from WebTest.) | |
BeginCondition | (Inherited from WebTest.) | |
BeginLoop | (Inherited from WebTest.) | |
BeginTransaction | (Inherited from WebTest.) | |
EndCondition | (Inherited from WebTest.) | |
EndLoop | (Inherited from WebTest.) | |
EndTransaction(String) | (Inherited from WebTest.) | |
EndTransaction(String, Boolean) | (Inherited from WebTest.) | |
Equals | Determines whether the specified object is equal to the current object. (Inherited from Object.) | |
ExecuteConditionalRule | (Inherited from WebTest.) | |
Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) | |
GetDataTableRowCount | (Inherited from WebTest.) | |
GetEnumerator | (Inherited from WebTest.) | |
GetHashCode | Serves as the default hash function. (Inherited from Object.) | |
GetRequestEnumerator | Infrastructure. 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().) | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
IncludeWebTest(String) | (Inherited from WebTest.) | |
IncludeWebTest(WebTest) | (Inherited from WebTest.) | |
IncludeWebTest(String, Boolean) | (Inherited from WebTest.) | |
IncludeWebTest(WebTest, Boolean) | (Inherited from WebTest.) | |
InitializeDataBinding | (Inherited from WebTest.) | |
InternalSetOutcome | (Inherited from WebTest.) | |
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |
MoveDataTableCursor(String, String) | (Inherited from WebTest.) | |
MoveDataTableCursor(String, String, Int32) | (Inherited from WebTest.) | |
RegisterDataSourceInLoop | (Inherited from WebTest.) | |
ReloadDataTable | (Inherited from WebTest.) | |
Run | When overridden in a derived class, runs the coded Web performance test of the user. | |
Send | Sends a WebTestRequest to be run by the Web performance test engine. | |
Stop | (Overrides WebTest.Stop().) | |
ToString | Returns a string that represents the current object. (Inherited from Object.) |
Top
Events
Name | Description | |
---|---|---|
PostPage | (Inherited from WebTest.) | |
PostRequest | (Inherited from WebTest.) | |
PostTransaction | (Inherited from WebTest.) | |
PostWebTest | (Inherited from WebTest.) | |
PrePage | (Inherited from WebTest.) | |
PreRequest | (Inherited from WebTest.) | |
PreRequestDataBinding | (Inherited from WebTest.) | |
PreTransaction | (Inherited from WebTest.) | |
PreWebTest | (Inherited from WebTest.) | |
ValidateResponse | (Inherited from WebTest.) | |
ValidateResponseOnPageComplete | (Inherited from WebTest.) |
Top
Remarks
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.
Examples
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 _
("https://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 _
("https://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
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 Overview