다음을 통해 공유


PostWebTestEventArgs.WebTest 속성

PostWebTest 이벤트를 발생시키고 이를 완료한 WebTest 개체를 가져옵니다.

네임스페이스:  Microsoft.VisualStudio.TestTools.WebTesting
어셈블리:  Microsoft.VisualStudio.QualityTools.WebTestFramework(Microsoft.VisualStudio.QualityTools.WebTestFramework.dll)

구문

‘선언
Public ReadOnly Property WebTest As WebTest
public WebTest WebTest { get; }
public:
property WebTest^ WebTest {
    WebTest^ get ();
}
member WebTest : WebTest with get
function get WebTest () : WebTest

속성 값

형식: Microsoft.VisualStudio.TestTools.WebTesting.WebTest
WebTest 개체

예제

다음 예제에서는 웹 성능 테스트를 실행하기 전에 컨텍스트에 난수를 추가하거나 웹 성능 테스트를 실행한 후 마지막 WebTestResponse의 길이를 표시하는 웹 성능 테스트 플러그 인을 표시합니다.

이 속성으로 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());
        }
    }
}

.NET Framework 보안

  • 직접 실행 호출자의 경우 완전히 신뢰합니다. 이 멤버는 부분적으로 신뢰할 수 있는 코드에서 사용할 수 없습니다. 자세한 내용은 부분 신뢰 코드에서 라이브러리 사용을 참조하십시오.

참고 항목

참조

PostWebTestEventArgs 클래스

Microsoft.VisualStudio.TestTools.WebTesting 네임스페이스