Search code examples
androidantandroid-libraryemma

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?

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.

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. 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


Solution

  • 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.

    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