2012-07-13 22 views
1

我正在使用PHPUnit Selenium對我的項目進行功能測試。 我正在使用junit進行日誌記錄並使用日誌文件來構建報告。以下是phpunit.xml中的日誌標記在PHPUnit中記錄其他自定義信息以獲得報告

<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'); 
?> 

上面會返回失敗消息,但不是當測試通過。

回答