A two-value boundary value analysis is a simplified approach within software testing where you primarily focus your test cases on just two values around a boundary: the boundary value itself and the immediate invalid value next to it.
Understanding Two-Value Boundary Value Analysis
Based on the provided reference, the core principle of this method is its narrow focus:
- Only the boundary value and the invalid value are considered.
This means that instead of testing multiple valid and invalid values around a boundary, you pinpoint the critical edge cases.
The Reference Example: Boiling Point
The reference illustrates this with a boiling point example:
- Boundary Value: 100
- Invalid Value: 101
In a standard boundary value analysis for a system processing temperatures where 100 is a boundary (e.g., water boils at 100°C), you might test values like 99, 100, and 101. However, with the two-value approach as described, you would strictly focus on 100 and 101 for that specific boundary condition.
How to Apply Two-Value Boundary Value Analysis
The reference outlines a simple step:
- Identify the Equivalence partitions – valid and invalid partitions.
Before applying the two-value approach, you first need to understand the distinct ranges of input values that the system treats similarly (equivalence partitions). For example, if a field accepts numbers 1 to 100:
- Valid Partition: 1 to 100
- Invalid Partition (less than 1): ...,-1, 0
- Invalid Partition (greater than 100): 101, 102,...
Once partitions are identified, you locate the boundaries (in this case, 1 and 100). The two-value analysis then selects the boundary value itself and the adjacent invalid value for testing.
Example Test Cases (for range 1-100)
Let's look at the boundaries for the 1-100 range:
Boundary | Boundary Value (Valid) | Adjacent Invalid Value | Test Case Values |
---|---|---|---|
Lower | 1 | 0 | 1, 0 |
Upper | 100 | 101 | 100, 101 |
This method drastically reduces the number of test cases compared to testing multiple values within each partition or closer to the boundary (like 99 and 101).
Why Use Two-Value Boundary Value Analysis?
This technique is typically used when:
- Testing is highly constrained by time or resources.
- It's combined with other techniques like Equivalence Partitioning to provide baseline coverage.
- The risk associated with values slightly further from the boundary is considered low.
It provides a minimum level of testing around boundary conditions, which are statistically more likely to contain defects than values well within a valid range.
Software Testing