question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Explain how to use coverage targets

See original GitHub issue

Is it possible to add documentation to the cobertura pipeline step parameters here: https://jenkins.io/doc/pipeline/steps/cobertura/ ?

I had to dig into https://github.com/jenkinsci/cobertura-plugin/blob/cbe06a5974494fb3775730edf7506b47bdd8d109/src/main/java/hudson/plugins/cobertura/CoberturaPublisher.java#L760 to discover how to set the lineCoverageTargets value for example.

Then I figured out that the value is a string of "healthy %, unhealthy %, unstable %" (but what does that mean with respect to build results?)

An experiment where the actual line coverage is 77% would give the following results:

  • Setting lineCoverageTargets: '100, 90, 80' caused the build to fail with the message: Failing build due to unstability
  • Setting lineCoverageTargets: '100, 90, 0' caused the build to fail with the message: Failing build because it is unhealthy.
  • Setting lineCoverageTargets: '100, 0, 0' caused the build to pass with a message about new health minimum and new stability minimum

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:13
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

9reactions
aedadescommented, Jan 31, 2020

https://github.com/jenkinsci/cobertura-plugin/pull/68

With lineCoverageTargets: '90.0, 80.1, 50':

  • Report health as 100% if line coverage > 90%
  • Report health as 0% if line coverage < 80.1%
  • Mark build as unstable if line coverage < 50%
8reactions
sajanepcommented, Aug 1, 2019

It is too bad so that these parameters are not documented in a decent way.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Set Code Coverage Goals and Interpret Results
How to Set Code Coverage Goals and Interpret Results · Covered != Tested · The obvious conclusion. So the only meaningful coverage target...
Read more >
Introduction to Cobertura | Baeldung
Simply put, Cobertura is a reporting tool that calculates test coverage for a codebase – the percentage of branches/lines accessed by unit tests ......
Read more >
Command line usage — Coverage.py 6.4.4 documentation
Coverage.py can annotate your source code to show which lines were executed and which were not. The html command creates an HTML report...
Read more >
2.8. Adding Code Coverage and Other Metrics
To see how the plugins work, we are going to integrate code coverage ... In the Coverage Metrics Targets section, you can define...
Read more >
Don't use test coverage as a target - Ben Morris.
Measuring test code coverage can be a useful technique for finding where the gaps are in your automated tests. The problem is that...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found