是否有评论继续测试PHPUnit中的失败?

时间:2018-05-17 16:22:12

标签: testing phpunit

当断言在命令行中失败时,有没有办法继续执行PHPUnit测试?

有一个示例PHPUnit命令的标志,如:

phpunit --continueonfailure

或执行一系列测试期间的某些事情

1 个答案:

答案 0 :(得分:0)

我认为默认情况下,PHPUnit会在失败时继续运行测试。因此,您可能已经在stopOnFailure="true"中定义了phpunit.xml。要么将其完全删除,要么尝试将其设置为true

您可以在命令中附加几个标志,以使PHPUnit在错误/失败时停止:

--stop-on-defect            Stop execution upon first not-passed test
--stop-on-error             Stop execution upon first error
--stop-on-failure           Stop execution upon first error or failure
--stop-on-warning           Stop execution upon first warning
--stop-on-risky             Stop execution upon first risky test
--stop-on-skipped           Stop execution upon first skipped test
--stop-on-incomplete        Stop execution upon first incomplete test

您可以read more about phpunit.xml here.