0
0
Testing Fundamentalstesting~10 mins

Equivalence partitioning in Testing Fundamentals - Test Execution Trace

Choose your learning style9 modes available
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.

Test Code - PyTest
Testing Fundamentals
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
Execution Trace - 9 Steps
StepActionSystem StateAssertionResult
1Test startsTest environment ready, validate_age function loaded-PASS
2Loop through valid ages: 18, 30, 65Calling validate_age with age=18Check if validate_age(18) returns TruePASS
3Calling validate_age with age=30Inside validate_age functionCheck if validate_age(30) returns TruePASS
4Calling validate_age with age=65Inside validate_age functionCheck if validate_age(65) returns TruePASS
5Loop through invalid ages: 17, 0, -5, 100Calling validate_age with age=17Check if validate_age(17) returns FalsePASS
6Calling validate_age with age=0Inside validate_age functionCheck if validate_age(0) returns FalsePASS
7Calling validate_age with age=-5Inside validate_age functionCheck if validate_age(-5) returns FalsePASS
8Calling validate_age with age=100Inside validate_age functionCheck if validate_age(100) returns FalsePASS
9Test endsAll assertions passed-PASS
Failure Scenario
Failing Condition: validate_age returns True for an invalid age or False for a valid age
Execution Trace Quiz - 3 Questions
Test your understanding
What does the test verify for the age value 30?
AThat age 30 causes an error
BThat age 30 is rejected as invalid
CThat age 30 is accepted as valid
DThat age 30 is ignored
Key Result
Equivalence partitioning helps reduce test cases by grouping inputs that should behave the same, ensuring efficient and effective testing.