Here's a patch that gives the full stack trace when a property or generator throws an exception. I find this makes it much easier to work out what's going wrong with the code I'm testing.
The patch is against the 0.9.4 tag.
Cheers Rich
--
Index: app/src/org/scalatest/prop/Checkers.scala ===================================== ============================== --- app/src/org/scalatest/prop/Checkers.scala (revision 815) +++ app/src/org/scalatest/prop/Checkers.scala (working copy) @@ -227,9 +227,11 @@ result.discarded + " tests were discarded." case Test.PropException(args, e, labels) => "Exception \"" + e + "\" raised on property evaluation:\n" + - prettyArgs(args) + prettyArgs(args) + ";\n" + + prettyThrowable(e) case Test.GenException(e) => - "Exception \"" + e + "\" raised on argument generation." + "Exception \"" + e + "\" raised on argument generation: \n" + + prettyThrowable(e) }
That's a nice enhancement. I'd like to include it in 0.9.5, which will be out soon, but I'll need a contributors agreement from you. I'll follow up via email.
OK. I just checked something in for this. I didn't use your patch, because it would have really elongated the failure message. Where the info belongs is in the stack trace, so what I did was add the thrown exception as the cause of the TestFailedException (and I put a note to that effect in the failure message). So you can look in the regular stack trace and you'll find the stack trace for the exception that originally caused the problem, in 0.9.5.