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: ajax, selenium, watir, jmeter, testing, agile
Topics: Ajax Development, Best Practices, Selenium, Testing
Comments: 2 so far
Leave a comment
About Pathfinder
Follow the Blog
-
Get a monthly update on best practices for delivering successful software.
Subscribe via email
Subscribe via RSS
Categories
Topics
Archives
- July 2009
- June 2009
- May 2009
- April 2009
- March 2009
- February 2009
- January 2009
- December 2008
- November 2008
- October 2008
- September 2008
- August 2008
- July 2008
- June 2008
- May 2008
- April 2008
- March 2008
- February 2008
- January 2008
- December 2007
- November 2007
- October 2007
- September 2007
- August 2007
- July 2007
- June 2007
- May 2007
- April 2007
- March 2007
- February 2007
- January 2007
- December 2006
- November 2006
- October 2006
- September 2006
- August 2006
- July 2006
- June 2006
- May 2006
- April 2006
- March 2006
Blogroll
Recent
- Elements of Testing Style
- Aesthetics and Web Design
- Asterisk-Java Testing with Groovy
- 3 Misuses of Code Comments
- Fluently NHibernate
- Digging a Hole and Covering it with Leaves — The Software Development Version
- The Importance of User Experience - Do You Understand It in Your Bones?
- Writing Your Own Protocol With NSURLProtocol
- What’s In Your Dock: iPhone edition
- Feature Fatigue

Selenium is good for ajax based apps. is Jmeter capable of handling AJAX?
Comment by smith, Thursday, September 11, 2008 @ 6:42 am
@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