What can cause JUnit to disregard @Ignore annotations?
In JUnit5 use @Disable
or @Disable("Reason text")
Make sure you are importing the right
@Ignore
. To be sure use@org.junit.Ignore
explicitly.Double check if your test is being executed by JUnit 4, not 3. The easiest way to do this is to either change the test name so it is not prefixed by
test
(now it shouldn't be executed at all and JUnit 4 does not need this prefix anyway) or examine your test case inheritance hierarchy: it shouldn't extend directly or indirectly fromjunit.framework.TestCase
(Junit 3 requirement).
I had this problem also even though JUnit 3 was not on my classpath. I believe that compatibility mode on Junit 4 picks up on the 'test' prefix in your testname and thus operates as JUnit 3 would rather than picking up the @Ignore. The solution is to rename your test.