01: package test.hook;
02:
03: import org.testng.Assert;
04: import org.testng.IHookCallBack;
05: import org.testng.IHookable;
06: import org.testng.ITestResult;
07: import org.testng.annotations.AfterMethod;
08: import org.testng.annotations.Test;
09:
10: public class HookSuccessTest implements IHookable {
11: private boolean m_hook = false;
12: private boolean m_testWasRun = false;
13:
14: public void run(IHookCallBack callBack, ITestResult testResult) {
15: m_hook = true;
16: callBack.runTestMethod(testResult);
17: }
18:
19: @Test
20: public void verify() {
21: m_testWasRun = true;
22: }
23:
24: @AfterMethod
25: public void tearDown() {
26: Assert.assertTrue(m_hook);
27: Assert.assertTrue(m_testWasRun);
28: }
29:
30: private void ppp(String string) {
31: System.out.println("[HookTest] " + string);
32: }
33:
34: }
|