generated from ebekker/pwsh-github-action-base
-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding support for overriding TRX XSL stylesheet
- Loading branch information
Showing
5 changed files
with
138 additions
and
6 deletions.
There are no files selected for viewing
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
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
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
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,89 @@ | ||
<?xml version="1.0"?> | ||
<xsl:stylesheet version="2.0" | ||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | ||
xmlns:xs="http://www.w3.org/2001/XMLSchema" | ||
xmlns:fn="http://www.w3.org/2005/xpath-functions" | ||
xmlns:ms="urn:schemas-microsoft-com:xslt" | ||
xmlns:dt="urn:schemas-microsoft-com:datatypes" | ||
xmlns:trxfn="urn:trxfn" | ||
xmlns:trx="http://microsoft.com/schemas/VisualStudio/TeamTest/2010" | ||
> | ||
|
||
<xsl:output method="text"/> | ||
<xsl:strip-space elements="*"/> | ||
|
||
<xsl:param name="reportTitle" select="/trx:TestRun/@name" /> | ||
|
||
<xsl:template match="/"> | ||
<xsl:variable name="startTime" select="/trx:TestRun/trx:Times/@start" as="xs:date" /> | ||
<xsl:variable name="finishTime" select="/trx:TestRun/trx:Times/@finish" as="xs:date" /> | ||
# Test Results - <xsl:value-of select="$reportTitle" /> | ||
|
||
* Duration: <xsl:value-of select="trxfn:DiffSeconds($startTime, $finishTime)" /> seconds | ||
* Outcome: <xsl:value-of select="/trx:TestRun/trx:ResultSummary/@outcome" | ||
/> | Total Tests: <xsl:value-of select="/trx:TestRun/trx:ResultSummary/trx:Counters/@total" | ||
/> | Passed: <xsl:value-of select="/trx:TestRun/trx:ResultSummary/trx:Counters/@passed" | ||
/> | Failed: <xsl:value-of select="/trx:TestRun/trx:ResultSummary/trx:Counters/@failed" /> | ||
|
||
## Tests: | ||
|
||
<xsl:apply-templates select="/trx:TestRun/trx:TestDefinitions"/> | ||
</xsl:template> | ||
|
||
<xsl:template match="trx:UnitTest"> | ||
<xsl:variable name="testId" | ||
select="@id" /> | ||
<xsl:variable name="testResult" | ||
select="/trx:TestRun/trx:Results/trx:UnitTestResult[@testId=$testId]" /> | ||
<xsl:variable name="testOutcomeIcon"> | ||
<xsl:choose> | ||
<xsl:when test="$testResult/@outcome = 'Passed'">:heavy_check_mark:</xsl:when> | ||
<xsl:when test="$testResult/@outcome = 'Failed'">:x:</xsl:when> | ||
<xsl:when test="$testResult/@outcome = 'NotExecuted'">:radio_button:</xsl:when> | ||
<xsl:otherwise>:grey_question:</xsl:otherwise> | ||
</xsl:choose> | ||
</xsl:variable> | ||
|
||
<details> | ||
<summary> | ||
<xsl:value-of select="$testOutcomeIcon" /> | ||
<xsl:text> </xsl:text> | ||
<xsl:value-of select="@name" /> | ||
</summary> | ||
|
||
| | | | ||
|-|-| | ||
| **Name:** | `<xsl:value-of select="@name" />` | ||
| **Code Base:** | `<xsl:value-of select="trx:TestMethod/@codeBase" />` | ||
| **Outcome:** | `<xsl:value-of select="$testResult/@outcome" />` <xsl:value-of select="$testOutcomeIcon" /> | ||
| **Computer Name:** | `<xsl:value-of select="$testResult/@computerName" />` | ||
| **Duration:** | `<xsl:value-of select="$testResult/@duration" />` | ||
|
||
|
||
<xsl:if test="$testResult/@outcome = 'Failed'"> | ||
|
||
<details> | ||
<summary>Error Message:</summary> | ||
|
||
```text | ||
<xsl:value-of select="$testResult/trx:Output/trx:ErrorInfo/trx:Message" /> | ||
``` | ||
</details> | ||
|
||
<details> | ||
<summary>Error Stack Trace:</summary> | ||
|
||
```text | ||
<xsl:value-of select="$testResult/trx:Output/trx:ErrorInfo/trx:StackTrace" /> | ||
``` | ||
</details> | ||
|
||
</xsl:if> | ||
|
||
----- | ||
|
||
</details> | ||
|
||
</xsl:template> | ||
|
||
</xsl:stylesheet> |
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