php 如何告诉 phpunit 在失败时停止
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/30037315/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to tell phpunit to stop on failure
提问by johncorser
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.
我正在运行一整套 phpunit 测试,我希望在失败后立即查看哪个测试失败,而不是等待所有测试完成然后让它列出所有失败。
How can I tell phpunit to do this?
我怎么能告诉 phpunit 这样做?
回答by Sven van Zoelen
Add the stopOnFailure="true"
attribute to your phpunit.xml
root element.
将该stopOnFailure="true"
属性添加到您的phpunit.xml
根元素。
You can also use it in the CLI: phpunit --stop-on-failure
您也可以在 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."
- stopOnError - “在第一个错误时停止执行。”
- stopOnFailure - “在第一次错误或失败时停止执行。”
- stopOnIncomplete - “在第一次未完成测试时停止执行。”
More info at: PHPunit manual
更多信息请访问:PHPunit 手册