ISuiteListener is another type of listener provided in TestNG this listener works on the suite level.
ISuiteListener listens to the
event of the start of a suite execution and end of the suite execution.
ISuiteListener runs the methods
only before the start of the suite and at the end. It contains two methods:
- onStart: This method
invokes before the test suite execution starts.
- onFinish: This method
invokes after the test suite execution ends.
One should note
that if the parent suite contains child suites then the child suites are
executed before the parent suite.
Code example:
package isuiteListener;
import org.testng.ISuite;
import org.testng.ISuiteListener;
public class ListenersTest implements ISuiteListener{
@Override
public void onStart(ISuite suite) {
// TODO Auto-generated method stub
System.out.println("this is on start function "+suite.getName());
}
@Override
public void onFinish(ISuite suite) {
// TODO Auto-generated method stub
System.out.println("this is on finish function "+suite.getName());
}
}
Follow my session on YouTube
Comments
Post a Comment