Skip to content
Permalink
Browse files

[FIXED JENKINS-11332] treat the 'timeout' outcome as a JUnit error

  • Loading branch information...
nilleb committed Mar 12, 2015
1 parent 5260e5b commit 7fafaae2aa041eebb90f15f30eeca07de222fd71
@@ -8,7 +8,7 @@
<xsl:variable name="buildName" select="/a:TestRun/@name or /b:TestRun/@name"/>
<xsl:variable name="numberOfTests" select="sum(/a:TestRun/a:ResultSummary/a:Counters/@total | /b:TestRun/b:ResultSummary/b:Counters/@total)"/>
<xsl:variable name="numberOfFailures" select="sum(/a:TestRun/a:ResultSummary/a:Counters/@failed | /b:TestRun/b:ResultSummary/b:Counters/@failed)" />
<xsl:variable name="numberOfErrors" select="sum(/a:TestRun/a:ResultSummary/a:Counters/@error | /b:TestRun/b:ResultSummary/b:Counters/@error)" />
<xsl:variable name="numberOfErrors" select="sum(/a:TestRun/a:ResultSummary/a:Counters/@error | /b:TestRun/b:ResultSummary/b:Counters/@error | /a:TestRun/a:ResultSummary/a:Counters/@timeout | /b:TestRun/b:ResultSummary/b:Counters/@timeout)" />
<xsl:variable name="numberSkipped" select="sum(/a:TestRun/a:ResultSummary/a:Counters/@notRunnable | /b:TestRun/b:ResultSummary/b:Counters/@notRunnable)" />
<testsuite name="MSTestSuite"
tests="{$numberOfTests}" time="0"
@@ -19,9 +19,6 @@
<xsl:variable name="testName" select="@testName"/>
<xsl:variable name="executionId" select="@executionId"/>
<xsl:variable name="duration" select="@duration"/>
<xsl:variable name="duration_seconds" select="substring(@duration, 7)"/>
<xsl:variable name="duration_minutes" select="substring(@duration, 4,2 )"/>
<xsl:variable name="duration_hours" select="substring(@duration, 1, 2)"/>
<xsl:variable name="outcome" select="@outcome"/>
<xsl:variable name="message" select="a:Output/a:ErrorInfo/a:Message"/>
<xsl:variable name="stacktrace" select="a:Output/a:ErrorInfo/a:StackTrace"/>
@@ -38,34 +35,22 @@
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<testcase classname="{$className}"
name="{$testName}">
<xsl:if test="$duration">
<xsl:attribute name="time">
<xsl:value-of select="$duration_hours*3600 + $duration_minutes*60 + $duration_seconds"/>
</xsl:attribute>
</xsl:if>
<xsl:if test="$message or $stacktrace">
<failure>
<xsl:if test="$message">
<xsl:attribute name="message"><xsl:value-of select="$message" /></xsl:attribute>
</xsl:if>
<xsl:value-of select="$stacktrace" />
</failure>
</xsl:if>
</testcase>
<xsl:call-template name="format-test-case">
<xsl:with-param name="className" select="$className"/>
<xsl:with-param name="duration" select="$duration"/>
<xsl:with-param name="message" select="$message"/>
<xsl:with-param name="outcome" select="$outcome"/>
<xsl:with-param name="stacktrace" select="$stacktrace"/>
<xsl:with-param name="testName" select="$testName"/>
</xsl:call-template>
</xsl:if>
</xsl:for-each>
</xsl:for-each>

<xsl:for-each select="//b:UnitTestResult">
<xsl:variable name="testName" select="@testName"/>
<xsl:variable name="executionId" select="@executionId"/>
<xsl:variable name="testId" select="@testId"/>
<xsl:variable name="duration" select="@duration"/>
<xsl:variable name="duration_seconds" select="substring(@duration, 7)"/>
<xsl:variable name="duration_minutes" select="substring(@duration, 4,2 )"/>
<xsl:variable name="duration_hours" select="substring(@duration, 1, 2)"/>
<xsl:variable name="outcome" select="@outcome"/>
<xsl:variable name="message" select="b:Output/b:ErrorInfo/b:Message"/>
<xsl:variable name="stacktrace" select="b:Output/b:ErrorInfo/b:StackTrace"/>
@@ -82,29 +67,55 @@
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<testcase classname="{$className}"
name="{$testName}"
>
<xsl:if test="$duration">
<xsl:attribute name="time">
<xsl:value-of select="$duration_hours*3600 + $duration_minutes*60 + $duration_seconds"/>
</xsl:attribute>
</xsl:if>

<xsl:if test="$message or $stacktrace">
<failure>
<xsl:if test="$message">
<xsl:attribute name="message"><xsl:value-of select="$message" /></xsl:attribute>
</xsl:if>
<xsl:value-of select="$stacktrace" />
</failure>
</xsl:if>
</testcase>
<xsl:call-template name="format-test-case">
<xsl:with-param name="className" select="$className"/>
<xsl:with-param name="duration" select="$duration"/>
<xsl:with-param name="message" select="$message"/>
<xsl:with-param name="outcome" select="$outcome"/>
<xsl:with-param name="stacktrace" select="$stacktrace"/>
<xsl:with-param name="testName" select="$testName"/>
</xsl:call-template>
</xsl:if>
</xsl:for-each>
</xsl:for-each>

</testsuite>
</testsuites>
</xsl:template>

<xsl:template name="format-test-case">
<xsl:param name="className"/>
<xsl:param name="testName"/>
<xsl:param name="duration"/>
<xsl:param name="outcome"/>
<xsl:param name="message"/>
<xsl:param name="stacktrace"/>
<xsl:variable name="duration_seconds" select="substring($duration, 7)"/>
<xsl:variable name="duration_minutes" select="substring($duration, 4, 2 )"/>
<xsl:variable name="duration_hours" select="substring($duration, 1, 2)"/>
<testcase classname="{$className}"
name="{$testName}"
>
<xsl:if test="$duration">
<xsl:attribute name="time">
<xsl:value-of select="$duration_hours*3600 + $duration_minutes*60 + $duration_seconds"/>
</xsl:attribute>
</xsl:if>
<xsl:if test="@outcome != 'Passed' or (not(@outcome) and ($message or $stacktrace))">
<xsl:variable name="tag">
<xsl:choose>
<xsl:when test="$outcome = 'Failed'">failure</xsl:when>
<xsl:otherwise>error</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:element name="{$tag}">
<xsl:if test="$message">
<xsl:attribute name="message"><xsl:value-of select="$message" /></xsl:attribute>
</xsl:if>
<xsl:if test="$stacktrace">
<xsl:value-of select="$stacktrace" />
</xsl:if>
</xsl:element>
</xsl:if>
</testcase>
</xsl:template>
</xsl:stylesheet>
@@ -1,13 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?><testsuites xmlns:b="http://microsoft.com/schemas/VisualStudio/TeamTest/2010" xmlns:a="http://microsoft.com/schemas/VisualStudio/TeamTest/2006">
<testsuite name="MSTestSuite" tests="3" time="0" failures="0" errors="3" skipped="0">
<testcase classname="LindbergCorp.StringFileTranslator.Test.TranslatorTests" name="TestConversion">
<failure message="Method LindbergCorp.StringFileTranslator.Test.TranslatorTests.TestFixtureSetup has wrong signature. The method should have 1 parameters."/>
<error message="Method LindbergCorp.StringFileTranslator.Test.TranslatorTests.TestFixtureSetup has wrong signature. The method should have 1 parameters."/>
</testcase>
<testcase classname="LindbergCorp.StringFileTranslator.Test.TranslatorTests" name="TestConversionFrench">
<failure message="Method LindbergCorp.StringFileTranslator.Test.TranslatorTests.TestFixtureSetup has wrong signature. The method should have 1 parameters."/>
<error message="Method LindbergCorp.StringFileTranslator.Test.TranslatorTests.TestFixtureSetup has wrong signature. The method should have 1 parameters."/>
</testcase>
<testcase classname="LindbergCorp.StringFileTranslator.Test.TranslatorTests" name="TestFileNotFound">
<failure message="Method LindbergCorp.StringFileTranslator.Test.TranslatorTests.TestFixtureSetup has wrong signature. The method should have 1 parameters."/>
<error message="Method LindbergCorp.StringFileTranslator.Test.TranslatorTests.TestFixtureSetup has wrong signature. The method should have 1 parameters."/>
</testcase>
</testsuite>
</testsuites>
@@ -0,0 +1,47 @@
<?xml version="1.0" encoding="UTF-8"?>
<TestRun id="38b008d6-3feb-4123-8d87-5791a3cdce8d" name="Carlos@COMPUTADOR-4 2010-02-08 15:12:31" runUser="Computador-4\Carlos" xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2010">
<TestSettings name="Local" id="b8541fa7-a682-4127-b2b6-be4a44224f53">
<Description>These are default test settings for a local test run.</Description>
<Deployment enabled="false" runDeploymentRoot="Carlos_COMPUTADOR-4 2010-02-08 15_12_31" />
<Execution>
<TestTypeSpecific />
<AgentRule name="Execution Agents">
</AgentRule>
</Execution>
</TestSettings>
<Times creation="2010-02-08T15:12:31.6930000-02:00" queuing="2010-02-08T15:12:35.8630000-02:00" start="2010-02-08T15:12:35.9910000-02:00" finish="2010-02-08T15:12:36.9830000-02:00" />
<ResultSummary outcome="Failed">
<Counters total="2" executed="2" passed="1" error="0" failed="1" timeout="0" aborted="0" inconclusive="0" passedButRunAborted="0" notRunnable="0" notExecuted="0" disconnected="0" warning="0" completed="0" inProgress="0" pending="0" />
</ResultSummary>
<TestDefinitions>
<UnitTest name="TestMethod1" storage="c:\users\carlos\documents\visual studio 2010\projects\testproject1\testproject1\bin\debug\testproject1.dll" id="59863143-3238-122e-4d8a-637b491cc755">
<Execution id="25893b49-65e3-4b43-b122-34f38945de36" />
<TestMethod codeBase="c:/users/carlos/documents/visual studio 2010/Projects/TestProject1/TestProject1/bin/Debug/TestProject1.DLL" adapterTypeName="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestAdapter, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.Adapter, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" className="TestProject1.UnitTest1" name="TestMethod1" />
</UnitTest>
<UnitTest name="TestMethod2" storage="c:\users\carlos\documents\visual studio 2010\projects\testproject1\testproject1\bin\debug\testproject1.dll" id="9381223e-8095-9777-a0c7-26043045171c">
<Execution id="58d9adb6-df78-4fa7-817f-b5c8ff64e98f" />
<TestMethod codeBase="c:/users/carlos/documents/visual studio 2010/Projects/TestProject1/TestProject1/bin/Debug/TestProject1.DLL" adapterTypeName="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestAdapter, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.Adapter, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" className="TestProject1.UnitTest1" name="TestMethod2" />
</UnitTest>
</TestDefinitions>
<TestLists>
<TestList name="Results Not in a List" id="8c84fa94-04c1-424b-9868-57a2d4851a1d" />
<TestList name="All Loaded Results" id="19431567-8539-422a-85d7-44ee4e166bda" />
</TestLists>
<TestEntries>
<TestEntry testId="59863143-3238-122e-4d8a-637b491cc755" executionId="25893b49-65e3-4b43-b122-34f38945de36" testListId="8c84fa94-04c1-424b-9868-57a2d4851a1d" />
<TestEntry testId="9381223e-8095-9777-a0c7-26043045171c" executionId="58d9adb6-df78-4fa7-817f-b5c8ff64e98f" testListId="8c84fa94-04c1-424b-9868-57a2d4851a1d" />
</TestEntries>
<Results>
<UnitTestResult executionId="25893b49-65e3-4b43-b122-34f38945de36" testId="59863143-3238-122e-4d8a-637b491cc755" testName="TestMethod1" computerName="COMPUTADOR-4" duration="00:00:00.0181950" startTime="2010-02-08T15:12:36.1200000-02:00" endTime="2010-02-08T15:12:36.7810000-02:00" testType="13cdc9d9-ddb5-4fa4-a97d-d965ccfc6d4b" outcome="Passed" testListId="8c84fa94-04c1-424b-9868-57a2d4851a1d" relativeResultsDirectory="25893b49-65e3-4b43-b122-34f38945de36">
</UnitTestResult>
<UnitTestResult executionId="58d9adb6-df78-4fa7-817f-b5c8ff64e98f" testId="9381223e-8095-9777-a0c7-26043045171c" testName="TestMethod2" computerName="COMPUTADOR-4" duration="00:00:00.1018105" startTime="2010-02-08T15:12:36.7930000-02:00" endTime="2010-02-08T15:12:36.8980000-02:00" testType="13cdc9d9-ddb5-4fa4-a97d-d965ccfc6d4b" outcome="Timeout" testListId="8c84fa94-04c1-424b-9868-57a2d4851a1d" relativeResultsDirectory="58d9adb6-df78-4fa7-817f-b5c8ff64e98f">
<Output>
<ErrorInfo>
<Message>Assert.Fail failed. </Message>
<StackTrace> at TestProject1.UnitTest1.TestMethod2() in c:\users\carlos\documents\visual studio 2010\Projects\TestProject1\TestProject1\UnitTest1.cs:line 71
</StackTrace>
</ErrorInfo>
</Output>
</UnitTestResult>
</Results>
</TestRun>

0 comments on commit 7fafaae

Please sign in to comment.
You can’t perform that action at this time.