Code coverage only works for lines

已回答

Hey,

some time ago I switched from Eclipse to IntelliJ. So far it has been nice. One thing I'm used from Eclipse is the code coverage, which is applied on statement level (not line). The following line needs more then one run to cover every path:

booelean result = booleanValue1 || booleanVealue2; 

Right now the coverage tool indicates "green" for the whole line even If I have covered just one path. Am I doing something wrong? I'm using OpenJDK 11 and IntelliJ IDEA Ultimate 2018.3.3

Thanks

0

Hello, 

Please try switching to Tracing mode in Code Coverage settings, that will enable accurate collection of the branch coverage (https://www.jetbrains.com/help/idea/code-coverage.html)

In Tracing mode this line

boolean result = booleanValue1 || booleanValue2; 

coverage will be shown as partial.

0
Avatar
Permanently deleted user

Hey Olga,

I've found this settings in the "run configuration" in the "code coverage" tab. Apparently, there is no way setting this in the preferences dialog. How do I set this value as default value? As I now need to adjust this manually for every test run configuration :(

 

0

Konstantin, you may go to Run Configurations -> Templates -> Application (or the used configuration template) and change the mode to Tracing, so the new configurations in current project will be created with Tracing coverage mode.

0
Avatar
Permanently deleted user

Thanks, that solves my issue.

0

请先登录再写评论。