【发布时间】:2016-10-15 16:03:12
【问题描述】:
我的 PHPUnit 配置文件有两个测试套件,unit 和 system。当我运行测试运行器vendor/bin/phpunit 时,它会运行两个套件中的所有测试。我可以使用testsuite 标志定位单个套件:vendor/bin/phpunit --testsuite unit,但我需要将测试运行器配置为默认仅运行unit 套件,并且仅在使用 testsuite 标志专门调用时运行integration .
我的配置:
<?xml version="1.0" encoding="UTF-8"?>
<phpunit colors="true">
<testsuites>
<testsuite name="unit">
<directory>tests/Unit</directory>
</testsuite>
<testsuite name="integration">
<directory>tests/Integration</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory suffix=".php">src</directory>
</whitelist>
</filter>
<logging>
<log type="coverage-clover" target="build/clover.xml"/>
</logging>
</phpunit>
【问题讨论】:
-
创建
phpunit_unit.sh和phpunit_integration.sh文件,里面有配置不是更好吗? -
是否找到了相反的答案?不是默认运行一些测试的方法 - 例如测试升级脚本的大量长期运行的测试?所以必须包括哪个。
-
我稍后可能会对此有一个关于我通常更喜欢的“替代”方式的答案......答案(甚至是接受的那个)非常复杂。认为重要吗?还是不值得打字?
标签: php unit-testing phpunit