-
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
Tests annotated with @Test(expected = AssumptionViolatedException.class)
will be marked as skipped instead of passing
#1290
Labels
Milestone
Comments
alb-i986
added a commit
to alb-i986/junit
that referenced
this issue
May 12, 2016
In case a test is expecting AssumptionViolatedException by using the attribute 'expected' of the @test annotation, the test will actually be marked as skipped by IDEA and mvn, as if the AssumptionViolatedException had been thrown up in the stack. See issue junit-team#1290
alb-i986
added a commit
to alb-i986/junit
that referenced
this issue
May 12, 2016
Tests annotated with `@Test(expected = AssumptionViolatedException.class)` which throw AssumptionViolatedException should be marked as passing, not skipped.
I think I got it. See #1291 |
alb-i986
added a commit
to alb-i986/junit
that referenced
this issue
May 14, 2016
Use a try/catch block instead of the attribute 'expected' of the @test annotation. See bug junit-team#1290. See discussion on junit-team#1289.
marcphilipp
pushed a commit
that referenced
this issue
May 14, 2016
What's the status of this issue? Is it fixed? |
@adrianosimoes there is a fix in #1291 by @alb-i986 but there were some issues with the tests and the pull languished. Alberto, any chance you can make the requested changes? |
Sure, I'll try to finish it asap. |
@kcooney I hope I haven't missed anything. Please check it out. |
sebasjm
pushed a commit
to sebasjm/junit4
that referenced
this issue
Mar 11, 2018
…d, not skipped (junit-team#1291) Tests annotated with `@Test(expected = AssumptionViolatedException.class)` which throw AssumptionViolatedException should be marked as passing, not skipped. Fixes junit-team#1290
aristotle0x01
pushed a commit
to aristotle0x01/junit4
that referenced
this issue
Jun 27, 2022
…d, not skipped (junit-team#1291) Tests annotated with `@Test(expected = AssumptionViolatedException.class)` which throw AssumptionViolatedException should be marked as passing, not skipped. Fixes junit-team#1290
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When using
@Test(expected = AssumptionViolatedException.class)
the test will actually be marked as skipped instead of passing, as if the AssumptionViolatedException were thrown up in the stack.In fact that's what seems to happen: https://github.com/junit-team/junit4/blob/master/src/main/java/org/junit/internal/runners/statements/ExpectException.java#L22
I've found this bug while doing #1289, while inspecting our skipped unit tests.
See e.g. https://github.com/junit-team/junit4/blob/master/src/test/java/org/junit/tests/experimental/AssumptionTest.java#L80
But maybe this is actually working as expected. I mean, no one should ever expect AssumptionViolatedException. It can happen only to us, in our unit tests. Wherever we need to, we have to use a try/catch block instead.
@stefanbirkner You seem to have worked on assumptions quite a lot, can you please advise?
The text was updated successfully, but these errors were encountered: