Tuesday, 29 June 2010

Introduction to the Visual Studio Team System 2010 WebTest

Visual Studio 2010 is a great tool for performance testing and if we consider just the web protocol I would say it is as good as HP LoadRunner.

The real power of the tool comes not from the fact that it is .NET based but from the fantastic tree view structure. Microsoft has accomplished tremendous job by allowing testers to record the scripts in as an XML and presenting it as a tree view list of requests with their POST, Query String parameters.

Each request can be expanded and depending on its type it will have any combination of the following child items:

  • Headers
  • Dependant requests
  • QueryString Parameters
  • Form Post Parameters

Each group can be easily edited through the Properties pane and new items can be added by using web request context menu.

Most of the request web headers are generated by VSTS automatically based on the Load Test scenario configuration.

A classic example is a User-Agent header which is automatically added (during test execution) to each request issued by VSTS based on browser mix in the Load Test scenario.

Dependant requests
When the web browser requests a web it then parses server response (HTML) and identifies all embedded resources such as images, iframe pages, scripts, CSS stylesheets etc. While the new resources are being downloaded the page will slightly change its appearance which can be observer on the computers with slow Internet connection.
Each of the items requested by the browser based on the parsed HTML response is called dependent request. VSTS will usually be able to parse the HTML page and requests all resources as the web browser would do in which case no dependant requests will be added to the request. While running a test VSTS will parse the response and automatically request all related resources.
In some cases VSTS won’t be able to identify where in the resulting HTML page a given resource is called from. Since the dependent requests cannot be identified from the resulting HTML during recording VSTS won’t be able to identify it during load test and thus the test won’t be accurate.
Any resources requested by browser during script recording which cannot be linked to the HTML will be added as a dependant requests. Each dependant request has exactly the same structure as any other request and it can even have its own dependent requests.

QueryString Parameters
QueryString Parameters could be used with either GET or POST requests. These parameters are passed to the server in the last part of the URL address. QueryString starts with the question mark character “?” followed by key=value pairs of the querystring parameters witch each pair separated by ampersand character “&”
All QueryString Parameters are displayed under QueryString Parameters folder under the request

Form Post Parameters
Form Post Parameters can be either a list of key=value pairs separated by ampersand (same as in the query string but with no question mark at the beginning) or data format.
The first case (i.e. key=value) is very common in all types of web applications whereas the second is usually found in Web 2.0 applications.
If the application uses key=value pairs to pass data to the server those pairs will be listed under Form Post Parameters folder in the same way as QueryString Parameters.

Form Post Parameters can also list files uploaded to the web server

If the post body contains any other content VSTS will record it as a String Body

In order to view/edit String Body right-click on String Body item and select Properties from context menu. The Properties panel on the right hand side will show String Body value and two additional parameters.
The most widely used types of post data types are JSON and XML.

XML example:

JSON example:

No comments:

Post a Comment