You wouldn’t consider developing a Rails application without having a solid test suite for your Ruby code, but you’ve somehow convinced yourself to cross your fingers and look the other way when it comes to JavaScript. It doesn’t have to be that way. In this session, you’ll learn how to apply test-driven and behavior-driven development to your unobtrusive JavaScript code in a Rails-friendly manner.

Historically, when selecting a JavaScript testing solution, you were forced to choose whether you wanted a framework that could run your tests in the browser or one that could only run your tests in a headless fashion. With the right combination of tools 1, you can enjoy the best of both worlds: fast, automation-friendly, and headless testing plus the ability to run your tests in whichever browser is acting up on any given day.

In this session, you’ll learn how to give your JavaScript code the testing love it deserves. We’ll tackle:

Jason Rudolph

GitHub

Jason Rudolph is a Principal at Relevance, a leading consultancy and training organization specializing in Ruby, Rails, Groovy, and Grails, and integrating them into enterprise environments. Jason has more than nine years of experience in developing software solutions for domestic and international clients of all sizes, including start-ups, Dow 30 companies, and government organizations. Jason holds a degree in Computer Science from the University of Virginia.

Comments

Jeff Wigal

05/08/2009 8:27am PDT

This was a terrific session. What a novel concept, actually test the javascript code we’re writing :) It was great to see you guys do the live programming thing, not as many people did that as I would have though.

Larry Karnowski

05/06/2009 7:46am PDT

@Marcus: We recommend not using Blue Ridge to test “glue code” where you’re just shuffling an event to a function. Instead you should unit test that target function. As such, whether it’s a simple “click” or “livequery click” shouldn’t make a difference.

If you really need to make sure that when your function (for example an Ajax call) creates a new DOM element that its new links/buttons are activated through LiveQuery, then I recommend using Watir or Selenium for a user-acceptance level test.

Larry Karnowski

05/06/2009 7:43am PDT

@Ray: Thanks for the feedback, sorry the slides were hard to read.

@Nathaniel: Thanks! We practiced the live coding a lot, and it was a lot of fun. I’m starting to think most talks should be given by pairs.

Nathaniel Bibler

05/05/2009 4:50pm PDT

Nice job guys and an excellent job of live demo/programming.

Marcus Derencius

05/05/2009 2:38pm PDT

I really liked your session. Have you guys already tested any code using jquery.live or jquery.livequery?

Ray Baxter

05/05/2009 2:35pm PDT

Nice presentation with a clear story. The slides and the live-coding were hard to read. (This has been a problem in every session.)

Larry Karnowski

04/29/2009 7:03am PDT

@Derek: We are definitely covering that.

Derek Kastner

04/28/2009 3:28pm PDT

I’m interested in a way to test JavaScript’s interaction with the DOM on a specific page from the command line (no GUI browser required). Any chance of seeing that?