The Secret Catcher

Definition:

  • A test that at first glance appears to be doing no testing, due to absence of assertions. But “The devil is in the details”.. the test is really relying on an exception to be thrown and expecting the testing framework to capture the exception and report it to the user as a failure.

Also Known As:

  • The Silent Catcher, Issues in Exception Handling

Code Example:

[Test]
public void ShouldNotThrow()
{
  DoSomethingThatShouldNotThrowAnException();
}

References:

Quality attributes

  • - Code Example

  • - Cause and Effect

  • - Frequency

  • - Refactoring