Hi Cédric,
I created my TestListenerAdapter extension and use <listener> in my testng.xml files to attach it to my test suites. I am not using the TestNG object to register my listener.
I am wondering what the lifecycle of the listener attached this way is. I have a multi module maven project that uses surefire to execute the tests. the listener registration looks like this:
<suite name="my-test" verbose="7">
<test name="test1">
<packages>
<package name="some.package" />
</packages>
</test>
<test name="test2">
<packages>
<package name="some.other.package" />
</packages>
</test>
<listeners>
<listener class-name="MyTestListenerExtension" />
</listeners>
</suite>
Now when I run the tests 2 instances of my testlistener extension are created (did a little blackbox testing around this) and onFinish() is called on each instance. I am wondering why 2 instances are created and how to prevent it. I am assuming it is wrong configuration on my end but was not able to find more documentation besides the javadoc on the ITestListener interface.
Does this outline my situation a little better?
Thanks!
-Dirk