Skip to content

Commit

Permalink
[JENKINS-19884] Unify test failure presentation
Browse files Browse the repository at this point in the history
- SurefireAggregatedReport lists all aggregated failures now (its maven counterpart MatrixTestResult does it already)
- Failure summary is available wherever applicable
  • Loading branch information
olivergondza committed Oct 4, 2013
1 parent f98070d commit 9b1bcb8
Show file tree
Hide file tree
Showing 4 changed files with 136 additions and 75 deletions.
Expand Up @@ -66,44 +66,7 @@ THE SOFTWARE.
</j:forEach>
</table>

<br/>
<h2>Failed Tests</h2>

<j:forEach var="report" items="${it.childReports}">
<j:if test="${report.result.failCount!=0}">

<h3>
<a name="${report.child.project.name}"/>
<a href="../${report.child.project.shortUrl}testReport" class="model-link inside">${report.child.project.name}</a>
</h3>

<table class="pane sortable">
<tr>
<td class="pane-header">Test Name</td>
<td class="pane-header" style="width:4em">Duration</td>
<td class="pane-header" style="width:4em">Age</td>
</tr>
<j:forEach var="f" items="${report.result.failedTests}" varStatus="i">
<tr>
<td class="pane">
<a href="../${report.child.project.shortUrl}testReport/${f.getRelativePathFrom(report.result)}" class="model-link inside">
<st:out value="${f.fullName}"/>
<j:forEach var="badge" items="${f.testActions}">
<st:include it="${badge}" page="badge.jelly" optional="true"/>
</j:forEach>
</a>
</td>
<td class="pane" style="text-align:right;">
${f.duration}
</td>
<td class="pane" style="text-align:right;">
${f.age}
</td>
</tr>
</j:forEach>
</table>
</j:if>
</j:forEach>
<t:aggregated-failed-tests/>
</l:main-panel>
</l:layout>
</j:jelly>
Expand Up @@ -25,28 +25,6 @@ THE SOFTWARE.

<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form">

<script type="text/javascript">
<!-- TODO make sure load doesn't happen every time -->
function showStackTrace(id,query) {
var element = document.getElementById(id)
element.style.display = "";
document.getElementById(id + "-showlink").style.display = "none";
document.getElementById(id + "-hidelink").style.display = "";

var rqo = new XMLHttpRequest();
rqo.open('GET', query, true);
rqo.onreadystatechange = function() { element.innerHTML = rqo.responseText; }
rqo.send(null);
}

function hideStackTrace(id) {
document.getElementById(id).style.display = "none";
document.getElementById(id + "-showlink").style.display = "";
document.getElementById(id + "-hidelink").style.display = "none";
}
</script>

<j:if test="${it.failCount!=0}">
<h2>${%All Failed Tests}</h2>
<table class="pane sortable">
Expand All @@ -57,21 +35,7 @@ THE SOFTWARE.
</tr>
<j:forEach var="f" items="${it.failedTests}" varStatus="i">
<tr>
<td class="pane">
<a id="test-${f.fullName}-showlink"
href="javascript:showStackTrace('test-${h.jsStringEscape(f.fullName)}','${f.getRelativePathFrom(it)}/summary')">&gt;&gt;&gt;</a>
<a id="test-${f.fullName}-hidelink" style="display:none"
href="javascript:hideStackTrace('test-${h.jsStringEscape(f.fullName)}')">&lt;&lt;&lt;</a>
<st:nbsp/>
<a href="${f.getRelativePathFrom(it)}" class="model-link inside"><st:out value="${f.fullDisplayName}"/></a>
<j:forEach var="badge" items="${f.testActions}">
<st:include it="${badge}" page="badge.jelly" optional="true"/>
</j:forEach>
<div id="test-${f.fullName}" class="hidden" style="display:none">
${%Loading...}
</div>
</td>

<td class="pane"><t:failed-test result="${f}" url="${f.getRelativePathFrom(it)}"/></td>
<td class="pane" style="text-align:right;" data="${f.duration}">
${f.durationString}
</td>
Expand Down
64 changes: 64 additions & 0 deletions core/src/main/resources/lib/hudson/aggregated-failed-tests.jelly
@@ -0,0 +1,64 @@
<!--
The MIT License
Copyright (c) 20013 Red Hat, Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-->

<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form">
<st:documentation>
Display links to failed test from all child reports.
@since TODO
<st:attribute name="it" type="AggregatedTestResultAction">
Aggregated action.
</st:attribute>
</st:documentation>

<j:if test="${it.failCount!=0}">
<br/>
<h2>Failed Tests</h2>

<j:forEach var="report" items="${it.childReports}">
<j:if test="${report.result.failCount!=0}">

<h3>
<a name="${report.child.project.name}"/>
<a href="../${report.child.project.shortUrl}testReport" class="model-link inside">${report.child.project.name}</a>
</h3>

<table class="pane sortable">
<tr>
<td class="pane-header">Test Name</td>
<td class="pane-header" style="width:4em">Duration</td>
<td class="pane-header" style="width:4em">Age</td>
</tr>
<j:forEach var="f" items="${report.result.failedTests}" varStatus="i">
<tr>
<td class="pane"><t:failed-test result="${f}" url="../${report.child.project.shortUrl}testReport/${f.getRelativePathFrom(report.result)}"/></td>
<td class="pane" style="text-align:right;">${f.duration}</td>
<td class="pane" style="text-align:right;">${f.age}</td>
</tr>
</j:forEach>
</table>
</j:if>
</j:forEach>
</j:if>
</j:jelly>
70 changes: 70 additions & 0 deletions core/src/main/resources/lib/hudson/failed-test.jelly
@@ -0,0 +1,70 @@
<!--
The MIT License
Copyright (c) 20013 Red Hat, Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-->

<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form">
<st:documentation>
Display link to the failed test.
@since TODO
<st:attribute name="url" type="String">
Path to the failed test.
</st:attribute>
<st:attribute name="result" type="TestObject">
Failed test object
</st:attribute>
</st:documentation>
<st:once>
<script type="text/javascript">
<!-- TODO make sure load doesn't happen every time -->
function showStackTrace(id,query) {
var element = document.getElementById(id)
element.style.display = "";
document.getElementById(id + "-showlink").style.display = "none";
document.getElementById(id + "-hidelink").style.display = "";

var rqo = new XMLHttpRequest();
rqo.open('GET', query, true);
rqo.onreadystatechange = function() { element.innerHTML = rqo.responseText; }
rqo.send(null);
}

function hideStackTrace(id) {
document.getElementById(id).style.display = "none";
document.getElementById(id + "-showlink").style.display = "";
document.getElementById(id + "-hidelink").style.display = "none";
}
</script>
</st:once>
<j:set var="id" value="${h.jsStringEscape(url)}"/>
<j:set var="open" value="javascript:showStackTrace('test-${id}','${url}/summary')"/>
<j:set var="close" value="javascript:hideStackTrace('test-${id}')"/>
<a id="test-${id}-showlink" href="${open}" title="${%Show details}">&gt;&gt;&gt;</a>
<a id="test-${id}-hidelink" href="${close}" title="${%Hide details}" style="display:none">&lt;&lt;&lt;</a>
<st:nbsp/>
<a href="${url}" class="model-link inside"><st:out value="${result.fullDisplayName}"/></a>
<j:forEach var="badge" items="${result.testActions}">
<st:include it="${badge}" page="badge.jelly" optional="true"/>
</j:forEach>
<div id="test-${id}" class="hidden" style="display:none">${%Loading...}</div>
</j:jelly>

0 comments on commit 9b1bcb8

Please sign in to comment.