PostWebTestEventArgs クラス

更新 : 2007 年 11 月

PostWebTest イベントにデータを提供します。

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

構文

'宣言
Public Class PostWebTestEventArgs _
    Inherits EventArgs
'使用
Dim instance As PostWebTestEventArgs
public class PostWebTestEventArgs : EventArgs
public ref class PostWebTestEventArgs : public EventArgs
public class PostWebTestEventArgs extends EventArgs

解説

これは、特に PostWebTest イベントを呼び出した WebTest への参照を提供します。

Web テストが実行される前にコンテキストにランダムな番号を追加し、Web テストが実行された後に最後の WebTestResponse の長さを表示する Web テスト プラグインを次の例に示します。

WebTest への参照を提供する際は、PostWebTestEventArgs の使用に注意してください。

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, PostWebTestEventArgse)
        {
            MessageBox.Show(e.WebTest.LastResponse.ContentLength.ToString());
        }
    }
}

継承階層

System.Object
  System.EventArgs
    Microsoft.VisualStudio.TestTools.WebTesting.PostWebTestEventArgs

スレッド セーフ

この型のすべてのパブリック static (Visual Basic では Shared) メンバは、スレッド セーフです。インスタンス メンバの場合は、スレッド セーフであるとは限りません。

参照

参照

PostWebTestEventArgs メンバ

Microsoft.VisualStudio.TestTools.WebTesting 名前空間

その他の技術情報

Web テストの操作