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.
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 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.
- 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)
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.
First:
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:
- Navigate to
http://path/to/dojo2-teststack/client.html?suites=mid/of/testsuite&suites=mid/of/othersuite
- View console
- Fix bugs
Or, for a stand-alone Node.js client:
- Run
node client.js suites=mid/of/testsuite suites=mid/of/othersuite
- View console
- Fix bugs
Or, as an amazing fully-featured automated test runner:
- 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
cd dojo2-teststack
node runner.js config=mid/of/teststack/config
- View console
- Fix bugs
…plus CI support:
- Create a
.travis.yml
like the one at https://github.com/csnover/dojo2-core/blob/master/.travis.yml - Enable Travis-CI for your GitHub account
- That’s it! Easy continuous integration is easy.
New BSD License © 2012–2013 Colin Snover http://zetafleet.com. Released under Dojo Foundation CLA.