Skip to content

Running unit tests

Tim Branyen edited this page Jan 7, 2013 · 2 revisions

If you are contributing or consuming and encounter a bug you should make a unit test showing a failing case. Once you've written the test you will need to run the tests to ensure it fails.

Also once you've fixed the bug, you'll want to see that rewarding green!

Before you can run the tests you'll need the source, the easiest way is clone the repository.

git clone git://github.com/tbranyen/backbone.layoutmanager.git

Running in a browser

This is a good way to ensure LayoutManager works in a specific browser. Simply open test/index.html in your browser of choice. If you notice tests failing in that particular browser, open an issue and let us know.

Running headless

This is significantly more useful when bug and feature testing since you can automate and have them run whenever you make a change. This is also the only way to test the Node.js tests.

  1. Install Node.js.
  2. Using NPM, install Grunt.
  3. Navigate into the project directory.

You'll need to install the project's development dependencies, you can do this by running:

npm install

Finally, you can lint, run headless browser tests, and run the Node.js tests by executing the following command:

grunt

You can also run specific tests:

# For the headless browser tests.
grunt qunit

# For the Node.js tests.
grunt nodequnit