Android的代码覆盖率 [英] Code coverage for Android

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

问题描述


可能重复:

Android测试代码覆盖,Eclipse


它真的令人沮丧看到没有关于如何在Eclipse中为Android应用程序使用EMMA的文档。有没有人设法在eclipse中使用EMMA进行Android应用程序?没有检查整个Android的源代码,并且做所有的hackery?

解决方案

如果你有<路径测试项目> /build.xml 文件重命名。



我可以通过从控制台执行以下命令来生成测试报告报告: / p>

< Android工具的路径> android更新测试项目-m<应用程序的路径> -p<测试项目路径> + 输入



cd<测试项目路径> + 输入



ant emma debug install test + 输入



其中< Android工具的路径> / opt / android-sdk-linux / tools /



这样生成<测试项目路径> /bin/coverage.html 文件。



如果你获取错误JAVA_HOME错误执行 gksu gedit / etc / environment + 输入,正确 JAVA_HOME ,保存文件,注销或重新启动,然后重试。



资料来源: http://blog.rabidgremlin.com/2010/11/19/android-tips-generating -a-coverage-report-for-your-unit-tests /


Possible Duplicate:
Android test code coverage, Eclipse

Its really frustrating to see there is no documentation for how to use EMMA for Android apps in Eclipse. Has anyone managed to work with EMMA in eclipse for Android apps? Without checking out the whole android source and do all the hackery?

解决方案

If you have <path to test project>/build.xml file rename it.

I was able to generate test coverage report by executing following from the console:

<path to android tools>android update test-project -m <path to app project> -p <path to test project> + Enter,

cd <path to test project> + Enter,

ant emma debug install test + Enter,

where <path to android tools> is /opt/android-sdk-linux/tools/ on my machine - the folder where android SDK is installed.

This generated <path to test project>/bin/coverage.html file.

If you get "wrong JAVA_HOME" error execute gksu gedit /etc/environment + Enter, correct JAVA_HOME, save the file, log out or reboot and try again.

Source: http://blog.rabidgremlin.com/2010/11/19/android-tips-generating-a-coverage-report-for-your-unit-tests/

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

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