Jasmine testing with XPCShell, revisited

Jasmine testing environment with XPCShell, revisited and enhanced

I’ve resurrected the idea of Jasmine testing in XPCShell.  My adaptation will do several things:

  1. Download and extract the latest Gecko SDK based on branch (Aurora, Beta or Release)
  2. Generate concatenated “bin” and “test” files with a simple build system
  3. Launch XPCShell with the Jasmine tests
  4. Launch Mozilla Firefox with the Jasmine tests
  5. Allow you to re-build the project from within Mozilla Firefox by reloading the test page
  6. Remember where it parked the SDK, so you don’t have to download it repeatedly

Quick start guide:

hg clone http://hg.code.sf.net/p/verbosio/jasmine verbosio-jasmine
cd verbosio-jasmine
python project.py --update-sdk=release
python project.py test-xpc

(Note:  right now I have a dependency on ECMScript Harmony’s Set, so this won’t work with Gecko SDK 12, the current release.  But it will work with Gecko SDK 13, which is in beta.  Whoops.)

For actually writing your own code and tests, there’s a top-level build.directories file, which simply lists directories to iterate over. Each listed directory should have a build.modules file as well – sample-build/build.targets should be a good start to explain how it does its work.

Help wanted!  First of all, is this useful to you?  Do you feel like you can create a JavaScript project with build support for Jasmine, and test it more effectively, than with Firefox alone?

Second, what would make this more useful to you?

  • What documentation would make this easier to use?
  • I plan on adding XUL support at a later stage, because I will be working in XUL land eventually.
  • I also plan on writing a Firebug XPI fetcher as well, and incorporating that into the HTML world.

I plan on maintaining this code separately from my main work, because I think a foundation to build a project with tests is far more useful than a fully built-out project without a portable test environment.