WebTestPlugin.PostWebTest Yöntem
Türetilmiş bir sınıfta geçersiz olduğunda, bir Web performans testi sonu ile ilişkili olay işleyecek yöntemi temsil eder.
Ad alanı: Microsoft.VisualStudio.TestTools.WebTesting
Derleme: Microsoft.VisualStudio.QualityTools.WebTestFramework (Microsoft.VisualStudio.QualityTools.WebTestFramework.dll içinde)
Sözdizimi
'Bildirim
Public Overridable Sub PostWebTest ( _
sender As Object, _
e As PostWebTestEventArgs _
)
public virtual void PostWebTest(
Object sender,
PostWebTestEventArgs e
)
public:
virtual void PostWebTest(
Object^ sender,
PostWebTestEventArgs^ e
)
abstract PostWebTest :
sender:Object *
e:PostWebTestEventArgs -> unit
override PostWebTest :
sender:Object *
e:PostWebTestEventArgs -> unit
public function PostWebTest(
sender : Object,
e : PostWebTestEventArgs
)
Parametreler
sender
Tür: ObjectOlay kaynağı.
e
Tür: Microsoft.VisualStudio.TestTools.WebTesting.PostWebTestEventArgsA PostWebTestEventArgs , olay verileri içerir.
Notlar
Bu, Web performans testi sonunda bir kod yürütme giriş noktası sağlar.
Örnekler
Aşağıdaki örnek Web performans testi çalıştırmadan önce bağlamına rasgele bir sayı ekler bir Web performans testi eklentisi gösterir.Aynı şekilde, geçersiz kılıp PostWebTest ve Web performans testi çalıştırdığınızda bir eylem gerçekleştirin.Örneğin, Web performans testi ve Web performans testi sırasında verilen istek sayısını tamamlamak için gereken süreyi bir günlük dosyasına yazmak isteyebilirsiniz.
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);
}
}
}
.NET Framework Güvenliği
- Anında arayanlar için tam güven. Bu üye kısmen güvenilen kodla kullanılamaz. Daha fazla bilgi için bkz. Kısmen Güvenilen Koddan Kitaplıkları Kullanma.