Search code examples
javaeclipseeclemma

How do I ignore scanning certain classes using EclEmma and Eclipse?


I am using EclEmma (inside of Eclipse) to scan my JUnit code coverage. This works correctly - however, I do not want EclEmma to scan my src/view folder since it contains Swing code that I consider not worthy of testing.

Is there any way to ignore this folder when EclEmma runs so that it: a) runs faster, and b) does not skew the coverage percentage?

EDIT:

My project's structure is:

src/view
src/model
src/controller

I have tried these (possibly others) with the Path Entries section in the Preferences page:

"src/view"
"src/view/*"
"view"
"view/*"
src/view

These are using the Excludes section in the Preferences page:

*
*View*
*View*.class
src/view/*View*
src/view/*View*.class

They all leave me with the same result of it analysing my entire src folder.


Solution

  • You can specify an exclude field:

    Excludes: A list of class names that should be excluded from execution analysis. The list entries are separated by a colon (:) and may use wildcard characters (* and ?). (Default: empty)

    However, it might be easier to use their options for classpath matching:

    Only path entries matching: Comma separated list of strings that must match with the class path entry. A class path entry matches the filter, if it contains one of the given strings. (e.g. "src/main/java", Default: no filter)

    See eclemma - how to ignore source about how to ignore src folders.

    Also please note their caution,

    Warning: If your settings do not match any of the class path entries in your project(s), every new launch in coverage mode will have an empty analysis scope.