0
0
Software Engineeringknowledge~10 mins

Equivalence partitioning and boundary value analysis in Software Engineering - Step-by-Step Execution

Choose your learning style9 modes available
Concept Flow - Equivalence partitioning and boundary value analysis
Start: Function accepts input with valid range
Define input domain (e.g., age: 1-120)
Equivalence Partitioning: Split into classes
Invalid Low
Pick ONE test from each partition
Boundary Value Analysis: Test at edges
Test: 0, 1, 2, 119, 120, 121
Combine: partition + boundary tests
End
This flow shows how equivalence partitioning divides inputs into classes and boundary value analysis tests at the edges of those classes to maximize defect detection with minimal test cases.
Execution Sample
Software Engineering
Function: validate_age(age) accepts integer 1-120

Equivalence Partitions:
  Partition 1 (Invalid Low):  age < 1    → test with -5
  Partition 2 (Valid):        1 <= age <= 120 → test with 25
  Partition 3 (Invalid High): age > 120  → test with 200

Boundary Values:
  Lower boundary: 0 (invalid), 1 (valid), 2 (valid)
  Upper boundary: 119 (valid), 120 (valid), 121 (invalid)

Final test set: {-5, 0, 1, 2, 25, 119, 120, 121, 200}
This sequence shows how to derive a minimal but effective test set using equivalence partitioning and boundary value analysis for an age validation function.
Analysis Table
StepActionCondition/CheckResult/DecisionNext Step
1Define input domainage must be integer 1-120Domain identifiedCreate equivalence partitions
2Create equivalence partitionsSplit into valid and invalid classes3 partitions: <1, 1-120, >120Select one value per partition
3Select partition test valuesOne representative per class-5 (low), 25 (valid), 200 (high)Identify boundary values
4Identify boundary valuesEdges of each partition0, 1, 2, 119, 120, 121Combine test sets
5Combine partition + boundary testsRemove duplicates9 unique test valuesExecute tests
6Execute testsRun validate_age() with each valueVerify pass/fail for eachAnalyze results
7Analyze resultsDo results match expected behavior?All correct → function validatedEnd
💡 9 well-chosen test values cover all equivalence classes and boundary conditions, catching most common defects without exhaustive testing.
State Tracker
VariableStartAfter Step 2After Step 3After Step 4Final
partitionsNone3: <1, 1-120, >1203 partitions3 partitions3 partitions
partition_testsNoneNone{-5, 25, 200}{-5, 25, 200}Merged into final set
boundary_testsNoneNoneNone{0, 1, 2, 119, 120, 121}Merged into final set
final_test_setEmptyEmpty3 values9 values9 values tested
Key Insights - 3 Insights
Why is testing one value from each partition sufficient?
Equivalence partitioning assumes all values within a partition behave the same way. If age=25 passes validation, age=50 will too. Testing one representative per class finds the same defects as testing all values in that class.
Why do most bugs occur at boundary values?
Off-by-one errors are the most common coding mistakes. A condition like age >= 1 might be incorrectly coded as age > 1, which only fails at the boundary value 1. Boundary value analysis specifically targets these edge cases.
How many test cases does this technique save compared to exhaustive testing?
For age 1-120, exhaustive testing needs 120+ values for valid inputs alone. Equivalence partitioning plus boundary value analysis needs only 9 tests total, yet catches the same classes of defects.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution_table at step 2. How many equivalence partitions are created for validate_age()?
A2 partitions
B3 partitions
C4 partitions
D6 partitions
💡 Hint
Check the 'Result/Decision' column in step 2.
According to the variable_tracker, how many boundary test values are identified?
A2 values
B4 values
C6 values
D9 values
💡 Hint
Look at the boundary_tests row in the 'After Step 4' column.
Why is 0 included as a boundary test value but not -1?
A0 is the value immediately below the valid lower boundary of 1
BNegative numbers cannot be tested
C0 is always a special case in programming
D-1 is already covered by the partition test value -5
💡 Hint
Boundary value analysis tests values immediately at and around the boundary, not arbitrary values far from it.
Concept Snapshot
Equivalence partitioning splits the input domain into classes with expected similar behavior.
Boundary value analysis tests at the edges of each partition.
Combined, they produce a minimal test set that catches most common defects.
For age 1-120: 3 partitions + 6 boundary values = 9 tests instead of 120+.
Most bugs cluster at boundaries due to off-by-one errors.
Full Transcript
This visual execution shows how equivalence partitioning and boundary value analysis work together to create efficient test sets. For a function that validates age between 1 and 120, we first create three equivalence partitions: invalid low, valid, and invalid high. We pick one representative value from each partition. Then boundary value analysis adds test values at the edges: 0, 1, 2 at the lower boundary and 119, 120, 121 at the upper boundary. The combined set of 9 tests covers all input classes and boundary conditions, catching the same defects that hundreds of random tests might miss.