Private methods coverage

How to cover private methods coverage.Or how to ignore

  • SonarQube- Version 10.2.1
  • SonarQube deployed: Docker
  • Code coverage for private methods. (No scope now with public methods)
  • Already achived 66% coverage >80%

Hi,

Welcome to the community!

While we have mechanisms to exclude entire files from coverage consideration, we don’t have mechanisms to exclude parts of files. For that, you’ll need to look to your coverage engine.

Once a file is included in a coverage report, we go 100% by what the report says for that file. So if the report says private methods are uncovered, SonarQube will reflect that. If the report ignores private methods, then SonarQube will reflect that too.

 
HTH,
Ann