haskellquickchecktest-framework

How to print the test seed in Haskell's test-framework?


The test-framework docs state that it supports "Reporting of the seed used upon a failed QuickCheck run, so you can reproduce the failure if necessary." However the default output does not display this, and I cannot find any command line option that will turn this on.

Is there a way of doing this in test-framework, or will I have to manually print the usedSeed from QuickCheck?


Solution

  • As i also was interested in the answer of this question it came to my mind, that result, searched for, is verbosed output of the test. This brought me to the answer on hoogle: https://www.haskell.org/hoogle/?hoogle=verboseCheck

    So instead of using quickCheck :: Testable prop => prop -> IO ()

    main = quickCheck propertyToTest
    

    giving just an output of:

    +++ OK, passed 100 tests.

    use verboseCheck :: Testable prop => prop -> IO ()

    main = verboseCheck propertyToTest
    

    giving verbosed, detailed output like this example for each test (Passed: for 100 times):

    Passed:
    [-83,-52,7,-3,-92,-52,21,18,48,-72,-93,74,-30,-1,88,57,39,-20,-92,-98,-85,8,-92,22,-83,82,-39,49,70,65,-35,-7,66,38,-76,92,0,-94,-28,68,43,21,-70,25,76,39,-31,-37,-30,-1,-39,-34,14,-5,-19,54,-21,-19,-3,10,68,74,50,13,-9,54,41,-78,-77,28,-17,76,-41,-51,17,-90,56,25,58,90]

    ... 99 others ...

    +++ OK, passed 100 tests.

    As there was no answer to this question and i got it by my own, i created an account here and share it