Alpha Kenny Buddy
Alpha Kenny Buddy

Reputation: 132

Grouping phpunit tests. Launching test from specified directory

I have a directory tests where I store all my tests.

Hierarchy of tests dirrectory

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

How can I make phpunit launch tests only from for example Service directory, instead of the whole tests directory? I read about @Groups, but I think that's not what I'm looking for and it would be best if I would not need to edit config files, but some how, do it from the command line.

Upvotes: 1

Views: 238

Answers (1)

Alpha Kenny Buddy
Alpha Kenny Buddy

Reputation: 132

Found a quite easy way, even with config editing.

phpunit.xml

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

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

Command line: php ./vendor/bin/phpunit --testdox --testsuite Service

Upvotes: 1

Related Questions