Skip to content
IRC-CodingIRC-Coding
Test case designEquivalence partitioningBoundary value analysisBranch coveragePath coverageStatement coverage

Test Case Design: Equivalence Classes & Boundary Value Analysis

Test case design methods: equivalence partitioning, boundary value analysis, branch coverage, statement coverage. With examples.

S

schutzgeist

1 min read
Test Case Design: Equivalence Classes & Boundary Value Analysis

Test Case Specification

This article is a glossary entry on test case specification, including exam questions and tags. This topic was important in my AP2 exam and I see it come up frequently in assessments.

In a Nutshell

  • Equivalence classes: groups inputs that behave the same way
  • Boundary value analysis: tests at exact limits (min, max, min±1, max±1)
  • Branch/path coverage: ensures every code path gets executed

Technical Definition

Equivalence Classes

Divides input ranges into classes where the system behaves identically. One test case per class.

Boundary Value Analysis

Tests at the exact boundaries and just beyond them — errors commonly occur at boundaries.

Branch Coverage

Every branch (if/else) must execute at least once for both True and False conditions.

Path Coverage

Every possible combination of branches gets tested (resource-intensive).

Statement Coverage

Every line of code must execute at least once.

Key Exam Topics

  • Equivalence classes: identify valid and invalid classes
  • Boundary value analysis: test min, max, min-1, max+1
  • Branch coverage: cover all if/else paths
  • Path coverage: execute all paths (theoretically)
  • Statement coverage: run every line
  • White-box: knowledge of internal structure
  • Black-box: testing only through interfaces

Core Components

  1. Equivalence class partitioning
  2. Boundary value analysis
  3. Branch coverage
  4. Path coverage
  5. Statement coverage
  6. Test case catalog
  7. Coverage analysis
  8. Tools (coverage tools)
  9. Risk-based prioritization
  10. Documentation

Practical Example (Age Validation)

// Rule: Age must be between 18 and 65

// Equivalence classes:
// - valid: [18, 65]
// - invalid: <18, >65

// Boundary value analysis:
// 17, 18, 19   (lower boundary)
// 64, 65, 66   (upper boundary)

// Test cases:
// - 17 (invalid)
// - 18 (valid, boundary)
// - 19 (valid)
// - 64 (valid)
// - 65 (valid, boundary)
// - 66 (invalid)

Common Exam Questions (Quick Answers)

  1. What is an equivalence class? A group of inputs with identical expected behavior.
  2. Why use boundary value analysis? Errors frequently occur at boundaries.
  3. Branch coverage vs. statement coverage? Branch: all if/else paths; statement: every line.
  4. Path coverage? Test all possible path combinations (very time-consuming).

Key Resources

  1. https://www.istqb.org
  2. https://junit.org/junit5/docs/current/user-guide/
  3. https://testing.googleblog.com
Back to Blog
Share:

Related Posts