Open
Description
The junit-10.xsd used for testing does not match the junit-10.xsd file the xUnit plugin uses. https://github.com/jenkinsci/xunit-plugin/blob/master/src/main/resources/org/jenkinsci/plugins/xunit/types/model/xsd/junit-10.xsd
Updating the file in this project and running unit tests results in the following errors:
======================================================================
ERROR: test_junitxml_xsd_validation_empty_properties (tests.testsuite.XMLTestRunnerTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\GitHub Repos\unittest-xml-reporting\tests\testsuite.py", line 658, in test_junitxml_xsd_validation_empty_properties
validate_junit_report(output)
File "C:\GitHub Repos\unittest-xml-reporting\tests\testsuite.py", line 50, in validate_junit_report
JUnitSchema.assertValid(document)
File "src\lxml\etree.pyx", line 3537, in lxml.etree._Validator.assertValid
DocumentInvalid: Element 'testcase', attribute 'file': The attribute 'file' is not allowed., line 4
======================================================================
ERROR: test_junitxml_xsd_validation_order (tests.testsuite.XMLTestRunnerTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\GitHub Repos\unittest-xml-reporting\tests\testsuite.py", line 643, in test_junitxml_xsd_validation_order
validate_junit_report(output)
File "C:\GitHub Repos\unittest-xml-reporting\tests\testsuite.py", line 50, in validate_junit_report
JUnitSchema.assertValid(document)
File "src\lxml\etree.pyx", line 3537, in lxml.etree._Validator.assertValid
DocumentInvalid: Element 'testcase', attribute 'file': The attribute 'file' is not allowed., line 7
----------------------------------------------------------------------
These are not all the errors however, when using xmlrunner with the xUnit plugin for one of my build jobs, the following XML warnings are reported:
WARNING: At line 3 of file:/E:/Test_Jenkins/workspace/gin_Testing_junit-plugin-testing/unittest-reports/TEST-testValidationEntryPoint.TestEntryPoint-20190618152127.xml:cvc-complex-type.3.2.2: Attribute 'file' is not allowed to appear in element 'testcase'.
WARNING: At line 3 of file:/E:/Test_Jenkins/workspace/gin_Testing_junit-plugin-testing/unittest-reports/TEST-testValidationEntryPoint.TestEntryPoint-20190618152127.xml:cvc-complex-type.3.2.2: Attribute 'line' is not allowed to appear in element 'testcase'.
WARNING: At line 3 of file:/E:/Test_Jenkins/workspace/gin_Testing_junit-plugin-testing/unittest-reports/TEST-testValidationEntryPoint.TestEntryPoint-20190618152127.xml:cvc-complex-type.3.2.2: Attribute 'timestamp' is not allowed to appear in element 'testcase'.
Activity
Pietro-G commentedon Jul 18, 2019
Experiencing precisely the same issue +1
AmauryOrtega commentedon Jul 26, 2019
Exactly the same behaviour. Tried using the XSD provided in the readme using this tool but no luck.
dnozay commentedon Nov 6, 2019
The version used was added in 2014 to xunit plugin by @gboissinot:
https://github.com/jenkinsci/xunit-plugin/blob/14c6e39c38408b9ed6280361484a13c6f5becca7/src/main/resources/org/jenkinsci/plugins/xunit/types/model/xsd/junit-10.xsd
@nfalco79 made several backwards incompatible changes to the schema while keeping the same version in 2018.
https://github.com/jenkinsci/xunit-plugin/commits/master/src/main/resources/org/jenkinsci/plugins/xunit/types/model/xsd/junit-10.xsd
A lot of tools came around between 2014 and 2018; if the claim was if you use
unittest-xml-reporting
and create an xml report, jenkinsxunit
plugin would work out of the box; that was true until sometime in 2018.[-]XML output from xmlrunner is not valid to the xUnit Plugin[/-][+]XML output from xmlrunner is not valid to the xUnit Plugin versions xunit-2.2.4 and above[/+]dnozay commentedon Nov 6, 2019
if you care to try with a version earlier than xunit-2.2.4, please let me know.
ncarrier commentedon Jan 17, 2020
Hi, for anyone interested in a workaround, I've posted one there: #209 (comment), which works for me and with some adjustments, may work for others...
[JENKINS-28871] CppTest 9.5 report file seems not valid for xUnit whe…
nfalco79 commentedon Jan 22, 2020
In the README description you report:
xUnit does not define an own XML format, it translates external report format into an internal format that use to build a result graph using threasholds.
JUnit does not define a standard, it is a library. There is an attempt by the JUnit team to create a sort of ISO format for the future (but it is firm).
Since xUnit 2.x supports only a defined pair of defined JUnit format (Ant and Maven, the latest has been evolved recently). This breaking changes has been documented here: https://wiki.jenkins.io/display/JENKINS/xUnit+Plugin
Add optional testcase attributes back
pbudzon commentedon Feb 15, 2020
@dnozay I tried with previous versions of xunit (from here: https://updates.jenkins.io/download/plugins/xunit/). Went as far back as version 2.0.4, results in each:
So basically the same as reported.
[-]XML output from xmlrunner is not valid to the xUnit Plugin versions xunit-2.2.4 and above[/-][+]XML output from xmlrunner is not valid to the xUnit Plugin versions xunit-1.104 and above[/+]dnozay commentedon Feb 18, 2020
yes, put the wrong version, xunit
1.100
is the version that had been around from 2014-2018; mid-2018 is when the bug reports started coming in and that lines up with more strict XSD validation. it looks like xunit1.104
is the first version published in 2018 which may present the issue.I made additional changes based on #209; but the gist is that you need to perform XSL transformation (now described in readme) or chose
Custom tool
report type inxunit
plugin with your own XSL fileIn this PR there are 2 ideas as well: relax the XSD validation, or provide another report type.
jenkinsci/xunit-plugin#81
I am also going to repeat my comment from
#209
For those using
xunit
plugin in Jenkins, thejunit
plugin seems to work out of the box without issues (it does not perform XSD validation AFAIK), so if you don't have specific requirements, it's worth trying out.I'm going to keep this issue open until jenkinsci/xunit-plugin#81 is closed. If someone has the time to work on it, I'd advise adding the other report type directly to the plugin, but I couldn't find enough time / info in the wiki.
2 remaining items