Information Technology Reference
In-Depth Information
source code in a program and you can determine manually or with a tool that
you have executed 4,537 lines of source code, then you have achieved a 90.7%
statement coverage (exceptionally high for complex programs). The underlying
hypothesis is that the higher the source code test coverage, the fewer will be the
defects found later. The practical conclusion is that new, unexecuted code lines
are just a software time bomb waiting to explode at the most inopportune mo-
ment in production. The question is not “if” they will explode, only a question
of “when.”
7.5.2 Branch (Simple Condition) Coverage Technique
Branch coverage techniques focus on determining what percentage of the source
code branch (true/false) logic in a program has been executed. If there are 1,500
source code branch points in a program and you can determine manually or with a
tool that you have executed 1,145 branches (count true and false branch executions
separately), then you have achieved a 76.3% branch point coverage (exceptionally
high for complex programs). The underlying hypothesis is that the higher the
branch point test coverage, the fewer will be the defects found later. The practical
conclusion is that unexecuted branches, true or false, are just a software time
bomb waiting to explode just like unexecuted statements. The co-occurrence of
unexecuted branches with unexecuted statements is found most often in untested
error recovery logic.
Because all computer logic conditions resolve to either true or false, you may
wonder about the stipulation of simple conditions in this technique. Choosing to
test the simple condition branches before the compound condition branches requires
fewer initial test actions. All the developer needs to do is choose any test value that
will force a true branch and any test value that will force a false branch, just two test
values per branch.
7.5.3 Compound Condition Coverage Technique
The compound condition coverage technique extends the branch coverage technique
to branches with compound conditions, ones that contain combinations of Boolean
operators AND, OR, and NOT along with pairs of parentheses, possibly nested.
The challenge is to identify all the test value combinations that will evaluate to
true and false for every simple condition and every Boolean combination of simple
conditions. Truth tables are normally employed at this point in the white box test
planning to enumerate all the possible condition permutations. Here is a compound
condition containing two simple conditions.
(AGE
M)
In order to identify the test data for 100% compound condition coverage, the
following truth table is constructed.
18 AND SEX
Search WWH ::




Custom Search