1.6. Example of IMethodInterceptor

1.6. Example of IMethodInterceptor


IMethodInterceptor interface is used to modify the list of test methods that we want TestNG to run. It will be invoked right before TestNG starts invoking test methods.
It has just one method to implement intercept which returns the altered list of methods.
Lets being with our test class. MethodInterceptorListenerExample has two test methods. One of the test methods testcase1 is to test performance so we grouped it in “sanity”.
Suppose we want to only run the SANITY based tests and not the other tests, we will have to provide aIMethodInterceptor listener that can filter out the other tests and return only SANITY based tests.



No comments:

Post a Comment

Note: Only a member of this blog may post a comment.