我正在为我的 geb spock html 报告使用 athaydes 报告。我正在尝试修改 html 报告以获取测试用例的状态。为此,我添加了新列作为“最后一列”下面是我正在使用的 html:
<table class="summary-table">
<thead>
<tr>
<th>Name</th>
<th>Features</th>
<th>Failed</th>
<th>Errors</th>
<th>Skipped</th>
<th>Time</th>
<th>Final Status</th>
</tr>
</thead>
<tbody>
<% data.each { name, map ->
def s = map.stats%>
<tr class="${s.errors ? 'error' : ''} ${s.failures ? 'failure' : ''} ">
<td><a href="${name}.html">$name</a></td>
<td>${s.totalRuns}</td>
<td>${s.failures}</td>
<td>${s.errors}</td>
<td>${s.skipped}</td>
<td>${fmt.toTimeDuration(s.time)}</td>
<td if="${s.totalRuns} != 0" ? 'PASS' : 'FAILED >${s.totalRuns = 0 ? 'PASS' : 'FAILED' }</td>
</tr>
<% } %>
</tbody>
</table>
现在我的要求是,如果“ ${s.failures}
”和“ ${s.errors}
”和“ ${s.skipped}
”都等于零,那么只有列的值应该是“PASS”,否则它应该是“FAILED”。
我尝试了类似的 方法,<td if="${s.totalRuns} != 0" ? 'PASS' : 'FAILED >${s.totalRuns = 0 ? 'PASS' : 'FAILED' }</td>
但是这个解决方案不起作用,因为我对 html 很陌生。
你能在这方面帮助我吗?谢谢!