Open danwallach opened 6 years ago
One other possibility: in JUnit5, they added the concept of a TestFactory --- a method that returns Iterable<DynamicTest>
where a DynamicTest is a string (name of the test) plus a lambda that is executed, and which might or might not have a failed assertion within.
It would be modestly clever to be able to write something like
@TestFactory
public Iterable<DynamicTest> testWhatever() {
return qtFactory().forAll(...).checkAssert(...);
}
I've got a number of QuickTheories tests using JUnit5's assertions and the
checkAssert()
feature. When you combine this with IntelliJ, here's a sample of the error output that appears when comparing the lengths of two lists that are supposed to be the same but there was a bug that made them differ:If you hit "click to see the difference", you'd expect to see something like
<0>
versus<1>
. Instead, you see this:I don't have a specific idea in mind for how to fix this. Some possibilities include:
Offer some way to configure QuickTheories to use slf4j and/or some other logging interface, such that the random seed and/or stack backtrace are logged separately, keeping the assertion failure report relatively clean.
Offer some way to integrate this with Gradle's test framework, with again the goal of separation between the values being compared, the stack backtrace, and the random seed.