Compartilhar via


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

Comments

  • Anonymous
    June 19, 2007
    Fiddler is great, but for regression web testing I prefer other tools: For testing AJAX web pages I highly recommend the free iMacros for Firefox addon (http://www.iopus.com/imacros/firefox) which works fine with Javascript dialogs and with most AJAX elements. There is a free version for IE, too. Unfortunately it can not automate drag & drop, so I convinced by boss to purchase the iMacros PRO Edition. It runs inside IE and can replay drag & drop using what they call "DirectScreen Technology", http://wiki.imacros.net/DirectScreen_Technology Peter

  • Anonymous
    June 27, 2007
    The comment has been removed

  • Anonymous
    November 11, 2007
    Thanks heaps for this, I have spent days trying out various expensive tools to meet these requirements. How can I export the test results to a format readable by my client? i.e. a html or word page of the results.

  • Anonymous
    November 11, 2007
    Hi Rod, I haven't worked much with presenting the data, since once it's time to present it to the end-customer I'm usually out of the loop. What I DO know, though, is that you can export the results as an .xml-file which can then be used to present to the customer. http://msdn2.microsoft.com/en-us/library/ms182499(VS.80).aspx

  • Anonymous
    November 13, 2007
    Don't forget to mention that it also happens to applications that uses XMLHttpRequest. AJAX uses it behind the scenes.