Jacoco converting coverage.ec to reports without coverage.em

后端 未结 4 1531
死守一世寂寞
死守一世寂寞 2020-12-18 09:09

I was able to get the code coverage report by following the steps below,

  1. Enable coverage on the build type you want (e.g. debug)

    buildTypes {

4条回答
  •  悲哀的现实
    2020-12-18 09:54

    I wrote an article about the same scenario and my solution. You can read it here. For answering this specific question you should do the following steps: Change gradle to this:

    apply plugin: 'jacoco'
    jacoco {
       toolVersion = '0.7.5.201505241946'
    }
    

    Second download this jar. Continue with the things you did until you have coverage.ec file. Then when you have it run:

    java -jar android-jacoco-the-missing.jar -f /path/to/coverage.ec -p ./path/to/android/project
    

    And thats it! The jar will generate a folder with the code coverage.

    Another option is to use the coverage.ec with the Jenkins Jacoco plugin. But for that you need to have Jenkins set on.

提交回复
热议问题