Ignored Test

Definition:

  • JUnit 4 provides developers with the ability to suppress test methods from running. However, these ignored test methods result in overhead since they add unnecessary overhead with regards to compilation time, and increases code complexity and comprehension.

Code Example:

@Ignore("disabled for now as this test is too flaky")
public void peerPriority() throws Exception {
  final List addresses = Lists.newArrayList(
      new InetSocketAddress("localhost", 2000),
        new InetSocketAddress("localhost", 2001),
        new InetSocketAddress("localhost", 2002)
  );
    peerGroup.addConnectedEventListener(connectedListener);
    .....
}

References:

Quality attributes

  • - Code Example

  • - Cause and Effect

  • - Frequency

  • - Refactoring