Método ThreadedWebTest.Send

Envia um WebTestRequest para serem executados por Web desempenho teste engine.

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

Sintaxe

'Declaração
Public Sub Send ( _
    request As WebTestRequest _
)
public void Send(
    WebTestRequest request
)
public:
void Send(
    WebTestRequest^ request
)
member Send : 
        request:WebTestRequest -> unit 
public function Send(
    request : WebTestRequest
)

Parâmetros

Comentários

Este método bloqueia até que o mecanismo de teste de carga Web termine executando a solicitação.

Exemplos

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

            // TODO: specify your proxy below
            Me.Proxy = "myproxy.seattle.corp.northwind.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

Segurança do .NET Framework

Consulte também

Referência

ThreadedWebTest Classe

Namespace Microsoft.VisualStudio.TestTools.WebTesting

Outros recursos

Understanding Web Tests

Working with Web Tests

Como: Criar um teste de desempenho da Web codificado