File: junit-xml-format-errors.xsl

package info (click to toggle)
jabref 3.8.1%2Bds-3%2Bdeb9u1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 18,336 kB
  • sloc: java: 114,114; xml: 3,985; python: 283; sh: 282; perl: 200; ruby: 22; makefile: 6
file content (61 lines) | stat: -rw-r--r-- 2,185 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?xml version="1.0" encoding="utf-8"?>
<!-- based on SO answer http://stackoverflow.com/a/9471505/166062 by dvdvorle http://stackoverflow.com/users/481635/dvdvorle -->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="text" indent="no"/>
    <xsl:template match="/testsuite">
        <xsl:text>Testsuite: </xsl:text><xsl:value-of select="@name" />
        <xsl:text>
Tests run: </xsl:text>
        <xsl:value-of select="@tests" />
        <xsl:text>, Failures: </xsl:text>
        <xsl:value-of select="@failures" />
        <xsl:text>, Errors: </xsl:text>
        <xsl:value-of select="@errors" />
        <xsl:text>, Time elapsed: </xsl:text>
        <xsl:value-of select="@time" />
        <xsl:text> sec</xsl:text>
        <xsl:text>
--------- ----------- ---------</xsl:text>
        <xsl:apply-templates select="testcase" />
        <xsl:apply-templates select="system-out" />
        <xsl:apply-templates select="system-err" />
    </xsl:template>

    <xsl:template match="testcase">
    <xsl:text>
Testcase: </xsl:text>
        <xsl:value-of select="@name" />
        <xsl:text> took </xsl:text>
        <xsl:value-of select="@time" />
        <xsl:choose>
            <xsl:when test="failure"><xsl:text> FAILURE </xsl:text><xsl:apply-templates select="failure"/></xsl:when>
            <xsl:when test="error"><xsl:text> ERROR </xsl:text><xsl:apply-templates select="error"/></xsl:when>
            <xsl:otherwise><xsl:text> SUCCESS</xsl:text></xsl:otherwise>
        </xsl:choose>
    </xsl:template>

    <xsl:template match="error | failure">
        <xsl:value-of select="@message" />
        <xsl:if test="@type != @message">
            <xsl:text> </xsl:text><xsl:value-of select="@type" />
        </xsl:if>
        <xsl:text>
</xsl:text>
        <xsl:value-of select="." />
    </xsl:template>

    <xsl:template match="system-out">
    <xsl:text>
------ Standard output ------
</xsl:text>
        <xsl:value-of select="." />
    </xsl:template>

    <xsl:template match="system-err">
    <xsl:text>
------ Error output ------
</xsl:text>
        <xsl:value-of select="." />
    </xsl:template>

</xsl:stylesheet>