How To Include HTTP Headers In Web Test Recording

02/02/2011

How To Include HTTP Headers In Web Test Recording

HTTP header fields contain the operating parameters of an HTTP request or response. With the request or response line (first line of message), they form the message header.

Here is a ScreenCast on How to Create Web Test\Coded Web Test – Screencast [HE]

While recording Web Test you will notice that Headers are not included in Web Test Requests, this because Web Test only record below header by default:

  • SOAPAction
  • Pragma
  • x-microsoftajax
  • Content-Type

image

But you can change those types by modifying registry, just add a string key with the headers that you want to record during Web Test.
How To Change Recorded Header Types:

Visual Studio 2008: HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\9.0\EnterpriseTools\QualityTools\WebLoadTest

Visual Studio 2010: HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0\EnterpriseTools\QualityTools\WebLoadTest

Add a string value under this key with the name "RequestHeadersToRecord” and value="SOAPAction;Pragma;x-microsoftajax;Content-Type;Referrer;Accept-Encoding;Accept-Language;User-Agent"

And you can add any Http Header you like to record. (More about HTTP Headers – http://en.wikipedia.org/wiki/List_of_HTTP_headers)

Download Registry for Visual Studio 2008 | Download Registry for Visual Studio 2010

In this demo I’ve added:

  • Accept-Encoding
  • Accept-Language
  • User-Agent

And record the same requests, and the result is:

image

Why? sometimes you just want to see those values in your web test and sometimes you want to Data Bind the headers value to a DataSource.

Download Registry for Visual Studio 2008 | Download Registry for Visual Studio 2010

Add comment
facebook linkedin twitter email

Leave a Reply