What if one small change could make your tests tell you exactly what's broken instantly?
Why Single assertion per test debate in JUnit? - Purpose & Use Cases
Imagine testing a calculator app by clicking buttons and writing down results on paper. You check addition, subtraction, multiplication, and division all at once. If something is wrong, you have to remember which step failed.
Manually testing many things in one go is slow and confusing. You might miss errors or forget details. When a test fails, it's hard to know exactly what went wrong because many checks are mixed together.
Using one assertion per test means each test checks only one thing. This makes it clear what passed or failed. If a test fails, you instantly know the exact problem. It saves time and reduces mistakes.
assertEquals(5, calculator.add(2, 3)); assertEquals(1, calculator.subtract(3, 2));
assertEquals(5, calculator.add(2, 3)); // separate test assertEquals(1, calculator.subtract(3, 2)); // separate test
Clear, fast feedback on exactly what works and what needs fixing in your code.
When a bank app test fails, knowing if it's the deposit or withdrawal feature that broke helps fix it quickly without guessing.
Manual multi-check tests are confusing and slow.
Single assertion tests isolate problems clearly.
This approach speeds up fixing bugs and improves confidence.