01: package test.testng106;
02:
03: import org.testng.Assert;
04: import org.testng.annotations.AfterSuite;
05: import org.testng.annotations.BeforeSuite;
06:
07: /**
08: * TESTNG-106: failing @BeforeSuite doesn't skip all tests
09: */
10: public class FailingSuiteFixture {
11: static int s_invocations = 0;
12:
13: @BeforeSuite
14: public void failingBeforeSuite() {
15: double d = 1 / 0;
16: }
17:
18: @AfterSuite(alwaysRun=true)
19: public void afterSuite() {
20: System.out.println("Invocations:" + s_invocations
21: + " must be 0");
22: Assert
23: .assertEquals(s_invocations, 0,
24: "@BeforeSuite has failed. All tests should be skipped.");
25: }
26: }
|