01: package test.alwaysrun;
02:
03: import org.testng.annotations.AfterClass;
04: import org.testng.annotations.BeforeClass;
05: import org.testng.annotations.Test;
06:
07: public class AlwaysRunAfter1 {
08: private static boolean m_success = false;
09:
10: @BeforeClass
11: public void setUpShouldFail() {
12: throw new RuntimeException("Failing in setUp");
13: }
14:
15: @AfterClass(alwaysRun=true)
16: public void tearDown() {
17: m_success = true;
18: }
19:
20: // Adding this method or @Configuration will never be invoked
21: @Test
22: public void dummy() {
23:
24: }
25:
26: static public boolean success() {
27: return m_success;
28: }
29: }
|