PreWebTestEventArgs クラス
更新 : 2007 年 11 月
PreWebTest イベントにデータを提供します。
名前空間 : Microsoft.VisualStudio.TestTools.WebTesting
アセンブリ : Microsoft.VisualStudio.QualityTools.WebTestFramework (Microsoft.VisualStudio.QualityTools.WebTestFramework.dll 内)
構文
'宣言
Public Class PreWebTestEventArgs _
Inherits EventArgs
'使用
Dim instance As PreWebTestEventArgs
public class PreWebTestEventArgs : EventArgs
public ref class PreWebTestEventArgs : public EventArgs
public class PreWebTestEventArgs extends EventArgs
解説
これは、特に PreWebTest イベントを呼び出した WebTest への参照を提供します。
例
Web テストが実行される前にコンテキストにランダムな番号を追加する Web テスト プラグインの例を次に示します。Web テストが実行されると、プラグインは最後の WebTestResponse の長さを表示します。
WebTest への参照を提供する際は、PreWebTestEventArgs の使用に注意してください。
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, PreWebTestEventArgse)
{
e.WebTest.Context["RandNum"] = NewRandomNumberString(4);
}
public override void PostWebTest(object sender, PostWebTestEventArgs e)
{
MessageBox.Show(e.WebTest.LastResponse.ContentLength.ToString());
}
}
}
継承階層
System.Object
System.EventArgs
Microsoft.VisualStudio.TestTools.WebTesting.PreWebTestEventArgs
スレッド セーフ
この型のすべてのパブリック static (Visual Basic では Shared) メンバは、スレッド セーフです。インスタンス メンバの場合は、スレッド セーフであるとは限りません。
参照
参照
Microsoft.VisualStudio.TestTools.WebTesting 名前空間