Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-21883

[xUnit] <skipped> message not shown for QtTestLib

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • xunit-plugin
    • None
    • Jenkins 1.532.2
      xUnit 1.82

      Hi,

      I've been trying to show my skipped tests without much success. My XML looks like:

      <?xml version="1.0" encoding="UTF-8"?>
      <testsuite name="tst_XmlPatterns" tests="2" failures="0" errors="0" skipped="1" time="0.000">
         <properties>
            <property name="QtVersion" value="5.2.2"/>
            <property name="QTestVersion" value="5.2.2"/>
         </properties>
         <testcase classname="tst_XmlPatterns" name="initTestCase" time="0.000">
            <skipped>tst_xmlpatterns.cpp:120 :: [] Device &#x9;IP:169.254.0.13&#xA;The command line tool (/usr/lib/qt5/bin/xmlpatterns) could not be run, possibly because Qt was incompletely built or installed. No tests will be run.</skipped>
         </testcase>
         <testcase classname="tst_XmlPatterns" name="cleanupTestCase" time="0.000"/>
         <system-out/>
         <system-err/>
      </testsuite>
      

      but it doesn't show anything.

      Looking at Jenkin's source code, I see that an attribute called "message" was added for <skipped>, so if I change my XML to

      <?xml version="1.0" encoding="UTF-8"?>
      <testsuite name="tst_XmlPatterns" tests="2" failures="0" errors="0" skipped="1" time="0.000">
         <properties>
            <property name="QtVersion" value="5.2.2"/>
            <property name="QTestVersion" value="5.2.2"/>
         </properties>
         <testcase classname="tst_XmlPatterns" name="initTestCase" time="0.000">
            <skipped message="tst_xmlpatterns.cpp:120 :: [] Device &#x9;IP:169.254.0.13&#xA;The command line tool (/usr/lib/qt5/bin/xmlpatterns) could not be run, possibly because Qt was incompletely built or installed. No tests will be run."/>
         </testcase>
         <testcase classname="tst_XmlPatterns" name="cleanupTestCase" time="0.000"/>
         <system-out/>
         <system-err/>
      </testsuite>
      

      then it fails because the XML is not valid according to junit-4.xsd for the xUnit plugin I am using.

      The error from the xUnit plugin I get is:

      13:03:18 [xUnit] [INFO] - Starting to record.
      13:03:18 [xUnit] [INFO] - Processing Custom Tool
      13:03:18 [xUnit] [INFO] - [Custom Tool] - 29 test report file(s) were found with the pattern 'test-results/tst_*.xml' relative to '/var/lib/jenkins/jobs/qt-5-qtxmlpatterns-dev/workspace/ARCH/ARM' for the testing framework 'Custom Tool'.
      13:03:18 [xUnit] [ERROR] - The converted file for the result file '/var/lib/jenkins/jobs/qt-5-qtxmlpatterns-dev/workspace/ARCH/ARM/test-results/tst_xmlpatterns.xml' (during conversion process for the metric 'Custom Tool') is not valid. The report file has been skipped.
      13:03:18 [xUnit] [INFO] - Failing BUILD because 'set build failed if errors' option is activated.
      13:03:18 [xUnit] [INFO] - There are errors when processing test results.
      13:03:18 [xUnit] [INFO] - Skipping tests recording.
      13:03:18 [xUnit] [INFO] - Stop build.
      

      the xUnitLogger shows

      [xUnit] - Converting '/var/lib/jenkins/jobs/qt-5-qtdeclarative-release/workspace/ARCH/ARM/test-results/tst_dialogs.xml' .
      
      Feb 19, 2014 6:05:10 PM WARNING org.jenkinsci.plugins.xunit.service.XUnitService warningSystemLogger
      
      [xUnit] - The converted file for the input file '/var/lib/jenkins/jobs/qt-5-qtdeclarative-release/workspace/ARCH/ARM/test-results/tst_dialogs.xml' doesn't match the JUnit format
      
      Feb 19, 2014 6:05:10 PM WARNING org.jenkinsci.plugins.xunit.service.XUnitService warningSystemLogger
      
      [xUnit] - At line 9 of file:/var/lib/jenkins/jobs/qt-5-qtdeclarative-release/workspace/ARCH/ARM/generatedJUnitFiles/Custom%20Tool/TEST-1913279430.xml:cvc-type.3.1.1: Element 'skipped' is a simple type, so it cannot have attributes, excepting those whose namespace name is identical to 'http://www.w3.org/2001/XMLSchema-instance' and whose [local name] is one of 'type', 'nil', 'schemaLocation' or 'noNamespaceSchemaLocation'. However, the attribute, 'message' was found.
      
      Feb 19, 2014 6:05:10 PM SEVERE org.jenkinsci.plugins.xunit.service.XUnitService errorSystemLogger
      
      [xUnit] - The converted file for the result file '/var/lib/jenkins/jobs/qt-5-qtdeclarative-release/workspace/ARCH/ARM/test-results/tst_dialogs.xml' (during conversion process for the metric 'Custom Tool') is not valid. The report file has been skipped.
      

      I was wondering whether this is as simple as just changing

      https://github.com/jenkinsci/xunit-plugin/blob/master/src/main/java/org/jenkinsci/plugins/xunit/types/QTestLibInputMetric.java#L45

      from "JUnitModel.OUTPUT_JUNIT_4" to JUnitModel.OUTPUT_JUNIT_X .. where X > 4 ?

            gbois Gregory Boissinot
            sahumada sahumada
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: