• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 package test.hook;
2 
3 import org.testng.IConfigurable;
4 import org.testng.IConfigureCallBack;
5 import org.testng.ITestResult;
6 
7 import java.lang.reflect.Method;
8 
9 public class ConfigurableListener implements IConfigurable {
10   static int m_hookCount = 0;
11   static String m_methodName;
12 
13   @Override
run(IConfigureCallBack callBack, ITestResult testResult)14   public void run(IConfigureCallBack callBack, ITestResult testResult) {
15     m_hookCount++;
16     Object[] parameters = callBack.getParameters();
17     if (parameters.length > 0) {
18       m_methodName = ((Method) parameters[0]).getName();
19     }
20     callBack.runConfigurationMethod(testResult);
21   }
22 
23 }
24