How to customize Test ReportDir and ResultsDir


#1

Hi, I have a custom integration test task which looks like the following:

task integrationTest(type: Test, dependsOn: integrationTestClasses) {
  testReportDir file('build/reports/integration-tests')
  testResultsDir file('build/integration-tests-results')
  testClassesDir = sourceSets.integrationTest.output.classesDir
  classpath = sourceSets.integrationTest.runtimeClasspath
 }

After Gradle upgrade to 1.7 I started getting the following deprecation warnings: The Test.testReportDir property has been deprecated and is scheduled to be removed in Gradle 2.0. Please use the Test.getReports().getHtml().getDestination() property instead. The Test.testResultsDir property has been deprecated and is scheduled to be removed in Gradle 2.0. Please use the Test.getReports().getJunitXml().setDestination() property instead.

Can you advise how to fix it? I checked DSL, but I do not see there any alternative for the removed properties.

Edit: I see that documentation was not updated and suggests using the deprecated properties: http://www.gradle.org/docs/current/userguide/java_plugin.html#N1280A


(René Groeschke) #2

well the deprecation warning already gives you a hint how to fix this. you can change the

destinationdir for your xml reports like this:

test{
    reports.junitXml.destination = file('build/integration-tests-results')
    reports.html.destination = file('build/integration-tests-results')
}

cheers, René


#3

Thanks! That’s exactly what I was searching for.