1

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?

Will Sewell
  • 2,593
  • 2
  • 20
  • 39
  • 2
    [As far as I can see](https://github.com/haskell/test-framework/blob/master/quickcheck2/Test/Framework/Providers/QuickCheck2.hs) the seed gets only reported on error, never on success. – Zeta Feb 09 '16 at 16:30

1 Answers1

1

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

Josef Klotzner
  • 182
  • 1
  • 6
  • So is each element of that list the test seed? – Will Sewell Feb 21 '18 at 09:53
  • "So is each element of that list the test seed? – Will Sewell" ... when You write your own Generator, you can see by yourself: .. charGen :: Gen Char charGen = elements "abcd" .. prop_charToNumAndBackAgain :: Property prop_charToNumAndBackAgain = forAll charGen (\c -> chr (fromEnum c) == c) .. main :: IO () main = do verboseCheck prop_charToNumAndBackAgain .. *Tests> main Passed: 'd' Passed: 'c' Passed: 'a' Passed: 'd' – Josef Klotzner Feb 22 '18 at 15:14