Jacoco code coverage for android application using mockito library

前端 未结 4 1649
[愿得一人]
[愿得一人] 2021-01-07 03:53

My android application uses the following config:

  • Gradle - 0.12.+

Contents of build.gradle file

buildscript {
repositories {
            


        
4条回答
  •  南笙
    南笙 (楼主)
    2021-01-07 04:33

    The following link was very useful in explaining the problem I encountered: http://www.androidpuzzles.com/168_17620080/

    I subsequently switched the source and target compatibility settings to Java 1.5 and I was able to run the unit and UI tests (which used both mockito and espresso) and generate code coverage report using Jacoco.

    If I had to retain Java 1.7 settings, the workaround would have been to change the scope of private methods in the class being tested to either protected or public scope. This would have then allowed me to generate the code coverage report (overcoming the issue as identified in the link included).

提交回复
热议问题