public interface IMethodInterceptor extends ITestNGListener
An instance of this class will be invoked right before TestNG starts invoking test methods.
Only methods that have no dependents and that don't depend on any other test methods will
be passed in parameter. Implementers of this interface need to return a list of IMethodInstance
that represents the list of test methods they want run. TestNG will run these methods in the
same order found in the returned value.
Typically, the returned list will be just the methods passed in parameter but sorted differently, but it can actually have any size (it can be empty, it can be of the same size as the original list or it can contain more methods).
The ITestContext
is passed in the intercept method so that implementers can set user values
(using IAttributes.setAttribute(String, Object)
), which they can then look up
later while generating the reports.
Modifier and Type | Method and Description |
---|---|
java.util.List<IMethodInstance> |
intercept(java.util.List<IMethodInstance> methods,
ITestContext context) |
java.util.List<IMethodInstance> intercept(java.util.List<IMethodInstance> methods, ITestContext context)