Automated Unit Testing for JavaScript

In our work towards Continuous Deployment and an improved approach to JavaScript we are missing one very important thing – automated unit testing for JavaScript. Currently we have have some tests written in TestCase that will run in the browser. But we need away to automate this without the need of a browser so we have started to look at some alternatives.

The solution we’re currently playing around with is Rhino + Env.js + QUnit.

Rhino is a JavaScript implementation written in Java and you can run it in a terminal, which harmonize with our aim for automation.

Env.js is a DOM implementation written entirely in JavaScript and will simulate the basic functions of a browser.

QUnit is simply the framework for the unit tests.

So far it looks very promising and it looks like we can do much of our testing in this environment. We will post more of our discoveries here later when we have done more testing, so stay tuned or follow me on twitter (@pahen).