Skip to content
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

Add optional testcase attributes back #81

Closed
wants to merge 1 commit into from

Conversation

dnozay
Copy link
Member

@dnozay dnozay commented Feb 10, 2020

These attributes were present from 2014-2018 on the testcase element.
Tools other than maven surefire or ant tasks use the XSD file to build a XML report file that xunit plugin can read.

https://github.com/jenkinsci/xunit-plugin/blob/14c6e39c38408b9ed6280361484a13c6f5becca7/src/main/resources/org/jenkinsci/plugins/xunit/types/model/xsd/junit-10.xsd

xunit 2.2.4 removed those optional attributes.

unittest-xml-reporting is a python library that tries to generate xml report using that older schema definition.
xmlrunner/unittest-xml-reporting#201

These attributes were present from 2014-2018 on the testcase element.
Tools other than maven surefire or ant tasks use the XSD file to build a XML report file that xunit plugin can read.

https://github.com/jenkinsci/xunit-plugin/blob/14c6e39c38408b9ed6280361484a13c6f5becca7/src/main/resources/org/jenkinsci/plugins/xunit/types/model/xsd/junit-10.xsd

xunit 2.2.4 removed those optional attributes.

`unittest-xml-reporting` is a python library that tries to generate xml report using that older schema definition.
xmlrunner/unittest-xml-reporting#201
@nfalco79
Copy link
Member

I do not see any of these options in the Ant schema:
https://github.com/windyroad/JUnit-Schema/blob/master/JUnit.xsd

For what I know Ant schema comes from windyroad

@dnozay
Copy link
Member Author

dnozay commented Feb 12, 2020

I do not see any of these options in the Ant schema:
https://github.com/windyroad/JUnit-Schema/blob/master/JUnit.xsd
For what I know Ant schema comes from windyroad

I did not mention Ant.

unittest-xml-reporting is a python library that generates xml reports
using the older XSD https://github.com/jenkinsci/xunit-plugin/blob/14c6e39c38408b9ed6280361484a13c6f5becca7/src/main/resources/org/jenkinsci/plugins/xunit/types/model/xsd/junit-10.xsd

Some of these optional fields make sense for python tracebacks or to indicate file and lineno where testcase is defined and that's why we're using them.
Some of these optional fields make sense for recording testcase start time when test frameworks can choose to run them sequentially or in parallel, and that's why we're using them.

https://plugins.jenkins.io/xunit/
AFAICT, this plugin supports:

  • JUnit (supported schema are Ant junit and Maven Surefire)
  • AUnit
  • MSTest (imported from MSTest Plugin)
  • NUnit (imported from NUnit Plugin)
  • UnitTest++
  • Boost Test Library
  • PHPUnit
  • Free Pascal Unit
  • CppUnit
  • MbUnit
  • Googletest
  • EmbUnit
  • gtester/glib
  • QTestLib

and it would be nice to support unittest-xml-reporting even if it doesn't need to be on the list.

@nfalco79
Copy link
Member

Than the way is add a new generic unit type without any schema validation where the XSLT is that one I had link in the main documentation. I will have a check (if I have time) next weekends.

@dnozay
Copy link
Member Author

dnozay commented Feb 18, 2020

The XSL for this type would be something like this:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
    <xsl:output method="xml" indent="yes" />

    <!-- /dev/null for these attributes -->
    <xsl:template match="//testcase/@file" />
    <xsl:template match="//testcase/@line" />
    <xsl:template match="//testcase/@timestamp" />

    <!-- copy the rest -->
    <xsl:template match="node()|@*">
        <xsl:copy>
            <xsl:apply-templates select="node()|@*" />
        </xsl:copy>
    </xsl:template>
</xsl:stylesheet>

@nfalco79
Copy link
Member

That is too closer you output. If I have to add support for a generic (j)unit report I will use the XSL referred in wiki page.

@nfalco79
Copy link
Member

nfalco79 commented Feb 23, 2020

I forgot that is already present a generic tools that allow to specify the XSL to use. And this is the reason I had create that XSL on wiki page.
The XSL could be pointed using a HTTP(S) url or using a file path relative to the master, slave or workspace
immagine

From wiki:
Is possible place the XSL file in the $JENKINS_HOME/userContent folder and automatically the file will be available under the URL http(s)://$JENKINS_URL/userContent/file.xsl

@nfalco79 nfalco79 closed this Feb 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants