简体   繁体   English

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

[英]How can I use filter for emma when building Android test with ant for a library project?

From this question : 从这个问题:

How can I use filter for emma when building Android test with ant? 使用Ant构建Android测试时,如何使用Emma过滤器?

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可以使用过滤器,方法是将以下行添加到目标项目(而不是测试项目)的ant.properties中,

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

but it seems it doesn't work properly if my target project is a library project. 但是,如果我的目标项目是一个图书馆项目,它似乎无法正常工作。

My workspace looks like this: 我的工作区如下所示:

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

When I run coverage for lib1 I also get coverage files for lib2 and lib3 which I do not want. 当我运行lib1的coverage时,我还会得到我不需要的lib2和lib3的coverage文件。 Where should I add the emma.filter? 我应该在哪里添加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 谢谢

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. 我也尝试将其直接添加到build.xml文件中,也没有用。

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"使其工作:

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在使用ant构建Android测试时,如何使用filter for emma? - How can I use filter for emma when building Android test with ant? 如何使用Android中的Ant在EMMA生成的测试覆盖率报告中过滤文件 - How to filter files in the generated test coverage report by EMMA, using Ant in Android 如何在Android Test-Project(蚂蚁构建)中引用库项目 - How can I reference library project in an Android Test-Project (ant build) 我可以在构建时使用Ant在我的Android项目中设置一些静态变量吗? - Can I use Ant to set some static variables in my Android project when building? 将android库项目添加到android项目可防止Ant构建 - Adding android library project to an android project prevents Ant from building 使用 ant/teamcity 构建引用 android 库项目的 android 项目 - Building an android project referencing android library project using ant / teamcity 使用ant与库项目的Android单元测试 - Android unit test using ant with library project 当它依赖于具有 Android 库项目依赖项的非库项目时,如何使用 ANT 构建我的项目? - How do I build my project with ANT when it depends on a non-library project with an Android library project dependency? 使用ant debug命令构建android项目时,我的apk上附有调试附加的名称。 我怎么改变它? - When building android project with ant debug command, my apk has the word debug attached to the name. How i change it? Ant / Emma Instrumentation Android SDK - Ant/Emma Instrumenting Android SDK
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM