TestRulepublic class TestName extends TestWatcher
public class TestNameTest {
@Rule
public TestName name= new TestName();
@Test
public void testA() {
assertEquals("testA", name.getMethodName());
}
@Test
public void testB() {
assertEquals("testB", name.getMethodName());
}
}
| Constructor | Description |
|---|---|
TestName() |
| Modifier and Type | Method | Description |
|---|---|---|
java.lang.String |
getMethodName() |
|
protected void |
starting(Description d) |
Invoked when a test is about to start
|
protected void starting(Description d)
TestWatcherstarting in class TestWatcherpublic java.lang.String getMethodName()