Get total test count in multi-module project from all modules

Hi,

I am curious to know how to get total test count in multi-module project? I can get total test count per-module by doing something similar to the following:

...
  def testCounter = 0
  afterSuite { testDescriptor, testResult ->
     testCounter += testResult.getTestCount()
   }
  ...

What I want to do is to aggregate each module’s test count totals into one value… Any ideas?

Thank you

You can do something like:

def testCounter = 0
  allprojects {
    tasks.withType(Test) {
        afterSuite { testDescriptor, testResult ->
            testCounter += testResult.testCount
        }
    }
}

Thanks!