Partager via


ExtractFormField Class

Extracts the value of a form field attribute and adds it to the WebTestContext.

Inheritance Hierarchy

Object
  Microsoft.VisualStudio.TestTools.WebTesting.ExtractionRule
    Microsoft.VisualStudio.TestTools.WebTesting.Rules.ExtractFormField

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

Syntax

'Declaration
Public Class ExtractFormField _
    Inherits ExtractionRule
public class ExtractFormField : ExtractionRule
public ref class ExtractFormField : public ExtractionRule
type ExtractFormField =  
    class 
        inherit ExtractionRule 
    end
public class ExtractFormField extends ExtractionRule

The ExtractFormField type exposes the following members.

Constructors

  Name Description
Public method ExtractFormField Initializes a new instance of the ExtractFormField class.

Top

Properties

  Name Description
Public property ContextParameterName Gets or sets the context name of the extracted property. (Inherited from ExtractionRule.)
Public property HtmlDecode Gets or sets a value that indicates whether the extracted value should be HTML decoded before the value is put into the Web performance test context.
Public property Index Gets or sets the 0-based index of the string to match.
Public property Name Gets or sets the name of the field whose value is to be extracted.
Public property Required Gets or sets a value that indicates whether the extraction rule should fail if the value to be extracted is not found in the response.
Public property RuleDescription Obsolete. This method is no longer used. Use the DisplayNameAttribute on the class to set a description for this rule. (Inherited from ExtractionRule.)
Public property RuleName Obsolete. This method is no longer used. Use the DisplayNameAttribute on the class to set a display name for this rule. (Inherited from ExtractionRule.)

Top

Methods

  Name Description
Public method Equals Determines whether the specified object is equal to the current object. (Inherited from Object.)
Public method Extract Extracts the form field name and value that matches the Name property. (Overrides ExtractionRule.Extract(Object, ExtractionEventArgs).)
Protected method Finalize Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public method GetHashCode Serves as the default hash function. (Inherited from Object.)
Public method GetType Gets the Type of the current instance. (Inherited from Object.)
Protected method MemberwiseClone Creates a shallow copy of the current Object. (Inherited from Object.)
Public method ToString Returns a string that represents the current object. (Inherited from Object.)

Top

Remarks

This extraction rule extracts form fields that have a name equal to the value that is set by Name. Consider the following HTML:

<input name="TextBox1" type="text" value="my first field" id="TextBox1" />

<input name="TextBox2" type="text" value="my 2nd field" id="TextBox2" />

The value of the TextBox1 field will be put in the context under the name that is specified by ContextParameterName.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

Microsoft.VisualStudio.TestTools.WebTesting.Rules Namespace

Other Resources

Working with Web Tests

Coding a custom extraction rule for a web performance test

[retired] How to: Add an Extraction Rule to a Web Performance Test