Automated Unit Testing for JavaScript

March 3, 2010 by Patrik Henningsson in Monday School 2 Comments » ()

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).

This website uses IntenseDebate comments, but they are not currently loaded because either your browser doesn't support JavaScript, or they didn't load fast enough.

  1. 2 Responses to “Automated Unit Testing for JavaScript”

  2. Since you use Ruby, you might also want to look at the Ruby/Spidermonkey fork of env.js at http://github.com/smparkes/env-js.

    By Steven Parkes on Mar 3, 2010

  3. Thanks for the tip but in fact we're using TestCase without using Ruby. But if we starting use Ruby, I'll definitely take a look at it.

    By pahen on Mar 4, 2010

Post a Comment