
Unit-testing
Backbone Views is hard. You need to cover enough for the test to be meaningful (for example DOM updates and server calls), without getting too tangled up in gory details. In this post I'll talk about how we use
QUnit and
Sinon.JS to unit-test our Backbone views.
There's already
material out there on using these frameworks together, so I'm not going to get into setting things up. However, having done it for a year now I feel I've learnt enough additional tips, tricks and traps to warrant sharing them with the world.
This post will cover the three things you
have to think about when testing Backbone Views, then talk about three strategies for simplifying your tests. I'll also share some more general thoughts on Backbone's suitableness for building large apps.
27 June, 2013
/