Re: [Haskell-cafe] Unit testing in Haskell

I find that I don't need unit testing frameworks. A few features of Haskell and the associated interpreters (ghci and hugs) combine to make "unit testing as you go" really easy. I just write a few tests for each function I write and then some more module wide tests once the whole module is finished. Sometimes I need a little scaffolding to be able to output complex data types (or type synonyms), but often just deriving Show does the job!
To me, unit testing is two things - testing at a low level (each and every function_ - regression testing by running all the unit tests again
The second may benefit more from the frameworks, but I find the first can be done very effectively on an "ad-hoc" basis.
Matt
On 12/01/2005, at 6:05 AM, Dmitri Pissarenko wrote:
Hello!
When programming in an imperative language like Java, unit tests are a very important development tool IMHO.
I want to try out unit testing in Haskell and wonder what experienced Haskellers think about unit testing in Haskell in general and the hUnit testing framework (see URL below) in particular?
What other unit testing frameworks for Haskell do you use?
TIA
dap -- Dmitri Pissarenko Software Engineer http://dapissarenko.com _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Matthew Roberts
I find that I don't need unit testing frameworks. A few features of Haskell and the associated interpreters (ghci and hugs) combine to make "unit testing as you go" really easy. I just write a few tests for each function I write and then some more module wide tests once the whole module is finished. Sometimes I need a little scaffolding to be able to output complex data types (or type synonyms), but often just deriving Show does the job!
It seems to me that if you're going to take the time to craft some ad-hoc tests in the interpreter, you might as well take an extra few seconds to put them into HUnit tests so you can make sure they still pass later. This gives you more confidence while you are refactoring your code. peace, isaac
participants (2)
-
Isaac Jones
-
Matthew Roberts