Running Unit Test with Org Mode

Frédérick Giasson has a nice post in which he describes how he uses Org mode to run unit tests on his code. Actually, his goal is to combine the writing, documentation, and testing of his code in a single document using a single tool.

His mechanism for this is to use Literate Programming in Org and to put the tests in the same file next to the function that they’re meant to test. He describes this in terms of Clojure but the technique is obviously generally applicable.

One possible problem with this procedure is if you’re working in a team and not everyone is an Emacs user. Non Emacs users won’t be keen to tangle an Org document to get the code and probably won’t feel comfortable making changes to an Org file. Unless everyone you’re working with is an Emacs user or you’re working alone, this means that Giasson’s workflow will have to be limited to initial development. Still, it’s a powerful technique and well worth experimenting with.

This entry was posted in Programming and tagged , . Bookmark the permalink.