WebTestPlugin.PostWebTest メソッド

更新 : 2007 年 11 月

派生クラスでオーバーライドされている場合、Web テストの末尾に関連付けられているイベントを処理するメソッドを表します。

名前空間 :  Microsoft.VisualStudio.TestTools.WebTesting
アセンブリ :  Microsoft.VisualStudio.QualityTools.WebTestFramework (Microsoft.VisualStudio.QualityTools.WebTestFramework.dll 内)

構文

'宣言
Public Overridable Sub PostWebTest ( _
    sender As Object, _
    e As PostWebTestEventArgs _
)
'使用
Dim instance As WebTestPlugin
Dim sender As Object
Dim e As PostWebTestEventArgs

instance.PostWebTest(sender, e)
public virtual void PostWebTest(
    Object sender,
    PostWebTestEventArgs e
)
public:
virtual void PostWebTest(
    Object^ sender, 
    PostWebTestEventArgs^ e
)
public function PostWebTest(
    sender : Object, 
    e : PostWebTestEventArgs
)

パラメータ

解説

Web テストの実行の末尾に、コード実行のエントリ ポイントを提供します。

Web テストが実行される前にコンテキストにランダムな番号を追加する Web テスト プラグインの例を次に示します。同様に、PostWebTest をオーバーライドし、Web テストの実行後にアクションを実行できます。たとえば、Web テストの完了にかかった時間と、Web テスト中に発行された要求数をログ ファイルに書き込むことができます。

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);
        }
        
    }
}

アクセス許可

  • 直前の呼び出し元に対する完全な信頼。このメンバは、部分的に信頼されているコードから使用することはできません。詳細については、「部分信頼コードからのライブラリの使用」を参照してください。

参照

参照

WebTestPlugin クラス

WebTestPlugin メンバ

Microsoft.VisualStudio.TestTools.WebTesting 名前空間