Created
December 23, 2012 13:13
-
-
Save kranthilakum/4363347 to your computer and use it in GitHub Desktop.
An implementation of a Rule overriding TestWatcher methods. A class only to be used for logging test cases activities.
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
/** | |
* An implementation of a {@link Rule} overriding {@link TestWatcher} methods. | |
* A class only to be used for logging test cases activities. | |
* | |
* @author Kranthi Lakum | |
* | |
*/ | |
public class TestWatch extends TestWatcher | |
{ | |
// SLF4J Logger instance for this class. | |
private static Logger myLogger = LoggerFactory.getLogger(TestWatch.class.getName()); | |
@Override | |
protected void failed(Throwable e, Description description) | |
{ | |
myLogger.info("Testcase has failed: [{}] \n{}.", description.getMethodName(), e); | |
} | |
@Override | |
protected void succeeded(Description description) | |
{ | |
myLogger.info("Testcase has passed: [{}].", description.getMethodName()); | |
} | |
@Override | |
protected void starting(Description description) | |
{ | |
myLogger.info("Running testcase: [{}].", description.getMethodName()); | |
} | |
@Override | |
protected void finished(Description description) | |
{ | |
myLogger.info("Testing: [{}] has finished.", description.getMethodName()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment