utdemir / hs-nix-template

A Haskell project template that uses Nix and comes with cabal-install, ghcid, ormolu, haskell-language-server and more.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Change testing framework to tasty-discover

utdemir opened this issue · comments

I'm thinking of changing the test framework to tasty-discover. The reason is that, it also supports more conventional unit tests rather than property tests.

What do you think @Skyfold ?

Edit: Looks like tasty-discover is not maintained. Maybe we can just go to plain tasty. Do you know any alternatives which supports both property tests and unit tests?

I've been using tasty (testing framework) with tasty-hedgehog and hedgehog, where I mostly use Hedgehog's state machine based testing. The only benefit tasty brings (that I have used) is a hierarchy on top of your tests for organization and selecting what tests to run, while tasty-hedgehog just wraps a property (from hedgehog) inside a TestTree.

Given you want to write unit tests, tasty by itself should meet that need, just like hspec would (I haven't spent enough time using hspec to give a good comparison between the two). It looks like hspec has possibly better maintained test discovery (given the last commit was in 2019 for hspec-discover instead of 2017 for tasty-th). If you find hspec better fits your needs I would be fine with switching.

I know of at least one use of tasty-discover in production if that affects any decisions.

I think I also agree with using hspec-discover over tasty, then again I haven't compared the two... though I just looked up the reddit announcment that asks about differences between Tasty and Hspec.

EDIT: Also Tasty wraps other test frameworks:

Besides HSpec, Tasty also wraps over other test-suite-libs; so you can use several test-suite-libs in one big Tasty-wrapped test suite, that has uniform command line options. - https://www.reddit.com/r/haskell/comments/2om545/doctest_v_hspec_v_htf_v_other/cmolt8y/

Thank you for the comments!

I found out that there's a way to use hedgehog as a unit test framework, just by using withTests 1 :: Property -> Property function. I think it sufficient to my needs, so I'm closing this issue, but feel free to reopen if you think otherwise.