TL;DR
The branch control structure is all about Boolean logic. As boolean logic is a rather complicated and extensive concept, many software bugs arise from boolean logic errors. The post is aligned with the Black Box Software Testing Foundations course (BBST) designed by Rebecca Fiedler, Cem Kaner, and James Bach.
Let’s start with an example:
NUMBER = RANDOM([1,2,3,4,5]) IF (NUMBER > 3) PRINT "WE HAVE A WINNER!" ELSE EXIT
Programming languages usually use the IF keyword as a branching statement. This simple program decides with IF which statement should run next. The decision is made based on a logical expression that comes after IF. The logical expression could be either TRUE or FALSE.
Logical expressions are based on Boolean arithmetic. If you are in software testing because you hate Math, then you are in trouble, because boolean arithmetic is a Math. Terms like Demorgan Law, truth tables, logical operator precedence, and logical expression simplification are essential to master Boolean arithmetic. You can find out more at this link.
Common Bugs
- boolean arithmetic error – The developer made a “logical error” in a boolean expression. Master boolean arithmetic and you would catch those bugs.
- Missed branch case – in multiple branches with many cases, developers could easily forget a case. In that case, branching goes to the default case. Guess what, developers could also forget the default case, so you have a double error!