I would like to understand how "Code Coverage On New Code" works in Sonar. Is there any difference, on "Code Coverage On New Code" functionality between Sonar Version 3.2.1 and Sonar Version 5.0.1.
We are using Sonar Version 3.2.1 and planning to upgrade to 5.0.1 soon.
I have an example/scenario where I would like to understand if this will give us Code Coverage On New Code because currently in our Sonar Dashboard we are seeing No New Lines to Cover.
We use SVN for our Code Repository. Lets say we created a new branch 7.1.0 on Jan 1 2015 but for some reason we are behind on running sonar analysis on the day branch was created. Lets say we started our sonar analysis for 7.1.0 branch on Feb 1 2015, which means we are 1 month behind. Let July 1 2015 is code cut off day.
Now, I have performed below steps inorder to get correct report on "Code Coverage On New Code" for 7.1.0 branch but I am not sure if I am correct or not. I am not sure if Sonar will give Correct Report or not peforming below steps.
We got the Revision Number for first day of our daily build for 7.1.0 branch or Revision Number of code cut off day for the branch before 7.1.0. Either way the code should be same.
We ran sonar analysis against this Revision Number which means the code is from the first day of 7.1.0 branch. We changed our sonar project name during these analysis, so this way it will create a new project in sonar dashboard.
After first sonar analysis, we got the result in sonar dashboard.
Now we run another or final sonar analysis against the latest code of 7.1.0 branch or the last day of code checkin.
After Second round of sonar analysis is completed, we are not seeing "Code Coverage on New Code". It prints a message "No New Lines to Cover".
So, my question here is how does sonar knows, when new code is added. As per my understanding since, we ran 2 sonar analysis, first analysis against first day of branch creation using revision number and 2nd analysis against last day of branch or code cut off day. And there were lots of check-in done during those 2 revision number. Why is sonar not able to find out new lines of code.
If sonar find new lines of code added from Repository, than it should be able to find those new lines of code added.
This new code coverage is very important and I really would like to know behind the scene of it.