BLACK BOX TESTING: BOUNDARY VALUE ANALYSIS AND EQUIVALENCE PARTITIONING
PROBLEM 1: DISCOUNT CALCULATION ON PURCHASE
Problem Statement
A discount is offered on purchases as follows:
| Purchase Range | Discount Percentage |
| 1000 Rs to 5000 Rs | 10% |
| 5001 Rs to 10000 Rs | 20% |
| Above 10000 Rs | 25% |
Equivalence Classes
Valid Classes:
- VC1: Purchase amount 1000 to 5000 Rs → 10% discount
- VC2: Purchase amount 5001 to 10000 Rs → 20% discount
- VC3: Purchase amount above 10000 Rs → 25% discount
Invalid Classes:
- IC1: Purchase amount < 1000 Rs → No discount (0%)
- IC2: Purchase amount = 0 Rs → Invalid
- IC3: Purchase amount < 0 Rs → Invalid (Negative value)
- IC4: Non-numeric input → Invalid
Boundary Value Analysis
Boundaries Identified:
- Lower boundary of VC1: 1000 Rs
- Upper boundary of VC1: 5000 Rs
- Lower boundary of VC2: 5001 Rs
- Upper boundary of VC2: 10000 Rs
- Lower boundary of VC3: 10001 Rs
Boundary Values:
- Just below 1000: 999 Rs
- At boundary 1000: 1000 Rs
- Just above 1000: 1001 Rs
- Just below 5000: 4999 Rs
- At boundary 5000: 5000 Rs
- Just above 5000: 5001 Rs
- Just below 10000: 9999 Rs
- At boundary 10000: 10000 Rs
- Just above 10000: 10001 Rs
Test Cases
| Test Case ID | Purchase Amount (Rs) | Expected Discount | Expected Result | Test Type | Remarks |
| TC1 | 0 | 0% | Invalid/No Discount | Boundary | Zero value |
| TC2 | -500 | 0% | Invalid | Boundary | Negative value |
| TC3 | 999 | 0% | No Discount | BVA | Just below minimum |
| TC4 | 1000 | 10% | 900 Rs final | BVA | Lower boundary VC1 |
| TC5 | 1001 | 10% | 900.90 Rs final | BVA | Just above lower boundary |
| TC6 | 3000 | 10% | 2700 Rs final | EP | Middle value VC1 |
| TC7 | 4999 | 10% | 4499.10 Rs final | BVA | Just below upper boundary |
| TC8 | 5000 | 10% | 4500 Rs final | BVA | Upper boundary VC1 |
| TC9 | 5001 | 20% | 4000.80 Rs final | BVA | Lower boundary VC2 |
| TC10 | 7500 | 20% | 6000 Rs final | EP | Middle value VC2 |
| TC11 | 9999 | 20% | 7999.20 Rs final | BVA | Just below upper boundary |
| TC12 | 10000 | 20% | 8000 Rs final | BVA | Upper boundary VC2 |
| TC13 | 10001 | 25% | 7500.75 Rs final | BVA | Lower boundary VC3 |
| TC14 | 15000 | 25% | 11250 Rs final | EP | Middle value VC3 |
| TC15 | 50000 | 25% | 37500 Rs final | EP | Large value VC3 |
| TC16 | ABC | Error | Invalid Input | EP | Non-numeric |
| TC17 | 2500.50 | 10% | 2250.45 Rs final | EP | Decimal value |
Calculation Examples
Example 1: Purchase = 5000 Rs
- Discount = 10% of 5000 = 500 Rs
- Final Amount = 5000 - 500 = 4500 Rs
Example 2: Purchase = 10001 Rs
- Discount = 25% of 10001 = 2500.25 Rs
- Final Amount = 10001 - 2500.25 = 7500.75 Rs
PROBLEM 2: LIFE INSURANCE PREMIUM RATES
Problem Statement
Life Insurance Premium rates based on age:
| Age Group | Premium (Rs) |
| Under 35 | 2000 |
| 35-59 | 5000 |
| Above 60 | 10000 |
Equivalence Classes
Valid Classes:
- VC1: Age 0 to 34 → Premium 2000 Rs
- VC2: Age 35 to 59 → Premium 5000 Rs
- VC3: Age 60 and above → Premium 10000 Rs
Invalid Classes:
- IC1: Age < 0 → Invalid (Negative age)
- IC2: Age > 120 → Invalid (Unrealistic age)
- IC3: Non-numeric input → Invalid
Boundary Value Analysis
Boundaries Identified:
- Upper boundary of VC1: 34 years
- Lower boundary of VC2: 35 years
- Upper boundary of VC2: 59 years
- Lower boundary of VC3: 60 years
Boundary Values:
- Just below 35: 34 years
- At boundary 35: 35 years
- Just above 35: 36 years
- Just below 60: 59 years
- At boundary 60: 60 years
- Just above 60: 61 years
Test Cases
| Test Case ID | Age (years) | Expected Premium (Rs) | Test Type | Remarks |
| TC1 | -5 | Error/Invalid | Boundary | Negative age |
| TC2 | 0 | 2000 | BVA | Newborn |
| TC3 | 1 | 2000 | EP | Child |
| TC4 | 18 | 2000 | EP | Young adult |
| TC5 | 25 | 2000 | EP | Middle of VC1 |
| TC6 | 33 | 2000 | BVA | Just below boundary |
| TC7 | 34 | 2000 | BVA | Upper boundary VC1 |
| TC8 | 35 | 5000 | BVA | Lower boundary VC2 |
| TC9 | 36 | 5000 | BVA | Just above boundary |
| TC10 | 45 | 5000 | EP | Middle of VC2 |
| TC11 | 50 | 5000 | EP | Middle of VC2 |
| TC12 | 58 | 5000 | BVA | Just below boundary |
| TC13 | 59 | 5000 | BVA | Upper boundary VC2 |
| TC14 | 60 | 10000 | BVA | Lower boundary VC3 |
| TC15 | 61 | 10000 | BVA | Just above boundary |
| TC16 | 70 | 10000 | EP | Senior citizen |
| TC17 | 80 | 10000 | EP | Very senior |
| TC18 | 100 | 10000 | EP | Centenarian |
| TC19 | 150 | Error/Invalid | Boundary | Unrealistic age |
| TC20 | ABC | Error/Invalid | EP | Non-numeric |
Decision Table
| Condition | Rule 1 | Rule 2 | Rule 3 | Rule 4 |
| Age < 0 | Yes | No | No | No |
| 0 ≤ Age < 35 | No | Yes | No | No |
| 35 ≤ Age < 60 | No | No | Yes | No |
| Age ≥ 60 | No | No | No | Yes |
| Action | Invalid | 2000 Rs | 5000 Rs | 10000 Rs |
PROBLEM 3: ELECTION VOTING ELIGIBILITY
Problem Statement
Election voting rules:
| Age Group | Voting Status |
| 0 to 17 | Not eligible |
| 18 and above | Eligible |
| Negative age | Not eligible (Invalid) |
Equivalence Classes
Valid Classes:
- VC1: Age 0 to 17 → Not eligible
- VC2: Age 18 and above → Eligible
Invalid Classes:
- IC1: Age < 0 → Invalid/Not eligible
- IC2: Age > 150 → Invalid (Unrealistic)
- IC3: Non-numeric input → Invalid
Boundary Value Analysis
Boundaries Identified:
- Upper boundary of VC1: 17 years
- Lower boundary of VC2: 18 years
Boundary Values:
- Just below 18: 17 years
- At boundary 18: 18 years
- Just above 18: 19 years
Test Cases
| Test Case ID | Age (years) | Expected Result | Test Type | Remarks |
| TC1 | -10 | Not eligible | Boundary | Negative age (invalid) |
| TC2 | -1 | Not eligible | Boundary | Just below zero |
| TC3 | 0 | Not eligible | BVA | Newborn |
| TC4 | 1 | Not eligible | EP | Infant |
| TC5 | 10 | Not eligible | EP | Child |
| TC6 | 15 | Not eligible | EP | Teenager |
| TC7 | 16 | Not eligible | BVA | Just below boundary |
| TC8 | 17 | Not eligible | BVA | Upper boundary VC1 |
| TC9 | 18 | Eligible | BVA | Lower boundary VC2 (exact) |
| TC10 | 19 | Eligible | BVA | Just above boundary |
| TC11 | 25 | Eligible | EP | Young adult |
| TC12 | 50 | Eligible | EP | Middle-aged |
| TC13 | 75 | Eligible | EP | Senior citizen |
| TC14 | 100 | Eligible | EP | Centenarian |
| TC15 | 120 | Eligible | EP | Very old |
| TC16 | 200 | Invalid/Eligible | Boundary | Unrealistic age |
| TC17 | 17.9 | Not eligible | BVA | Decimal just below |
| TC18 | 18.0 | Eligible | BVA | Decimal at boundary |
| TC19 | 18.1 | Eligible | BVA | Decimal just above |
| TC20 | XYZ | Error/Invalid | EP | Non-numeric |
| TC21 | NULL | Error/Invalid | EP | Null input |
| TC22 | " " | Error/Invalid | EP | Empty/space |
Decision Table
| Condition | Rule 1 | Rule 2 | Rule 3 |
| Age < 0 | Yes | No | No |
| 0 ≤ Age ≤ 17 | No | Yes | No |
| Age ≥ 18 | No | No | Yes |
| Action | Not eligible (Invalid) | Not eligible | Eligible |
State Transition Diagram
[Not Eligible] ------Age reaches 18------> [Eligible]
^ |
| |
+---------Age drops below 18--------------+
(Invalid scenario)
COMPARISON: BOUNDARY VALUE ANALYSIS vs EQUIVALENCE PARTITIONING
| Aspect | Boundary Value Analysis | Equivalence Partitioning |
| Focus | Boundaries between partitions | Representative values from partitions |
| Test Cases | Tests at, just above, just below boundaries | Tests one value from each partition |
| Coverage | Focuses on edge conditions | Focuses on typical conditions |
| Defect Detection | Finds boundary-related errors | Finds errors in processing logic |
| Number of Tests | More test cases | Fewer test cases |
| Example (Age 18-60) | Tests: 17, 18, 19, 59, 60, 61 | Tests: 25 (one from range) |
SUMMARY TABLE: ALL TEST CASES
Problem 1: Discount Calculation
- Total Test Cases: 17
- Boundary Test Cases: 11
- Equivalence Partitioning: 6
- Invalid Cases: 3
Problem 2: Life Insurance Premium
- Total Test Cases: 20
- Boundary Test Cases: 10
- Equivalence Partitioning: 7
- Invalid Cases: 3
Problem 3: Election Voting
- Total Test Cases: 22
- Boundary Test Cases: 9
- Equivalence Partitioning: 8
- Invalid Cases: 5
Total Test Cases Designed: 59
KEY TESTING PRINCIPLES APPLIED
1. Boundary Value Analysis: Testing at exact boundaries and one step beyond
2. Equivalence Partitioning: Selecting representative values from each class
3. Negative Testing: Testing with invalid inputs
4. Edge Case Testing: Testing extreme values
5. Error Handling: Verifying system behavior with invalid data
These black box testing techniques ensure comprehensive coverage without knowledge of internal code structure.
Comments
Post a Comment