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.

Code Coverage Metrics

See original GitHub issue

Hi, I would like to explore implementing test coverage metrics in our codebase. Ideally, we would have something that runs as part of our CI process that provides an overall test coverage metrics as well as the ability to drill down and see the contributing factors to those high level metrics. We can also have that information surfaced in some form in open PRs.

Here are what I see as the goals/benefits of that. Do these seem reasonable? Anything I’m missing that we’d like to call out?

Goals:

  • Provide a baseline understanding of how thoroughly different parts of our codebase are tested.
  • Help identify areas we’d like to test more thoroughly and if there are any areas that we feel are overly tested. This could result in tech-debt tasks to add coverage on certain areas, or allow us to mark tests we’d remove when they require upkeep.
  • Ensure we are intentional about increasing or decreasing code coverage over time through the PR process.

att. @desktop/maintainers

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
shiftkeycommented, Aug 30, 2018

👍 to this work.

Some team-based ideas off the top of my head:

  • when updating a component, review whether it can be simplified by extracting functionality that makes it easier to test
  • reviewers encouraging PRs for fixes to also include regression tests, where appropriate (e.g. #5434)

Some specific “nice to have” integration ideas:

  • PR integration to indicate how an incoming PR impacts the code coverage stats
  • tracking trends over time about how we’re keeping up with coverage goals
1reaction
shiftkeycommented, Nov 9, 2018

Just noticed that Appveyor doesn’t have gcov installed - which is part of GCC - and it quietly errors (but still seems to succeed uploading code coverage):

yarn run v1.10.1
$ codecov -f coverage/*.json
  _____          _  
 / ____|        | |  
| |     ___   __| | ___  ___ _____   __  
| |    / _ \ / _` |/ _ \/ __/ _ \ \ / /  
| |___| (_) | (_| |  __/ (_| (_) \ V /  
 \_____\___/ \__,_|\___|\___\___/ \_/  
                                v3.1.0
==> Detecting CI Provider
    AppVeyor CI Detected
==> Configuration: 
    Endpoint: https://codecov.io
{ commit: 'bd3938780b3977a824c0f17727fd49d5038aa6ac',
  branch: '__release-beta-bd39387-112930252',
  package: 'node-v3.1.0' }
==> Building file structure
==> Generating gcov reports (skip via --disable=gcov)
    $ for /f "delims=" %g in ('dir /a-d /b /s *.gcno ') do gcov  %g
File Not Found
    Failed to run gcov command.
==> Targeting specific file
    X Failed to read file at C:\projects\desktop\coverage\*.json
==> Uploading reports
    Success!
    View report at: https://codecov.io/github/desktop/desktop/commit/bd3938780b3977a824c0f17727fd49d5038aa6ac
Done in 74.76s.

It might be cool to try out whether this can be disabled because the command line yarn test:unit:cov generates these JSON files that match coverage/*.json:

$ ls coverage/*.json
coverage/coverage-final.json
Read more comments on GitHub >

github_iconTop Results From Across the Web

What is Code Coverage? | Atlassian
Code coverage is a metric that can help you understand how much of your source is tested. It's a very useful metric that...
Read more >
Everything you need to know about code coverage - Codegrip
Code coverage is a software testing metric that determines the number of lines of code that is successfully validated under a test procedure,...
Read more >
What is code coverage and how do YOU measure it?
Code coverage is a measurement of how many lines/blocks/arcs of your code are executed while the automated tests are running. Code coverage is...
Read more >
The Real Problem with Code Coverage Metrics in 2020
This measures the number of lines of source code executed during a given test suite for a program. Tools that measure code coverage...
Read more >
Code coverage - Wikipedia
Many different metrics can be used to calculate test coverage. Some of the most basic are the percentage of program subroutines and the...
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