I have the following test class:
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;
import static org.junit.jupiter.api.Assertions.assertTrue;
public class HierarchicalTest {
@Test
void checkOuter() {
assertTrue(false);
}
@Nested
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
class PrepBTest {
@Test
void checkInnerA() {}
@Test
void checkInnerB() {}
}
}
I want to have the behavior that checkInnerA() and checkInnerB() won't be executed when checkOuter() fails.
On the other side checkInnerB() should be executed when checkInnerA() fails because it is on the same level.
Is there a simple soulution (e.g. with JUnit 5 extension) to achieve this behavior? In my opinion that's often the behavior which is wished.