Reputation: 221
I have suite of fitnesse test cases from junit. and I would like to log the test or page name(from setup()) for each test case. Please let me know how I can find test or page name dynamically with sample code.
Thanks
Upvotes: 0
Views: 513
Reputation: 24520
JUnit's TestName rule is what you're looking for.
public class TestNameTest {
@Rule
public TestName name= new TestName();
@Test
public void testA() {
assertEquals("testA", name.getMethodName());
}
}
Upvotes: 2