SonarQube Code coverage

Hi,

Can you please let me know , if there is any other way to increase code coverage to 80 percent
without writing any junit or test cases for it. As there are lots of code so writing junit for all is very lengthy task , so if there is any metrics we can use to increase code coverage for our project.

can anyone please response … early help would be very much appreciated … Thanks

Hi @Pooja12,

Welcome to our community forum.
First thing, I would like to let you know that this is a community forum, and people here are users and SonarSourcers, who reply to the different (hundreds of) posts on their “free” time. Requesting a reply after only few hours is not a very good practice :wink:

May I ask you why you want to increase your code coverage to 80% ?

And last thing, I moved your post to “Get Help” and not “Report a bug” as there is no bug in your post description.

Thanks,
Carine

Hi @Carine_Bayon ,
Thanks for your reply. In our company as for the quality coding of project code metrics are set, so it is mandatory for us to have overall code coverage of 80 % so we are looking for another alternative to increase it.

Best Regards,
Pooja

Hi ,
Can anyone help with my above question please , It will be very helpful.

Best regards,
Pooja

Hi @Carine_Bayon,

Could you please help with some suggestion on this please.

Best regards,
Pooja

Yeah even for us to get an overall code coverage of 80% for the SonarQube scanned projects.

If there’s a way to pass to get 80% coverage without writing test cases, it will be very helpful.

Hi here,

to increase your code coverage, the suggestion is to write tests. It can be unit tests (easiest way) or other tests (Integration test, System tests) which may contribute to coverage when a tool can report coverage for these.

Carine

2 Likes

Hi @Carine_Bayon,
Thanks for your feedback.Can you also please confirm that scanning for entire project is happening in this case .Basically I want to know if there is any link between coverage and scanning , ie if coverage is 2 percent does that mean scanning will be also 2 percent.As I am aware ,but I need an official confirmation

Best regards,
Pooja

Hi ,
Can any please let me know if there is any link between code coverage and scanning. How can we be assure that sonar qube is scanning our whole project.Your early response will be very helpful.

Best regards,
Pooja