Search code examples
javaintellij-ideajunit

How do I reset code coverage in IntelliJ, not hide it?


After running unit tests with code coverage, I used to get a pop up that asked if I would like to add to existing code coverage or reset it then add the new coverage. I accidentally clicked on "do not ask again" and now it always just adds to existing code coverage.

But now I would like to clear my code coverage numbers, reset it to 0 lines covered. When I search online and in SO all I find is answers to hide the code coverage, not reset it to 0 lines covered. How exactly do I get the IDE to either ask me like it used to, if I would like to reset the code coverage after running a test, or how can I manually just reset the code coverage. This is not about hiding it, this is about resetting it to 0 lines covered.


Solution

  • Please open "Settings/Preferences | Build, Execution, Deployment | Coverage" and select the needed option.

    Here is Jetbrains documentation https://www.jetbrains.com/help/idea/configuring-code-coverage-measurement.html

    enter image description here