-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TestNG, Multiple duplicate listener warnings on implementing multiple listener interfaces #1400
Comments
I have seen this issue as well today, while debugging issues with pitest versions 1.1.5 and up. As mentioned in the StackOverflow comment by Robby Cornelissen it probably boils down to this commit which is in TestNG versions 6.10 and 6.11. I've verified that TestNG 6.10 and 6.11 in combination with pitest versions 1.1.5 and upwards are breaking. Project showcase of the conflicting versions: https://github.com/MartinKanters/pitest-testng-issues |
@MariusVolkhart - You are right about that commit. TestNG was changed to ensure that duplicate listener instances aren't wired in. Can you please elaborate as to what is the issue that you are facing ? |
That's not how the behavior was expected to be. It should be showing this warning ONCE per duplicate instance being injected. |
@krmahadevan Hm, it seems that the issues are not really related after all. I failed to notice that this issue was about adding one class implementing multiple listeners. It seems that pitest is reusing the same TestNG instance for their mutation tests. The owner of pitest is working on it on their side. |
@krmahadevan Done. updated the original sample with the complete code. Hope this will suffice. |
@bipo1980 - This looks like a problem only when the suite xml is executed from within eclipse (using the eclipse TestNG plugin). I have not been able to recreate the problem using either IntelliJ (or) when executing via a command line using Maven. ping @missedone - Can you please help take a look at this one ? |
@krmahadevan,
so the fix might be set a flag (e.g. cfgInitialized=true) in initializeConfiguration() then check the value in createSuiteRunner() to avoid duplicate |
issue #1400: don't add duplicate reporter
TestNG Version
Also refer - Link to Stackoverflow Comments
Expected behavior
If i have a single Listener class that implements multiple listeners eg: IAnnotationTransformer, IInvokedMethodListener, ITestListener and IReporter etc...
Then the warning indicating multiple listeners must not be displayed if this the act of implementing multiple TestNG listener interface is of no consequence.
Actual behavior
My Test run successfully BUT i get a warning "[TestNG] [WARN] Ignoring duplicate listener : com.NGtest.RetryListener". This warning is shown for every method call i.e. Listener gets called multiple times per test method invocation, and hence the IGNORED duplicate warning.
Is the issue reproductible on runner?
Test case sample
Listener Class:
Test Class:
Test Xml:
Test Result:
The text was updated successfully, but these errors were encountered: