如何在不修改其内容的情况下忽略 phpunit 中的测试方法? [英] How can I ignore a test method in phpunit without modifying its content?

查看:58
本文介绍了如何在不修改其内容的情况下忽略 phpunit 中的测试方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为了忽略使用 PHPUnit 的测试,应该放在 PHP 测试方法旁边的属性是什么?

What is the attribute that should be placed next to the PHP test method in order to ignore the test using PHPUnit ?

我知道 NUnit 的属性是:

I know that for NUnit the attribute is :

[Test]
[Ignore]
public void IgnoredTest()

推荐答案

您可以使用 组注释 并从运行中排除这些测试.

You can tag the test with a group annotation and exclude those tests from a run.

/**
 * @group ignore
 */
public void ignoredTest() {
    ...
}

然后你可以运行所有的测试但忽略这样的测试:

Then you can run the all the tests but ignored tests like this:

phpunit --exclude-group ignore

这篇关于如何在不修改其内容的情况下忽略 phpunit 中的测试方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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