Да, вы можете использовать указанный ниже код.
@AfterAll
static void afterAllIAmCalled() {
System.out.println("---Inside after finishing all testsDownAll---");
}
Ссылка для вас: https://www.concretepage.com/testing/junit-5/junit-5-beforeall-and-afterall-example
Дальнейшее обновление ответа в зависимости от вашей необходимости бегать за всеми сетами. Определите свои тесты в комплекте, как показано ниже
@RunWith(Suite.class)
@ Suite.SuiteClasses({
SuiteTest1.class,
SuiteTest2.class,
})
public class JunitTest {
// This class remains empty, it is used only as a holder for the above annotations but as you need to perform action at the end of it do as mentioned below
@AfterSuite
Private void methodName(){
//my suite end action
}
}
Ответ на мобильном телефоне. Не может быть симметричным c ответом, но решит вашу проблему.
Это должно сработать для вас.