Sonar Java - Coverage quality gates

java
sonarqube
coverage

(Vincent Moittie) #1

Hi,

It’s possible to apply the minimum of coverage percent on each classes and on the all the classes in project.

Example:

I develop a feature and I add 10 classes, my minimum coverage is 80% for the quality gates.

All classes are fully covered by test, except one I get lazy and I didn’t covered.

The quality gates passed because the total coverage is above the minimum limit. But, I want that the quality gates failed because one of my classes doesn’t respect the quality gates.

Thanks for your help =D


(Adam Gabryś) #2

Hi,
I’m not sure if it is possible by using coverage conditions in Quality Gate, but it is possible by using the following two rules:

Enable them with Blocker severity and minimum ratio coverage equal to 80. Next add a condition to your Quality Gate that no new blockers are allowed.

Cheers