PreWebTestEventArgs Sınıf
İçin veri sağlar WebTest.PreWebTest olay.
Devralma Hiyerarşisi
Object
EventArgs
Microsoft.VisualStudio.TestTools.WebTesting.PreWebTestEventArgs
Ad alanı: Microsoft.VisualStudio.TestTools.WebTesting
Derleme: Microsoft.VisualStudio.QualityTools.WebTestFramework (Microsoft.VisualStudio.QualityTools.WebTestFramework.dll içinde)
Sözdizimi
'Bildirim
Public Class PreWebTestEventArgs _
Inherits EventArgs
public class PreWebTestEventArgs : EventArgs
public ref class PreWebTestEventArgs : public EventArgs
type PreWebTestEventArgs =
class
inherit EventArgs
end
public class PreWebTestEventArgs extends EventArgs
PreWebTestEventArgs türü aşağıdaki üyeleri ortaya koyar.
Özellikler
Ad | Açıklama | |
---|---|---|
WebTest | Alır WebTest başlamak üzereyse ve neden nesne PreWebTest olay. |
Üst
Yöntemler
Ad | Açıklama | |
---|---|---|
Equals | Determines whether the specified object is equal to the current object. (Object kaynağından devralındı.) | |
Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Object kaynağından devralındı.) | |
GetHashCode | Serves as the default hash function. (Object kaynağından devralındı.) | |
GetType | Gets the Type of the current instance. (Object kaynağından devralındı.) | |
MemberwiseClone | Creates a shallow copy of the current Object. (Object kaynağından devralındı.) | |
ToString | Returns a string that represents the current object. (Object kaynağından devralındı.) |
Üst
Notlar
Bu, özellikle bir başvuru sağlar WebTest çağrılan PreWebTest olay.
Örnekler
Aşağıdaki örnek Web performans testi çalıştırmadan önce bağlamına rasgele bir sayı ekler bir Web performans sınaması eklentisi gösterir.Web performans testi çalışması bittikten sonra eklentinin son uzunluğunu görüntüler WebTestResponse.
Kullanımına dikkat edin PreWebTestEventArgs başvuru sağlayarak, 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());
}
}
}
İş Parçacığı Güvenliği
Bu türün tüm genel statik (Visual Basic'te Shared) üyeleri iş parçacığı açısından güvenlidir. Hiçbir örnek üyesinin iş parçacığı açısından güvenliği garanti edilemez.
Ayrıca bkz.
Başvuru
Microsoft.VisualStudio.TestTools.WebTesting Ad Alanı