There are several variations of the phpunit command that can help determine which tests should and should not run:
$ phpunit --help PHPUnit 3.4.0beta5 by Sebastian Bergmann. Usage: phpunit [switches] UnitTest [UnitTest.php] phpunit [switches] <directory> ... --filter <pattern> Filter which tests to run. --group ... Only runs tests from the specified group(s). --exclude-group ... Exclude tests from the specified group(s). --list-groups List available test groups. ...
Those probably will not be able to indicate exactly what you wanted ... But they can help.
See Command Line Tester for more details.
In particular, I’m kind of like a group function: just use the @group tag in phpdoc of your tests to rearrange them (for example, one group into a “piece of functionality”); and after that you can use the --group or --exclude-group options on the command line to indicate which tests should or should not be performed.
In your case, if you cannot change the tests, perhaps the -filter option may help depending on how your tests are packed (that is, if there is a way to identify which ones you want to run):
--filter
Runs only those tests whose name matches the given pattern. A pattern can be either the name of a single test or a regular expression that matches multiple test names.
Another solution, if you do not always change the "groups" of tests to run, maybe use a test package that includes only those tests that you want to run.
For example, see Building a test case using an XML configuration .
Pascal martin
source share