Finally, someone wrote a version of doctest for Ruby.
Recently I’ve been writing most of my tests using stand-alone doctest files. It’s a great way to do TDD — mostly because the cognitive load is so low. Also, I write my examples but don’t write my output, then copy the output after visually confirming it is correct. So the basic pattern is:
- Figure out what I want to do
- Figure out how I want to test it
- Automate my conditions
- Manually inspect whether the output is correct (i.e., implement and debug)
- Copy the output so that in the future the manual process is automated (doctest-mode for Emacs makes this particularly easy)
The result is a really good balance of manual and automated testing, I think giving you the benefit of both processes — the ease of manual testing, and the robustness of automated testing.
Another good thing about doctest is it doesn’t let you hide any boilerplate and setup. If it’s easy to use doctest, it’s probably easy to use the library.
There’s nothing Python-specific about doctest (e.g., doctestjs), so it’s good to see it moving to other languages. Even if the language doesn’t have a REPL, IMHO it’s worth inventing it just for this.
Paddy3118 | 23-Aug-07 at 11:42 pm | Permalink
Its great to see the idea of doctest spreading - every Dynamic language with a shell interface should have it!
Maybe someone should prompt those Perl 6 guys :-)
Thinking about these new versions made me add to the doctest wikipedia page a comment about not mentioning on the wiki page until they became language standards though. This in turn gave me a great way of tidying-up the wikipedia Duck Typing entry so thanks.
roger | 02-Apr-08 at 8:57 am | Permalink
Yea! one less lib for me to write :)