12Testing TypesTesting TypesTest Design
What is the difference between Positive and Negative Testing?
Positive Testing:
- Definition: Testing with valid inputs to verify system works as expected
- Purpose: Validate that application does what it’s supposed to do
- Approach: Test with correct data and valid scenarios
- Expected Result: System should accept input and process correctly
- Example: Login with valid username and password
- Also Known As: Happy path testing
Negative Testing:
- Definition: Testing with invalid inputs to verify system handles errors gracefully
- Purpose: Ensure application doesn’t crash with unexpected input
- Approach: Test with incorrect data and invalid scenarios
- Expected Result: System should reject input with appropriate error message
- Example: Login with invalid password, SQL injection attempts
- Also Known As: Error path testing, failure testing
Examples
Login Functionality:
- Positive: Valid username + valid password → Login successful
- Negative: Valid username + invalid password → Error message
- Negative: Empty fields → Validation error
- Negative: SQL injection in username → Rejected safely
File Upload:
- Positive: Upload valid file type within size limit → Success
- Negative: Upload file exceeding size limit → Error message
- Negative: Upload invalid file type → Rejected
- Negative: Upload without selecting file → Validation error
Best Practice
Both positive and negative testing are essential. A good test strategy includes 20-30% positive tests and 70-80% negative tests to ensure robust error handling.