Automatic Hidden Field Tracking

I wrote the following response to an MSDN forums question asking how VIEWSTATE is tracked in a web test.  Let me know if you have any questions or comments.

For many sites, the Web Test Recorder is able to automatically detect the use of hidden fields (including VIEWSTATE) and ensure the web test will use the correct runtime values for those fields.

All the hidden fields found in an HTTP response are extracted into the context by the ExtractHiddenFields extraction rule.  Each hidden field value will be stored in the context under a name like $HiddenFields1.__VIEWSTATE.  The ‘1’ comes from the ContentParameterName property assigned to the ExtractHiddenFields rule and can be anything you want.  This is, by the way, the only built-in rule that extracts more than one item into the context.

In Beta 2, binding the extracted hidden fields to a later request is done by adding a BindHiddenFields request plugin to the request.  This will add all the hidden fields in the context for the given hidden field group (‘1’ in my example above) as parameters on the request.

Post Beta 2, the BindHiddenFields plugin has been removed.  Instead, binding hidden fields to a request now uses standard context binding, so it will show up in your web test as individual parameters with values like {{$Hidden1.__VIEWSTATE}}.

Note that this automatic hidden field tracking feature may require some manual tweaking on some sites.  Web sites that set hidden field values in javascript can sometimes cause the Web Test Recorder to not be able to identify hidden fields being used.  During runtime, web sites that do redirects using javascript can cause hidden field binding to fail because our web load testing engine does not execute javascript.  This can cause a web test to run a different set of requests than were recorded and the expected hidden fields may not be present.

BTW, the next CTP release (and later RTM) will contain some improvements I’m working on to substantially shrink the set of web sites that can cause the Web Test Recorder to not identify hidden field usage.

Comments (2)

  1. Adam Ulrich is busting testing myths here ⊕ and here ⊕.

    Eric Jarvi on:

    VSTS Tip: making sense…