gpt4 book ai didi

php - Symfony2 功能测试 - 检查表格内容

转载 作者:可可西里 更新时间:2023-10-31 22:53:14 26 4
gpt4 key购买 nike

我只用过类似 contains() 的东西在我的断言中,所以我不确定如何处理像这样复杂的事情。

假设我有一系列预期答案 - 在本例中是"is"、"is"、“否”。

所以这意味着有效,对于第一个和第二个问题,我希望看到 <span class="glyphicon glyphicon-ok"></span>第三个里面<td>对于第三个问题,我希望在第四个 <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> 很难吗?是程序化的吗?

谢谢

最佳答案

我认为您应该查看有关测试和 DomCrawler 组件的文档页面:

有很简单的方法可以过滤html或xml内容。

关于php - Symfony2 功能测试 - 检查表格内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31868369/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com