0
0
Testing Fundamentalstesting~20 mins

Equivalence partitioning in Testing Fundamentals - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Equivalence Partitioning Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Identify valid equivalence partitions for age input

A software form accepts an age input between 18 and 65 inclusive. Which of the following correctly describes the valid equivalence partitions for this input?

AOne partition: ages 18 to 65 inclusive
BTwo partitions: ages less than 18, and ages 18 to 65 inclusive
CThree partitions: ages less than 18, ages 18 to 65 inclusive, and ages greater than 65
DFour partitions: ages less than 18, ages 18 to 30, ages 31 to 65, and ages greater than 65
Attempts:
2 left
💡 Hint

Think about all possible input groups including invalid and valid ranges.

Predict Output
intermediate
2:00remaining
Output of test case count using equivalence partitions

Given the input domain for a field is divided into 3 equivalence partitions, and boundary value analysis adds 2 test cases per boundary, how many total test cases are generated?

Testing Fundamentals
partitions = 3
boundaries = partitions - 1
boundary_tests = boundaries * 2
total_tests = partitions + boundary_tests
print(total_tests)
A9
B7
C8
D6
Attempts:
2 left
💡 Hint

Calculate boundaries as one less than partitions, then multiply by 2 for boundary tests, then add partitions.

assertion
advanced
2:00remaining
Assertion to verify partition coverage in test suite

Which assertion best verifies that a test suite covers all equivalence partitions for input values 1-10, 11-20, and 21-30?

Aassert all(test in range(1,31) for test in tests)
Bassert all(any(test in range(1,11) for test in tests), any(test in range(11,21) for test in tests), any(test in range(21,31) for test in tests))
Cassert any(test in range(1,31) for test in tests)
Dassert any(test in range(1,11) for test in tests) and any(test in range(11,21) for test in tests) and any(test in range(21,31) for test in tests)
Attempts:
2 left
💡 Hint

Think about checking that each partition has at least one test case.

🔧 Debug
advanced
2:00remaining
Find the error in equivalence partition test code

What is the error in this Python test code that tries to check input partitions?

Testing Fundamentals
def test_partitions(inputs):
    valid = [x for x in inputs if 10 <= x <= 20]
    invalid = [x for x in inputs if x < 10 or x > 20]
    assert len(valid) > 0
    assert len(invalid) > 0
    assert len(valid) + len(invalid) == len(inputs)
    assert all(x >= 10 and x <= 20 for x in valid)
    assert all(x < 10 or x > 20 for x in invalid)
AThe last assertion uses 'and' instead of 'or', causing it to always fail
BThe first assertion should check for len(valid) == 0
CThe invalid list comprehension is missing parentheses
DThe function does not return any value
Attempts:
2 left
💡 Hint

Check the logic in the last assertion carefully.

framework
expert
3:00remaining
Designing test cases using equivalence partitioning in automation

You are automating tests for a form field that accepts numeric input 1 to 100. Using equivalence partitioning, which set of test inputs best covers all partitions including invalid inputs?

A[0, 1, 50, 100, 101]
B[1, 50, 100]
C[-1, 0, 1, 100, 101, 102]
D[10, 20, 30, 40, 50]
Attempts:
2 left
💡 Hint

Include values from below, inside, and above the valid range.