4.3 White box test techniques Flashcards
Which white-box test techniques are focused on in this course?
The two techniques discussed are:
Statement testing
Branch testing
What is the objective of Statement Testing?
Statement testing aims to exercise every executable statement in the code at least once to achieve a desired level of coverage.
How is coverage quantified in Statement Testing?
Coverage in Statement Testing is measured as the percentage of executable statements that have been exercised by test cases, out of the total number of executable statements in the code.
What is guaranteed when 100% statement coverage is achieved?
Achieving 100% statement coverage ensures that all executable statements in the code have been executed at least once, potentially exposing defects associated with those statements.
What are the limitations of 100% statement coverage?
100% statement coverage may not detect defects that are data-dependent (e.g., division by zero only when certain data conditions are met) or defects in decision logic that involve branches not exercised by the test cases.
What is Branch Testing?
Branch testing aims to ensure that all possible branches of conditional statements (if-else, switch-case, etc.) are exercised by test cases, rather than just focusing on individual executable statements.
How is coverage measured in Branch Testing?
Coverage in Branch Testing is measured as the percentage of decision branches that have been exercised by test cases, out of the total number of decision branches in the code.
What is a branch in the context of branch testing?
A branch is defined as a transfer of control between two nodes in the control flow graph of the code, representing possible sequences of execution of source code statements.
What does branch testing aim to cover?
Branch testing aims to cover branches in the code, including both unconditional and conditional branches.
What does achieving 100% branch coverage ensure?
Achieving 100% branch coverage ensures that all branches in the code, both unconditional and conditional, have been exercised by test cases.
What are the limitations of branch testing in detecting defects?
Branch testing may not detect defects that require the execution of specific paths or scenarios within a branch, which may remain untested.
What is the relationship between branch coverage and statement coverage?
Branch coverage subsumes statement coverage, meaning achieving 100% branch coverage guarantees 100% statement coverage as well, but the reverse is not true.
What advantage do all white-box testing techniques offer?
White-box testing techniques consider the entire software implementation, which aids in detecting defects even when the software specification is vague, outdated, or incomplete.
What limitation does white-box testing have in terms of defect detection?
White-box testing may not detect defects resulting from omitted requirements if the software does not implement certain requirements.
Where can white-box techniques be applied besides dynamic testing?
White-box techniques can also be used in static testing scenarios such as code reviews, dry runs of code, and reviewing high-level logic like pseudocode.