Emma code coverage for a lib on Android

老子叫甜甜 提交于 2019-12-07 09:41:19

问题


I currently have some unit tests for an Android app, which makes calls to a library jar file. I would like to see the code coverage for the jar, but when I run ant emma and look at the coverage.html, it only reports on the coverage of the app project.

Is there a way to specify that I would like to view the coverage for the jar as well?


回答1:


The ADT r20-preview solves this issue by giving access to the full classpath of tested projects and their Library Projects:

http://tools.android.com/download/adt-20-preview

Fixes in Ant:

  • Test projects now have access to the full classpath from the tested projects, including Library Projects and 3rd party jar
  • Applications embedding tests can now be deployed and tested, including with code coverage, like test applications.

This will give you code coverage reports on your library projects, but you will have to do some modifying of the test target of build.xml to attach the source files too. See Attach Android library project source code to Emma report (ant, emma) for more information on how to incorporate emma test coverage for your library projects for the time being.




回答2:


The Emma documentation mentions instrumenting jars ( http://emma.sourceforge.net/ ) so it seems possible, perhaps you need to play with the configuration settings a bit.

Good luck.



来源:https://stackoverflow.com/questions/9419331/emma-code-coverage-for-a-lib-on-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!