Hi,
I managed to make my python unit test run under my Jenkins scripted pipeline 
Jenkinsfile. I have multiple .xml files into my output folders. When I try to 
gather the result with xunit, it doesn't work and I don't know why, the xml 
seem like a legitimate Junit result:

My jenkinsfile call (I want an unstanble built when test doesn't pass, error 
build is the test did not complete or scripts fail):
   xunit(
                thresholds: [
                    skipped(failureThreshold: '99999', failureNewThreshold: 
'99999', unstableThreshold: '0', unstableNewThreshold: '0'),
                    failed( failureThreshold: '99999', failureNewThreshold: 
'99999', unstableThreshold: '0', unstableNewThreshold: '0')
                ],
                tools: [ JUnit(pattern: "TestResults/TEST-*.xml", 
skipNoTestFiles: false, failIfNotNew: true) ]
            );

Here is the error:

13:47:04  [Pipeline] xunit

13:47:04  INFO: Starting to record.

13:47:04  INFO: Processing JUnit

13:47:04  INFO: [JUnit] - 5 test report file(s) were found with the pattern 
'TestResults/TEST-*.xml' relative to 
'c:\Jenkins\workspace\ZZZ\ZZZCoRegistration-UnitTests\CoRegistration\Prototype' 
for the testing framework 'JUnit'.

13:47:04  WARNING: The file 
'c:\Jenkins\workspace\ZZZ\ZZZCoRegistration-UnitTests\CoRegistration\Prototype\TestResults\TEST-Tests.Algorithms.AlgorithmInterfaceTestCase-20200116134659.xml'
 is an invalid file.

13:47:04  WARNING: At line 3 of 
file:/c:/Jenkins/workspace/ZZZ/ZZZCoRegistration-UnitTests/CoRegistration/Prototype/TestResults/TEST-Tests.Algorithms.AlgorithmInterfaceTestCase-20200116134659.xml:cvc-complex-type.3.2.2:
 Attribute 'file' is not allowed to appear in element 'testcase'.

13:47:04  WARNING: At line 3 of 
file:/c:/Jenkins/workspace/ZZZ/ZZZCoRegistration-UnitTests/CoRegistration/Prototype/TestResults/TEST-Tests.Algorithms.AlgorithmInterfaceTestCase-20200116134659.xml:cvc-complex-type.3.2.2:
 Attribute 'line' is not allowed to appear in element 'testcase'.

13:47:04  WARNING: At line 3 of 
file:/c:/Jenkins/workspace/ZZZ/ZZZCoRegistration-UnitTests/CoRegistration/Prototype/TestResults/TEST-Tests.Algorithms.AlgorithmInterfaceTestCase-20200116134659.xml:cvc-complex-type.3.2.2:
 Attribute 'timestamp' is not allowed to appear in element 'testcase'.

The report look like this:
<?xml version="1.0" encoding="UTF-8"?>
<testsuite errors="0" failures="0" file="Tests/Algorithms.py" 
name="Tests.Algorithms.AlgorithmInterfaceTestCase-20200116134659" skipped="0" 
tests="5" time="0.005" timestamp="2020-01-16T13:46:59">
                <testcase 
classname="Tests.Algorithms.AlgorithmInterfaceTestCase" 
file="Tests\Algorithms\__init__.py" line="51" 
name="test_invalid_key_type_in_context" time="0.003" 
timestamp="2020-01-16T13:46:59">
                                <system-out>
<![CDATA[]]>                     </system-out>
                                <system-err>
<![CDATA[]]>                     </system-err>
                </testcase>
                <testcase 
classname="Tests.Algorithms.AlgorithmInterfaceTestCase" 
file="Tests\Algorithms\__init__.py" line="55" 
name="test_invalid_key_value_in_context" time="0.000" 
timestamp="2020-01-16T13:46:59">
                                <system-out>
<![CDATA[]]>                     </system-out>
                                <system-err>
<![CDATA[]]>                     </system-err>
                </testcase>
                <testcase 
classname="Tests.Algorithms.AlgorithmInterfaceTestCase" 
file="Tests\Algorithms\__init__.py" line="42" 
name="test_missing_required_key_in_context" time="0.000" 
timestamp="2020-01-16T13:46:59">
                                <system-out>
<![CDATA[]]>                     </system-out>
                                <system-err>
<![CDATA[]]>                     </system-err>
                </testcase>
                <testcase 
classname="Tests.Algorithms.AlgorithmInterfaceTestCase" 
file="Tests\Algorithms\__init__.py" line="46" 
name="test_set_optional_key_in_context" time="0.001" 
timestamp="2020-01-16T13:46:59">
                                <system-out>
<![CDATA[]]>                     </system-out>
                                <system-err>
<![CDATA[]]>                     </system-err>
                </testcase>
                <testcase 
classname="Tests.Algorithms.AlgorithmInterfaceTestCase" 
file="Tests\Algorithms\__init__.py" line="60" name="test_wrong_context_type" 
time="0.001" timestamp="2020-01-16T13:46:59">
                                <system-out>
<![CDATA[]]>                     </system-out>
                                <system-err>
<![CDATA[]]>                     </system-err>
                </testcase>
</testsuite>

Am I using the proper class JUnit to parse the file? I don't have any test 
results. I understand that the file and line are extra properties not into the 
JUnit standards, but still the remaining should work, I should see those test 
as working. Any clue why is this an invalid file or why I don't have any 
results?


[36E56279]
une compagnie  [cid:image004.jpg@01D5CC75.EB8DDB00]
RAPPROCHEZ LA DISTANCE
Jérôme Godbout
Développeur Logiciel Sénior /
Senior Software Developer
p: +1 (418) 800-1073 ext.:109
amotus.ca<http://www.amotus-solutions.com/>
statum-iot.com<http://statum-iot.com/>
[cid:image006.png@01D5CC75.EB8DDB00]<https://www.facebook.com/LesSolutionsAmotus/>
 [cid:image008.png@01D5CC75.EB8DDB00] 
<https://www.linkedin.com/company/amotus-solutions/>  
[cid:image010.png@01D5CC75.EB8DDB00] <https://twitter.com/AmotusSolutions>  
[cid:image012.jpg@01D5CC75.EB8DDB00] 
<https://www.youtube.com/channel/UCoYpQgsmj1iJZyDjTQ3x8Ig>


-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/YQXPR0101MB11738BDA5541824489CB8652CD360%40YQXPR0101MB1173.CANPRD01.PROD.OUTLOOK.COM.

Reply via email to