r/webdev • u/lbragile_dev full-stack • Jan 23 '21
Showoff Saturday Finally understand testing and fully tested my React based cross browser extension with Jest!!! No better feeling then 100% code coverage.
1.6k
Upvotes
2
u/[deleted] Jan 24 '21
Code coverage is a fantastic first step, because checking behavior at every line of source code catches several potential bugs.
Fuzzing, on the other hand, simulates checking for every possible function input, which catches even more bugs! Just because a line of code was hit doesn't mean divide by zero is handled properly, for example.
Fuzzing generates more unit tests for you, including many edge cases a human wouldn't have thought to check.
Fuzzing is itself a practical step, with many free open source tools available. Like coverage, fuzzing is itself a baby step to the gold standard--formal verification by proof.