scalagradletestngscoverage

Scoverage with TestNG (and Gradle)


Is it possible to use Scoverage with TestNG or do I have to use JUnit? I included the gradle-scoverage plugin in my Gradle script and it's running, but it shows 0.00% coverage.

Is there any way I can configure the script to work or do I have to choose between Scoverage and TestNG?


Solution

  • The solution is to modify your build.gradle file to include:

    tasks.withType(Test) {
        useTestNG()
    }
    

    Note: this is NOT enough:

    test {
        useTestNG() {
        }
    }