node package manager


Montage Testing

MontageJS uses some pure unit tests that are straightforward Jasmine specs.

To install the test code, run npm install in your project folder. This installs the montage-testing package, which adds some useful utilities for writing jasmine tests. You will need the file run-tests.html.

For an example of how we implement unit testing, see the digit repository:

  • run-tests loads our test environment.
  • data-module="test/all" inside the final script tag tells the system to load test/all.js.
  • all.js specifies a list of module ids for the runner to execute.

Note that in this example, all the tests load a page in an iframe using TestPageLoader.queueTest(). These are akin to integration tests since they test the component in a real environment.

We also test some components by mocking their dependencies.

Last edited: March 12, 2014