Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHPUnit - Running a particular test suite via the command line test runner [duplicate]

Is it possible to specify which test suite to run from a configuration file via the command line test runner? For example, if I have the following xml configuration:

<phpunit ...>
    <testsuites>
        <testsuite name="My Test Suite 1">
            <directory>./MyTestSuite1/</directory>
        </testsuite>
        <testsuite name="My Test Suite 2">
            <directory>./MyTestSuite2/</directory>
        </testsuite>
    </testsuites>
    ...
</phpunit>

Can I have it run only "My Test Suite 1"?

like image 333
rr. Avatar asked Dec 02 '10 07:12

rr.


People also ask

How do I run a PHPUnit test?

To run the unit test, click the arrow next to the Run button on the Tool-bar, and select Run As | PHPUnit Test . From the Menu-bar, select Run | Run As | PHPUnit Test . To debug the PHPUnit Test Case, click the arrow next to the debug button on the toolbar, and select Debug As | PHPUnit Test .

How do I start PHPUnit?

PHPUnit InstallationThe first command creates a folder in your current directory, test-project and the second command moves into it. The last command starts an interactive shell. Follow the prompt, filling in the details as required (the default values are fine).


Video Answer


2 Answers

It's phpunit --testsuite "My Test Suite 1"

like image 108
havvg Avatar answered Oct 18 '22 20:10

havvg


  • you can use the @group tag in the class documentation to indicate the group and then run tests only on that group using --group
  • you can use --filter to only run tests that match a given regex

Update 2013

As @havg's answer below mentions, it's now possible to run individual test suites using phpunit --testsuite

like image 10
El Yobo Avatar answered Oct 18 '22 20:10

El Yobo