[]
Continuous Integration with JavaScript
[ tirsen ] 04:14, Thursday, 18 August 2005

It was when I for the umptenth time broke another unit test in script.aculo.us that I decided that it just had to be enough! We need continuous integration for these buggered JavaScript unit tests.

Rake to the rescue!

After some hacking around on the ferry to work I had the solution!

desc "Runs all the JavaScript unit tests and collects the results"
JavaScriptTestTask.new(:unittest) do |t|
  t.mount("/lib")
  t.mount("/src")
  t.mount("/test")
  
  t.run("/test/unit/unittest_test.html")
  t.run("/test/unit/ajax_inplaceeditor_test.html")
  t.run("/test/unit/string_test.html")
  t.run("/test/unit/builder_test.html")
  
  t.browser(:safari)
  t.browser(:firefox)
end

This will start a WEBRick server with the specified files mounted, run all the combinations of browsers and tests and report back the results:

beatrix:~/Projects/rails/spinoffs/scriptaculous tirsen$ rake unittest
(in /Users/tirsen/Projects/rails/spinoffs/scriptaculous)
/test/unit/unittest_test.html on Safari: FAILURE
/test/unit/ajax_inplaceeditor_test.html on Safari: ERROR
/test/unit/string_test.html on Safari: SUCCESS
/test/unit/builder_test.html on Safari: FAILURE
/test/unit/unittest_test.html on Firefox: SUCCESS
/test/unit/ajax_inplaceeditor_test.html on Firefox: SUCCESS
/test/unit/string_test.html on Firefox: SUCCESS
/test/unit/builder_test.html on Firefox: SUCCESS

Coming to a script.aculo.us SVN repository near you soon!

(Caveat: Only works on the Mac at the moment. Maybe it's time to switch like the rest of the world.)


Comments

Nice solution, but:
- most of the users don't use Macs
- lot of people can't 'switch' even if they would like to. Except for hobby, most employees can't choose what platform to use at work.
- the 'rest of the world' is not switching (only in Jobs dream maybe).
- for most of the people in this world (you can look at the CIA statistics) even a mini-Mac is prohibitive.

just my 2 cents :).

regards,

Jake.

--Jake Robwood, August 18, 2005 12:27 PM

Chill out Jake, he said *at the moment* it only supports Macs...

Maybe we can all raise some moola to buy Jake a mini...

--Tim Lucas, August 18, 2005 04:07 PM

Sorry,
but everywhere on RoR related places I see the 'get a Mac' as 'solution'. Even all the video demonstrations are made with Macs :) .
I have a Mac, but I'm not allowed to bring it with me at work :).

regards,
Jake.

--Jake Robwood, August 18, 2005 05:41 PM

You're not allowed to bring you Mac with you to work!? That's just insane. Maybe it's time to switch work as well...?

--Jon Tirsen, August 19, 2005 05:59 AM

> Maybe it's time to switch work as well...?
Good idea, but my wife would not agree :), err
wait, ..., maybe it's time to switch the wife as well...? :).

regards,
Jake.

--Jake Robwood, August 19, 2005 10:03 PM

Mac's good. It's sad to live in the world running Linux on servers and Win on desktops. where's trouble? in world or in Mac's? Please, fire it up on other OSes. You're surely do right things.
and please ex-cuse my English - i'm just using most popular lang (Chinese, you wouldn't guess!) ;-))

--Vake, October 8, 2006 05:30 PM
Post a comment









Remember personal info?