Equivalence Partitioning and Boundary Value Analysis
📖 Scenario: You are a QA engineer designing test cases for a function that validates a student's exam score. The score must be an integer between 0 and 100 (inclusive). You will use equivalence partitioning and boundary value analysis to derive a minimal but effective test set.
🎯 Goal: Build a Python model that defines equivalence partitions, selects representative values, identifies boundary values, and combines them into a final test set with expected results.
📋 What You'll Learn
Define equivalence partitions for the score input domain
Select one representative value from each partition
Identify boundary values at partition edges
Combine partitions and boundaries into a final test set with expected outcomes
💡 Why This Matters
🌍 Real World
EP and BVA are used in every QA department to design efficient test cases. They are standard techniques in ISTQB certification and required knowledge for QA roles.
💼 Career
QA engineers and SDETs are expected to derive test cases from specifications using EP and BVA. These techniques appear in virtually every software testing interview.
Progress0 / 4 steps
1
Define equivalence partitions
Create a dictionary called partitions with three entries: 'invalid_low' mapped to 'score < 0', 'valid' mapped to '0 <= score <= 100', and 'invalid_high' mapped to 'score > 100'.
Software Engineering
Hint
Three partitions cover all possible integer inputs: below range, within range, and above range.
2
Select representative values from each partition
Create a dictionary called partition_tests with three entries: 'invalid_low' mapped to -10, 'valid' mapped to 50, and 'invalid_high' mapped to 150.
Software Engineering
Hint
Pick any value well inside each partition. The exact value does not matter as long as it clearly belongs to that class.
3
Identify boundary values
Create a dictionary called boundary_tests with six entries: 'below_lower' mapped to -1, 'at_lower' mapped to 0, 'above_lower' mapped to 1, 'below_upper' mapped to 99, 'at_upper' mapped to 100, and 'above_upper' mapped to 101.
Software Engineering
Hint
Test one value below, at, and above each boundary. For lower boundary 0: test -1, 0, 1. For upper boundary 100: test 99, 100, 101.
4
Combine into final test set with expected outcomes
Create a dictionary called final_tests. Use a for loop with variables name and value over partition_tests.items(), setting final_tests[value] to 'valid' if 0 <= value <= 100 else 'invalid'. Then use another for loop with name and value over boundary_tests.items() doing the same.
Software Engineering
Hint
Each test value gets an expected outcome: valid if within 0-100, invalid otherwise.
Practice
(1/5)
1. Which of the following best describes equivalence partitioning in software testing?
easy
A. Running all possible input combinations exhaustively
B. Testing only the maximum input value of a range
C. Checking the software's response to invalid inputs only
D. Dividing input data into groups where test cases represent each group
Equivalence partitioning divides inputs into groups where all inputs in a group are expected to behave similarly.
Step 2: Match description to options
Dividing input data into groups where test cases represent each group correctly states this grouping approach. Other options describe different testing ideas.
Final Answer:
Dividing input data into groups where test cases represent each group -> Option D
Quick Check:
Equivalence partitioning = Group inputs [OK]
Hint: Group inputs by behavior to reduce tests [OK]
Common Mistakes:
Confusing equivalence partitioning with boundary value analysis
Thinking it tests only invalid inputs
Assuming it requires exhaustive testing
2. Which of the following is the correct boundary value test inputs for a field accepting integers from 1 to 10 inclusive?
easy
A. 1, 2, 9, 10
B. 1, 5, 10
C. 0, 1, 10, 11
D. 0, 5, 10
Solution
Step 1: Identify boundary values for range 1 to 10
Boundaries are the edges: minimum (1), maximum (10), and just outside edges (0 and 11).
Step 2: Check options for correct boundary inputs
0, 1, 10, 11 includes 0 (just below min), 1 (min), 10 (max), and 11 (just above max), which is correct for boundary testing.
Final Answer:
0, 1, 10, 11 -> Option C
Quick Check:
Boundary values = edges and just outside [OK]
Hint: Test edges plus one inside and outside values [OK]
Common Mistakes:
Testing only valid inputs ignoring just outside boundaries
Choosing random middle values instead of edges
Missing one side of the boundary
3. Consider a function that accepts an integer input from 1 to 5 inclusive. Which set of test inputs covers both equivalence partitioning and boundary value analysis?
medium
A. [0, 1, 3, 5, 6]
B. [1, 2, 3, 4, 5]
C. [1, 5]
D. [2, 3, 4]
Solution
Step 1: Identify equivalence partitions and boundaries
Partitions: invalid below (<=0), valid (1-5), invalid above (>=6). Boundaries: 1 and 5 plus just outside 0 and 6.
Step 2: Check which option covers all partitions and boundaries
[0, 1, 3, 5, 6] includes 0 (below), 1 (min boundary), 3 (valid middle), 5 (max boundary), and 6 (above), covering partitions and boundaries.
Final Answer:
[0, 1, 3, 5, 6] -> Option A
Quick Check:
Partitions + boundaries = test edges and groups [OK]
Hint: Include invalid, valid, and boundary values [OK]
Common Mistakes:
Ignoring invalid partitions
Testing only boundaries without middle values
Choosing only valid inputs
4. A tester wrote these test inputs for a field accepting values 10 to 20 inclusive: [9, 10, 15, 20, 21]. The test failed to catch a bug at input 21. What is the likely mistake?
medium
A. They only tested valid inputs and ignored invalid ones
B. They did not include invalid inputs below 10
C. They missed testing the exact boundary values
D. They did not test the boundary just above the max value correctly
Solution
Step 1: Analyze test inputs and bug location
Inputs include 9 (below min), 10 (min), 15 (middle), 20 (max), and 21 (just above max). Bug at 21 means boundary above max was tested.
Step 2: Identify mistake causing bug miss
Since bug was missed at 21, likely the test did not properly check or handle the boundary just above max, possibly due to incorrect validation or test setup.
Final Answer:
They only tested valid inputs and ignored invalid ones -> Option A
Quick Check:
Boundary above max must be tested carefully [OK]
Hint: Check boundaries just outside valid range carefully [OK]
Common Mistakes:
Assuming testing 21 is enough without checking handling
Ignoring off-by-one errors at boundaries
Not validating test setup correctness
5. You have a form field that accepts ages from 18 to 60 inclusive. Using equivalence partitioning and boundary value analysis, which of the following test sets is the most effective to detect input errors?
hard
A. [18, 19, 20, 59, 60]
B. [17, 18, 30, 60, 61]
C. [18, 30, 60]
D. [16, 18, 60, 62]
Solution
Step 1: Define equivalence partitions and boundaries for age 18-60
Partitions: invalid below 18, valid 18-60, invalid above 60. Boundaries: 18 (min), 60 (max), and just outside 17 and 61.
Step 2: Evaluate options for coverage
[17, 18, 30, 60, 61] includes 17 (below min), 18 (min), 30 (valid middle), 60 (max), and 61 (above max), covering all partitions and boundaries effectively.
Final Answer:
[17, 18, 30, 60, 61] -> Option B
Quick Check:
Test invalid, valid, and boundary values for best coverage [OK]
Hint: Test just below, at, inside, and just above boundaries [OK]
Common Mistakes:
Ignoring invalid partitions
Testing only valid inputs
Missing boundary values just outside range
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.