1 package test.inheritance.testng739;
2 
3 import org.testng.TestNG;
4 import org.testng.annotations.Test;
5 
6 import test.InvokedMethodNameListener;
7 import test.SimpleBaseTest;
8 
9 import static org.assertj.core.api.Assertions.assertThat;
10 
11 public class TestNG739 extends SimpleBaseTest {
12 
13   @Test
test_classes_should_be_skipped_when_a_before_class_fails()14   public void test_classes_should_be_skipped_when_a_before_class_fails() {
15     TestNG tng = create(A.class, B.class);
16     tng.setPreserveOrder(true);
17     InvokedMethodNameListener listener = new InvokedMethodNameListener();
18     tng.setPreserveOrder(true);
19     tng.addListener(listener);
20 
21     tng.run();
22     assertThat(listener.getSucceedMethodNames()).containsExactly("beforeBaseClass", "beforeBaseClass", "testB");
23     assertThat(listener.getFailedMethodNames()).containsExactly("beforeClassA");
24     assertThat(listener.getSkippedMethodNames()).containsExactly("testA");
25   }
26 }
27