Multiple Assertions

Definition:

  • When a test method contains multiple assertion statements, it is an indication that the method is testing too much

Also Known As:

  • Eager Test

Code Example:

public class MyTestCase extends TestCase {
    public void testSomething() {
        // Set up for the test, manipulating local variables
        assertTrue(condition1);
        assertTrue(condition2);
        assertTrue(condition3);
    }
}

References:

Quality attributes

  • - Code Example

  • - Cause and Effect

  • - Frequency

  • - Refactoring