指定Gradle报告目录

Eth*_*han 4 gradle

我有几个文件夹试图将​​我的测试分成单元,集成,第三方,数据库.通过这种方式,我可以将我的测试分成多个块,使TDD更容易/更快.这是我正在尝试使用的任务.

task integrationTest(type: Test) {
    testClassesDir = sourceSets.integration.output.classesDir
    classpath = sourceSets.integration.runtimeClasspath
    maxParallelForks 8
    maxHeapSize = "4048m"
}
Run Code Online (Sandbox Code Playgroud)

我知道有testReportDir,但它已被弃用.我希望能够使用新方法.

我试过以下关闭:

reports {
    html = file("$buildDir/reports/intTests")
}

reports {
    setDestination = file("$buildDir/reports/intTests")
}

reports {
    destinationDir = file("$buildDir/reports/intTests")
}

destinationDir = file("$buildDir/reports/intTests")
Run Code Online (Sandbox Code Playgroud)

Mat*_*att 7

我想你想要的

integrationTest.reports.html.destination = file("$buildDir/reports/intTests")
Run Code Online (Sandbox Code Playgroud)

您可能需要查阅api文档,TestTaskReports其中显示html报告是DirectoryReport扩展的ConfigurableReport,并且提供了上面一个内容中引用的目标访问器.