I would like to exclude or include certain test from test-suites. I would like to have some control of this via annotations/groups rather than naming specific files or folders in phpunit.xml
I have attempted something like this, but its appears to be ignoring the <groups>
and/or <include>
<testsuites>
<testsuite name="Unit">
<directory>Unit</directory>
</testsuite>
<testsuite name="IntegrationFirstRound">
<directory>Integration/</directory>
<include><!-- I want to ONLY include this group -->
<group>first-round</group>
</include>
</testsuite>
<testsuite name="IntegrationOther">
<directory>Integration/</directory>
<exclude><!-- I want to EXCLUDE this group, run all others -->
<group>first-round</group>
</exclude>
</testsuite>
</testsuites>
I don't want to move tests to different folders just to accommodate this, and I do not want to invoke phpunit multiple times from the CLI, I am hoping I can achieve the desired results via the xml config.
Ok, looking at the DOCs which should be the first place you look
https://phpunit.de/manual/current/en/appendixes.configuration.html
You need a groups
element with the group
inside of it. So where you have
<exclude><!-- I want to EXCLUDE this group, run all others -->
<group>first-round</group>
</exclude>
You should have
<groups>
<exclude><!-- I want to EXCLUDE this group, run all others -->
<group>first-round</group>
</exclude>
</groups>
It doesn't really say if it should go inside the <testsuite>
, and I never used it but I am sure if you look in the documentation you should find some examples.