Ginger
Ginger

Reputation: 8630

How to use phpunit --testsuite option?

How do I use the phpunit --testsuite command?

For example, I have a testfile:

test/xxx/RegistrationConfirmedListenerTest.php

If I run phpunit, then it will run the tests in RegistrationConfirmedListenerTest.php, but it also runs all other tests in my tests folder.

I have tried using this the --testsuite option like this:

phpunit --testsuite RegistrationConfirmedListenerTest

However, nothing runs.

PHPUnit 4.8.26 by Sebastian Bergmann and contributors.



Time: 46 ms, Memory: 4.00Mb

No tests executed!

I have read the docs here but there aren't any examples to help:

https://phpunit.de/manual/current/en/textui.html

Upvotes: 1

Views: 996

Answers (1)

akDeveloper
akDeveloper

Reputation: 1058

You have to create a phpunit.xml and define your testsuites there.

<testsuites>
    <testsuite name="youttestsuitename1">
        <file>./path/to/folder/</file>
    </testsuite>
    <testsuite name="youttestsuitename1">
        <file>./path/to/folder2/</file>
    </testsuite>
</testsuites> 

More info to official documentations

Upvotes: 3

Related Questions