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
Update NUnitXml.xslt to emit properties element before reason/failure #1797
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The NUnit 2.5 schema at http://nunit.org/files/testresult_schema_25.txt specifies that the test-case element should look like this: ```xml <xs:complexType name="test-caseType"> <xs:sequence> <xs:element name="categories" type="categoriesType" minOccurs="0" maxOccurs="1" /> <xs:element name="properties" type="propertiesType" minOccurs="0" maxOccurs="1" /> <xs:choice> <xs:element name="failure" type="failureType" minOccurs="0" /> <xs:element name="reason" type="reasonType" minOccurs="0" /> </xs:choice> </xs:sequence> <xs:attribute name="name" type="xs:string" use="required" /> ... ``` The usage of xs:sequence means categories, properties and failure/reason elements need to be emitted in exactly that order. Currently NUnitXml.xslt however emits the properties _after_ the reason element. This fixes the xslt to emit properties in the expected order.
jonathanpeppers
added a commit
to jonathanpeppers/xamarin-android
that referenced
this pull request
Aug 22, 2018
Context: https://jenkins.mono-project.com/job/xamarin-android-pr-builder/3806 Context: xunit/xunit#1797 Our on-device XUnit tests don't appear to be reporting properly in Jenkins: WARNING: The result file '/Users/builder/jenkins/workspace/xamarin-android-pr-builder/xamarin-android/TestResult-Xamarin.Android.Bcl_Tests.nunit-Debug.xml' for the metric 'NUnit' is not valid. The result file has been skipped. WARNING: The file '/Users/builder/jenkins/workspace/xamarin-android-pr-builder/xamarin-android/TestResult-Xamarin.Android.Bcl_Tests.xunit-Debug.xml' is an invalid file. WARNING: At line 36993 of file:/Users/builder/jenkins/workspace/xamarin-android-pr-builder/xamarin-android/TestResult-Xamarin.Android.Bcl_Tests.xunit-Debug.xml:cvc-complex-type.2.4.d: Invalid content was found starting with element 'properties'. No child element is expected at this point. WARNING: At line 37006 of file:/Users/builder/jenkins/workspace/xamarin-android-pr-builder/xamarin-android/TestResult-Xamarin.Android.Bcl_Tests.xunit-Debug.xml:cvc-complex-type.2.4.d: Invalid content was found starting with element 'properties'. No child element is expected at this point. @akoeplinger also has a patch for the XLST transforms in XUnit. Hopefully this fixes all of our on-device tests!
Thanks! |
grendello
pushed a commit
to xamarin/xamarin-android
that referenced
this pull request
Aug 22, 2018
* [Xamarin.Android.NUnitLite] don't omit empty <categories /> Context: https://jenkins.mono-project.com/job/xamarin-android-pr-builder/3806 Context: mono/NUnitLite#12 Our on-device tests don't appear to be reporting properly in Jenkins: INFO: Starting to record. INFO: Processing NUnit-2.x (default) INFO: [NUnit-2.x (default)] - 16 test report file(s) were found with the pattern 'xamarin-android/TestResult-*.xml' relative to '/Users/builder/jenkins/workspace/xamarin-android-pr-builder' for the testing framework 'NUnit-2.x (default)'. WARNING: The file '/Users/builder/jenkins/workspace/xamarin-android-pr-builder/xamarin-android/TestResult-Xamarin.Android.Bcl_Tests.nunit-Debug.xml' is an invalid file. WARNING: At line 7 of file:/Users/builder/jenkins/workspace/xamarin-android-pr-builder/xamarin-android/TestResult-Xamarin.Android.Bcl_Tests.nunit-Debug.xml:cvc-complex-type.2.4.b: The content of element 'categories' is not complete. One of '{category}' is expected. Followed by thousands of similar warnings... Apparently the latest Jenkins plugin for NUnit tests is more strict about the test result format. We can add the patch from @akoeplinger to prevent these empty `<categories />` from being omitted. Hopefully this fixes it! * [TestRunner.xUnit] reorder when <properties /> emitted Context: https://jenkins.mono-project.com/job/xamarin-android-pr-builder/3806 Context: xunit/xunit#1797 Our on-device XUnit tests don't appear to be reporting properly in Jenkins: WARNING: The result file '/Users/builder/jenkins/workspace/xamarin-android-pr-builder/xamarin-android/TestResult-Xamarin.Android.Bcl_Tests.nunit-Debug.xml' for the metric 'NUnit' is not valid. The result file has been skipped. WARNING: The file '/Users/builder/jenkins/workspace/xamarin-android-pr-builder/xamarin-android/TestResult-Xamarin.Android.Bcl_Tests.xunit-Debug.xml' is an invalid file. WARNING: At line 36993 of file:/Users/builder/jenkins/workspace/xamarin-android-pr-builder/xamarin-android/TestResult-Xamarin.Android.Bcl_Tests.xunit-Debug.xml:cvc-complex-type.2.4.d: Invalid content was found starting with element 'properties'. No child element is expected at this point. WARNING: At line 37006 of file:/Users/builder/jenkins/workspace/xamarin-android-pr-builder/xamarin-android/TestResult-Xamarin.Android.Bcl_Tests.xunit-Debug.xml:cvc-complex-type.2.4.d: Invalid content was found starting with element 'properties'. No child element is expected at this point. @akoeplinger also has a patch for the XLST transforms in XUnit. Hopefully this fixes all of our on-device tests!
grendello
pushed a commit
to xamarin/xamarin-android
that referenced
this pull request
Aug 22, 2018
* [Xamarin.Android.NUnitLite] don't omit empty <categories /> Context: https://jenkins.mono-project.com/job/xamarin-android-pr-builder/3806 Context: mono/NUnitLite#12 Our on-device tests don't appear to be reporting properly in Jenkins: INFO: Starting to record. INFO: Processing NUnit-2.x (default) INFO: [NUnit-2.x (default)] - 16 test report file(s) were found with the pattern 'xamarin-android/TestResult-*.xml' relative to '/Users/builder/jenkins/workspace/xamarin-android-pr-builder' for the testing framework 'NUnit-2.x (default)'. WARNING: The file '/Users/builder/jenkins/workspace/xamarin-android-pr-builder/xamarin-android/TestResult-Xamarin.Android.Bcl_Tests.nunit-Debug.xml' is an invalid file. WARNING: At line 7 of file:/Users/builder/jenkins/workspace/xamarin-android-pr-builder/xamarin-android/TestResult-Xamarin.Android.Bcl_Tests.nunit-Debug.xml:cvc-complex-type.2.4.b: The content of element 'categories' is not complete. One of '{category}' is expected. Followed by thousands of similar warnings... Apparently the latest Jenkins plugin for NUnit tests is more strict about the test result format. We can add the patch from @akoeplinger to prevent these empty `<categories />` from being omitted. Hopefully this fixes it! * [TestRunner.xUnit] reorder when <properties /> emitted Context: https://jenkins.mono-project.com/job/xamarin-android-pr-builder/3806 Context: xunit/xunit#1797 Our on-device XUnit tests don't appear to be reporting properly in Jenkins: WARNING: The result file '/Users/builder/jenkins/workspace/xamarin-android-pr-builder/xamarin-android/TestResult-Xamarin.Android.Bcl_Tests.nunit-Debug.xml' for the metric 'NUnit' is not valid. The result file has been skipped. WARNING: The file '/Users/builder/jenkins/workspace/xamarin-android-pr-builder/xamarin-android/TestResult-Xamarin.Android.Bcl_Tests.xunit-Debug.xml' is an invalid file. WARNING: At line 36993 of file:/Users/builder/jenkins/workspace/xamarin-android-pr-builder/xamarin-android/TestResult-Xamarin.Android.Bcl_Tests.xunit-Debug.xml:cvc-complex-type.2.4.d: Invalid content was found starting with element 'properties'. No child element is expected at this point. WARNING: At line 37006 of file:/Users/builder/jenkins/workspace/xamarin-android-pr-builder/xamarin-android/TestResult-Xamarin.Android.Bcl_Tests.xunit-Debug.xml:cvc-complex-type.2.4.d: Invalid content was found starting with element 'properties'. No child element is expected at this point. @akoeplinger also has a patch for the XLST transforms in XUnit. Hopefully this fixes all of our on-device tests!
This was referenced Mar 12, 2021
Closed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The NUnit 2.5 schema at http://nunit.org/files/testresult_schema_25.txt specifies
that the test-case element should look like this:
The usage of xs:sequence means categories, properties and failure/reason elements
need to be emitted in exactly that order.
Currently NUnitXml.xslt however emits the properties after the reason element.
This fixes the xslt to emit properties in the expected order.
We noticed this because (for reasons ...) we emit xunit test results in NUnit format and parse it with the popular Jenkins xunit plugin (name similarity is just coincidence, the plugin supports multiple xml formats). That plugin had an update where it enforced the NUnit schema more stringently than before and this broke the parsing:
It'd be nice if this could make the 2.4.1 release.