Unit 2.1: Black Box Testing & Techniques
1. Functional Testing (Black Box Testing)
Definition: Black Box Testing (also known as Functional Testing) is a testing method where the internal structure/design/implementation of the item being tested is not known to the tester. The tester interacts with the system solely through the interface (GUI, API inputs).
Why "Black Box"? Imagine a literal black box where you cannot see inside. You put an input (X) into a slot, and you get an output (Y) from another slot. You verify if Y is correct for X, without caring how the box produced Y.
Characteristics:
- Requires: Requirements and Functional Specifications.
- Performed by: Independent Testers (QA) or End Users.
- Focus: Functionality, UX, External behavior.
Advantages:
- Tester doesn't need to know coding.
- Testing is done from the user's perspective.
- Helps expose missing functionality or interface errors.
Disadvantages:
- Cannot test hidden logic or complex paths inside the code.
- Redundant test cases might be written if the tester doesn't know how code works.
---
2. Boundary Value Analysis (BVA)
Definition: A technique based on the idea that "errors aggregate at boundaries". Programmers often make "Off-by-one" errors (e.g., using < instead of <=).
Concept: Instead of testing the middle values, we focus on the edges.
Rules for Range [Min, Max]:
- Valid Min: (The minimum value allowed).
- Valid Max: (The maximum value allowed).
- Invalid Min-1: (Just below the minimum).
- Invalid Max+1: (Just above the maximum).
Detailed Example:
- Requirement: An "Age" field accepts values from 18 to 60.
- Test Case 1 (Min): Enter 18 -> Accept.
- Test Case 2 (Max): Enter 60 -> Accept.
- Test Case 3 (Min-1): Enter 17 -> Error Message.
- Test Case 4 (Max+1): Enter 61 -> Error Message.
- Note: Software often breaks at 17 or 61 due to boundary conditions.
---
3. Equivalence Class Partitioning (ECP)
Definition: A technique where input data is divided into logical groups called Equivalence Classes. Data elements within one class are expected to be processed in the same way by the software.
Concept: Testing one value from a class is as good as testing all values from that class. This dramatically reduces the number of test cases.
Types of Classes:
- Valid Class: Set of inputs that should be accepted.
- Invalid Class: Set of inputs that should be rejected.
Detailed Example:
- Requirement: An application accepts a "Zip Code" which must be a 5-digit number.
- Partition 1 (Valid): Any 5-digit number (e.g., 10000 to 99999). Test Data: 12345.
- Partition 2 (Invalid - Length): Less than 5 digits. Test Data: 123.
- Partition 3 (Invalid - Length): More than 5 digits. Test Data: 123456.
- Partition 4 (Invalid - Type): Non-numeric characters. Test Data: ABCDE.
---
4. Decision Table Based Testing
Definition: A "Cause-Effect" table used to test systems with complex rules, where the output depends on a combination of inputs. It is excellent for logic verification.
Components:
- Conditions (Process inputs): Questions with Yes/No answers.
- Actions (Process outputs): What the system should do.
- Rules: Columns showing the combination of conditions.
Detailed Example: E-Commerce Discount Logic Rules:
- "New Users get 10% off."
- "Orders over $100 get Free Shipping."
- "Premium Members always get Free Shipping."
Decision Table:
| Conditions | Rule 1 | Rule 2 | Rule 3 | Rule 4 |
|---|---|---|---|---|
| Is New User? | T | T | F | F |
| Order > $100? | T | F | T | F |
| Action | ||||
| 10% Discount | Yes | Yes | No | No |
| Free Shipping | Yes | No | Yes | No |
Benefit: It ensures no combination of rules is missed.