How to run excluded PHPUnit group tests in PHPStorm

Sebastian Sulinski
Jul 11 · 1 min read

Up until now every time I ran a test that was marked as excluded in the phpunit.xml file I had to run it directly via terminal i.e.

// ...
// ...

phpunit --group service tests/Featured/ServiceTest.php`

I’ve decided to investigate how I could run it directly from within PHPStorm using a shortcut I use with all other tests and it appears the solution is quite simple.

From the menu select Run > Edit Configuration

Select Class radio button and in the Test Runner options field type the option for the group you want to include.

Once you’ve done all this, you can hit your shortcut to run tests on the excluded class you‘ve set it for.