-
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
issue #1400: don't add duplicate reporter #1404
Conversation
src/main/java/org/testng/TestNG.java
Outdated
@@ -1394,7 +1394,9 @@ private SuiteRunner createSuiteRunner(XmlSuite xmlSuite) { | |||
} | |||
|
|||
for (IReporter r : result.getReporters()) { | |||
addListener(r); | |||
if (!m_reporters.containsKey(r.getClass())) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in #createSuiteRunner(), add reporter only if it's not yet existing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you consider to replace the line by maybeAddListener(m_reporters, r.getClass(), r);
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is what's i'm trying to avoid, since calling maybeAddListener
will print the warning message.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but we can add a new boolean param in order to determine the behavior.
In fact, the question is more: do we need to add all listener implementations? If yes, we should not check only with m_reporters
. If no, we should add the listener directly in m_reporters
.
WDYT about it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's for reporter only, PR updated. thx
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
Ping @cbeust
Fixes #1400 .
Did you remember to?
CHANGES.txt
We encourage pull requests that:
If your pull request involves fixing SonarQube issues then we would suggest that you please discuss this with the
TestNG-dev before you spend time working on it.