How can I configure groups of tests in PHPUnit? I find the docs a little lacking ... it just says
The
<groups>
element and its<include>
,<exclude>
, and<group>
children can be used to select groups of tests from a suite of tests that should (not) be run.<groups> <include> <group>name</group> </include> <exclude> <group>name</group> </exclude> </groups>
But how can I add directories/files into these groups?
Add the @group
attribute to your test methods. A simple example from the linked docs:
class MyTest extends PHPUnit_Framework_TestCase
{
/**
* @group specification
*/
public function testSomething()
{
}
/**
* @group regresssion
* @group bug2204
*/
public function testSomethingElse()
{
}
}
Then you can run PHPUnit mentioned in the documentation above:
{how you normally run phpunit} --group {GroupName}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With