如何指示PHPUnit测试预期失败? [英] How to indicate that a PHPUnit test is expected to fail?

查看:62
本文介绍了如何指示PHPUnit测试预期失败?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以用PHPUnit将测试标记为预期失败"?当执行TDD时,这将很有用,并且您想要区分真正失败的测试和由于尚未编写相关代码而碰巧失败的测试.

Is it possible to mark a test as "expected to fail" with PHPUnit? This would be useful when performing TDD, and you want to distinguish between genuinely failed tests, and tests that happen to fail because the associated code hasn't been written yet.

推荐答案

我认为在这些情况下,简单地将测试标记为已跳过是相当标准的.您的测试仍将运行并且套件将通过,但是测试运行器将提醒您跳过的测试.

I think in these cases, it's fairly standard to simply mark the test as skipped. Your tests will still run and the suite will pass, but the test runner will alert you of the skipped tests.

http://phpunit.de/manual/current/zh_cn/incomplete-and-skipped-tests.html

这篇关于如何指示PHPUnit测试预期失败?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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