Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error reporting when using checkAssert #40

Open
danwallach opened this issue Feb 28, 2018 · 1 comment
Open

error reporting when using checkAssert #40

danwallach opened this issue Feb 28, 2018 · 1 comment

Comments

@danwallach
Copy link

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:

screen shot 2018-02-28 at 9 59 03 am

If you hit "click to see the difference", you'd expect to see something like <0> versus <1>. Instead, you see this:

screen shot 2018-02-28 at 9 59 52 am

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.

@danwallach
Copy link
Author

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(...);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant