DEV Community 👩‍💻👨‍💻

DEV Community 👩‍💻👨‍💻 is a community of 963,673 amazing developers

We're a place where coders share, stay up-to-date and grow their careers.

Create account Log in

Discussion on: What gives you a false sense of certainty/security/...?

Collapse
 
adam_cyclones profile image
Adam Crockett

Honestly, Unit tests. Based on the assumption that 💯% coverage was achieved, how many of those tests are actually testing what they are meant to test, and what does that mean for the coverage statistic.

Collapse
 
adam_cyclones profile image
Adam Crockett • Edited on

So the answer is use humans to review code. But who really trusts humans to code, that's why we have tests?

Collapse
 
_bigblind profile image
Frederik 👨‍💻➡️🌐 Creemers Author

There's an infinite number of things a piece of code could be doing, and in general tests only test that code does the things we want. But there's another infinity of things we don't want that code to do, that we're not testing for. As I'm learning more about how brittle and hard to understand large and complex systems are, the more I see the value of fuzzing, or property-based testing for smaller pieces of it.

Collapse
 
stickwarslit profile image
Nora Del Rosario

Unit tests are good at proving that the program does what the programmer says it's going to do

Collapse
 
adam_cyclones profile image
Adam Crockett

Precisely, as humans make mistakes, tests also may be prone to the same (I am pro TDD to be clear, but this is always in the back of my mind).

Collapse
 
reergymerej profile image
ᴙɘɘᴙgYmɘᴙɘj

Coverage is the biggest feel good fraud.

expect(() => foo.bar())).toThrow()

That counts as coverage, but it's (probably) useless.

Collapse
 
firozansari profile image
Firoz Ansari

I totally agree. Unit tests are another false sense of security. Having 100% code coverage does not guarantee a working functionality.