我想通过gradle文件运行我的junit测试,但构建成功但未运行任何测试。这是我的gradle这个文件看起来像:Gradle文件未运行测试
apply plugin: 'java'
// Creating a new sourceSet because you should move your integration tests to a separate directory.
sourceSets {
test {
java.srcDirs = ['src/integration-test/java']
}
integrationTest {
java.srcDirs = ['src/integration-test/java']
compileClasspath += main.output + test.output
runtimeClasspath += main.output + test.output
}
}
configurations {
integrationTestCompile.extendsFrom testCompile
integrationTestRuntime.extendsFrom testRuntime
}
task integrationTest(type: Test, description: 'Runs the integration tests', group: 'Verification') {
testClassesDir = sourceSets.integrationTest.output.classesDir
classpath = sourceSets.integrationTest.runtimeClasspath
}
运行的任务integrationTest之后,成功打造运行,但它不运行任何测试。有谁知道为什么?
您需要定义一个'集成 - test' [来源集(https://docs.gradle.org/current/userguide/java_plugin.html#sec:java_project_layout) –