Tag Archives: testng

TestNG – How to create a single report for tests in gradle

If you are using testng in a gradle multi (sub) project scenario and want to centrally locate all your TestNG html reports into one folder, this is how I did it with latest versions of TestNG and Gradle (1.8)

/////////////////////////////////////////////////////////////////////////////////////
apply plugin: ‘java’

subprojects{

//override the java plugin test task
test {
//runs tests across all sub-projects. good for CI build process.
ignoreFailures = true
//TestNG support in gradle java plugin
useTestNG()
}

}

//new task, outside of the subprojects task, which creates a top level directory for all of your tests in sub projects
task testReport(type: TestReport) {
//
destinationDir = file(“reports/test”)
subprojects {
reportOn { tasks.withType(Test) }
}

}
/////////////////////////////////////////////////////////////////////////////////////