1 package test.hook; 2 3 import org.testng.IHookCallBack; 4 import org.testng.IHookable; 5 import org.testng.ITestResult; 6 import org.testng.annotations.Test; 7 8 public class HookFailureTest implements IHookable { 9 static boolean m_hook = false; 10 static boolean m_testWasRun = false; 11 12 @Override run(IHookCallBack callBack, ITestResult testResult)13 public void run(IHookCallBack callBack, ITestResult testResult) { 14 m_hook = true; 15 // Not invoking the callback: the method should not be run 16 } 17 18 @Test verify()19 public void verify() { 20 m_testWasRun = true; 21 } 22 23 // @AfterMethod 24 // public void tearDown() { 25 // Assert.assertTrue(m_hook); 26 // Assert.assertFalse(m_testWasRun); 27 // } 28 ppp(String string)29 private void ppp(String string) { 30 System.out.println("[HookFailureTest] " + string); 31 } 32 33 34 } 35