Introduction
Imagine building a complex machine without checking if each part works correctly. Testing in software development solves this problem by finding mistakes early to ensure the final product works well and meets user needs.
Think of building a car. First, you check the design plans to make sure everything is clear. Then, you test each part like the engine and brakes separately. Next, you assemble parts and test how they work together. After the whole car is built, you take it for a test drive. Finally, the customer tries the car to confirm it meets their needs.
┌─────────────────────────────┐
│ Requirement Analysis │
└──────────────┬──────────────┘
│
┌───────▼───────┐
│ Unit Testing │
└───────┬───────┘
│
┌───────▼────────┐
│ Integration Test│
└───────┬────────┘
│
┌───────▼───────┐
│ System Test │
└───────┬───────┘
│
┌───────▼─────────┐
│ Acceptance Test │
└───────┬─────────┘
│
┌───────▼─────────┐
│ Regression Test │
└─────────────────┘def add(a: int, b: int) -> int: return a + b # Unit test for add function def test_add(): assert add(2, 3) == 5 assert add(-1, 1) == 0 assert add(0, 0) == 0 if __name__ == '__main__': test_add() print('All tests passed!')