I would like to know, if I write my own custom RunNotifier (and Overwrite the methods from the default one), will this methods like fireTestFailure() be automatically called when a test fails?
http://junit.sourceforge.net/javadoc/org/junit/runner/notification/RunNotifier.html#RunNotifier()
Another way to ask: can I use this methods like I would overwrite and use custom RunListener Methods?
RunNotifieris called by the classes which execute the tests. It calls eachRunListenerfor the test (there can be more than one). If you’re implementing your ownRunner, you may want to implement your ownRunNotifier, but in general you don’t need to. It’s theRunnerwhich calls theRunNotifier, which in turn calls eachRunListener.If you are implementing your own Runner, look at JUnitCore, which does pretty much everything you want. And then for each test failure, you would call the RunNotifier. If you inherit from JUnitCore, then most of the methods are already there.
If you just want to be informed of the progress of a test, use
RunListener.