forked from apache/xalan-test
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFailScanner.xsl
140 lines (125 loc) · 4.95 KB
/
FailScanner.xsl
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:lxslt="http://xml.apache.org/xslt"
xmlns:redirect="org.apache.xalan.lib.Redirect"
extension-element-prefixes="redirect"
version="1.0">
<!-- FileName: FailScanner.xsl -->
<!-- Author: shane_curcuru@us.ibm.com -->
<!-- Purpose: Stylesheet for org.apache.qetest.XMLFileLogger
logFiles that only prints out failing (and error) results.
-->
<!-- Import the BaseScanner for most duties; note this must be first in file -->
<xsl:import href="BaseScanner.xsl"/>
<xsl:output method="html"
doctype-public="-//W3C//DTD HTML 4.0 Transitional"/>
<lxslt:component prefix="redirect" elements="write open close" functions="">
<lxslt:script lang="javaclass" src="org.apache.xalan.lib.Redirect"/>
</lxslt:component>
<!-- Name of file for mini-fails redirected output -->
<xsl:param name="redirectFilename">FailScannerMini.html</xsl:param>
<xsl:template name="printScannerName">
<xsl:element name="a">
<xsl:attribute name="href"><xsl:text>FailScanner.xsl</xsl:text></xsl:attribute>
<xsl:text>FailScanner</xsl:text>
</xsl:element>
</xsl:template>
<!-- ================================== -->
<!-- Element templates: output basic data for each of the common
test elements, like messages, checks, etc.
-->
<!-- All non-fail testcases just get a status line, nothing else -->
<xsl:template match="testcase[caseresult/@result = $PASS] | testcase[caseresult/@result = $INCP]">
<h3>
<xsl:value-of select="caseresult/@result"/>
<xsl:text> Testcase: # </xsl:text>
<!-- This creates the anchor as well as printing the @desc -->
<xsl:call-template name="create-testcase-anchor">
<xsl:with-param name="testcase" select="."/>
</xsl:call-template>
<br/>
</h3>
</xsl:template>
<!-- Process all remaining testcases with special fails mode -->
<xsl:template match="testcase">
<table frame="box" border="1" rules="groups"
cellspacing="2" cellpadding="2"
bgcolor="#FFFFEE">
<caption>
<b><xsl:text>Testcase # </xsl:text></b>
<!-- This creates the anchor as well as printing the @desc -->
<xsl:call-template name="create-testcase-anchor">
<xsl:with-param name="testcase" select="."/>
</xsl:call-template>
</caption>
<!-- establish row widths here -->
<tr>
<td width="20"></td>
<td></td>
</tr>
<!-- Only select results; the checkresult templates have special
processing to output additional messages when needed.
-->
<xsl:apply-templates select="checkresult" />
<tr>
<td><br/><hr/></td>
<td><xsl:value-of select="caseresult/@result"/>:<xsl:text>Testcase #</xsl:text><xsl:value-of select="@desc"/></td>
</tr>
</table>
</xsl:template>
<!-- Results that are clearly fails have preceding messages printed out;
since those help in debugging and may indicate cause of failure.
-->
<xsl:template match="checkresult[@result=$FAIL] | checkresult[@result=$ERRR]">
<xsl:apply-templates select="preceding-sibling::*[2]" mode="table"/>
<xsl:apply-templates select="preceding-sibling::*[1]" mode="table"/>
<!-- Then print out this result itself -->
<tr>
<td bgcolor="#FF8080">
<xsl:call-template name="create-checkresult-anchor">
<xsl:with-param name="checkresult" select="."/>
</xsl:call-template>
</td>
<td>
<xsl:if test="@id">
<xsl:text>[</xsl:text><xsl:value-of select="@id"/><xsl:text>] </xsl:text>
</xsl:if>
<xsl:value-of select="@desc"/>
</td>
</tr>
<!-- Then print out blank row to separate results -->
<tr><td colspan="2" bgcolor="silver"><xsl:text> </xsl:text></td></tr>
<redirect:write select="$redirectFilename" append="true">
<b><xsl:value-of select="@result"/><xsl:text> </xsl:text></b>
<xsl:if test="@id">
<xsl:text>[</xsl:text><xsl:value-of select="@id"/><xsl:text>] </xsl:text>
</xsl:if>
<xsl:value-of select="@desc"/><br/>
</redirect:write>
</xsl:template>
<!-- Other Results that are not passes just get printed out as-is -->
<xsl:template match="checkresult[@result=$AMBG] | checkresult[@result=$INCP]">
<xsl:apply-templates select="preceding-sibling::fileCheck[1]" mode="table"/>
<tr>
<td bgcolor="#FFFF00">
<i>
<xsl:call-template name="create-checkresult-anchor">
<xsl:with-param name="checkresult" select="."/>
</xsl:call-template>
</i>
</td>
<td>
<xsl:if test="@id">
<xsl:text>[</xsl:text><xsl:value-of select="@id"/><xsl:text>] </xsl:text>
</xsl:if>
<xsl:value-of select="@desc"/>
</td>
</tr>
<!-- Then print out blank row to separate results -->
<tr><td colspan="2" bgcolor="silver"><xsl:text> </xsl:text></td></tr>
</xsl:template>
<!-- Override BaseScanner handling of non-fail checkresults as no-op -->
<xsl:template match="checkresult" />
<!-- Override most messages when not in a testcase -->
<xsl:template match="message[@level > $WARNINGMSG]" />
</xsl:stylesheet>