Failure to Fail


Here’s a quick testing tip: make it as difficult as possible for your test to pass. Otherwise, a failure to fail may be reported as a success and mask a real problem. For example, if your method returns non-zero for a failure, initialize your result code to a non-zero value and only set it to 0 when you’re positive that everything has finished and worked correctly.