1

I want my project to fail if the code coverage on new code is not 70%.

Therefore, I set Coverage on New Code to 70% in Quality Gates.

I analyse code that has 84.1% coverage. Then I add some files which don't have test coverage and the coverage drops to 58%.

So obviously, the coverage on new code is not 70%.

Despite this, Quality Gates is Passed and Coverage on New Code is -

My project is in Scala, I'm using Maven as the build tool and Scoverage for test coverage.

Why doesn't SonarQube see the coverage on new code?

bsky
  • 19,326
  • 49
  • 155
  • 270
  • Where does Scoverage place the coverage results? Look at the log to find any lines regarding this file. – Jeroen Heier Feb 19 '17 at 21:00
  • 1
    Before anything: see if [this similar question](http://stackoverflow.com/questions/39237636/sonarqube-coverage-on-new-code-never-calculated) helps. If not then update your question with details on SCM plugin used and analysis logs. – Nicolas B. Feb 20 '17 at 09:33
  • @Nicolas I have added `sonar-scm-git-plugin-1.2.jar` to `sonarqube-6.2/extensions/plugins/` since I'm using Git for scm. However, nothing changed. Is that enough? – bsky Feb 20 '17 at 10:51
  • Add/commit code with test coverage, then build/test and analyse with debug logs (_sonar.verbose=true_) to see if the SCM sensor does its jobs during analysis. Update your question with analysis logs if needed. – Nicolas B. Feb 20 '17 at 11:58
  • @Nicolas I've added the option `sonar.verbose=true`. I looked in the logs from `sonarqube-6.2/logs` but I didn't find any reference to `scoverage`. Any idea what I should be looking for? – bsky Feb 20 '17 at 19:04

0 Answers0