【发布时间】:2012-07-13 10:25:18
【问题描述】:
我正在使用 PHPUnit Selenium 对我的项目进行功能测试。 我正在使用 junit 进行日志记录并使用日志文件来生成报告。以下是phpunit.xml中的日志标签
<phpunit>
<logging>
<log type="junit" target="reports/logfile.xml" logIncompleteSkipped="false" />
</logging>
</phpunit>
然后我使用 logfile.xml 生成报告。
我正在寻找的是记录附加信息的能力(在两种情况下,即在断言的通过/失败中,说明在断言中究竟测试了什么的信息)。
基本上,我想在报告中说明所断言的内容。并且该信息将由测试编写者在测试用例中手动写入以及断言。
assert 函数带有第三个可选参数作为消息,但仅在失败时显示。
例如:
<?php
// $accountExists is the dummy variable which wil probably checking in database for the existence of the record
$this->assertEquals(true, $accountExists, 'Expecting for accountExists to be true');
?>
以上将在失败时返回消息,但在测试通过时不返回。
【问题讨论】:
标签: selenium report reporting phpunit