org.gradle.api.tasks.testing.junit.JUnitOptions.includeGroups()适用于参数类型:(java.lang.String)values:[NoDbTests]

时间:2015-08-06 14:19:28

标签: java junit gradle

我添加了这个gradle任务

然后我收到此错误:

FAILURE: Build failed with an exception.

* Where:
Build file '/Users/eladb/WorkspaceQa/java/UsersServer/build.gradle' line: 98

* What went wrong:
A problem occurred evaluating root project 'UsersServer'.
> No signature of method: org.gradle.api.tasks.testing.junit.JUnitOptions.includeGroups() is applicable for argument types: (java.lang.String) values: [NoDbTests]

我的语法出了什么问题?

我看到了这个教程:

test {
    useJUnit {
          includeCategories 'linqmap.users.interfaces.NoDbTests'
    //    excludeCategories 'org.gradle.junit.CategoryB'
    }
}

1 个答案:

答案 0 :(得分:1)

我应该使用"excludeCategories"而不是"includeGroups()"

test {
    useJUnit {
          includeGroups 'linqmap.users.interfaces.NoDbTests'
    //    excludeGroups 'org.gradle.junit.CategoryB'
    }
}

应该是

test {
    useJUnit {
          includeCategories 'linqmap.users.interfaces.NoDbTests'
    }
}