Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@EugeneLoy
Last active August 29, 2015 14:02
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save EugeneLoy/9fcdd9801a86253629f4 to your computer and use it in GitHub Desktop.
Save EugeneLoy/9fcdd9801a86253629f4 to your computer and use it in GitHub Desktop.
Add this field to your test class to log names of the tests when they start. Works with JUnit 4.9+ and SLF4J.
@Rule
public TestRule loggingRule = new TestWatcher() {
protected void starting(Description description) {
Logger logger = LoggerFactory.getLogger(description.getClassName());
logger.info("Starting: {}", description.getMethodName());
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment