Key takeaways
- Black-box testing designs tests from the specification: what the software should do, without looking at the code.
- White-box testing designs tests from the internal structure: the code, its branches and paths. It's measured with code coverage.
- Experience-based testing uses the tester's knowledge and intuition: error guessing, exploratory testing, checklists. The best testing combines all three.
Why group techniques at all?
There are dozens of test design techniques. Grouping them by where the test ideas come from helps you choose: is your source the requirements, the code, or what you know about how software usually fails?
The ISTQB Foundation syllabus uses exactly these three families, and "What's the difference between black-box and white-box testing?" is one of the most common junior interview questions.
Black-box testing
You treat the software as a closed box. You know what goes in and what should come out, but not how it works inside.
Test ideas come from requirements, user stories, acceptance criteria and designs. Anyone who understands the requirements can do it, with no programming needed.
Main techniques:
| Technique | The idea | Read more |
|---|---|---|
| Equivalence partitioning | Group inputs that should behave the same; test one from each group. | Equivalence partitioning |
| Boundary value analysis | Bugs gather at the edges; test just inside and outside each limit. | Boundary value analysis |
| Decision tables | Test every meaningful combination of business rules. | Decision table testing |
| State transition testing | Test how the system moves between states, like an order going from paid to shipped. | State transition testing |
| Use case testing | Test complete user flows, including alternatives and errors. | Use case and scenario testing |
Strength: it tests what users actually care about. Weakness: it can miss code that the specification never mentions, like a hidden special case.
White-box testing
You look inside the box. Test ideas come from the code itself: its conditions, branches and paths.
It's mostly done by developers in unit tests, but testers who read code use it too, especially in automation and API testing.
The two basic measures:
- Statement coverage: what percentage of the code's lines (statements) have the tests executed?
- Branch coverage: what percentage of the decision outcomes (both the
trueandfalseside of everyif) have the tests executed?
A small example:
function shippingCost(total) {
if (total >= 200) {
return 0; // free shipping
}
return 15;
}
A single test with total = 250 executes the if and the return 0, but never reaches return 15. That's incomplete statement coverage. Add a test with total = 50, and both branches are covered: 100% branch coverage.
Strength: it finds code no test ever runs, and logic errors in conditions. Weakness: it can't find missing code. If the requirement said "free shipping for students" and nobody wrote that code, there's nothing for coverage to measure.
Experience-based testing
Test ideas come from the tester: skill, intuition, knowledge of similar products and of where bugs usually hide.
Main techniques:
- Error guessing: "What usually goes wrong here?" Empty fields, double clicks, very long names, the back button, losing connection mid-payment.
- Exploratory testing: learning, designing and testing at the same time, guided by a goal (a charter).
- Checklist-based testing: a list of things to check, built from experience, such as a checklist for every new form.
Strength: it finds the bugs nobody wrote a requirement for. Weakness: it depends on the tester's experience and is harder to repeat exactly.
The three side by side
| Black-box | White-box | Experience-based | |
|---|---|---|---|
| Test ideas come from | Requirements, specs | Code structure | Tester's knowledge |
| Needs code access? | No | Yes | No |
| Typical users | Testers, business analysts | Developers, automation testers | Experienced testers |
| Finds well | Wrong or missing behaviour | Untested code, logic errors | Unexpected, real-world problems |
| Misses | Hidden code paths | Missing features | Systematic coverage |
A team tested a new discount feature: "10% off orders of 100 lei or more; 20% off for loyalty members."
- Black-box boundary tests at 99.99, 100 and 100.01 lei found that exactly 100 lei got no discount. The code used
>instead of>=. - White-box coverage showed one branch never ran: a special case for orders paid with gift cards, which nobody had mentioned in the requirements. A test for it found that gift-card orders got the discount twice.
- Experience-based error guessing ("What if I apply the discount, then remove an item?") found that the discount stayed even when the total dropped to 60 lei.
Lesson: each family found a bug the others missed. That's why good test strategies combine them.
Do
Start from the requirements (black-box), check coverage to find blind spots (white-box), then explore with your experience of what usually breaks.
Don't
Rely on a single family. "We have 90% code coverage" and "we tested every requirement" are both incomplete on their own.
Check yourself
A tester with no access to the code designs tests for a password field: 7, 8 and 64 characters, plus an empty field. Then they try pasting a password with a trailing space, because 'that broke the last app I tested'. Which families are they using?
Show answer
The 7/8/64/empty tests are black-box (boundary value analysis and equivalence partitioning from the requirement). Trying the trailing space because of a past bug is experience-based (error guessing). No white-box testing here, since they can't see the code.
