sj26 / rspec_junit_formatter

RSpec results that your CI can read
http://rubygems.org/gems/rspec_junit_formatter
MIT License
302 stars 122 forks source link

Update invalid testcase attribute file #70

Closed travisofthenorth closed 5 years ago

travisofthenorth commented 5 years ago

I'm seeing this in my test pipeline with an updated (> 2.0) version of xunit:

Attribute 'file' is not allowed to appear in element 'testcase'.

I cannot find any documentation on what the xml should be, so this PR is a wild guess. Alternatively, I could remove the attribute entirely.

Issue: https://github.com/sj26/rspec_junit_formatter/issues/65

travisofthenorth commented 5 years ago

@sj26 please advise on what to do here. I'm happy to remove or rename the attribute.

sj26 commented 5 years ago

Hi @travisofthenorth, I think both file and filename are non-standard. Junit is a pretty lean, and isn't really standardised at all, it's just what the original junit tool used to produce. But many tools consuming rspec junit formatter output now rely on the file attribute so we cannot remove it now. I'm afraid this might be a problem xunit needs to fix — to ignore unknown attributes, or something.

travisofthenorth commented 5 years ago

@sj26 thanks for the explanation

obfuscoder commented 5 years ago

I would like to ask you to reconsider here. If there are tools relying on the file attribute to be present then how about providing an option to have the output in accordance with the Junit XML schema (see https://github.com/junit-team/junit5/blob/master/platform-tests/src/test/resources/jenkins-junit.xsd).

The Jenkins xUnit Plugin is quite popular and relies on the output to be in the proper XML schema.

obfuscoder commented 5 years ago

In addition I would like to point out that surefire also defines an XML schema which the generated XML is incompatible with:

http://maven.apache.org/surefire/maven-surefire-plugin/xsd/surefire-test-report.xsd

sj26 commented 5 years ago

These sounds like great arguments for a rspec-xunit-formatter and rspec-surefire-formatter, I notice surefire have a whole range of extra elements and attributes which could be utilised for better presentation of rspec results :-)