Autorun PHPUnit Tests in PhpStorm 2017.2
In recent versions of PhpStorm we’ve tried to make improving the testing experience a priority, and in 2017.2 we’ve done just that by introducing the ability to automatically run PHPUnit tests when you stop editing.
The ability to autorun tests has been a hot topic of discussion on Twitter and at conferences and user groups for a long time. There’s been a workaround using file-watchers for a while, but PhpStorm 2017.2 brings you the ability to autorun tests after you’ve stopped editing files integrated into the test runner.
To start your tests automatically running, run your tests, as usual, (using a run configuration – you can find more information in this video), and then turn on auto-testing by using the Toggle auto-test button.
This turns on autorunning of tests 3 seconds after you stop editing any file (excluding scratch files). You can change the time it takes for the autorun to fire using the Set AutoTest Delay menu you can find in the More options (cog) menu.
It’s also worth mentioning that we’ve unified the place you configure your test frameworks, be that PHPUnit, PhpSpec, Behat or Codeception. If you want to create a configuration for a test framework you’ll now find them all under Languages & Frameworks | PHP | Test Frameworks rather than in their own individual settings section. You still create each configuration in the same way as before, however.
We hope you enjoy this new feature, I’m already using this in some of my open source work and it’s really useful – give it a try and let me know what you think.
– Gary & The PhpStorm Team