What is Software Testing?
Learn the fundamentals of software testing, including what testing really means, the relationship between errors, defects, and failures, and why testing is essential in software development.
What you'll learn
- Define software testing and explain its purpose
- Explain the relationship between errors, defects, and failures
- List at least 3 reasons why software testing matters
FoundationlessonsJump to another lesson
What is Software Testing?
A Simple Definition
Software testing evaluates software to find the gap between expected behavior and actual behavior.
Testing is not just bug hunting. It’s about building confidence that software works, meets requirements, and is ready for real users.
The Chain: Error → Defect → Failure
Three words that sound similar but mean very different things. They form a chain:
Error
Human mistake
Defect
Flaw in code
Failure
Broken behavior
- 1
1. Error (human mistake)
A developer misreads a requirement. The spec says 'users must be 18 or older' but they interpret it as 'over 18'.
// Requirement: age >= 18 // Dev thinks: age > 18 - 2
2. Defect (flaw in the code)
The error becomes real code sitting in the codebase. It exists whether or not anyone triggers it.
if (age > 18) { allowSignup(); } - 3
3. Failure (wrong behavior at runtime)
An 18-year-old user tries to sign up and is rejected. This is what users actually experience.
// User, age 18: // 'You must be at least 18'
Why Do We Test?
Quick check
A PM asks 'ship now or delay?' — which purpose of testing matters most here?
What Testing is NOT
A Practical Example: The Login Page
Every feature has two sides — the happy path where everything works, and the sad path where things go wrong. Testing covers both.
Happy Path
Everything goes right
Sad Path
Things go wrong
Even a simple login page generates dozens of test cases:
| What to test |
|---|
| Valid email and password → successful login |
| Wrong password → error message shown |
| Empty email field → validation message |
| SQL injection in email field → handled safely |