Missed Fail Rotten Green Test

Definition:

  • Tests where the test engineer passes to an assertion primitive to force the test to fail. Such assertion calls are intended to be executed only if something goes wrong, and not if the test passes.

Code Example:

@Test
public void testMethod() {
    MyClass obj = new MyClass();
    int expected = 5;
    int actual = obj.doSomething();
    assertTrue(actual > 0);
    assertFalse(actual > 10);
    fail("Something went wrong");
}

References:

Quality attributes

  • - Code Example

  • - Cause and Effect

  • - Frequency

  • - Refactoring