In JUnit you can use @Ignore
before methods to tell the test runner to automatically skip those tests. From what I can gather, this is really only a convenient way
A method with no annotation most likely is a utility method, likely used by other methods in the test.
A commented-out method is one that is completely hidden.
But you might use @Ignore
to indicate that you are temporarily disabling the test. If you have a large and complicated piece of code that is in transition, you might want to temporarily disable some tests while that code is failing, especially if the mechanism running that code is run as part of some larger regression suite. The @Ignore
attribute would be a reminder to you (or your QA team) that there is still more to do.
Remember that @Ignore
'd tests are still live code, and can be seen and even executed via reflection, which commented-out code cannot be. And it also means when you refactor other code, they are also updated, and syntax breakage in an API will show there. So even tests with @Ignore
set can actively contribute to quality of code.
JUnit 4 TestRunners will show @Ignore
'd tests as "skipped" so you can see in the end how many tests passed/failed/skipped.
Although your copy of Netbeans may not take full advantage of @Ignore, I can assure you that it is not the only consumer of JUnit tests.