Lecture 6-2025
Lecture 6-2025
Lecture 6
Software Testing
+ General Techniques
+ Web Application Testing
Text
Code Coverage
• A measure which describes the degree of
which the source code of the program has
been tested.
• It is categorized as a white-box testing
technique.
Types of Code Coverage
• Statement Coverage
• Decision Coverage
• Branch Coverage
• Condition Coverage
Statement Coverage (1)
• Let A = The number of statements executed by
test cases.
• Let B = The total number of statements.
𝐴
𝑆𝑡𝑎𝑡𝑒𝑚𝑒𝑛𝑡 𝐶𝑜𝑣𝑒𝑟𝑎𝑔𝑒 =
𝐵
• If age = 5, code coverage is 100%, if age = 15,
code coverage is 66.67% (2 of 3 statements)
Statement Coverage (2)
Statement Coverage (3)
• Statement Coverage can detect the following:
– Unused Statements
– Dead Code
– Unused Branches
– Missing Statements
• Statement Coverage is ineffective for:
– Complex logical expressions
Decision Coverage (1)
• Measured by the number of executed decision
outcomes over the total number of decision
outcomes.
• Example:
o age = 12, coverage = 50%.
o age = 14, coverage = 50%.
Decision Coverage (2)
1. 1A-2C-3D-E-4G-5H
2. 1A-2B-E-4F
Decision Coverage (3)
• Goal: every decision in the program must take on
all possible outcomes (true/false) at least once.
1. 1A-2B-E-4F
2. 1A-2B-E-4G-5H
3. 1A-2C-3D-E-4G-5H
4. 1A-2C-3D-E-4F
Documentation Testing
• Software documentation is also a testing target.
• The goal is to ensure the document accurately
guide the end-users to use the software.
• Some points to note:
– Does the documentation accurately describe how to
accomplish each mode of use?
– Are examples accurate?
– Are terminology, menu descriptions, and system
responses consistent with the actual program?
– Are the document’s table of contents and index accurate,
and complete?
Part 3