He has a cool example showing 100% code coverage does not mean good or correct code is being tested:
Here, we call GetAnswerString with 2 and 2. This method should give us back “The answer is 4”.
Unfortunately, the developer didn’t really do addition and the method always returns “The answer is 42”.
Unfortunately, the unit tests are just built to ensure that the string starts with the expected prefix, so the actual value isn’t tested.
As a result, we have 100% passing tests and a blatantly incorrect method.
Just because a line is executed by a test, doesn’t mean that the line is correct or accurately tested. @integerman
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Take this post for example:
The Myth of Code Coverage
Matt Eland ・ Nov 9 '19 ・ 6 min read
He has a cool example showing 100% code coverage does not mean good or correct code is being tested: