Question
How can I remove code coverage highlighting in Eclipse after running tests?
Answer
Eclipse, when used with coverage tools like Cobertura or EMMA, highlights source code lines based on coverage results. This can clutter your view once you're done reviewing the reports. Fortunately, clearing this highlighting is straightforward.
Causes
- Coverage highlighting is enabled by the coverage tools like Cobertura or EMMA after reports are generated.
- The default behavior of Eclipse retains the highlighting to help developers quickly identify tested and untested code.
Solutions
- Go to the 'Coverage' view in Eclipse.
- Select the coverage report you want to clear.
- Right-click on the report and choose 'Clear Coverage' from the context menu.
- Alternatively, you can select 'Clear All Coverage' from the Coverage menu in the GUI. This will remove all highlights.
Common Mistakes
Mistake: Not selecting the correct coverage report before attempting to clear highlights.
Solution: Ensure you are right-clicking the appropriate coverage report in the Coverage view.
Mistake: Confusing clearing coverage with removing it permanently.
Solution: Clearing the highlighting does not delete the coverage data; it simply removes the visual cues from the editor.
Helpers
- clear code coverage highlighting
- Eclipse clear coverage report
- remove coverage highlighting in Eclipse
- Cobertura Eclipse plugin
- EMMA plugin Eclipse remove highlight