Coder Perfect

How can I tell phpunit to quit if it fails?

Problem

I’m running a huge suite of phpunit tests, and instead of waiting for all of the tests to finish before seeing which ones failed, I’d like to see which ones failed right away.

How can I tell phpunit to do this?

Asked by johncorser

Solution #1

Add the stopOnFailure=”true” attribute to the root element of your phpunit.xml file.

It’s also possible to use it from the command line: phpunit —stop-on-failure

Information from the manual, as well as a few others that may be valuable to you:

More information can be found in the PHPunit handbook.

Answered by Sven van Zoelen

Post is based on https://stackoverflow.com/questions/30037315/how-to-tell-phpunit-to-stop-on-failure