生成的Andr​​oid code覆盖尽管在build.xml文件和ant.properties变化 [英] Generating android code coverage though changes in build.xml and ant.properties

查看:163
本文介绍了生成的Andr​​oid code覆盖尽管在build.xml文件和ant.properties变化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在试图产生的Andr​​oid code覆盖我的Andr​​oid测试项目,测试一个Android项目,其中包括一个外部JAR。当我运行命令

I have been trying to generate android code coverage for my android test project which tests a android project which includes a external jar. When I run command

蚂蚁艾玛安装调试试验

它仅示出了机器人的项目的范围,但不包括包含在外部罐的包和功能。
按我的研究,我发现了一些变化应 ant.properties 进行文件和艾玛报告标记的build.xml

it shows coverage of only the android project but does not include the package and functions of the external jar included. As per my researches I have found that some changes should be done in ant.properties file and emma report tag in build.xml.

任何建议者居多。

在furthur研究中,​​我通过博客它说输入变量去

On furthur study, I went through a blog which says enter the variable

tested.android.library.source.dir="path to external jars" in ant.properties

和相同的变量应报告源路径添加为

and same variable should be added in report sourcepath as

<emma>
                    <report sourcepath="${tested.project.source.absolute.dir}:${tested.project.lib.source.path.value}:${tested.android.library.source.dir}" verbosity="${verbosity}">
                        <!-- TODO: report.dir or something like should be introduced if necessary -->
                        <infileset file="${out.absolute.dir}/coverage.ec" />
                        <infileset file="${tested.project.out.absolute.dir}/coverage.em" />
                        <!-- TODO: reports in other, indicated by user formats -->
                        <html outfile="${out.absolute.dir}/coverage.html" />
                   </report>
  </emma>

不过还是覆盖范围没有显示外部JAR的功能和包装。

But still the coverage is not showing functions and package of External jar.

我想知道我的罐子是不是在Android的测试项目,但在其中测试的Andr​​oid项目。因此,如何让在 ant.properties 测试项目的路径,这些外部罐子。

I wanted to know that my jars are not in the android test project but in the android project which is tested. So how to give path to those external jars in ant.properties of the test project.

推荐答案

在很多搜索和尝试,终于得到了我的外部JAR的包在我的主要项目。
就在ant.properties和build.xml文件进入tested.android.library.source.dir

After lots of searching and trying , finally got the package of my External jar in my Main project. Just entered tested.android.library.source.dir in ant.properties and build.xml

ant.properties:tested.android.library.source.dir =路径LIBS主体工程的文件夹,罐子present
  build.xml文件:下报告标签艾玛标记添加此变量由冒号分隔。

ant.properties: tested.android.library.source.dir="Path to libs folder of main project where jars are present" Build.xml : Under emma tag in report tag add this variable seperated by colon.

现在进入命令提示符,运行

Now go to command prompt and run

在主项目:Android的更新项目-p。
  在测试项目:Android的更新测试项目-m路径主体工程的-p

In Main Project :android update project -p . In Test Project: android update test-project -m "Path of main project" -p .

现在从build.xml文件(SDK /工具/ ANT / build.xml文件)拷贝测试目标并将其粘贴线以上的测试项目中的build.xml

Now copy test target from build.xml (sdk/tools/ant/build.xml) and paste it in build.xml of test project above the line

 <import file="${sdk.dir}/tools/ant/build.xml" />

不要忘了版本标记更改为

Dont Forget to Change Version Tag to

现在再次打开命令提示符,然后运行:

Now Again open command prompt and run:

在主项目:蚂蚁艾玛安装调试
  在测试项目:蚂蚁艾玛调试安装测试

In Main Project: ant emma debug install In Test Project: ant emma debug install test

您code覆盖报告

这篇关于生成的Andr​​oid code覆盖尽管在build.xml文件和ant.properties变化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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