I have written a ScalaCheck test case within Specs2. The test case gives up because too many tests were discarded. However, it doesn’t tell me why they were discarded. How can I find out why?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Set a breakpoint on the
org.scalacheck.Gen.failmethod and see what is calling it.Incidentally, in my case the problem was twofold:
I had set
maxDiscardedto a value (1) that was too small, because I was being too optimistic – I didn’t realise that ScalaCheck would start at a collection of size 0 by default even if I asked for a non-empty collection (I don’t know why it does this).I was generating collections of size 1 and up, even though, as I later realised, they should have been of size 2 and up for what I was trying to test – which was causing further discards in later generators based on that generator.