I am trying to do Sonar analysis with the unit tests code coverage on new code. When I do code coverage analysis with cobertura and do Sonar analysis the overall code coverage of the code is displayed correctly, however the code coverage of new code is not displayed.
I did following
The overall code coverage of the code by unit tests got increased as I have implemented some unit tests on a code that was changed. The On New Code item in the widget however stays hidden and the code coverage of new code is not displayed.
Does any of you have any tips that could bring more light to this?
Thank you all.
You're observing this behaviour because Coverage on new code currently identifies new code based on the date of the previous analysis (and not the commit date of the code previously analyzed), see SONAR-7085 .
For your scenario to work you have to force a past date for the analysis of the old code, using
-Dsonar.projectDate. Good article on this right here: Sonar Time Machine : replaying the past .