【问题标题】:how to run junit only for tests with custom annotation?如何只为带有自定义注释的测试运行junit?
【发布时间】:2015-08-06 13:27:13
【问题描述】:

我有一些测试要单独运行。

如何添加只运行这些测试的 gradle 任务?

如何添加一个 gradle 任务来运行除这些测试之外的所有测试?

我想使用注解,但没有看到将它与 gradle 结合的方法。

【问题讨论】:

    标签: junit gradle annotations


    【解决方案1】:

    使用 junit @Category 然后像这样 gradle:

    test {
        useJUnit {
            includeCategories 'org.gradle.junit.CategoryA'
            excludeCategories 'org.gradle.junit.CategoryB'
        }
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-03-24
      • 1970-01-01
      • 2016-02-22
      • 1970-01-01
      • 2014-08-05
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多