重新运行PHPUnit中上次失败的测试 [英] Re-run last failed test in PHPUnit

查看:76
本文介绍了重新运行PHPUnit中上次失败的测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当其中一项测试失败时,您可以使用--stop-on-failure标志来中断单元测试.

You may use --stop-on-failure flag to break the unit testing when one of the tests fails.

是否有任何快速方法告诉PHPUnit重新运行此失败的测试,而不是手动提供完整路径?

Is there any way quick way to tell PHPUnit to re-run this failed test, instead providing the full path manually?

推荐答案

看看--filter cli选项.您可以在 organisation docs 中找到一个示例,在 CLI Docs 中.

Take a look at the --filter cli option. You can find an example in the organisation docs and in the CLI Docs.

-过滤器

仅运行名称与给定模式匹配的测试.该模式可以是单个测试的名称,也可以是与多个测试名称匹配的正则表达式.

Only runs tests whose name matches the given pattern. The pattern can be either the name of a single test or a regular expression that matches multiple test names.

假设运行phpunit Tests/Tests/Stuff/ThatOneTestClassAgain::testThisWorks失败:

您的选择是:

phpunit --filter ThatOneTestClassAgain

phpunit --filter testThisWorks

或大多数其他有意义的字符串

or most other strings that somehow make sense

这篇关于重新运行PHPUnit中上次失败的测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆