Jasmine testing environment with XPCShell, revisited and enhanced
I’ve resurrected the idea of Jasmine testing in XPCShell. My adaptation will do several things:
- Download and extract the latest Gecko SDK based on branch (Aurora, Beta or Release)
- Generate concatenated “bin” and “test” files with a simple build system
- Launch XPCShell with the Jasmine tests
- Launch Mozilla Firefox with the Jasmine tests
- Allow you to re-build the project from within Mozilla Firefox by reloading the test page
- 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.
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.