• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 package org.testng;
2 
3 /**
4  * If a test class implements this interface, its run() method
5  * will be invoked instead of each @Test method found.  The invocation of
6  * the test method will then be performed upon invocation of the callBack()
7  * method of the IHookCallBack parameter.
8  *
9  * This is useful to test classes that require JAAS authentication, which can
10  * be implemented as follows:
11  *
12  * <pre>
13  * public void run(final IHookCallBack icb, ITestResult testResult) {
14  *   // Preferably initialized in a @Configuration method
15  *   mySubject = authenticateWithJAAs();
16  *
17  *   Subject.doAs(mySubject, new PrivilegedExceptionAction() {
18  *     public Object run() {
19  *       icb.callback(testResult);
20  *     }
21  *   };
22  * }
23  * </pre>
24  *
25  * @author cbeust
26  * Jan 28, 2006
27  */
28 public interface IHookable extends ITestNGListener {
run(IHookCallBack callBack, ITestResult testResult)29   public void run(IHookCallBack callBack, ITestResult testResult);
30 }
31