BVA (Boundary Value Analysis) is a software testing technique that focuses on testing values at the extreme boundaries of input domains. It is based on the observation that defects frequently occur on the outskirts of valid input ranges rather than in the center. Testers hope to identify potential issues and errors more effectively by testing boundary values. BVA is widely used in black-box testing and is especially useful for detecting off-by-one errors and other boundary-related issues.
Here’s an example of Boundary Value Analysis:
Consider the following scenario: You are testing a software application that calculates discounts for online purchases. The application provides discounts based on the amount of the purchase and has predefined discount tiers.
- Tier 1: 0% discount for purchases less than $10.
- Tier 2: 5% discount for purchases from $10 (inclusive) to $50 (exclusive).
- Tier 3: 10% discount for purchases from $50 (inclusive) to $100 (exclusive).
- Tier 4: 15% discount for purchases of $100 or more.
In this scenario, you want to apply Boundary Value Analysis to ensure the discount calculation works correctly. Here are the boundary values and test cases you would consider:
- Boundary Value 1: Testing the lower boundary of Tier 1.
- Input: $9.99
- Expected Output: 0% discount
- Boundary Value 2: Testing the upper boundary of Tier 2.
- Input: $10.00
- Expected Output: 5% discount
- Boundary Value 3: Testing the lower boundary of Tier 3.
- Input: $50.00
- Expected Output: 10% discount
- Boundary Value 4: Testing the upper boundary of Tier 3.
- Input: $100.00
- Expected Output: 10% discount (Tier 3)
- Boundary Value 5: Testing the lower boundary of Tier 4.
- Input: $100.01
- Expected Output: 15% discount
- Boundary Value 6: Testing the upper boundary of Tier 4.
- Input: $1,000.00
- Expected Output: 15% discount (Tier 4)
By testing these boundary values, you ensure that the software handles discounts at the tier’s edges correctly. If there are any flaws or issues with the discount calculation, this technique will help you find them. Boundary Value Analysis improves software robustness and reliability by focusing on critical areas where errors are likely to occur.
What are the types of boundary value testing?
Boundary value testing is broadly classified into two types:
Normal Boundary Value Testing: This type is concerned with testing values that are precisely on the boundary between valid and invalid inputs. Normal boundary value testing, for example, would examine inputs like 1, 100, and any values in between if an input field accepts values between 1 and 100.
Robust Boundary Value Testing: This type of testing includes values that are slightly outside of the valid boundary limits. Using the same example, robust boundary value testing would use test inputs such as 0, 101, -1, and 101 to see how the system handles them.
While these are the two most common types of boundary value testing, there are also variations and combinations based on the specific requirements and potential risks associated with the software being tested.
What is the difference between boundary value and equivalence testing?
Aspect | Boundary Value Testing | Equivalence Testing |
Focus | Concerned with boundary values | Focuses on equivalence classes |
Objective | To test values at the edges | To group similar inputs |
Input Range | Tests values at boundaries | Tests values within classes |
Number of Test Cases | Typically more test cases | Fewer test cases |
Test Cases | Includes values on boundaries | Represents one from each class |
Boundary Handling | Checks inputs at exact limits | Tests input within a class |
Risk Coverage | Addresses edge-related issues | Deals with class-related issues |
Applicability | Useful for validating limits | Suitable for typical values |
The goal of boundary value testing is to discover issues related to boundary conditions by focusing on values at the edges of valid ranges. Equivalence testing, on the other hand, groups inputs into equivalence classes in order to reduce the number of test cases while maintaining effective test coverage. Both techniques are useful and can be used in tandem as part of a comprehensive testing strategy.
Advantages and DIsadvantages of Boundary Value Analysis
Benefits of Boundary Value Analysis:
- BVA focuses on the edges or boundaries of input domains, making it effective at identifying issues related to these critical points.
- It provides comprehensive test coverage for values near the boundaries, which are often more likely to cause errors.
- BVA is simple to understand and implement, making it suitable for both experienced and inexperienced testers.
- It can detect defects in the early stages of development, lowering the cost of later problem resolution.
The following are the disadvantages of boundary value analysis:
- BVA’s scope is limited to addressing boundary-related defects and potentially missing issues that occur within the input domain.
- Combinatorial Explosion: BVA can result in a large number of test cases for systems with multiple inputs, increasing the testing effort.
- Overlooking Class Interactions: It fails to account for interactions between different input classes, which can be critical in some systems.
- BVA makes the assumption that system behavior near boundaries is linear, which may not be true for all applications.
- BVA may not cover all possible scenarios or corner cases: While it is effective in many cases, BVA may not cover all possible scenarios or corner cases.
FAQs
What’s boundary value analysis in black box testing with an example
BVA is a black-box testing technique that is used to test the boundaries of input domains. It focuses on valid and invalid input ranges’ edges or boundaries to test values. The primary goal is to ensure that a system correctly handles input values at its limits, as this is frequently where errors occur.
Here’s an illustration of Boundary Value Analysis:
Consider the following scenario: You are testing a simple calculator application, and one of its functions is to add two numbers. The application accepts integers from -100 to +100.
Boundary Values: The following are the boundary values in this scenario:
Lower Boundary: -100 Upper Boundary: +100 BVA Test Cases:
Test with the smallest valid input possible:
Input 1: -100
Input 2: 0
-100 is the expected outcome. (At least one valid input)
Test with the most valid input possible:
Input 1: 100
Input 2: 50
150 (Maximum valid input) is the expected result.
Just below the lower boundary, perform the following test:
Input 1: -101
Input 2: 50
Expected Outcome: Error (outside of the valid range)
Just above the upper limit, perform the following test:
Input 1: 101
Input 2: 50
Error (outside valid range) is the expected outcome.
By using Boundary Value Analysis in this example, you ensure that the calculator application handles edge cases at the input range’s minimum and maximum boundaries, as well as values just outside the boundaries, correctly. This assists in identifying potential boundary value errors or issues.
Equivalence Partitioning and Boundary Value Analysis, What’s the difference?
Aspect | Equivalence Partitioning | Boundary Value Analysis |
Definition | Divides the input domain into groups or partitions, where each group is expected to behave in a similar way. | Focuses on testing values at the edges or boundaries of the input domain. |
Objective | Identifies representative values or conditions from each partition to design test cases. | Tests values at the extreme boundaries of valid and invalid input ranges. |
Usage | Suitable for inputs with a wide range of valid values, where values within a partition are expected to have similar behavior. | Effective when values near the boundaries of the input domain are more likely to cause issues. |
Test Cases | Typically, one test case is selected from each equivalence class or partition. | Multiple test cases are created to test values at the boundaries, including just below, on, and just above the boundaries. |
Coverage | Provides broad coverage across input domains, ensuring that different types of inputs are tested. | Focuses on testing edge cases and situations where errors often occur. |
Example | For a password field, you might have equivalence partitions for short passwords, long passwords, and valid-length passwords. | In a calculator application, testing inputs at the minimum and maximum limits, as well as values just below and above these limits. |
Applicability | Useful when you want to identify a representative set of test cases without focusing solely on boundary values. | Useful when you want to thoroughly test boundary conditions where errors are more likely to occur. |
Both Equivalence Partitioning and Boundary Value Analysis are valuable black-box testing techniques, and the choice depends on the specific characteristics of the input data and where potential issues are expected to arise.