Category: Java

Get name of currently executing test in JUnit 4

In JUnit 3, I could get the name of the currently running test like this: public class MyTest extends TestCase { public void testSomething() { System.out.println(“Current test is ” + getName()); … } } which would print “Current test is testSomething”. Is there any out-of-the-box or simple way to do this in JUnit 4? Background: […]