Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fca93e3
commit 573192f
Showing
3 changed files
with
128 additions
and
0 deletions.
There are no files selected for viewing
47 changes: 47 additions & 0 deletions
47
src/main/java/org/jenkinsci/plugins/xunit/types/EmbUnitInputMetric.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package org.jenkinsci.plugins.xunit.types; | ||
|
||
import com.thalesgroup.dtkit.junit.model.JUnitModel; | ||
import com.thalesgroup.dtkit.metrics.model.InputMetricXSL; | ||
import com.thalesgroup.dtkit.metrics.model.InputType; | ||
import com.thalesgroup.dtkit.metrics.model.OutputMetric; | ||
|
||
/** | ||
* @author Gregory Boissinot | ||
*/ | ||
public class EmbUnitInputMetric extends InputMetricXSL { | ||
|
||
@Override | ||
public InputType getToolType() { | ||
return InputType.TEST; | ||
} | ||
|
||
@Override | ||
public String getToolVersion() { | ||
return "Version N/A"; | ||
} | ||
|
||
@Override | ||
public String getToolName() { | ||
return "EmbUnit"; | ||
} | ||
|
||
@Override | ||
public boolean isDefault() { | ||
return true; | ||
} | ||
|
||
@Override | ||
public String getXslName() { | ||
return "embunit-to-junit.xsl"; | ||
} | ||
|
||
@Override | ||
public String[] getInputXsdNameList() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public OutputMetric getOutputFormatType() { | ||
return JUnitModel.OUTPUT_JUNIT_7; | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
src/main/java/org/jenkinsci/plugins/xunit/types/EmbUnitType.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package org.jenkinsci.plugins.xunit.types; | ||
|
||
import com.thalesgroup.dtkit.metrics.hudson.api.descriptor.TestTypeDescriptor; | ||
import com.thalesgroup.dtkit.metrics.hudson.api.type.TestType; | ||
import hudson.Extension; | ||
import org.kohsuke.stapler.DataBoundConstructor; | ||
|
||
/** | ||
* @author Gregory Boissinot | ||
*/ | ||
public class EmbUnitType extends TestType { | ||
|
||
@DataBoundConstructor | ||
public EmbUnitType(String pattern, boolean skipNoTestFiles, boolean failIfNotNew, boolean deleteOutputFiles, boolean stopProcessingIfError) { | ||
super(pattern, skipNoTestFiles, failIfNotNew, deleteOutputFiles, stopProcessingIfError); | ||
} | ||
|
||
@Extension | ||
public static class EmbUnitTypeDescriptor extends TestTypeDescriptor<EmbUnitType> { | ||
|
||
public EmbUnitTypeDescriptor() { | ||
super(EmbUnitType.class, EmbUnitInputMetric.class); | ||
} | ||
|
||
} | ||
} |
55 changes: 55 additions & 0 deletions
55
src/main/resources/org/jenkinsci/plugins/xunit/types/embunit-to-junit.xsl
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<?xml version="1.0"?> | ||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | ||
version="1.0"> | ||
<xsl:output method="xml" | ||
indent="yes"/> | ||
<xsl:template match="/"> | ||
<testsuites> | ||
<xsl:apply-templates/> | ||
</testsuites> | ||
</xsl:template> | ||
<xsl:template match="//TestRun/*"> | ||
<testsuite> | ||
<xsl:attribute name="errors">0</xsl:attribute> | ||
<xsl:attribute name="failures"> | ||
<xsl:value-of select="//Statistics/Failures"/> | ||
</xsl:attribute> | ||
<xsl:attribute name="tests"> | ||
<xsl:value-of select="//Statistics/Tests"/> | ||
</xsl:attribute> | ||
<xsl:attribute name="name"> | ||
<xsl:value-of select="name(.)"/> | ||
</xsl:attribute> | ||
<properties></properties> | ||
<system-err></system-err> | ||
<system-out></system-out> | ||
<xsl:apply-templates/> | ||
</testsuite> | ||
</xsl:template> | ||
<xsl:template match="//TestRun/Statistics"></xsl:template> | ||
<xsl:template match="//TestRun/*/Test"> | ||
<testcase> | ||
<xsl:attribute name="name"> | ||
<xsl:value-of select="Name"/> | ||
</xsl:attribute> | ||
</testcase> | ||
</xsl:template> | ||
<xsl:template match="//TestRun/*/FailedTest"> | ||
<testcase> | ||
<xsl:attribute name="name"> | ||
<xsl:value-of select="Name"/> | ||
</xsl:attribute> | ||
<failure> | ||
<xsl:attribute name="message"> | ||
<xsl:value-of select="Message"/> | ||
<xsl:text> (</xsl:text> | ||
<xsl:value-of select="Location/File"/> | ||
<xsl:text>:</xsl:text> | ||
<xsl:value-of select="Location/Line"/> | ||
<xsl:text>)</xsl:text> | ||
</xsl:attribute> | ||
</failure> | ||
</testcase> | ||
</xsl:template> | ||
<xsl:template match="text()|@*"/> | ||
</xsl:stylesheet> |