What is code coverage and is a high percentage a good target?
IntermediateConceptTesting and Quality Gates
Answer
Coverage measures which lines or branches were executed by tests (JaCoCo for Java, coverage.py, Istanbul/nyc, go test -cover). It shows what is untested, not whether the tests are meaningful: a test with no assertions gives coverage. We gate on coverage of new code (for example, 80% on changed lines) rather than a global number, and combine it with mutation testing (PIT, Stryker) on critical modules.
More on Testing and Quality Gates
What is the testing pyramid?BeginnerWhat is the difference between unit, integration, and end-to-end tests?BeginnerWhat are smoke tests and sanity tests in a deployment pipeline?IntermediateWhat is a quality gate in SonarQube?IntermediateHow do you integrate SonarQube into a CI pipeline and make it block on gate failure?IntermediateWhat does SonarQube's "Clean as You Code" and new code period mean?Advanced