Profile picture
, 11 tweets, 2 min read Read on Twitter
Tests coverage is valuable, because it gives me the confidence to make change and to do so quickly.
The test coverage *metric*, on the other hand, is a measure of which lines of code got touched by tests. The only relationship between test coverage and the test coverage metric is that they have a few letters in common. There is no correlation between the metric and the thing.
I write tests for the same reason I put all the semicolons in the right place, not because the metric isn't high enough. I'm not done until all the semicolons are in the right place, and I'm not done until I have test coverage.
When teams use the test coverage metric to drive decisions, they touch lines of code *while missing out on test coverage*. As a team's confidence in the test coverage metric rises, my confidence in test coverage *drops*.
Evaluating test coverage is a human decision about human decisions. It's a code review issue. As a developer, it's about my confidence to make change. As a reviewer, it's about my confidence to click "Merge".
The test coverage metric is a percentage. Test coverage, on the other hand, is a *bool*: I either have it, or I don't.
I either have the confidence to make the change I'm working on, or I don't. If I do, ship it. If I don't, that drives the next test. Nowhere in the train of thought do I think about how many lines got touched, because that isn't what makes the next test effective.
You might, on occasion, run a test coverage tool to find the worst offending areas of an application, but I'd argue even that isn't going to drive the right decisions. Adding test coverage to an area you aren't working in doesn't add value.
Instead, let the real, valuable work drive the next test. If I'm creating a new feature, it naturally has test coverage. If I'm working in legacy code, the parts I have to work in motivate new coverage as I go.
When you let the real work drive your test coverage, and when test coverage is a shared goal of your team, the metric that you are *not* watching will naturally rise.
I am curious, though, about my semicolon metric after all these years.
Missing some Tweet in this thread?
You can try to force a refresh.

Like this thread? Get email updates or save it to PDF!

Subscribe to Patrick Lioi
Profile picture

Get real-time email alerts when new unrolls are available from this author!

This content may be removed anytime!

Twitter may remove this content at anytime, convert it as a PDF, save and print for later use!

Try unrolling a thread yourself!

how to unroll video

1) Follow Thread Reader App on Twitter so you can easily mention us!

2) Go to a Twitter thread (series of Tweets by the same owner) and mention us with a keyword "unroll" @threadreaderapp unroll

You can practice here first or read more on our help page!

Follow Us on Twitter!

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just three indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3.00/month or $30.00/year) and get exclusive features!

Become Premium

Too expensive? Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal Become our Patreon

Thank you for your support!