分组 phpunit 测试。从指定目录启动测试

Grouping phpunit tests. Launching test from specified directory

我有一个目录 tests 用于存储我所有的测试。

tests 目录的层次结构

tests->
       ApplicationTests->
       IntegrationTests->
                         Factory->
                         Service->
       UnitTests->

如何让 phpunit 仅从 Service 目录而不是整个 tests 目录启动测试?我阅读了有关 @Groups 的信息,但我认为这不是我想要的,最好是我不需要编辑配置文件,但有些方法是从命令行执行此操作。

找到了一个非常简单的方法,即使是配置编辑。

phpunit.xml

See: The XML Configuration File Phpunit Docs and Organizing Tests Phpunit Docs<

<testsuite name="Service">
      <directory>tests/IntegrationTests/Service</directory>
</testsuite>

命令行: php ./vendor/bin/phpunit --testdox --testsuite Service