简体   繁体   中英

How can i run phpunit tests from excluded list?

i have this configuration in phpunit.xml . My concern is that I don't want to run a test when phpuint command is executed.

<testsuite name="Unit">
    <directory suffix="Test.php">./tests/Unit</directory>
</testsuite>
<testsuite name="Feature">
    <directory suffix="Test.php">./tests/Feature</directory>
    <exclude>./tests/Feature</exclude>
</testsuite>

i need to run Feature test separatly, Is it possible ?

I do the same of limiting the tests that are being run - the larger set only runs when I specifically run all the tests, and less than half for a normal, quick-run.

The trick is to add @group annotations to the test sources (on a class or method basis) - so, for example:

/** 
 * @group feature
 * @group large
 */
public function testFeatureThatTakesTime() {}

Now, if you run vendor/bin/phpunit --exclude-group feature ./tests/ it will not run that test. I have that, and some other command-line parameters in a shell script, and there are other ways for me to run all of my tests.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM