Main Content

Client Side Unit Testing for Single Page Applications

A talk by John K. Paul

About the Talk

August 20, 2012 3:00 PM



The unit testing web developer population, in general, has been growing by leaps and bounds, but sadly those gains haven’t been as steady on the client side. I’d like to address a few of the reasons why that is, and how we can change that by unit testing our client side application code as thoroughly as possible.

Most unit testing examples focus on very straightforward imperative tests. I have seen many explanations of JavaScript unit testing that describe how to verify the logic behind a calculator or a form validation library, but not how to test a more complex, event triggered application. I’ll walk you through a simple unit tested Backbone application and explain some design tips for effectively unit testing your code along the way. After that, I will explain how to effectively mock Ajax requests and trigger Ajax events from your unit tests.

I will also be giving a short introduction to the grunt build tool. I’ll show you how to setup grunt in such a way that your test output can be easily integrated with your continuous integration suite as well as run every time you change a file. Hopefully, eventually, we’ll all be able to have the confidence inspired by the green and red lights on a build monitor, on both sides of the great HTTP divide.

Ratings and Recommendations

Avg. Rating

Average based
on 4 ratings

comments powered by Disqus