Changeset View
Changeset View
Standalone View
Standalone View
templates/ctesttojunit.xsl
Show First 20 Lines • Show All 54 Lines • ▼ Show 20 Line(s) | 25 | <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xunit="http://www.xunit.org"> | |||
---|---|---|---|---|---|
55 | 55 | | |||
56 | <xsl:template match="/"> | 56 | <xsl:template match="/"> | ||
57 | <testsuites> | 57 | <testsuites> | ||
58 | <xsl:variable name="buildName" select="//Site/@BuildName"/> | 58 | <xsl:variable name="buildName" select="//Site/@BuildName"/> | ||
59 | <xsl:variable name="buildTime" select="(//Site/Testing/EndTestTime - //Site/Testing/StartTestTime)"/> | 59 | <xsl:variable name="buildTime" select="(//Site/Testing/EndTestTime - //Site/Testing/StartTestTime)"/> | ||
60 | <xsl:variable name="numberOfTests" select="count(//Site/Testing/Test)"/> | 60 | <xsl:variable name="numberOfTests" select="count(//Site/Testing/Test)"/> | ||
61 | <xsl:variable name="numberOfFailures" select="count(//Site/Testing/Test[@Status='failed'])"/> | 61 | <xsl:variable name="numberOfFailures" select="count(//Site/Testing/Test[@Status='failed'])"/> | ||
62 | <xsl:variable name="numberOfSkipped" select="count(//Site/Testing/Test[@Status='notrun'])"/> | 62 | <xsl:variable name="numberOfSkipped" select="count(//Site/Testing/Test[@Status='notrun'])"/> | ||
63 | <xsl:variable name="numberOfSkippedDueNotFound" select="count(//Site/Testing/Test[@Status='notrun']/Results/NamedMeasurement[@name='Completion Status'][Value='Unable to find executable'])"/> | ||||
63 | <testsuite name="CTest" | 64 | <testsuite name="CTest" | ||
64 | tests="{$numberOfTests}" | 65 | tests="{$numberOfTests}" | ||
65 | failures="{$numberOfFailures}" | 66 | failures="{$numberOfFailures + $numberOfSkippedDueNotFound}" | ||
66 | errors="0" | 67 | errors="0" | ||
67 | skipped="{$numberOfSkipped}"> | 68 | skipped="{$numberOfSkipped - $numberOfSkippedDueNotFound}"> | ||
68 | <xsl:for-each select="//Site/Testing/Test"> | 69 | <xsl:for-each select="//Site/Testing/Test"> | ||
69 | <xsl:variable name="testName" select="translate(Name, '-', '_')"/> | 70 | <xsl:variable name="testName" select="translate(Name, '-', '_')"/> | ||
70 | <xsl:variable name="duration" select="Results/NamedMeasurement[@name='Execution Time']/Value"/> | 71 | <xsl:variable name="duration" select="Results/NamedMeasurement[@name='Execution Time']/Value"/> | ||
71 | <xsl:variable name="status" select="@Status"/> | 72 | <xsl:variable name="status" select="@Status"/> | ||
73 | <xsl:variable name="completionStatus" select="Results/NamedMeasurement[@name='Completion Status']/Value"/> | ||||
72 | <xsl:variable name="output" select="Results/Measurement/Value"/> | 74 | <xsl:variable name="output" select="Results/Measurement/Value"/> | ||
73 | <xsl:variable name="className" select="translate(Path, '/.', '.')"/> | 75 | <xsl:variable name="className" select="translate(Path, '/.', '.')"/> | ||
74 | <testcase classname="projectroot{$className}" | 76 | <testcase classname="projectroot{$className}" | ||
75 | name="{$testName}"> | 77 | name="{$testName}"> | ||
76 | <xsl:choose> | 78 | <xsl:choose> | ||
77 | <xsl:when test="@Status='passed'"/> | 79 | <xsl:when test="@Status='passed'"/> | ||
80 | <xsl:when test="@Status='notrun' and $completionStatus='Unable to find executable'"> | ||||
81 | <failure> | ||||
82 | <xsl:value-of select="$output"/> | ||||
83 | </failure> | ||||
84 | </xsl:when> | ||||
78 | <xsl:when test="@Status='notrun'"> | 85 | <xsl:when test="@Status='notrun'"> | ||
79 | <skipped/> | 86 | <skipped/> | ||
80 | </xsl:when> | 87 | </xsl:when> | ||
81 | <xsl:otherwise> | 88 | <xsl:otherwise> | ||
82 | <failure> | 89 | <failure> | ||
83 | <xsl:value-of select="$output"/> | 90 | <xsl:value-of select="$output"/> | ||
84 | </failure> | 91 | </failure> | ||
85 | </xsl:otherwise> | 92 | </xsl:otherwise> | ||
Show All 10 Lines |