Fix buck to junit transformation to support skipped tests
Skipped test were considered failures instead of skipped.
Change-Id: Ie38678d36b62cdaf946804c98dfc89bcb522355f
diff --git a/tools/buckToJUnit.xsl b/tools/buckToJUnit.xsl
index 424c050..f336520 100644
--- a/tools/buckToJUnit.xsl
+++ b/tools/buckToJUnit.xsl
@@ -31,8 +31,10 @@
<xsl:variable name="nonEmptyStacks" select="count(testresult[stacktrace != ''])"/>
<xsl:variable name="failures"
select="count(testresult[contains(stacktrace, 'java.lang.AssertionError')])"/>
- <xsl:variable name="errors" select="$nonEmptyStacks - $failures"/>
- <testsuite failures="{$failures}" time="{func:toMS(@time)}" errors="{$errors}" skipped="0"
+ <xsl:variable name="skipped"
+ select="count(testresult[contains(stacktrace, 'org.junit.internal.AssumptionViolatedException')])"/>
+ <xsl:variable name="errors" select="$nonEmptyStacks - $failures - $skipped"/>
+ <testsuite failures="{$failures}" time="{func:toMS(@time)}" errors="{$errors}" skipped="{$skipped}"
tests="{$testCount}" name="{@name}">
<xsl:apply-templates/>
</testsuite>
@@ -47,7 +49,11 @@
<xsl:template match="message"/>
- <xsl:template match="stacktrace[. != '']">
+ <xsl:template match="stacktrace[contains(.,'org.junit.internal.AssumptionViolatedException')]">
+ <skipped/>
+ </xsl:template>
+
+ <xsl:template match="stacktrace[. != '' and not(contains(.,'org.junit.internal.AssumptionViolatedException'))]">
<failure message="{../message}" type="{substring-before(., ':')}">
<xsl:value-of select="."/>
</failure>