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

jUnit output of pytest/Selenium test fail to parse

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Not A Defect
    • Component/s: xunit-plugin
    • Labels:
      None
    • Environment:
      Jenkins 2.127
      xUnit plugin 2.0.2
    • Similar Issues:

      Description

      Job log show a lot of error lines like:

      WARNING: The file '/var/lib/jenkins/workspace/bob-develop/selenium.xml' is an invalid file.
       WARNING: At line 1 of file:/var/lib/jenkins/workspace/bob-develop/selenium.xml:cvc-complex-type.3.2.2: Attribute 'skips' is not allowed to appear in element 'testsuite'.
       WARNING: At line 1 of file:/var/lib/jenkins/workspace/bob-develop/selenium.xml:cvc-complex-type.3.2.2: Attribute 'file' is not allowed to appear in element 'testcase'.
       WARNING: At line 1 of file:/var/lib/jenkins/workspace/bob-develop/selenium.xml:cvc-complex-type.3.2.2: Attribute 'line' is not allowed to appear in element 'testcase'.
       WARNING: At line 156 of file:/var/lib/jenkins/workspace/bob-develop/selenium.xml:cvc-complex-type.3.2.2: Attribute 'file' is not allowed to appear in element 'testcase'.

      I can supply a full XML file if wanted.

        Attachments

          Issue Links

            Activity

            Hide
            nfalco Nikolas Falco added a comment - - edited

            Skip is not a valid attribute for the testsuite element of JUnit report.
            The correct name for that attribute is skipped. if you would support the custom junit format for pytest please select the "Custom Tool" as test type and provide an XSL to conver the generated report to a correct format of the supported JUnit format. In the "custom stylesheet" value you could insert the path of your XSL file that could be absolute on the server (master) or relative to the workspace.

            Show
            nfalco Nikolas Falco added a comment - - edited Skip is not a valid attribute for the testsuite element of JUnit report. The correct name for that attribute is skipped. if you would support the custom junit format for pytest please select the "Custom Tool" as test type and provide an XSL to conver the generated report to a correct format of the supported JUnit format. In the "custom stylesheet" value you could insert the path of your XSL file that could be absolute on the server (master) or relative to the workspace.
            Hide
            larsskj Lars Skjærlund added a comment -

            It did work with xUnit 1.X though. I think you should provide a very clear warning when you break backwards compatibility - and provide a way to keep the old version until we've had a chance to resolve the issue. The 1.X -> 2.X upgrade has broken a lot of existing functionality.

            Show
            larsskj Lars Skjærlund added a comment - It did work with xUnit 1.X though. I think you should provide a very clear warning when you break backwards compatibility - and provide a way to keep the old version until we've had a chance to resolve the issue. The 1.X -> 2.X upgrade has broken a lot of existing functionality.
            Hide
            vladichko Vlad Aginsky added a comment -

            see my comment in tread

            Show
            vladichko Vlad Aginsky added a comment - see my comment in tread
            Hide
            vladichko Vlad Aginsky added a comment -

            I also see this, i was able to parse my files with older version of xinuit, even more, current version of junit plugin is able to parse my files. pytest creates those files with "line" atribute and now e get "

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

            "

             

            Show
            vladichko Vlad Aginsky added a comment - I also see this, i was able to parse my files with older version of xinuit, even more, current version of junit plugin is able to parse my files. pytest creates those files with "line" atribute and now e get " Attribute 'line' is not allowed to appear in element 'testcase' . "  
            Hide
            nfalco Nikolas Falco added a comment - - edited

            Line is not allowed in the supported schemas from 2.x (now you will see a warning of breaking changes in the manage plugin page).

            As described above use a Custom Tools to transform the custom junit report into a compatible format.

            I'm preparing in the junit branch the XSL that copy from a junit report just the allowed attributes. When done I will publish it on the Wiki page.

            Show
            nfalco Nikolas Falco added a comment - - edited Line is not allowed in the supported schemas from 2.x (now you will see a warning of breaking changes in the manage plugin page). As described above use a Custom Tools to transform the custom junit report into a compatible format. I'm preparing in the junit branch the XSL that copy from a junit report just the allowed attributes. When done I will publish it on the Wiki page.
            Hide
            nfalco Nikolas Falco added a comment -

            Explanation was in Wiki page and support in the linked issue

            Show
            nfalco Nikolas Falco added a comment - Explanation was in Wiki page and support in the linked issue
            Hide
            larsskj Lars Skjærlund added a comment - - edited

            pytest-xunit.xsl

            There's no such thing as a universally accepted common jUnit schema. Until you convince the entire world that they must obey to a more or less random Java standard, other tools are needed.
            You can use the attached XSLT stylesheet to transform your Python tests into a format accepted by the new Java-centric xUnit plugin.
            For instance, use the Unix shell tool called xsltproc this way:

            xsltproc pytest-xunit.xsl testreport.xml > testreport-xunit.xml
            

            and then ask xUnit to analyze testreport-xunit.xml instead of testreport.xml. It's been tested with nosetest and pytest.

            Regards,
            Lars

            Show
            larsskj Lars Skjærlund added a comment - - edited pytest-xunit.xsl There's no such thing as a universally accepted common jUnit schema. Until you convince the entire world that they must obey to a more or less random Java standard, other tools are needed. You can use the attached XSLT stylesheet to transform your Python tests into a format accepted by the new Java-centric xUnit plugin. For instance, use the Unix shell tool called xsltproc this way: xsltproc pytest-xunit.xsl testreport.xml > testreport-xunit.xml and then ask xUnit to analyze testreport-xunit.xml instead of testreport.xml. It's been tested with nosetest and pytest. Regards, Lars

              People

              Assignee:
              nfalco Nikolas Falco
              Reporter:
              larsskj Lars Skjærlund
              Votes:
              2 Vote for this issue
              Watchers:
              5 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: