JUnit 4 中是否可以排除多个类别?

发布于 2024-11-29 23:46:37 字数 285 浏览 0 评论 0 原文

我想做一些类似的事情:

@RunWith(Categories.class)
@Categories.IncludeCategory(Small.class)
@Categories.ExcludeCategory({Manual.class, NonFunctional.class})
@Suite.SuiteClasses(AllTests.class)
public class SmallTests {
}

但是 ExcludeCategories 只接受一个类,而不是一组类。

I would like to do something like:

@RunWith(Categories.class)
@Categories.IncludeCategory(Small.class)
@Categories.ExcludeCategory({Manual.class, NonFunctional.class})
@Suite.SuiteClasses(AllTests.class)
public class SmallTests {
}

but ExcludeCategories accepts only one class, not an array of classes.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

朕就是辣么酷 2024-12-06 23:46:37

看起来 runtime-suite 可能提供另一种解决方法/解决方案。

It looks like runtime-suite may provide another workaround/solution.

久而酒知 2024-12-06 23:46:37

有一个 JUnit 4 功能请求:
https://github.com/junit-team/junit/issues/146

此链接还建议了一种解决方法:

有一个不太好的解决方法。您可以获得多个包含或排除
如果您创建套件的继承层次结构并排除其中的一个类别
每个级别。

There's a JUnit 4 feature request for this:
https://github.com/junit-team/junit/issues/146

This link also suggests a workaround:

There is a not-so-beatiful workaround. You can get multiple includes or excludes
if you create an inheritance hierarchy of suites and exclude one category on
each level.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文