Software Testing Equivalence Partitioning

Equivalence partitioning is a test design technique that divides all possible inputs into groups called partitions. Every value inside a partition behaves the same way in the software. Testing one value from each partition is enough to represent the entire group.

The Core Idea

  Without Equivalence Partitioning:
  Age field accepts 1–120
  → Test 1, 2, 3, 4, 5 ... 120 → 120 tests needed

  With Equivalence Partitioning:
  → Test one value from each group → 3–4 tests needed

The technique reduces the number of test cases dramatically without reducing the quality of coverage.

How to Identify Partitions

Every input field can be divided into at least two partitions: valid values and invalid values. Often, there are multiple invalid partitions depending on the ways input can be wrong.

  Age Field Rule: "Age must be between 18 and 60"

  PARTITION          VALUES              TYPE
  ─────────          ──────              ────
  Below minimum      0, 5, 17            Invalid
  Valid range        18, 35, 60          Valid
  Above maximum      61, 100, 200        Invalid
  Non-numeric        "abc", "@#$", ""    Invalid

One representative value from each partition is selected as the test input.

Applying Equivalence Partitioning: Step by Step

  STEP 1: Read the requirement
  ─────────────────────────────────────────────
  "The discount field accepts percentage values
   between 1 and 50. No decimals allowed."

  STEP 2: Identify partitions
  ─────────────────────────────────────────────
  EP1 (Invalid): Less than 1       → e.g., 0, -5
  EP2 (Valid):   1 to 50           → e.g., 25
  EP3 (Invalid): Greater than 50   → e.g., 75
  EP4 (Invalid): Decimal values    → e.g., 12.5
  EP5 (Invalid): Non-numeric       → e.g., "abc"

  STEP 3: Select one representative per partition
  ─────────────────────────────────────────────
  Test with: -5, 25, 75, 12.5, "abc"

  STEP 4: Write test cases
  ─────────────────────────────────────────────
  TC01: Enter -5    → Expected: Error message
  TC02: Enter 25    → Expected: Discount applied
  TC03: Enter 75    → Expected: Error message
  TC04: Enter 12.5  → Expected: Error message
  TC05: Enter "abc" → Expected: Error message

Real-World Example: Mobile Number Field

  Requirement: "Mobile number must be exactly 10 digits, numbers only"

  Partitions:
  ┌────────────────────────────────────────────────────┐
  │ EP1: Less than 10 digits   → "98765432"   Invalid  │
  │ EP2: Exactly 10 digits     → "9876543210" Valid    │
  │ EP3: More than 10 digits   → "98765432109" Invalid │
  │ EP4: Contains letters      → "98765abcde" Invalid  │
  │ EP5: Contains symbols      → "987654321@" Invalid  │
  │ EP6: Empty                 → ""           Invalid  │
  └────────────────────────────────────────────────────┘

  6 test cases cover millions of possible inputs.

Equivalence Partitioning for Output

The technique applies to outputs as well, not just inputs. Group the expected outputs into partitions and design tests that exercise each output group.

  E-Commerce Shipping Cost Rules:
  ─────────────────────────────────────────────────────
  Order below ₹500    → Shipping: ₹50
  Order ₹500 to ₹999  → Shipping: ₹25
  Order ₹1000+        → Shipping: Free

  Output Partitions → 3 groups → Test one value per group
  Test ₹300 → Expect ₹50 shipping
  Test ₹700 → Expect ₹25 shipping
  Test ₹1500 → Expect Free shipping

Equivalence Partitioning vs Boundary Value Analysis

  EQUIVALENCE PARTITIONING       BOUNDARY VALUE ANALYSIS
  ────────────────────────       ───────────────────────
  Tests middle of each group     Tests the edges of each group
  Fewer test cases               More test cases
  Quick coverage                 Catches edge-specific bugs
  Use together for best results

Equivalence partitioning selects the representative values. Boundary value analysis refines the selection by checking the exact edges. Most testers use both techniques together.

Benefits of Equivalence Partitioning

  • Dramatically reduces the number of test cases needed without reducing coverage.
  • Provides a logical, systematic way to select test inputs.
  • Works for any input — text fields, dropdowns, date pickers, numeric inputs, file uploads.
  • Easy to explain to stakeholders — the logic is simple and visual.
  • Scales well for data-driven automation testing where multiple values per partition are fed into one test script.

Leave a Comment