ExtractionRule.ContextParameterName Property

Gets or sets the context name of the extracted property.

Namespace:  Microsoft.VisualStudio.TestTools.WebTesting
Assembly:  Microsoft.VisualStudio.QualityTools.WebTestFramework (in Microsoft.VisualStudio.QualityTools.WebTestFramework.dll)


<BrowsableAttribute(False)> _
Public Overridable Property ContextParameterName As String
public virtual string ContextParameterName { get; set; }
virtual property String^ ContextParameterName {
    String^ get ();
    void set (String^ value);
abstract ContextParameterName : string with get, set
override ContextParameterName : string with get, set
function get ContextParameterName () : String
function set ContextParameterName (value : String)

Property Value

Type: System.String
The context name of the extracted property.


This name may be used for binding to data elements in subsequent requests.


The following is a Web performance test that assigns context names to extracted values.

namespace TestProject1
    using System;
    using System.Collections.Generic;
    using Microsoft.VisualStudio.TestTools.WebTesting;
    using ClassLibrary2;

    public class MyWebTest : WebTest
        public MyWebTest()
            this.PreAuthenticate = true;

        public override IEnumerator<WebTestRequest> GetRequestEnumerator()
            WebTestRequest request1 = new WebTestRequest("http://localhost/ts");
            ExtractCheckBoxes rule1 = new ExtractCheckBoxes();
            rule1.FindCheckedBoxes = true;
            rule1.ContextParameterName = "CheckedBoxes";
            request1.ExtractValues += new EventHandler
            ExtractCheckBoxes rule2 = new ExtractCheckBoxes();
            rule2.FindCheckedBoxes = false;
            rule2.ContextParameterName = "";
            request1.ExtractValues += new EventHandler
            yield return request1;
Option Strict Off
Option Explicit On

Imports Microsoft.VisualStudio.TestTools.WebTesting
Imports Microsoft.VisualStudio.TestTools.WebTesting.Rules
Imports System
Imports System.Collections.Generic

Namespace MyVBTestProject
    Public Class MyCodedWebTest
        Inherits ThreadedWebTest
        Public Sub New()
            Me.PreAuthenticate = true

            // TODO: specify your proxy below
            Me.Proxy = "myproxy.seattle.corp.northwind.com:80"
        End Sub
        Public Overrides Sub Run()
            Dim request1 As WebTestRequest = New WebTestRequest _
            request1.ThinkTime = 10
            Dim rule1 As ExtractHiddenFields = New ExtractHiddenFields
            rule1.ContextParameterName = "MyContextParam"
            AddHandler request1.ExtractValues, AddressOf rule1.Extract

            Dim request2 As WebTestRequest = New WebTestRequest _
            request2.Method = "POST"
            Dim request2Body As FormPostHttpBody = New FormPostHttpBody
            request2Body.FormPostParameters.Add("__VIEWSTATE", _
            request2Body.FormPostParameters.Add("Button1", "Button")
            request2Body.FormPostParameters.Add("TextBox1", "Entered text")
            request2.Body = request2Body
        End Sub
    End Class
End Namespace

.NET Framework Security

See Also


ExtractionRule Class

Microsoft.VisualStudio.TestTools.WebTesting Namespace