Specification Based or Black Box Techniques
What are Specification-Based Techniques?
Specification-based (black box) techniques derive test cases from the requirements, specifications, or functional description of the software, without reference to its internal code structure.
Common Specification-Based Techniques
- Boundary Value Analysis (BVA): Testing at the edges of input ranges.
- Equivalence Class Partitioning (ECP): Grouping inputs into classes expected to behave similarly.
- Decision Table Testing: Testing combinations of conditions and their resulting actions.
- State Transition Testing: Testing how the system moves between different states.
- Orthogonal Array Testing: Efficiently testing combinations of multiple input parameters.
- Use Case Testing: Deriving tests from documented user interactions with the system.
Why Use Black Box Techniques?
These techniques ensure the software meets functional requirements from the end user's perspective and are especially useful when source code isn't available or relevant to the tester.
Applying the Techniques to One Requirement
Consider a simple requirement: "An online form accepts applicants aged 18 to 60. Age must be a whole number." Here is how three techniques turn that sentence into tests.
Equivalence partitioning
Split the inputs into groups that the system should treat the same way:
- Valid class: 18 to 60, for example 35.
- Invalid class below range: less than 18, for example 10.
- Invalid class above range: more than 60, for example 72.
- Invalid class of wrong type: text or decimals, for example "abc" or 25.5.
One value from each class is enough, because any other value in the same class should behave identically.
Boundary value analysis
Defects cluster at edges, so test just below, on and just above each limit: 17, 18, 19 and 59, 60, 61. Six values give strong coverage of the range logic.
Decision table
Now add a second rule: applicants over 50 need a medical certificate. Conditions combine, so a table makes every case visible.
| Rule | Age valid? | Age over 50? | Certificate? | Result |
|---|---|---|---|---|
| R1 | No | - | - | Reject: invalid age |
| R2 | Yes | No | - | Accept |
| R3 | Yes | Yes | Yes | Accept |
| R4 | Yes | Yes | No | Reject: certificate needed |
Each column of rules becomes one test case, and the table itself exposes gaps in the requirement if a combination has no defined result.
State Transition in Practice
State transition testing fits anything with memory of earlier events. A login that locks after three wrong passwords has states such as Ready, One failure, Two failures and Locked. Valid transitions include a correct password from any non-locked state leading to Logged in. The interesting tests are invalid ones: trying the correct password while Locked must still be refused, and the counter must reset after a successful login.
Picking the Right Technique
| If the requirement has... | Start with |
|---|---|
| Numeric ranges or length limits | Equivalence partitioning plus boundary values |
| Several conditions that combine | Decision table |
| Status changes or workflows | State transition |
| Many parameters with many values | Pairwise or orthogonal arrays |
| End-to-end user goals | Use case testing |
Techniques are usually mixed. A registration feature might use boundaries for the password length, a decision table for discount rules and a use case for the full sign-up journey.
Where Testers Commonly Slip
- Testing only the valid partition and assuming invalid inputs are handled.
- Choosing boundary values on one side of the limit only.
- Building decision tables without collapsing impossible combinations, which wastes effort.
- Ignoring outputs: partitions apply to results too, such as zero, positive and negative totals.
- Not tracing each test back to the requirement line it came from.
A useful habit is to write the partitions and boundaries next to the requirement before writing any steps; reviewers can then spot missing classes in seconds.
Ready to master real-world software testing?
Learn manual and automation testing hands-on with mentor-led sessions.