-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Assumption violation is not reflected on text UI #1525
Comments
Hello i want to contribute to JUnit i can take a look of this if it's ok |
If the concern is tools that are consuming the output, those tools would need to be updated to understand the changes proposed here. The proposed changes could break those tools in the interim. Given all that, the potential costs of the change may outweigh the benefits. An assumption failure isn't a failure; the test was skipped because the assumptions of the test were not true with the current parameters. So showing it as passed, while confusing to some users, might be correct for others. |
Of course we could have the output for assumption failures be 'I' like it is for ignored tests. That would match what Buck apparently does... |
I don't see how this is possible. A tool
+1. Still the preferred solution would be to add unique char say 'A' to differentiate assumption violations from ignored tests. |
@davido Users compile against a particular version if JUnit. Tools that run tests are often devoped using a different version of JUnit, but are designed to allow developers to upgrade to a newer version of JUnit without forcing them to upgrade the tool. In any case, tools that read the output of the text UI might break if the output changes. No idea how likely that is. Let's just have assumption failures print out an "I" @JxJxJxMxNxS we would be glad to have your help. |
Fine, I will look into it. |
Great! rest-core-1.3.jar org.junit.runner.JUnitCore PrintyTest
FAILURES!!! or in the Test run field should be just 2 tests? |
@davido Can you give us an example of a build tool that relies on JUnit text UI to report test outcome. |
Bazel, see my analysis in this issue: bazelbuild/bazel#3476. |
@davido last I checked Bazel installs a custom listener which produces Ant-style XML. |
My analysis was, that for its own output rendering standard log file produced by JUnit text UI is used. Ant-Style XML is produced for consumption by/integration with external tools. |
@davido I will respond on the Bazel bug |
For the record, I don't think this change would have any affect on that Bazel issue. |
@stefanbirkner So given that we no longer have examples of tools that parse the output, should we print something different for assumption failures? |
I feel it is a good idea. For me your proposal that we handle it like a normal ignore makes sense, because I consider failed assumptions as dynamic ignores. |
@stefanbirkner given the comments in In any case, I don't think we should change the meaning of the methods in Result.getIgnoredCount() so it starts including assumption failures. |
The whole assumption violation outcome was completely forgotten. That why my suggestion to get it right, and extend JUnit and make assumption violations first class citizens. By that I mean: 'A' char and add new method: |
Based on the comments, I think the authors assumed developers wouldn't want to think of assumption failures as any different than a passed test. Perhaps they didn't want to repeat the failures vs errors confusion of JUnit 3?
There is an abandoned pull request for this; see #1294 ... would you be able to help get it across the finish line? As for the text UI, I don't personally look at the output of periods and F's (it gets lost with all the other test output) but if you do, what about something simple like "-"? And wouldn't summary text at the end of the run be infinitely more useful? |
It would be helpful if assumption violations would be reflected on the text UI. For this test class with three test methods:
JUnit text UI produces this result:
The impression is that 2 tests were successful even though, only single test was successful and another one failed with assumption violation. This information is lost.
Compared to it the output from Buck build tool is:
This line reflects more accurately what happened:
You may wonder, why would I care to improve text JUnit UI; in the end devs are using dedicated build tools and IDE integrations and not
java -classpath sut.jar:junit.jar org.junit.runner.JUnitCore <test class>
?It turns out, that other build tools rely on JUnit text UI to report test outcome. Given that assumption violation is lost here, the other build tools also cannot offer more accurate test outcome.
The text was updated successfully, but these errors were encountered: