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

support xunit reports without testsuite #1599

Merged
merged 1 commit into from
Nov 26, 2018
Merged

support xunit reports without testsuite #1599

merged 1 commit into from
Nov 26, 2018

Conversation

guwirth
Copy link
Collaborator

@guwirth guwirth commented Nov 24, 2018

@guwirth guwirth added the bug label Nov 24, 2018
@guwirth guwirth added this to the 1.2.1 milestone Nov 24, 2018
@guwirth guwirth self-assigned this Nov 24, 2018
@guwirth guwirth requested review from ivangalkin and Bertk November 24, 2018 20:36
Copy link
Contributor

@ivangalkin ivangalkin left a comment

Choose a reason for hiding this comment

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

Reviewed 3 of 3 files at r1.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @guwirth and @Bertk)


cxx-sensors/src/main/java/org/sonar/cxx/sensors/tests/xunit/XunitReportParser.java, line 59 at r1 (raw file):

throw new EmptyReportException(...)

I believe, that the previous code tried to implement the standard protocol for all our report parsers: If the file is empty or invalid the parser has to throw EmptyReportException. The name and the purpose of this exception is ambiguous in my opinion. E.g. since the report is empty the fix could look as following...

try {
   final SMEvent event = testSuiteCursor.getNext();
   if (event == nullptr) {
      throw new EmptyReportException("Empty report");
   }
}

But on the other hand, IMHO there is no reason to throw an exception if the XML file is perfectly correct (like in the #1595). So I like your solution more.

@guwirth
Copy link
Collaborator Author

guwirth commented Nov 26, 2018

@ivangalkin think the difference is

  • empty / corrupt XML => exception
  • or iterating over testsuites (with special case no testsuite)

@guwirth guwirth merged commit 9080dc2 into SonarOpenCommunity:master Nov 26, 2018
@guwirth guwirth mentioned this pull request Dec 21, 2018
@guwirth guwirth deleted the xunit-1595 branch December 27, 2018 18:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

xUnit sensor couldn't parse test report with 0 testsuite tag
2 participants