O'Reilly logo

Backbone.js Cookbook by Vadim Mirgorod

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Writing tests for a Backbone extension with QUnit

If you are working on a complex project or a Backbone extension, you need to make sure that the new commits do not break any existing functionality. This is why many developers choose to create tests prior to or after writing new code.

For JavaScript applications, there are a good number of different testing tools that perfectly integrate with Backbone. In this recipe, we are going to learn one of the tools named QUnit.

When we were building our project from a template using Grunt, QUnit was included in the project, and the test/mongodb.js file was created. Let's add a simple test to the extension we did in the previous recipe.

How to do it...

Perform the following steps to test an application:

  1. Edit ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required