Sonarqube code coverage for variables

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
    Using Version 6.7.5 (build 38563)

  • what are you trying to achieve
    full code coverage

  • what have you tried so far to achieve this
    tried improving unit test cases

I am not seeing coverage for some autowired variables or private variables in some of my files, the unit test cases use them but in the class files these show in red bringing down the total code coverage as the functions are covered fully within that class. these classes are Service or COmponents and some of them don’t include these variables and some do. but I am unable to figure out why in some classes these variables are marked as red by sonarQube.


SonarQube relies on the coverage files you supply it – so investigating those files to see if coverage is indicated there is a good starting point.

Here is screenshot of how it looks