【发布时间】:2015-08-07 01:32:54
【问题描述】:
我只在断言中使用过contains() 之类的东西,所以我不确定如何处理如此复杂的事情。
假设我有一系列预期的答案 - 在这种情况下,答案是“是”、“是”、“否”。
这实际上意味着,对于第一个和第二个问题,我希望在第三个 <td> 中看到 <span class="glyphicon glyphicon-ok"></span>,对于第三个问题,我希望在第四个 <td> 中看到它。
这是我的 HTML 代码:
<table class="table table-curved">
<tr>
<th width="10%">Item</th>
<th width="60%">Description</th>
<th width="10%">YES</th>
<th width="10%">NO</th>
<th width="10%">NOT APPLICABLE</th>
</tr>
<tr>
<td class="report-table-inner report-centre">1</td>
<td class="report-table-inner">Check cargo is secure and undamaged.</td>
<td class="report-centre success"><span class="glyphicon glyphicon-ok"></span></td>
<td class="report-centre"></td>
<td class="report-centre"></td>
</tr>
<tr>
<td class="report-table-inner report-centre">2</td>
<td class="report-table-inner">Is all cargo accounted for.</td>
<td class="report-centre success"><span class="glyphicon glyphicon-ok"></span></td>
<td class="report-centre"></td>
<td class="report-centre"></td>
</tr>
<tr>
<td class="report-table-inner report-centre">3</td>
<td class="report-table-inner">Is all cargo checked by customs.</td>
<td class="report-centre"></td>
<td class="report-centre danger"><span class="glyphicon glyphicon-ok"></span></td>
<td class="report-centre"></td>
</tr>
...
我应该如何为此编写测试?以编程方式遍历<tr> 是否很难?
谢谢
【问题讨论】:
标签: php symfony functional-testing