package test.tmp;
public class TmpSuiteListener implements ISuiteListener {
public static boolean start = false;
public static boolean finish = false;
@Override
public void onFinish(ISuite suite) {
System.out.println("Finishing");
}
@Override
public void onStart(ISuite suite) {
System.out.println("Starting");
}
}
$ tree|____META-INF| |____services| | |____org.testng.ITestNGListener|____test| |____tmp| | |____TmpSuiteListener.class$ cat META-INF/services/org.testng.ITestNGListenertest.tmp.TmpSuiteListener
$ jar cvf ../sl.jar .added manifestignoring entry META-INF/adding: META-INF/services/(in = 0) (out= 0)(stored 0%)adding: META-INF/services/org.testng.ITestNGListener(in = 26) (out= 28)(deflated -7%)adding: test/(in = 0) (out= 0)(stored 0%)adding: test/tmp/(in = 0) (out= 0)(stored 0%)adding: test/tmp/TmpSuiteListener.class(in = 849) (out= 470)(deflated 44%)
$ java -classpath sl.jar:testng.jar org.testng.TestNG testng-single.yamlStartingf2 11 2PASSED: f2("2")Finishing
--
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.
I get the Error: 'Could not find or load main class org.testng.TestNG' when i run through the command using cmd - >java -classpath serviceLoader.jar;testng.jar;bin
org.testng.TestNG %1% and when i run in eclipse, listeners are not invoked.
--
org.testng.ITestNGListener has to be saved as 'all files'. It was such a learning experience.
Thanks a lot