使用 ant 为库项目构建 Android 测试时,如何为 emma 使用过滤器?

使用 ant 为库项目构建 Android 测试时,如何为 emma 使用过滤器?

问题描述:

来自这个问题:

我该怎么做使用 ant 构建 Android 测试时使用 emma 过滤器?

我知道 emma 可以通过将以下几行添加到目标项目(而不是测试项目)的 ant.properties 中来使用过滤器,

I know emma can use a filter by adding the following lines to my ant.properties of the targeted project, not the test project,

emma.filter=-com.your.excluded.package.*

但如果我的目标项目是图书馆项目,它似乎无法正常工作.

but it seems it doesn't work properly if my target project is a library project.

我的工作区如下所示:

projectlib1         : lib project using lib2
projectlib1/tests   : unit tests for lib1
projectlib2         : lib project using lib3
projectlib2/tests   : unit tests for lib2
projectlib3         : stand alone lib

当我运行 lib1 的覆盖率时,我也得到了我不想要的 lib2 和 lib3 的覆盖率文件.我应该在哪里添加 emma.filter?我尝试将它放在每个项目的根目录中,但到目前为止还没有奏效.

When I run coverage for lib1 I also get coverage files for lib2 and lib3 which I do not want. Where should I add the emma.filter? I tried putting it at the root of each of those projects but it did not work so far.

欢迎提出任何建议!谢谢

any suggestion welcome! thank you

刚遇到同样的问题,我尝试了您提到的线程的解决方案,但没有奏效.我也试过直接在build.xml文件中添加,也没用.

Just had the same problem, I tried the solution of the thread you mention and I did not work. I also tried to add it directly in the build.xml file, did not work either.

虽然我设法通过在 ant 命令行上添加 -Demma.filter="-your.app.package" 使其工作:

Although I managed to make it work by adding the -Demma.filter="-your.app.package" on the ant command line:

ant -Demma.filter="-your.app.package.to.exclude.*" emma debug install test