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:
1 (sudo) gem install jodosha-hanoi -s http://gems.github.com
Then you have to initialize your project path, with the hanoi executable:
1 hanoi /path/to/project
Now, you can easily run the test suite:
1 rake test:js
You can find more details on the GitHub page.
advertising





Posted by Michelangelo Altamore on 2009-06-09 14:48:06 UTC (permalink)
Hello Luca, as I can understand unit testing of javascript code using jQuery in rails projects it's now easy as running a rake task! Thanks Luca, I'll have a look at it, I can definitely use it in some project of mine.
Very useful!
Posted by Luca Guidi on 2009-06-09 14:55:26 UTC (permalink)
Hi Michelangelo, thank you. Hanoi isn't Rails related, but a general purpose system, you just need Rake and nothing else.
Posted by Luca Guidi on 2009-06-09 15:13:42 UTC (permalink)
Hi Michelangelo, thank you. Hanoi isn't Rails related, but a general purpose system, you just need Rake and nothing else.
Posted by TJ Holowaychuk on 2009-06-15 15:45:35 UTC (permalink)
Use http://jspec.info ;) supports jQuery with many matchers