Lecture 38: Black Box Testing - Equivalence Partitioning
Unit 5: Software Coding and Testing (4353202)
Lecture Agenda
- Recap of Unit Testing
- What is Black Box Testing?
- Why Black Box Testing?
- Introduction to Equivalence Partitioning
- How Equivalence Partitioning Works
- Example of Equivalence Partitioning
- Advantages and Disadvantages
- Key Takeaways
Recap of Unit Testing
Unit Testing is the first level of software testing, focusing on individual code components (units) to ensure they work as designed. It helps in early bug detection and improves code quality.
What is Black Box Testing?
Black Box Testing is a software testing method in which the internal structure, design, implementation, and code of the item being tested are not known to the tester.
It focuses solely on the inputs and outputs of the software, treating the system as a "black box."
It is also known as **Functional Testing** because it verifies the functionality of the software against its requirements.
Why Black Box Testing?
- User Perspective: Tests the system from the end-user's point of view.
- No Code Knowledge Required: Testers do not need programming knowledge.
- Early Testing: Can begin once requirements are finalized, even before code is written.
- Identifies Discrepancies: Effective in finding discrepancies between requirements and actual system behavior.
Introduction to Equivalence Partitioning
Equivalence Partitioning is a black box testing technique that divides the input data into partitions (or classes) of equivalent data. Test cases are then designed to pick one representative value from each partition.
The idea is that if one condition in a partition works, all conditions in that partition will work. Similarly, if one condition in a partition fails, all conditions in that partition will fail.
How Equivalence Partitioning Works
- Identify Input Ranges: Determine the valid and invalid input ranges for a given field or condition.
- Divide into Partitions: Create partitions (equivalence classes) for both valid and invalid inputs.
- Select Test Cases: Choose one representative value from each partition as a test case.
Example: Age Input Field (18-60)
Consider a system that accepts age input between 18 and 60 (inclusive).
- Valid Partition: Ages from 18 to 60. (e.g., 35)
- Invalid Partition 1 (Below Min): Ages less than 18. (e.g., 10)
- Invalid Partition 2 (Above Max): Ages greater than 60. (e.g., 70)
Test Cases: 10, 35, 70
Advantages of Equivalence Partitioning
- Reduces Test Cases: Significantly reduces the number of test cases needed, making testing more efficient.
- Effective: Helps in finding defects with a minimal set of test data.
- Systematic: Provides a systematic way to derive test cases.
- Covers Valid & Invalid Inputs: Ensures that both valid and invalid inputs are tested.
Disadvantages of Equivalence Partitioning
- Doesn't Cover Boundary Values: It does not specifically test the boundary conditions, which are often prone to errors.
- Relies on Assumptions: Assumes that errors are uniformly distributed within a partition.
- Not Suitable for All Cases: May not be effective for complex conditions or non-numeric inputs.
Key Takeaways
- **Black Box Testing** focuses on inputs and outputs without knowing internal code.
- **Equivalence Partitioning** divides input data into valid and invalid classes.
- It helps **reduce the number of test cases** while ensuring good coverage.
- It is a powerful technique but should be combined with other methods (like Boundary Value Analysis) for comprehensive testing.
Next Lecture
Topic: Black Box Testing - Boundary Value Analysis
Q & A
Questions & Discussion

