Created
August 23, 2014 06:18
-
-
Save alinush/d937094f314771eb1218 to your computer and use it in GitHub Desktop.
Java JUnit TestWatcher
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Rule | |
public TestWatcher watchman = new TestWatcher() { | |
@Override | |
protected void starting(final Description description) { | |
String methodName = description.getMethodName(); | |
String className = description.getClassName(); | |
className = className.substring(className.lastIndexOf('.') + 1); | |
System.out.println("\n * Running " + className + "::" + methodName); | |
} | |
@Override | |
protected void failed(Throwable e, Description description) { | |
someTestsFailed = true; | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this to any of your JUnit test case classes if you want notifications about tests failing.