Code Coverage shows 0% for IntelliJ while running web app
code-coverage, intellij-idea, java
Solution
I had the same issue. Clicking Stop to end the process results in all 0% coverage, presumably due to the process not getting a chance to tidy up and generate results:
Stop Click this button to terminate the current process externally by means of the standard mechanisms.
Clicking Exit instead allows the coverage to generate properly:
Exit Click this button to terminate the current process gracefully using in-process internal mechanisms.
See here for more detail: https://www.jetbrains.com/idea/webhelp/test-runner-tab.html#
Problem
I have a web server application that I am running inside IntelliJ. I want to run the server with code coverage, then execute an external test harness that will make requests, and see how much of the code is executed by those requests. I can generate the correct code coverage when running unit tests from within the IDE, but when I run with Code Coverage on and execute with an external harness, I get all 0's for code coverage. If I run the web app in the debugger instead, it triggers breakpoints as expected, so I know that code is being executed. Please help!