I have configured EclEmma not to instrument my unit tests which works fine. However, the editor still highlights the test code as not covered. I want no highlighting in unit tests because they are not instrumented to detect coverage. How can I do this?
            Asked
            
        
        
            Active
            
        
            Viewed 2.1k times
        
    2 Answers
67
            I did the following steps:
- Go to Preferences->Java->Code Coverage and
 - set the "Only path entries matching" option to 
src/main/java 
It seems to work nicely.
        SkyWalker
        
- 28,384
 - 14
 - 74
 - 132
 
        Martin Matthews
        
- 686
 - 6
 - 3
 
- 
                    6This has the added bonus of not requiring configuration of each project. – JJ Zabkar Mar 31 '14 at 17:55
 - 
                    The accepted answer didn't work for me, but this did. – dennisdeems Apr 07 '15 at 15:44
 - 
                    This is the best solution imo – Lawrence Tierney May 15 '15 at 13:55
 - 
                    1make sure you create a new coverage configuration after making the changes in Preferences. – beluchin Jul 17 '15 at 17:31
 - 
                    this didn't work for me. including just /src/ made coverage results not display at all, the other answer about checking items in coverage configuration did work – jotadepicas Oct 13 '19 at 21:40
 
40
            
            
        The include/exclude filter settings in the Preferences window apply to class name/package patterns for all projects. To control the files at the folder/path level you must set it per-project.
- Right-click the project
 - Select Coverage As | Coverage Configurations...
 - Select the project under the Junit subtree
 - Select the Coverage tab on the right
 - Uncheck the folder containing your tests, e.g., 
src/test/java - Click Apply
 - Click Close (or Coverage to run immediately)
 
These settings will apply every time you run the coverage in the future without having to open the configuration window.
        David Harkness
        
- 35,992
 - 10
 - 112
 - 134