Classe PostWebTestEventArgs
Fornece dados para o evento WebTest.PostWebTest.
Hierarquia de herança
Object
EventArgs
Microsoft.VisualStudio.TestTools.WebTesting.PostWebTestEventArgs
Namespace: Microsoft.VisualStudio.TestTools.WebTesting
Assembly: Microsoft.VisualStudio.QualityTools.WebTestFramework (em Microsoft.VisualStudio.QualityTools.WebTestFramework.dll)
Sintaxe
'Declaração
Public Class PostWebTestEventArgs _
Inherits EventArgs
public class PostWebTestEventArgs : EventArgs
public ref class PostWebTestEventArgs : public EventArgs
type PostWebTestEventArgs =
class
inherit EventArgs
end
public class PostWebTestEventArgs extends EventArgs
O tipo PostWebTestEventArgs expõe os membros a seguir.
Propriedades
Nome | Descrição | |
---|---|---|
![]() |
WebTest | Obtém o WebTest objeto que foi concluída e fez com que o PostWebTest evento. |
Superior
Métodos
Nome | Descrição | |
---|---|---|
![]() |
Equals | Determines whether the specified object is equal to the current object. (Herdado de Object.) |
![]() |
Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Herdado de Object.) |
![]() |
GetHashCode | Serves as the default hash function. (Herdado de Object.) |
![]() |
GetType | Gets the Type of the current instance. (Herdado de Object.) |
![]() |
MemberwiseClone | Creates a shallow copy of the current Object. (Herdado de Object.) |
![]() |
ToString | Returns a string that represents the current object. (Herdado de Object.) |
Superior
Comentários
Especificamente, isso fornece uma referência para o WebTest que invocou o PostWebTest evento.
Exemplos
O exemplo a seguir mostra um desempenho teste da Web plug-in que adiciona um número aleatório para o contexto antes do teste de desempenho da Web é executado e exibe o comprimento do último WebTestResponse após a execução do teste de desempenho da Web.
Observe o uso da PostWebTestEventArgs no fornecimento de uma referência para o WebTest.
using System;
using Microsoft.VisualStudio.TestTools.WebTesting;
using System.Windows.Forms;
namespace WebTestPluginNamespace
{
public class MyWebTestPlugin : WebTestPlugin
{
public static string NewRandomNumberString(int size)
{
byte[] buffer = new byte[size];
// Seed using system time
Random random = new Random(unchecked((int)DateTime.Now.Ticks));
random.NextBytes(buffer);
return BitConverter.ToInt32(buffer, 0).ToString();
}
public override void PreWebTest(object sender, PreWebTestEventArgs e)
{
e.WebTest.Context["RandNum"] = NewRandomNumberString(4);
}
public override void PostWebTest(object sender, PostWebTestEventArgs e)
{
MessageBox.Show(e.WebTest.LastResponse.ContentLength.ToString());
}
}
}
Acesso thread-safe
Quaisquer membros estático (Shared no Visual Basic) públicos deste tipo são thread-safe. Não há garantia de que qualquer membro de instância seja thread-safe.
Consulte também
Referência
Namespace Microsoft.VisualStudio.TestTools.WebTesting