Navigate Select ESC Close

The Lies Of 100% Code Coverage | Prime Reacts

2024-03-27 Science & Technology
80.1k
1.8k
251
ThePrimeTime
ThePrimeTime
1.1m subscribers

Unlock all features

FREE: Get instant access to 10 AI summaries, chats, or transcripts per day.

Description

Recorded live on twitch, GET IN https://twitch.tv/ThePrimeagen Become a backend engineer. Its my favorite site https://boot.dev/?promo=PRIMEYT This is also the best way to support me is to support yourself becoming a better backend engineer. Article link: https://www.code4it.dev/blog/code-coverage-must-not-be-the-target/ MY MAIN YT CHANNEL: Has well edited engineering videos https://youtube.com/ThePrimeagen Discord https://discord.gg/ThePrimeagen Have something for me to read or react to?: https://www.reddit.com/r/ThePrimeagenReact/ Kinesis Advantage 360: https://bit.ly/Prime-Kinesis Hey I am sponsored by Turso, an edge database. I think they are pretty neet. Give them a try for free and if you want you can get a decent amount off (the free tier is the best (better than planetscale or any other)) https://turso.tech/deeznuts

Top Comments (10)

@KvapuJanjalia 2024-03-27

Code coverage: Goodhart's Law all over again. "When a measure becomes a target, it ceases to be a good measure"

131 1 replies
@AlLiberali 2024-03-27

I'd like to see a mock testing framework _mock_ old school human testers; pun intended. Walk to a pub. Ask for 1 beer, -1 beer, 0 beer, 2^32 beer, 0.5 a beer. Come in through the window, exit through the back door. Breakdance inside and then defenestrate yourself. Introduce yourself as null, empty string, a null terminated string, CRLF, etc.

46 10 replies
@ayehavgunne 2024-03-27

The answer is obviously > 200% coverage.

46 3 replies
@remirth_bergström 2024-03-27

I'll tell you what, I'm covering something else to a 100% if you catch my meaning

41 3 replies
@SimGunther 2024-03-27

100% value delivered "to the people" > 100% not happy path code coverage > 100% happy path code coverage

19
@SamArmstrong-DrSammyD 2024-03-27

The best code coverage is 100% if it’s achieved via tree shaking removal of all code that isn’t covered in an integration test.

11
@orterves 2024-03-27

19:20 "The best way to have a well running project is to have tests easier to write and run to test your project than running the project itself" - this is the core takeaway from the video and it is absolutely true. Identifying and managing the path of least resistance is the core of driving human behaviour in general.

9 1 replies
@Adam_A_Dude 2024-03-27

300% coverage, bro. You got to pump those numbers up !

8 1 replies
@omarmachin4852 2024-03-27

It’s crazy how integration tests were not even mentioned. Unit tests are not design to test end to end functionality of your application. It suppose to test individual “units” of it. In reasonable well designed applications 100% coverage would not be even possible because guess what? You have an entry point where you create all your dependencies and that hard and inefficient to mock. That’s when integration tests come in the picture. You should have a set of test that will call real dependencies. For example call the real weather api and verify that the output you get its correct. Units tests by design are not meant to test this type of end to end scenarios. If you find yourself in a situation like this, something in the architecture of your app/ service can be improved.

7
@GearsDatapacks 2024-05-28

One of the most useful benefits of testing is that it prevents introducing bugs later on when updating code (regressions)

1

Unlock the Data Inside
Turn Videos into Knowledge

  • Get FREE 10/day: transcripts, summaries, chats
  • Chat with videos, export text & PDF
  • $1 free API credit for RAG, chatbots & research

Free forever plan • All features unlocked

App screenshot