java - JUnit @Ignore 的 Sonarqube 规则

标签 java unit-testing junit sonarqube

我担心一些开发人员通常会使用 @Ignore 忽略失败的测试以绕过 SonarQube 静态验证。

为此,我正在寻找会产生问题的规则。

有人知道我怎样才能做到这一点吗?

我正在使用 SonarQube 5.4 和 JUnit。

最佳答案

曾经有一个规则:Rule S1607: Tests should not be ignored(旧)

然而,此规则已更新,现在实际上允许忽略测试,如果适当注释:Rule S1607: JUnit4 @Ignored and JUnit5 @Disabled annotations should be used to disable tests and should provide a rationale (new)

关于java - JUnit @Ignore 的 Sonarqube 规则,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45109864/

相关文章:

java - 我应该继续将记录器实例传递给不同的类吗

angularjs - Jasmine 无法模拟 Elasticsearch 对象

c# - 如何在 UnitTest asp.net 中使用应用程序变量

c++ - 在 Visual C++ 2015 中使用 Catch2

java - 如何在 Spring Batch Junit 测试中模拟编写器?

java - 领域对象共享微服务

java - 错误无法实例化类 [org.apache.log4j.rolling.RollingFileAppender]

java - 如何返回多个值?

Android Junit 测试卡住

java - JUnit/测试 Ng : How to simplify/combine multiple { try fail() catch } for same exception?