Skip to content
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

Merged
merged 3 commits into from
Apr 7, 2017

Conversation

missedone
Copy link
Contributor

@missedone missedone commented Apr 1, 2017

Fixes #1400 .

Did you remember to?

  • Add test case(s)
  • Update CHANGES.txt

We encourage pull requests that:

  • Add new features to TestNG (or)
  • Fix bugs in TestNG

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.

@@ -1394,7 +1394,9 @@ private SuiteRunner createSuiteRunner(XmlSuite xmlSuite) {
}

for (IReporter r : result.getReporters()) {
addListener(r);
if (!m_reporters.containsKey(r.getClass())) {
Copy link
Contributor Author

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

Copy link
Member

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);?

Copy link
Contributor Author

@missedone missedone Apr 6, 2017

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.

Copy link
Member

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?

Copy link
Contributor Author

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

Copy link
Member

@juherr juherr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

Ping @cbeust

@cbeust cbeust merged commit 1e1d341 into testng-team:master Apr 7, 2017
@missedone missedone deleted the issue/1400 branch April 7, 2017 13:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TestNG, Multiple duplicate listener warnings on implementing multiple listener interfaces
3 participants