Tests should Fail

Not too sure how often I have run into this recently, but I am starting to see many tests that cannot fail. What I mean by this is tests that pass regardless of whether the change it is meant to test is present in the codebase or not.

Obviously this is not in a Test Driven Development project, since with TDD the first thing to do is run the test to make sure it fails. However with the more common develop tests after writing the code a passing test does not mean that the code works. All it means is that the test is passing.

It is important to make sure that any test will fail if the feature that it is implementing is doing the right thing. So for tests that were written after the code, it is important to comment out parts of the feature and ensure that the test can detect the deliberate defect.