Space Home
About Sumatra
Sumatra is a testing framework for javascript code written in Groovy.
On a number of projects recently, I have found myself writing a lot of javascript code and have found that I didn't have a good way of testing this code. I created Sumatra so that I could write tests in Groovy that would execute this growing mass of JavaScript code.
Get the code
svn co http://svn.assembla.com/svn/sumatra/trunk/sumatra
Run the examples
From the command line, execute ./runExamples.sh
Take a tour of Sumatra
The best way to understand how Sumatra works and how it makes testing javascript code easier is to look at working examples and see the code in action.
Walk through the examples:
- examples/0_interactive/InteractiveJavascriptTest.groovy
- examples/1_conference/ConferenceTest.groovy
- examples/2_browser/ExpandElementTest.groovy
- examples/3_prototype/ExpandElementWithPrototypeTest.groovy
Walk through the source in src/groovy/rhinounit/groovy/:
- SumatraTestCase.groovy - base test case
- RhinoJsWrapper.groovy - wrapper for Rhino objects using Groovy MetaProgramming to intercept attribute access and method calls
- RhinoJsBuilder.groovy - builder for javascript objects, etc
- Rhino.groovy - interface wrapper for Rhino calls
Where are the tests?
Unfortunately, they're still sorely needed. Volunteers welcome.
What's the future of Sumatra?
I have some thoughts about additional features, but nothing concrete. Check out Sumatra.todo in the project. Again, volunteers welcome.