How to tell phpunit to stop on failure

PhpUnit TestingPhpunit

Php Problem Overview


I'm running a large suite of phpunit tests, and I'd like see which test failed as soon as it failed, rather than waiting for all of the tests to complete then having it list out all of the failures.

How can I tell phpunit to do this?

Php Solutions


Solution 1 - Php

Add the stopOnFailure="true" attribute to your phpunit.xml root element.

You can also use it in the CLI: phpunit --stop-on-failure

Info from manual and some others that are maybe useful for you:

  • stopOnError - "Stop execution upon first error."
  • stopOnFailure - "Stop execution upon first error or failure."
  • stopOnIncomplete - "Stop execution upon first incomplete test."

More info at: PHPunit manual

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionjohncorserView Question on Stackoverflow
Solution 1 - PhpSven van ZoelenView Answer on Stackoverflow