Increase of code coverage by each commit until threshhold reached

Hi,

I am trying to increase the code coverage of our UnitTests and I want to enforce it.
I thought that it might be a great idea to test if the coverage between the last built and the actual built simply increased until a certain threshold. Lets say 80%. If it is higher than 80% I want the built to always pass (as long as the tests are fine). If it stays or decrease lower than 80% I want the built to fail.

Case 1
Last built Coverage was 60%. Actual built coverage is 60% --> Fail.

Case 2
Last built coverage was 60%. Actual built coverage is 61% --> Success.

Case 3
Last built coverage was 85%. Actual built coverage is 84% --> Success.

Case 4
Last built coverage was 85%. Actual built coverage is 79% --> Fails.

Does this make sense? Is it possible to check this with SonarCube and how to do this?

We use SonarQube Version 6.7.7.

Thank you & Kind regards

Andy

Andy,

It’s not possible to have the Quality Gate pass/fail based on a differential as you’ve proposed. The purpose of a Quality Gate is really to answer a single question: can I deliver my project to production today or not? It’s meant to signal the quality of your code–the standards you deem acceptable for delivering code into Production–not whether your code is progressing towards those standards.

Furthermore, I think it would be interesting to imagine a different scenario:

Case 1: Code Coverage is 80 % --> Success

Case 2: Code Coverage is 70% --> Fail

Case 3: Code Coverage is 75% --> Success

Does that seem right, or misleading?

Best regards,

Colin