PacktLib: Backbone.js Testing

Backbone.js Testing


About the Author

About the Reviewers


Setting Up a Test Infrastructure

Designing an application and test repository structure

Getting the test libraries

Setting up and writing our first tests

Running and assessing test results


Creating a Backbone.js Application Test Plan

A Backbone.js refresher

Selecting a Backbone.js application to test

Test paradigms and methods

Testing concepts, approaches, and planning

Testing individual Backbone.js components

Testing application interactions and events

Dipping our toes in the application testing waters

Running the application tests


Test Assertions, Specs, and Suites

Choosing a test style that fits

Trying out some different styles

A tour of the Chai assertion library

Getting the application and tests ready to run

Writing Mocha test specifications

Testing and supporting Backbone.js views

Aggregating and running the application tests

Test development tips, tricks, and hints


Test Spies

Fake it 'til you make it

Getting to know Sinon.JS

Spicing up Chai with the Sinon.JS plugin

Testing Backbone.js components with spies


Test Stubs and Mocks

Replacing method behaviors with Sinon.JS stubs

Faking and verifying behavior with Sinon.JS mocks

Testing Backbone.js components with stubs and mocks

Finding the rest of the Notes application components

A few more Sinon.JS test helpers


Automated Web Testing

The world of testing beyond humans and browsers

Automating browser environments

Headless testing with PhantomJS

Parting thoughts, next steps, and future ideas