Skip to content
forked from theintern/intern

A next-generation code testing stack for JavaScript.

License

Notifications You must be signed in to change notification settings

douathao/intern

Repository files navigation

The Dojo Test Stack

The Dojo Test Stack is a collection of JavaScript modules designed to work together to help you write consistent, high-quality test cases for your JavaScript libraries and applications.

Does my app need to use Dojo to use Dojo Test Stack?

No! Dojo Test Stack uses Dojo but can be used to test any JavaScript code. Its functional testing interface can even be used to test non-JavaScript Web apps if you really want.

This repository

This repository is an experimental repository for the next major version of the Dojo Toolkit. However, at this point it is extremely likely that this project will be finalised and maintained, so please feel free to start using it as long as you can put up with some API churn until it reaches alpha.

Features

  • 100% AMD, 100% Promises/A-based API
  • Instant one-off test execution in the browser or Node.js
  • Full statement, branch, function, and line code coverage reporting with Istanbul
  • Functional testing using the standard WebDriver API with a fluid, promises-wrapped WD.js
  • Integration with Sauce Labs for super simple continuous integration
  • Tested with Travis CI
  • Extensible interfaces (comes with TDD, BDD, and objects)
  • Extensible reporters (comes with basic console and WebDriver reporters, lcov and tap output planned)

How to write tests

dojo2-teststack currently comes with support for 3 different test interface: TDD, BDD, and object-oriented. There will be more instructions here soon; for now, https://github.com/csnover/dojo2-core/blob/master/test/cookie.js demonstrates writing both synchronous and asynchronous tests. The assertion library currently bundled is not recommended and will be going away. Anything that throws errors will work just fine, so go nuts with Chai or whatever your preferred AMD-compatible assertion library might be.

How to run

First:

  1. git clone --recursive https://github.com/csnover/dojo2-teststack.git as a sibling directory of the package you want to test

Then, for a stand-alone browser client:

  1. Navigate to http://path/to/dojo2-teststack/client.html?suites=mid/of/testsuite&suites=mid/of/othersuite
  2. View console
  3. Fix bugs

Or, for a stand-alone Node.js client:

  1. Run node client.js suites=mid/of/testsuite suites=mid/of/othersuite
  2. View console
  3. Fix bugs

Or, as an amazing fully-featured automated test runner:

  1. Create a teststack configuration file describing your desired test environment, like the one at https://github.com/csnover/dojo2-core/blob/master/test/teststack.js
  2. cd dojo2-teststack
  3. node runner.js config=mid/of/teststack/config
  4. View console
  5. Fix bugs

…plus CI support:

  1. Create a .travis.yml like the one at https://github.com/csnover/dojo2-core/blob/master/.travis.yml
  2. Enable Travis-CI for your GitHub account
  3. That’s it! Easy continuous integration is easy.

License

New BSD License © 2012–2013 Colin Snover http://zetafleet.com. Released under Dojo Foundation CLA.

About

A next-generation code testing stack for JavaScript.

Resources

License

Stars

Watchers

Forks

Packages

No packages published