Android 上的库的 Emma 代码覆盖率 [英] Emma code coverage for a lib on Android

查看:30
本文介绍了Android 上的库的 Emma 代码覆盖率的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前有一些 Android 应用程序的单元测试,它调用库 jar 文件.我想查看 jar 的代码覆盖率,但是当我运行 ant emma 并查看coverage.html 时,它只报告应用程序项目的覆盖率.

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.

有没有办法指定我也想查看 jar 的覆盖率?

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

推荐答案

ADT r20-preview 通过提供对测试项目及其库项目的完整类路径的访问来解决这个问题:

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

Ant 中的修复:

  • 测试项目现在可以访问来自测试项目的完整类路径,包括库项目和 3rd 方 jar
  • 现在可以部署和测试应用程序嵌入测试,包括代码覆盖率,如测试应用程序.

这将为您提供库项目的代码覆盖率报告,但您必须对 build.xmltest 目标进行一些修改以附加源文件也.参见 将 Android 库项目源代码附加到 Emma 报告 (ant, emma) 有关目前如何为您的库项目合并 emma 测试覆盖率的更多信息.

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.

这篇关于Android 上的库的 Emma 代码覆盖率的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆