public interface ITestClassListener extends ITestNGListener {
void onStart(ITestClass testClass);
void onFinish(ITestClass testClass);
}You mean like IClassListener?
Would this do?
import org.testng.IClassListener;
import org.testng.IInvokedMethod;
import org.testng.IInvokedMethodListener;
import org.testng.ITestClass;
import org.testng.ITestContext;
import org.testng.ITestResult;
import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.testng.xml.XmlSuite;
@Listeners(GetClassInfo.ClassListener.class)
public class GetClassInfo {
@Test
public void testMethod() {
System.err.println("Hello world");
}
public static class ClassListener implements IClassListener, IInvokedMethodListener {
@Override
public void onBeforeClass(ITestClass testClass) {
String clazzName = testClass.getName();
XmlSuite suite = testClass.getXmlTest().getSuite();
System.err.println("Suite Object for " + clazzName);
System.err.println(suite.toXml());
}
@Override
public void onAfterClass(ITestClass testClass) {
}
@Override
public void beforeInvocation(IInvokedMethod method, ITestResult testResult) {
String clazzName = method.getTestMethod().getTestClass().getName();
ITestContext context = testResult.getTestContext();
System.err.println(clazzName + " has its test context as " + context);
}
@Override
public void afterInvocation(IInvokedMethod method, ITestResult testResult) {
}
}
}
Thanks & Regards
Krishnan Mahadevan
"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
My Technical Scribbings @ http://rationaleemotions.wordpress.com/
--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to testng-users...@googlegroups.com.
To post to this group, send email to testng...@googlegroups.com.
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.