Frontend web applications are soaring in popularity and the Backbone.js library is leading this charge with a modular, lightweight approach for organizing JavaScript web applications. At the same time, testing client-side JavaScript and Backbone.js programs remains a difficult and tedious undertaking.
Backbone.js Testing brings sensible practices and current techniques to the challenges of Backbone.js test development. The book introduces fundamental testing concepts, comprehensive test infrastructure design, and practical exercises to easily and systematically test modern JavaScript web applications.
The book progresses from Mocha test suites and Chai assertions to advanced test mocks and stubs with Sinon.JS. The requisite libraries and utilities are introduced with in-depth examples and best practices for integration with your applications. The book guides you through the test planning and implementation processes for your application models, views, routers, and other Backbone.js components.
Backbone.js Testing gives you the tools, examples, and assistance to test your Backbone.js web applications thoroughly, quickly, and with confidence.
Approach
This book is packed with step-by-step tutorials and instructions in recipe format to help you create test infrastructures and gradually advance your Backbone.js application development and testing skills.
Who this book is for
If you are a JavaScript developer looking to create and implement test support for your Backbone.js applications, then this book is ideal for you.
At the very begin of the book, the author mentioned that, for the sake of showing tests, there would be a complete application to be used as an example. My thought, at this point was: Finally, a book talking more about how to connect Backbone elements than Backbone.js Essentials. Well, I was mistaken.
There isn't much of Backbone itself in this book. When it says "Backbone.js Testing", it actually means that Backbone is just a background thingy to talk about Mocha, Chai and Sinon. If the author decided to write a "React.js Testing", there wouldn't be more much in the topics, just a few adjustments there and there.
This means this book is back? Actually not. Although not focusing directly on Backbone, it does focus a lot on testing and all related libraries. Even if you don't work with Backbone -- but have at least some general idea about how it works -- it is a damn good book about JavaScript testing.
Equips You with All the Tools and Leaves out the Clutter
This books explains all the tools you'll need to test you Backbone.js application and does so in a strait forward and simple fashion. The structure of sample code files was basic enough that you could easily find the correct files referred to by the book. I literally could write my own tests on my personal application as I was progressing through the book!
The further you read, the better it gets. Initial chapters are very basic & won't teach you anything you couldn't find on the web in 15 mins, but the final chapters are much better: there's a lot of fiddling with: * spies & stubs * Backbone views & models via attaching ancillary event listeners
I've found them very useful - great reminder what you could achieve with some tinkering.