[英]PHPUnit Code Coverage
我正在学习单元测试Zend Framework
应用程序的绳索。 到目前为止,我已经设置了PHPUnit
来与Zend Framework
一起工作,并开始编写一些简单的测试用例。
我的问题是,我想知道为什么Code Coverage
无法在我的phpunit.xml
中的日志标记中phpunit.xml
。
我没有收到任何错误但没有生成覆盖率报告。
但是当我运行phpunit --coverage <dir>
时它会起作用
我的phpunit的日志记录部分如下:
<phpunit bootstrap="./application/bootstrap.php" colors="true">
<testsuite name="CI Test Suite">
<directory>./</directory>
</testsuite>
<testsuite name="Library Test Suite">
<directory>./library</directory>
</testsuite>
<filter>
<whitelist>
<directory suffix=".php">../application/</directory>
<exclude>
<directory suffix=".phtml">../application</directory>
<file>../application/Bootstrap.php</file>
<file>../application/controllers/ErrorController.php</file>
</exclude>
</whitelist>
<logging>
<log type="coverage-html" target="./log/report" charset="UTF-8" yui="true"
highlight="true" lowUpperBound="50" highLowerBound="80" />
<log type="testdox" target="./log/testdox.html" />
</logging>
</filter>
</phpunit>
有没有遇到过这个? 什么是可能的问题?
这是我的一个项目的phpunit.xml,这很好用。 正如您所看到的,日志记录部分位于过滤器部分之外,因此这可能是Mark Baker评论的问题。 我选择这个,因为它来自一个小项目,非常简单。
<phpunit bootstrap="./bootstrap.php" colors="false">
<testsuite name="HSSTests">
<directory>./</directory>
</testsuite>
<filter>
<whitelist>
<directory suffix=".php">d:/wamp/app_hss/</directory>
<exclude>
<directory suffix=".phtml">d:/wamp/app_hss/</directory>
<directory suffix=".php">d:/wamp/app_hss/tests/</directory>
</exclude>
</whitelist>
</filter>
<logging>
<log type="coverage-html" target="./log/codeCoverage" charset="UTF-8"
yui="true" highlight="true"
lowUpperBound="50" highLowerBound="80"/>
<log type="testdox-html" target="./log/testdox.html" />
</logging>
</phpunit>
您可能需要的所有信息都在PHPunit手册中 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.