Skip to content
Back to search results

Equivalence Partitioning Testing

Introduced by
Glenford Myers
Year
1979
Type
partitioning strategy
Family
Test case design
Font size

What does it do?

Equivalence partitioning divides input domains into equivalence classes—sets of inputs expected to behave identically—then selects test cases from each class.

Introduced by Myers (1979), this technique reduces test cases while maintaining effectiveness. Boundary value analysis (BVA) complements partitioning by testing values at partition boundaries where failures often occur.

The intuition behind the method

Testing every possible input is infeasible; equivalence partitioning recognizes that many inputs behave identically. If a function works for one value in a partition, it likely works for all values in that partition. Bugs often hide at boundaries between partitions. By selecting one representative from each partition plus boundary cases, test suites achieve broad coverage efficiently.

History

Myers introduced equivalence partitioning and boundary value analysis in his 1979 seminal work on software testing. Beizer (1990) expanded practical guidance and categorized different partition types. Modern tools (automated test generators) use partitioning as foundation. The technique remains standard in test case design curricula and industrial testing practices.

When to use it

Apply equivalence partitioning when input domain is large or continuous (ranges of integers, floating-point numbers). Particularly effective for functions with clear input ranges: validation functions, mathematical functions, protocol parsers. Combine with boundary value analysis to catch off-by-one errors and edge cases. Less valuable for complex logical conditions; decision table analysis suits those better.

Limitations and considerations

  • Effectiveness depends on correct partition identification; wrong partitions miss bugs
  • Assumes inputs are independent; combinatorial interactions between inputs may escape detection
  • Does not detect all defect types: logic errors, state-dependent bugs, concurrency issues often hide in equivalent classes
  • Boundary value selection can be arbitrary; guidelines help but subjective judgment remains

Source conditions do not replace independent scientific review or validation by an analysis engine.

Strengths

  • Dramatically reduces test case count while maintaining coverage; achieves near-boundary coverage with linear test cases
  • Captures intuition that inputs in a class behave similarly; partitions align with software design intent
  • Boundary value analysis catches common defect patterns (off-by-one, fence-post errors)
  • Simple to understand and apply; teachable technique for software engineering teams

Applications

  • Testing date validation function by partitioning inputs: valid dates, invalid dates, boundary dates (Feb 28/29), leap year logic, month boundaries
  • Verifying range-checking in API endpoints by identifying valid parameter ranges, testing edge values (0, negative, max int), and invalid extremes
  • Testing discount calculation in e-commerce: partitions for different discount tiers, boundary order values (e.g., $50 triggers 10% discount), edge cases (zero, negative amounts)
  • Validating login form by partitioning username/password domains: valid combinations, empty inputs, special characters, length boundaries, SQL injection attempts

How it works

How it works

1

Analyze the input domain and divide it into equivalence classes — sets of inputs expected to cause identical program behavior. Identify valid classes (inputs the system should accept) and invalid classes (inputs the system should reject). Include boundary values at class edges.

2

For each equivalence class, select one representative test case. Add boundary value test cases at the edge of each partition (just inside, at, and just outside boundary values) to catch off-by-one and fence-post errors.

3

Execute the selected test cases and compare actual outputs against expected outputs. If any test case fails, investigate the failure cause and refine the partition definitions if needed.

Common pitfalls

  • Over-trusting equivalence assumption; similar inputs do not always produce identical behavior, especially with floating-point arithmetic
  • Neglecting invalid inputs; test both valid equivalence classes and invalid boundary cases
  • Ignoring state: for stateful systems, behavior may depend on previous actions, not just current input
  • Partitioning only obvious variables; sometimes hidden state variables (system configuration, time) create additional partitions

Frequently asked questions

How do I identify equivalence classes for complex inputs?

Start with domain specification: what values are valid, what ranges exist, what values are excluded? Group values where program behavior is expected to be identical. For numeric inputs, typical classes: negative numbers, zero, positive numbers, large values, values causing overflow. For strings: empty, normal length, max length, special characters, non-ASCII. Consult requirements to find intent-based partitions.

What is the difference between valid and invalid equivalence classes?

Valid equivalence classes contain inputs meeting system requirements; invalid classes contain inputs violating requirements. Test both: valid classes verify correct behavior; invalid classes verify error handling. Example: age input validation: valid class [0, 150], invalid classes [<0] and [>150]. Include test cases from both to validate acceptance and rejection logic.

How many test cases should I generate per equivalence class?

Minimum: one test case per equivalence class (achieves basic coverage). Effective: add boundary test cases (just inside/at/outside boundary). For critical systems, add additional tests within classes. Do not create too many; diminishing returns apply. A function with 5 equivalence classes × 3 test cases per class = 15 tests is typical; 50 tests suggests over-testing.

Can equivalence partitioning guarantee I will catch all bugs?

No. Equivalence partitioning catches bugs in input validation and range-checking excellently. It misses logic errors, state-dependent bugs, and concurrency issues. Combine with other techniques: boundary value analysis (covered here), decision table analysis (for complex logic), state-based testing (for stateful systems), exploratory testing (creative scenarios).

Related methods

Sources

  1. Myers, G. J. (1979). The Art of Software Testing. John Wiley & Sons.

    Open publication reference
    Copied.
  2. Beizer, B. (1990). Software Testing Techniques (2nd ed.). International Thomson Computer Press.

    Open publication reference
    Copied.
  3. Coppit, D., & Leavens, G. T. (2003). Practical implications of simpler, more scalable path-sensitive data flow analyses. ACM Transactions on Software Engineering and Methodology, 12(3), 261–306.

    Open publication reference
    Copied.