Test Overview
This test demonstrates how to use the @Disabled annotation in JUnit to skip a test method. The test verifies that a simple addition operation works correctly, but the test is skipped during execution.
This test demonstrates how to use the @Disabled annotation in JUnit to skip a test method. The test verifies that a simple addition operation works correctly, but the test is skipped during execution.
import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; public class CalculatorTest { @Test @Disabled("Skipping this test temporarily") void testAddition() { int result = 2 + 3; assertEquals(5, result, "2 + 3 should equal 5"); } }
| Step | Action | System State | Assertion | Result |
|---|---|---|---|---|
| 1 | Test runner discovers testAddition method annotated with @Test and @Disabled | Test suite loaded with one test method marked as disabled | - | PASS |
| 2 | Test runner skips execution of testAddition due to @Disabled annotation | No browser or UI involved; test framework skips test execution | No assertions executed because test is skipped | PASS |
| 3 | Test report marks testAddition as skipped | Test report shows one skipped test | Skipped test is correctly reported | PASS |