CPS4/Z3ECM sprint, day 4, Javascript unit testing automation

For the last day of sprint, I wanted to set up a Javascript unit test automation,
in order to be able to run all Js unitests like Python tests are through buildbot.

Scriptaculous unit testing framework provides a way to do it: the tests results are sent to a url through an Ajax call.

More infos on unit testing javascript here: Scriptaculous Unit testing

Therefore, I have coded:

  • a small python script that launches html unit tests with mozilla-firefox, then close it
  • a small python http server that retrieves results sent by the javascript

Some caveats to correct before its useable in a Zope project:

  • Right now the results sent by the unit test is just a simple 'SUCESS' or 'ERROR' string, and I need to change it so I can get the full error log when they are errors, like the one displayed in the browser, and convert it to Python assertions.
  • The ajax call to send results is done from the filesystem html to the localhost. So a trick is needed to make cross-domain ajax posts. The python http server could be used to serve the html tests file as well to avoid this problem, so I would have a complete js test server.
  • It needs to work on IE as well, maybe through Wine

So to the question "Can I do TDD in JS as smoothly as in Python ?", I'd answer: "Yes, it's coming up :)"

You can check the work here: nuxeo.javascript cps tests

I might try to release the js test runner in a clean package sometimes, as it might be reused.

This entry contains a screencast, you should check it in a browser

Important announcement: Join the Nuxeo team and contribute to the Nuxeo project! We have open positions in France and the UK for open source Java EE developers and sales engineers, both junior and senior.

Like this post? Share it:


Trackback Pings

Trackback URL for this entry:
http://blogs.nuxeo.com/sections/blogs/tarek_ziade/2006_04_21_javascript-unit-testing-automation/tbping
Posted by Tarek Ziadé @ 04/21/2006 04:13 PM. - Categories: AJAX, cps, python, sprint, web, zope3 -  0 comments

Nuxeo Bloggers: Log in!
Nuxeo - Indesko - Nuxeo 5 Project
All content is copyrighted by their author.
CPSSkins is Copyright © 2003-2006 by Jean-Marc Orliaguet. | CPS is Copyright © 2002-2006 by Nuxeo SAS.