Hanoi: Automated jQuery tests with QUnit
About a month ago, we have released adva-cms 0.2.0, the most relevant change was the migration from Prototype to jQuery. I always been a loyal Prototype fan, and, until then, I always tested my code with `unittest.js`, combined with `jstest.rb`.
Like other rewrite we needed to rely on a solid test layer, but what I noticed was the lack of a valid automation support for QUnit, the test framework used internally by the jQuery team. So, in a couple of days I built what we need, just creating a custom version of jstest.rb
and changing a little bit QUnit, in order to communicate with it.
Now I extracted a the general purpose code for testing other JavaScript projects, the result is Hanoi.
Hanoi needs a working Rake installation and it’s capable to test your JavaScript code, collecting the results inside the shell. It currently supports assets, and fixtures, and it’s pretty easy to use.
First of all you need to install the gem:
(sudo) gem install jodosha-hanoi -s http://gems.github.com
Then you have to initialize your project path, with the hanoi
executable:
hanoi /path/to/project
Now, you can easily run the test suite:
rake test:js
You can find more details on the GitHub page.