Testing

NOTE: this page is deprecated. I am not updating it anymore.


By Artyom Kazak aka @availablegreen
Last update: January 5, 2021

Testing framework

Both hspec and tasty are fine.

Somebody has spread a vile lie that hspec only has unit tests, while tasty has everything. Nope! They both have everything.

The reason I'm enraged by this lie is that I like hspec's syntax more and don't want to see it dismissed for a wrong reason.

However, I think both are good enough, and I will use whatever other people on the project are more familiar with. For my own libraries I go with hspec.

Property tests

Probably Hedgehog.

For property tests, I would go with Hedgehog instead of QuickCheck, but it's been a while since I used either.

Doctests

Probably cabal-docspec (not yet on Hackage).

The default choice is cabal-doctest. However, 'lens' (a heavy user of doctests) has recently switched to cabal-docspec, and judging by the PR, it is indeed easier to use, so the next time I want doctests I would try cabal-docspec.