我想通過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) –