Book Image

Backbone.js Testing

By : Ryan Glenn Roemer
Book Image

Backbone.js Testing

By: Ryan Glenn Roemer

Overview of this book

Table of Contents (13 chapters)
Backbone.js Testing
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Choosing a test style that fits


Mocha and Chai both provide different library interfaces for writing tests. This conveniently allows developers to choose an appropriate test paradigm or style for different projects while still leveraging the same underlying functionality.

Mocha test interfaces

Mocha currently offers four interfaces for test suites and specifications:

  • The Behavior-Driven Development (BDD) interface: This interface uses test constructs similar to those popularized by the Ruby RSpec framework (http://rspec.info/).

  • The Test-Driven Development (TDD) interface: This interface uses more traditional unit test keywords such as suite and test.

  • The exports interface: This interface utilizes a modular format familiar to Node.js/CommonJS developers, implementing the test functionality as properties of a module.exports object.

  • The QUnit-styled interface: This interface uses a flat declaration paradigm taken from the popular QUnit test framework (http://qunitjs.com/). A suite in this style...