How to run multiple PHPUnit test suites from the command line?

If you have several test suites configured in phpunit.xml , how do you run more than one test suite, but not all of them from the command line?

phpunit.xml

 <?xml version="1.0" encoding="utf-8"?> <phpunit backupGlobals="false" backupStaticAttributes="false" colors="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="true" syntaxCheck="true" bootstrap="tests/bootstrap.php"> <testsuites> <testsuite name="Unit"> <directory suffix="Test.php">tests/unit</directory> </testsuite> <testsuite name="Integration"> <directory suffix="Test.php">tests/integration</directory> </testsuite> <testsuite name="Acceptance"> <directory suffix="Test.php">tests/acceptance</directory> </testsuite> </testsuites> <logging> <log type="coverage-html" target="build/coverage"/> <log type="testdox-html" target="build/requirements.html"/> </logging> <filter> <whitelist> <directory suffix=".php">src</directory> </whitelist> </filter> </phpunit> 

Example

phpunit --testsuite Unit|Integration but not Acceptance

+5
source share
1 answer

From @emfi in the comments: starting with PHPUnit 6.0, this has been fixed to allow a separate list of comma sets via --testsuite suite1,suite2 .

Source: https://github.com/sebastianbergmann/phpunit/commit/80754cf323fe96003a2567f5e57404fddecff3bf


Original answer / pre -PHPUnit 6.0

It does not work as you expect.

--testsuite <pattern> Filter which testsuite to run.

Where <pattern> not an actual template.

You can select a test case to run, but you cannot use a template to filter those that need to be run.

A better description would be --testsuite <name> Which testsuite to run.

Problem Report https://github.com/sebastianbergmann/phpunit/issues/2273

+5
source

All Articles