Skip to content
Permalink
Browse files
Add support file for JENKINS-15923
  • Loading branch information
gboissinot committed Feb 24, 2014
1 parent fca93e3 commit 573192f685a76ab2cd5d30e46750f6e140f1c312
@@ -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;
}
}
@@ -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);
}

}
}
@@ -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>

0 comments on commit 573192f

Please sign in to comment.