Loading...

What is Boundary Value Analysis (BVA) in Software Testing??

Boundary Value Analysis (BVA)

 is a black-box testing technique that emphasizes testing at the edges of equivalence partitions to uncover errors related to boundary handling. This approach is particularly effective for identifying defects where boundaries are misplaced, incorrect, or missing in the implementation.

Key Concepts of Boundary Value Analysis:

  1. Ordered Partitions:
    BVA applies only to ordered equivalence partitions, where the sequence or range of values has significance.
  2. Boundary Values:
    These include the minimum and maximum values of a partition. BVA assumes that if two values belong to the same partition, all intermediate values also belong to that partition.
  3. Focus on Boundaries:
    Errors are more likely to occur at boundaries due to incorrect comparisons or omissions in code logic.
  4. Coverage Measurement:
    Coverage is the proportion of boundary values (and neighbours, in some cases) tested relative to the total boundary values identified.

Types of BVA:

1. 2-Value BVA

  • Definition: For each boundary, two test cases are derived:
  • One on the boundary.
  • One in the adjacent partition closest to the boundary.
  • Example:
    For a boundary value of 10: Test cases include 10 (on the boundary) and 11 (in the adjacent partition).
  • Coverage Calculation:
    Coverage=(Boundary values tested/Total boundary values identified)×100%

2. 3-Value BVA

  • Definition: For each boundary, three test cases are derived:
  • One on the boundary.
  • One in the adjacent partition closest to the boundary.
  • One just inside the current partition, next to the boundary.
  • Example:
    For a boundary value of 10: Test cases include 10 (on the boundary), 9 (just inside), and 11 (in the adjacent partition).
  • Coverage Calculation:
    Coverage=(Boundary values and neighbors tested/Total boundary values and neighbors identified)×100

Comparison of 2-Value and 3-Value BVA:

Advantages of BVA:

  • Detects issues where boundaries are misdefined or omitted.
  • Focused testing reduces the number of test cases while increasing the likelihood of uncovering defects.

Limitations of BVA:

  • Requires clearly defined and ordered partitions.
  • May not detect errors unrelated to boundaries.
  • It can be ineffective in highly dynamic systems without well-defined boundaries.

Conclusion:

Boundary Value Analysis is an essential technique in testing, especially for systems with numerical ranges or constraints. When boundary issues are critical to the system’s functionality, 3-value BVA is recommended for rigorous testing.

Example of Boundary value analysis 2VA and 3VA

1. Age Validation (Input Range: 18–60)

  • Scenario: A form accepts age input between 18 and 60 inclusive.
  • Boundary Values:
  • Lower Boundary: 18
  • Upper Boundary: 60
  • Test Cases for 2-Value BVA:
  • 18 (boundary value, valid)
  • 17 (just outside lower boundary, invalid)
  • 60 (boundary value, valid)
  • 61 (just outside upper boundary, invalid)
  • Test Cases for 3-Value BVA:
  • 17 (just outside lower boundary, invalid)
  • 18 (boundary value, valid)
  • 19 (just inside lower boundary, valid)
  • 59 (just inside upper boundary, valid)
  • 60 (boundary value, valid)
  • 61 (just outside upper boundary, invalid

2. Password Length Validation (Input Range: 8–16 Characters)

  • Scenario: A password must be between 8 and 16 characters long.
  • Boundary Values:
  • Lower Boundary: 8 characters
  • Upper Boundary: 16 characters
  • Test Cases for 2-Value BVA:
  • 7 characters (just outside lower boundary, invalid)
  • 8 characters (boundary value, valid)
  • 16 characters (boundary value, valid)
  • 17 characters (just outside upper boundary, invalid)
  • Test Cases for 3-Value BVA:
  • 7 characters (just outside lower boundary, invalid)
  • 8 characters (boundary value, valid)
  • 9 characters (just inside the lower boundary, valid)
  • 15 characters (just inside the upper boundary, valid)
  • 16 characters (boundary value, valid)
  • 17 characters (just outside the upper boundary, invalid)

3. Shopping Cart Quantity (Input Range: 1–50 Items)

  • Scenario: A user can add between 1 and 50 items to a shopping cart.
  • Boundary Values:
  • Lower Boundary: 1 item
  • Upper Boundary: 50 items
  • Test Cases for 2-Value BVA:
  • 0 items (just outside lower boundary, invalid)
  • 1 item (boundary value, valid)
  • 50 items (boundary value, valid)
  • 51 items (just outside upper boundary, invalid)
  • Test Cases for 3-Value BVA:
  • 0 items (just outside lower boundary, invalid)
  • 1 item (boundary value, valid)
  • 2 items (just inside lower boundary, valid)
  • 49 items (just inside upper boundary, valid)
  • 50 items (boundary value, valid)
  • 51 items (just outside upper boundary, invalid)