Curdled Test Fixtures

Definition:

  • Where there’s an inappropriate union of tests in the same fixture, or splitting into multiple fixtures where one would be better

Code Example:

class MyTest {
  // some test input or expected output
  private static final SomeObject COMPLEX_DATA = new ...;

  private Thing whatWeAreTesting = new ...;

  // ... other resources

  @BeforeEach
  void beforeEach() {
      // some additional setup
  }
  @AfterEach
  void afterEach() {
      // some tidy up
  }

  @Test
  void testOne() { ... }

}

References:

Quality attributes

  • - Code Example

  • - Cause and Effect

  • - Frequency

  • - Refactoring