I've been dealing with a Sr Dev recently that loves unit testing. That's great! I'm not sure I agree with his testing methods though, contrived example:
function foo (String $var) {
switch ($var) {
case 'hello':
return '-world';
default:
return 'good-bye!';
}
}
function TestFoo() {
$result = foo('hello');
assertInternalType('string', $result);
}
I'm hoping the issue here is obvious, these types of tests don't actually test business logic at all, but they do increase code coverage (which he loves to show off). When asked about tests like this, I've received general "I didn't write it to test that (return values)." responses.
This is quite frustrating to me, especially as he's begun removing existing tests that do check return values in favor of this generic type-test.
This is a bad practice, correct? Just yesterday I found a bug in a function that had a passing test because of this reason - doesn't make me feel good about the code.