Getting the application and tests ready to run

Now that we have the Chai assertion library API under our belts, it is time to write and organize the tests. While we have incidentally covered much of this material already, the concise core of a Mocha test infrastructure includes:

  • Test runner: Configures the overall test run and report
  • Test suites: One or more organization units grouping many specifications/tests
  • Setup/Teardown: Setting up a state for each test or suite run
  • Specifications: Writing the test functions

Starting at the highest level, we look at our test driver web page. As previously discussed, this is where our core application libraries, test libraries, and test specifications are set up and included. All of the Backbone.js application ...

Get Backbone.js Testing now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.