Announcement Announcement Module
Collapse
No announcement yet.
Logging the currently excecuting method name in Junit Tests Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Logging the currently excecuting method name in Junit Tests

    Hi All,
    This is a general question related to Spring and Junit. I running my unit tests using "AbstractJUnit4SpringContextTests" and Junit. When i am runnig my unit tests, i need to log the method name which it is currently executing. Please help. I tried with Spring AOP but it doesnt worked.

    Thanks.

  • #2
    If you are using Junit 4.7 or above, use a @Rule, as in this example:

    @Rule
    public TestName testMethodName = new TestName();


    @Test
    public void testFooForValidBar() throws Throwable {
    logger.debug("starting..." + testMethodName.getMethodName());

    Comment


    • #3
      I got solution.

      Please refer the below link.
      http://forum.springsource.org/showthread.php?t=64860

      Comment

      Working...
      X