Problems with test not being incremental


(Eivind Brandth Smedseng) #1

I’m having problem whit multiple tests tasks in one project apparently overwriting some of the out put files resulting in that test don’t run incremental.

My set up for for test is now:

test {
        exclude '**/*DataTest.*','**/*PerformanceTest.*', '**/*IntegrationTest.*','**/*SystemTest.*'
    }
      task testngTest(type: Test) {
        useTestNG()
        exclude '**/*DataTest.*','**/*PerformanceTest.*', '**/*IntegrationTest.*','**/*SystemTest.*'
            }
      task dataTest(type: Test) {
        useTestNG()
        include '**/*DataTest.*'
    }
      task performanceTest(type: Test) {
        include '**/*PerformanceTest.*'
    }
      task integrationTest(type: Test) {
        useTestNG()
        include '**/*IntegrationTest.*'
    }
      task systemTest(type: Test) {
        include '**/*SystemTest.*'
    }
      check.dependsOn testngTest, dataTest, performanceTest, integrationTest, systemTest

I found one way to solve it is to set

testReportDir =
file("${buildDir}/reports/ngtests")

for every task. I’m wondering if there is a better way to do it so that i can have one report with all test results.


(Peter Niederwieser) #2

You’ll want something like:

def testTasks = tasks.withType(Test)
  check.dependsOn(testTasks)
  testTasks.all { task ->
    testReportDir = file("$buildDir/reports/$task.name")
}
  task testReport(type: TestReport) {
    reportOn testTasks
}

(Eivind Brandth Smedseng) #3

Thanks :slight_smile: Now every thing works. Had to add

destinationDir = file("somWhere")

to the TestReport task.