Re-run last failed test in PHPUnit(在 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 选项.您可以在 组织文档代码>
并在 CLI 文档
.
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
失败:
Assume your run phpunit Tests/
and Tests/Stuff/ThatOneTestClassAgain::testThisWorks
fails:
您的选择是:
phpunit --filter ThatOneTestClassAgain
和
phpunit --filter testThisWorks
或大多数其他有意义的字符串
or most other strings that somehow make sense
这篇关于在 PHPUnit 中重新运行上次失败的测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:在 PHPUnit 中重新运行上次失败的测试


基础教程推荐
- mysqli_insert_id 是否有可能在高流量应用程序中返回 2021-01-01
- 如何在 PHP 中的请求之间持久化对象 2022-01-01
- 在多维数组中查找最大值 2021-01-01
- Libpuzzle 索引数百万张图片? 2022-01-01
- WooCommerce 中选定产品类别的自定义产品价格后缀 2021-01-01
- 在 Woocommerce 中根据运输方式和付款方式添加费用 2021-01-01
- XAMPP 服务器不加载 CSS 文件 2022-01-01
- 超薄框架REST服务两次获得输出 2022-01-01
- 通过 PHP SoapClient 请求发送原始 XML 2021-01-01
- 在 PHP 中强制下载文件 - 在 Joomla 框架内 2022-01-01