I'm very interested in learning more about how people are doing unit-testing in functional languages. My personal experience has been with OUnit and HUnit for OCaml and Haskell respectively. These frameworks get the job done but they felt foreign to me when I was using them.
Perhaps my feeling stemmed from an unfamiliarity with functional programming in general but I think it had more to do with the fact that these frameworks were trying to be just another xUnit. (Not XUnit but xUnit.) There's definitely a benefit to be had in reusing things that are already well-known but I think this gives short shrift to functional programs.
My current thoughts on the matter are ultimately being expressed in the FsUnit project where I plan to bring inspiration from my favorite frameworks. RSpec is probably at the top of the list which is apparent in my choice of keywords.
Functional programming is a perfect fit for unit testing: no side-effects; small, composable units; deterministic paths; idempotence. These are some of the most important qualities of programs that make them testable. Add to that a deep support for language-oriented programming and we have fertile ground for test-driven development and the likes.
If you have experience unit testing in functional languages, I would love to get example code and/or resources.
No comments:
Post a Comment