In my Abstract class I have this code line :
@Rule
public final TestName testName = new TestName();
That is used in some tests to pass the specific method the name, for example:
@Test
public void assertApiUp() {
sendTest(testName.getMethodName(),true);
}
How do you manage this in junit 5 with TestInfo? I was thinking add in my set up method @BeforeEach void setUp(TestContext context, TestInfo testInfo){deploy(context,testInfo)}
or do you think is better in each testClass, for instance:
@Test
@DisplayName("assertApiUp")
public void assertApiUp(TestInfo testInfo) {...}
And another doubt, how do you put this other piece of code in junit 5 :
@Rule
public TestRule doOnfail = new TestWatcher() {
@Override
protected void failed(Description desc) {
stopAllRunningContainers();
}
Thanks in advance guys!