agile-ajax

Ajax Testing: Doubling Down with Selenium and JMeter

This idea comes from my colleague John McCaffrey, but since he's having a bad case of blogger's block, I get to post about it.

For anyone who has developed tests for web applications with a tool like Selenium (or Watir), you know it is a sysiphean task, rolling the boulder of automated tests up the hill of a constantly changing application. The DOM changes, the text changes, the url's and parameter's change, iframes and onload events don't always play nice with your test recorder. Depending on the framework you are using, id's may change in unpredictable ways, forcing you to hack together brittle xpath expressions. Still, functional testing is important, so you persevere, spending countless hours in making those tests run clean.

If you are doing performance tests on top of that (and you are doing
performance tests in every sprint, aren't you?), then you have a second
set of brittle tests to support. Ugh.

Why not save some time and leverage your functional tests to create performance tests? Enter JMeter. JMeter, like many tools of its type, has the ability to record HTTP requests through a proxy.
So, record your tests in Selenium, get them working to your
satisfaction, then point your browser at the JMeter proxy and record
away.

You'll want to put some assertions in your script in
JMeter, and you will need to do some work if your app has
authentication and you want your script to log in under a different
user name per thread, but at least you don't have to duplicate the
effort of keeping the base interactions up to date.

This
increase in efficiency is especially important if you want to pipeline
requirements, development and testing, as you'll only have 2 weeks
(presuming 2 week iterations) to whip your tests into shape.

It is also possible to generate Selenium and JMeter rests programmatically. More on that later.

Technorati Tags: , , , , ,

Comments: 2 so far

  1. Selenium is good for ajax based apps. is Jmeter capable of handling AJAX?

    Comment by smith, Thursday, September 11, 2008 @ 6:42 am

  2. @smith

    Absolutely. JMeter just looks at the HTTP requests recorded against it and replays them. Since an Ajax app makes HTTP requests just like a regular Web app, they are the same from JMeter’s point of view.

    There can be some gotcha’s, such as Comet, but if unless your Ajax app is really unusual, you should be good to go.

    Comment by Dietrich Kappe, Friday, September 12, 2008 @ 11:27 pm

Leave a comment

Powered by WP Hashcash

Who is Pathfinder?

Topics

Search

WordPress

Comments about this site: info@pathf.com