Test Overview
This test checks if the input field correctly accepts valid age values using equivalence partitioning. It verifies that the system accepts ages within the valid range and rejects invalid ones.
This test checks if the input field correctly accepts valid age values using equivalence partitioning. It verifies that the system accepts ages within the valid range and rejects invalid ones.
def test_age_input_equivalence_partitioning(): valid_ages = [18, 30, 65] # valid partition invalid_ages = [17, 0, -5, 100] # invalid partitions for age in valid_ages: result = validate_age(age) assert result == True, f"Age {age} should be valid" for age in invalid_ages: result = validate_age(age) assert result == False, f"Age {age} should be invalid" def validate_age(age): return 18 <= age <= 65
| Step | Action | System State | Assertion | Result |
|---|---|---|---|---|
| 1 | Test starts | Test environment ready, validate_age function loaded | - | PASS |
| 2 | Loop through valid ages: 18, 30, 65 | Calling validate_age with age=18 | Check if validate_age(18) returns True | PASS |
| 3 | Calling validate_age with age=30 | Inside validate_age function | Check if validate_age(30) returns True | PASS |
| 4 | Calling validate_age with age=65 | Inside validate_age function | Check if validate_age(65) returns True | PASS |
| 5 | Loop through invalid ages: 17, 0, -5, 100 | Calling validate_age with age=17 | Check if validate_age(17) returns False | PASS |
| 6 | Calling validate_age with age=0 | Inside validate_age function | Check if validate_age(0) returns False | PASS |
| 7 | Calling validate_age with age=-5 | Inside validate_age function | Check if validate_age(-5) returns False | PASS |
| 8 | Calling validate_age with age=100 | Inside validate_age function | Check if validate_age(100) returns False | PASS |
| 9 | Test ends | All assertions passed | - | PASS |