我的PHPUnit配置文件有兩個測試套件,分別爲unit
和system
。當我運行測試跑步者vendor/bin/phpunit
時,它將在兩個套件中運行所有測試。我可以使用testsuite
標誌:vendor/bin/phpunit --testsuite unit
來標記一個套件,但我需要配置測試運行器默認情況下僅運行unit
套件,並且只有在使用testsuite標誌專門調用時才運行integration
。默認情況下在PHPUnit中運行單個測試套件
我的配置:
<?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'文件是不是更好,裏面的配置? –