How to get code coverage using Android Studio?

前端 未结 9 1941
囚心锁ツ
囚心锁ツ 2020-12-02 07:00

I am developing apps using Android Studio.
I was able to run the test code.
But, I do not know how to get code coverage in android studio.

I have a

9条回答
  •  抹茶落季
    2020-12-02 08:05

    Enable testCoverage in your module build.gradle file

    buildTypes {
            debug {
                testCoverageEnabled true
            }
        }
    

    and then

    Right click on the test -> java package and select Run Tests in Java with Coverage to run all tests with code coverage or right click on the particular test class and click Run SampleTest with Coverage

提交回复
热议问题