代码覆盖 – 来自某些特定目录的phpunit三叶草,而不是完整的三叶草.可能吗?
|
我为什么需要这个?我在symfony项目上运行测试(并使用Zend fw),phpunit为所有受影响的文件生成三叶草.但我不希望看到symfony和Zend libs(以及所有其他第三方)的报道.我希望只看到我的代码的报道.
顺便说一下,可能还有另外一种方法可以解决这个问题吗? 您需要为phpunit创建配置文件,在该配置文件中,您可以从代码覆盖中排除特定文件或目录.示例文件如下所示: <phpunit stopOnFailure="false">
<testsuite name="Name">
</testsuite>
<filter>
<whitelist>
<directory suffix=".php">../php</directory>
<exclude>
<file>../php/somefile.php</file>
<directory suffix=".php">../php/pdf</directory>
</exclude>
</whitelist>
</filter>
<logging>
<log type="coverage-html" target="target-dir/coverage" charset="UTF-8" yui="true" highlight="true"/>
<log type="coverage-clover" target="target-dir/build/logs/clover.xml"/>
</logging>
</phpunit>
使用上面的文件,除了文件../php/somefile.php和所有带扩展名的文件外,代码覆盖率中包含了../php下的所有内容(这是从测试所在的目录和执行phprun的相对位置).目录中的php ../php/pdf 将此文件命名为phpunit.xml,将其放入运行测试的同一目录中.他们,如果你运行phpunit,它会选择conf. 如果您不能使用此特定文件名,则可以从命令行指定名称 phpunit --configuration yourconf.xml 有关phpunit配置文件的更多详细信息,请访问:http://phpunit.de/manual/3.7/en/appendixes.configuration.html (编辑:安卓应用网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
