Test Projects and AJAX

If you have an AJAX project and you're using Visual Studio Team Edition for Software Testers you might have noticed that the Web Test recorder is unable to record client side script navigation like AJAX requests.

The way the test recorder is created it attaches to IE and records all "standard" navigation. This means it will disregard AJAX-calls as well as JScript popups. This is really unfortunate if you wish to stress test your new, cool AJAX project.

What to do

Basically there are two options for dealing with this.

Wait for "Orcas"

Well unless you have an abundance of time, this really isn't an option, but I thought it would be a good idea to mention the new features of the next version of Visual Studio. A lot of improvements have been made for tests alone:

  • Web Test Validation Rule Improvements to enable testers to create more comprehensive validation rules for the application being tested. These improvements include the following functions:
    • Stop test on error
    • Search request and response
    • Add validation rule for title
    • Redirect validation
    • Provide test level validation rules
    • Expected HTTP code
    • Warning level for errors on dependents
  • Better Web Test Data Binding to allow users to data bind .CSV and XML files, as well as databases to a web test, using a simple data binding wizard.
  • Improved Load Test Results Management so a user can open or remove an existing load test result from the load test repository. User can also import and export load test results files.
  • Load test summary report support for multiple machine graphs in Load Test Analyzer
  • Web Test recorder now records Ajax requests and JavaScript pop-ups
  • Load Modeling support initialize and terminate functions for a virtual user, as well as modeling load based on user pacing.

Use "Fiddler"

If you're familiar with Fiddler you might be thinking "Oh, no! Copying each request from Fiddler is going to be terrible!" Actually you don't have to do that. Fiddler will do it for you, so keep reading!

Fiddler is a sweet little tool that will act as a proxy between your machine and the network. All HTTP-traffic will be intercepted and you'll be able to see the exact request and the exact response. While the Web Test recorder binds to one particular instance of IE, Fiddler will get everything. IM-sessions, software update checks, you name it. This means that there's a potential risk of Information Overload, but filtering out the interesting bits is quite easy.

Once you've recorded a session in fiddler you can then select the requests you're interested in, right click them and save them as a Visual Studio Web Test.

That's it. You now have an XML file with the .webtest extension, ready to be imported into Visual Studio. One thing that you might want to do once you've imported it is to set the "Parse Dependent Requests"-property to false. Otherwise you'll download all dependent images, CSS stylesheets, etc. twice.

/ Johan