Gradle没有运行TestNG测试,即使使用test.useTestNG()也不行
我的Gradle没有运行TestNG测试,即使使用test.useTestNG()也不行,gradle,testng,Gradle,Testng,我的build.gradle如下所示: apply plugin: 'scala' apply plugin: 'java' sourceCompatibility = 1.8 version = '1.0' repositories { mavenCentral() } dependencies { compile "org.scala-lang:scala-library:2.11.4" compile 'org.reactivestreams:reactiv
build.gradle
如下所示:
apply plugin: 'scala'
apply plugin: 'java'
sourceCompatibility = 1.8
version = '1.0'
repositories {
mavenCentral()
}
dependencies {
compile "org.scala-lang:scala-library:2.11.4"
compile 'org.reactivestreams:reactive-streams:1.0.0.RC1'
compile 'org.reactivestreams:reactive-streams-tck:1.0.0.RC1'
testCompile group: 'junit', name: 'junit', version: '4.11'
testCompile group: 'org.testng', name: 'testng', version: '5.14.10'
}
test {
useTestNG()
}
我用Scala实现了一些,用java实现了TestNG测试。测试类实际上不包含任何测试,但它的父类包含任何测试。格雷德尔似乎认为课堂上没有考试
Skipping task ':testClasses' as it has no actions.
:testClasses UP-TO-DATE
:testClasses (Thread[main,5,main]) completed. Took 0.001 secs.
:test (Thread[main,5,main]) started.
:test
Skipping task ':test' as it is up-to-date (took 0.048 secs).
:test UP-TO-DATE
测试类在build/classes/test
tl中编译;dr
将以下代码添加到build.gradle:
说明:
这就是导致您遇到问题的bug。并且可以找到解决方案。别忘了对所有答案(我是说彼得的答案)进行投票表决 这个项目是在线托管的吗?不是。稍后我会将其推送到github。@Opal在这里:对于cmd
gradle clean test
,我使用gradle v2.2.1获得了正确的输出。看起来一切正常。好的,当使用-i
和gradlew
运行时,它确实跳过了testClasses
。
tasks.withType(Test) {
scanForTestClasses = false
include "**/*Test.class" // whatever Ant pattern matches your test class files
}