JavaScript Testing in Rails: Fast, Headless, In-Browser. Pick Any Three.
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:
- Choosing and configuring a JavaScript testing framework
- Writing RSpec-style specifications for test-first JavaScript development
- Adding jQuery, Prototype, or other libraries to the mix
- Coding in true red-green-refactor fashion with TextMate
- Running tests in the browser
- Running JavaScript tests headlessly with Rake
- Automating your tests with Continuous Integration
[1] http://github.com/relevance/javascript_testing
People planning to attend this session also want to see:
Larry Karnowski
Relevance, Inc.
Larry Karnowski has been designing and developing software applications—mostly network management tools—for almost fifteen years. His biggest passion is solving problems for real people—creating user interfaces that let users kick ass. In addition to hard technical skills like Ruby, Java, etc., he brings experience in usability, product design, and uncovering what users really need.
Jason Rudolph
Relevance, Inc.
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 on this page are now closed.














Comments
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.
@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.
@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.
Nice job guys and an excellent job of live demo/programming.
I really liked your session. Have you guys already tested any code using jquery.live or jquery.livequery?
Nice presentation with a clear story. The slides and the live-coding were hard to read. (This has been a problem in every session.)
@Derek: We are definitely covering that.
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?