Android Studio 3.0 gradle 3.0.0-beta2, breaks Kotlin Unit Test Coverage?

后端 未结 1 1678
[愿得一人]
[愿得一人] 2020-12-31 07:48

I have a simple Kotlin classes, as below

class MyClass {
    fun justSayHello(yes: Boolean): String {
        if (yes) {
            return \"Hello\"
                


        
相关标签:
1条回答
  • 2020-12-31 08:32

    In case anyone is still looking for a solution, adding in a gradle task to copy the cases from the tmp directory into the directory that the coverage output looks in helps with this issue as a workaround.

    For example add copyTestClasses to your module gradle file

    task copyTestClasses(type: Copy) {
        from "build/tmp/kotlin-classes/debug"
        into "build/intermediates/classes/debug"
    }
    

    And then setting up your defaults to run the gradle task before running the tests

    It can help to find both of the directories in your project manually before trying to point to them using gradle, to make sure that you're pointing to the right place (flavours will change the directories that you need to point to)

    0 讨论(0)
提交回复
热议问题