DEV Community

Discussion on: Unit testing frontend code is (probably) useless

 
polterguy profile image
Thomas Hansen • Edited

Not only is coverage a good measurement of unit test quality, but it is also the only measure stick we've got. Is it perfect? No. Is your snippet an example of a test where it misses things? Yes. But it's still for all practical concerns the only measurement we've got to (statically) analyse unit test "quality". You still need to bring your brain to the party as you write unit tests. The best example of that would be your own code, that multiples 1 with 1. If one of my developers did that in code, and told me "I implemented 100% coverage", I would chase the guy out of the building with a stick when I realised what he or she had done ...

Thread Thread
 
joelbonetr profile image
JoelBonetR 🥇 • Edited

Hahahaha 😂 I imagined it and was funny.

Just pointing out that coverage measures test quantity and not quality even it's bringed over the table when talking about code quality. It it would be a test quality measure, a 100% code coverage codebase won't need regressions and we all know that's not true.

That was a dumb example but I've found things not much cleaver than that tbh 😅

Thread Thread
 
polterguy profile image
Thomas Hansen

coverage measures test quantity and not quality

True, but one speaks about the other, at least to some extent ...

That was a dumb example but I've found things not much cleaver than that tbh

^_^

Thread Thread
 
joelbonetr profile image
JoelBonetR 🥇

Agree