• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 package org.testng;
2 
3 import java.util.List;
4 
5 /**
6  * This class is used to alter the list of test methods that TestNG is about to run.
7  *
8  * <p>
9  *
10  * An instance of this class will be invoked right before TestNG starts invoking test methods.
11  * Only methods that have no dependents and that don't depend on any other test methods will
12  * be passed in parameter.  Implementers of this interface need to return a list of {@link IMethodInstance}
13  * that represents the list of test methods they want run.  TestNG will run these methods in the
14  * same order found in the returned value.
15  *
16  * <p>
17  *
18  * Typically, the returned list will be just the methods passed in parameter but sorted
19  * differently, but it can actually have any size (it can be empty, it can be of the
20  * same size as the original list or it can contain more methods).
21  *
22  * <p>
23  *
24  * The {@link ITestContext} is passed in the <tt>intercept</tt> method so that implementers can set user values
25  * (using {@link ITestContext#setAttribute(String, Object)}), which they can then look up
26  * later while generating the reports.
27  *
28  * @author cbeust
29  */
30 public interface IMethodInterceptor extends ITestNGListener {
31 
intercept(List<IMethodInstance> methods, ITestContext context)32   List<IMethodInstance> intercept(List<IMethodInstance> methods, ITestContext context);
33 
34 }
35