Module 3: Boolean Logic Testing
Boolean logic bugs are the most dangerous kind. The system works for 95% of users. It accepts most inputs correctly. It rejects most invalid ones correctly. And then, for exactly the right combination of edge conditions, it does exactly the wrong thing — silently.
The reason? A && that should be ||. A precedence assumption without parentheses. A NOT applied to the wrong expression. These are the bugs that survive code review and unit tests and only show up when a real user finds them.
Lessons in this module
- AND, OR, NOT — Where Developers Go Wrong — Survey the most common boolean logic mistakes: using
&&when||was intended, inverting the wrong condition, and confusing short-circuit evaluation. See each mistake as a test case. - Operator Precedence Traps — In most languages,
&&binds tighter than||. What looks unambiguous to the developer is actuallyA || (B && C), not(A || B) && C. Learn to spot these traps from a black-box perspective. - Testing Compound Conditions Systematically — Apply a lightweight version of Modified Condition/Decision Coverage (MC/DC): the technique that forces every condition to independently affect the outcome. Build test sets that guarantee you exercise every logical path.
Practice: Promo Code Engine
A promo code that should activate when (amount > 100 AND day == Saturday) OR user == new. But the developer wrote something subtly different. Your job: find the logical breach.
By the end of this module, you will earn the Logic Gate Guardian badge.