Hi , I have a kotlin mpp with android, js and iOS ...
# multiplatform
a
Hi , I have a kotlin mpp with android, js and iOS outputs. Could you please suggest the unit testing code coverage tools I can use for Kotlin mpp project ?
v
AFAIK, There is no code coverage tools that support Kotlin MPP project at the moment.
e
We use Jacoco
a
@EvaS - Can you please share an example ?. Looking online . I can see jacoco being used for Kotlin java project. but can't find any for a Kotlin app with js, ios and android outputs
e
Actually we don't use JS, still we have a
.gradle
looking like that :
Copy code
apply plugin: 'jacoco'
jacoco {
    toolVersion = "0.8.3"
}

task jacocoTestReport(type: JacocoReport, dependsOn: "testDebugUnitTest") {
    group = "Reporting"
    description = "Generate Jacoco coverage reports after running tests."
    reports {
        xml.enabled = true
        html.enabled = true
    }

    classDirectories = fileTree(
            dir: "$project.buildDir/tmp/kotlin-classes/debug/my-package",
            excludes: [/some/path/irrevelant]
    )

    sourceDirectories = files('src/commonMain/kotlin')
    executionData = files("$project.buildDir/jacoco/testDebugUnitTest.exec")
}
Then, we just have to launch
jacocoTestReport