Thu Sep 14 15:58:00 UTC 2006
I’m going to write this post live; hopefully it won’t just come across as a mish-mash of incoherent ramblings.
alert. it can be useful sometimes but it generally doesn’t offer anything interesting. Use it sparingly.
- Some options exist already, such as jsunit. These have their problems, such as awkward syntax or problems with Prototype.
- Scriptaculous has its own unittest.js library. All you need to do is include the unittest.js file and an empty
divwith a “testlog” HTML ID (defaults). Now you’re ready to roll with Test.Unit.Runner.
- Test.Unit.Runner looks quite similar to the standard xUnit family of testing libraries. It has the standard setup and teardown methods and a suite of assertions.
- It has some good testing functionality for dealing with effects, and time-sensitive behaviour (wait function).
- It has a basic benchmarking system too!
- Did I mention the browser-based test runner looks pretty sweet?
- OK, here’s the killer feature so far: RSpec-style syntax, including should* style expectations and context/spec format. I’m convinced, sign me up!
- Don’t forget your RJS templates either. RJS has some basic debugging support built-in (although this could really do with being expanded upon).
Finally, a word of warning for those who want to try a bit of live blogging: IRC is evil and distracting. Use with caution!