https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
a

Akhil Sunny

11/26/2019, 10:28 PM
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

verachadw

11/27/2019, 4:02 AM
AFAIK, There is no code coverage tools that support Kotlin MPP project at the moment.
e

EvaS

11/27/2019, 9:58 AM
We use Jacoco
a

Akhil Sunny

11/27/2019, 6:47 PM
@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

EvaS

11/28/2019, 8:55 AM
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
2 Views