Test Adequacy Flashcards
Structural Analysis
Study how much of the structure of a program we have actually tested
Dataflow Analysis
We study test adequacy from the point of view of the extent to which different data flows are managed
Static Testing
Testing of a program through analysis of artefacts without actually executing the SUT, ex. requirements testing or code reviews.
Dynamic Testing
Test a system via techniques that involve execution of the system under test. Black Box/White Box
Black Box Testing
driven by specifications, assumes no knowledge of a system’s internal workings
White Box Testing
Driven by knowledge of a system’s internal workings
Gray Box Testing
combination of black box and white box testing techniques whereby a tester directs his testing based on partial knowledge about the internal workings of the SUT.
Structural Testing
Determine test cases based on structure of the program. Asks “what is missing in our test suite”. Structural coverage increases confidence in thoroughness of testing.
Structural Testing in Practice
- Create functional test suite first
- Measure structural coverage to identify what is missing
- Interpret unexecuted elements, which may be due to natural differences between specs and implementation or may reveal flaws
- Attractive cause automated. Coverage is a good measure of progress.
Control Flow Graph (CFG)
A model of a single method that is closely related to source code. Directed graph where nodes represent regions of the source code and directed edges represent the possibility that program execution proceeds from the end of one region directly to the beginning of the other.
Test Case
Set of inputs, execution conditions, and a pass/fail criterion
Test Case Specification
A requirement to be satisfied by one or more actual test cases
Test Suite
A set of test cases
Test Obligation
Partial test case specification, requiring some property deemed important to thorough testing
Adequacy Criterion
A predicate deciding whether or not a particular test suite adequately tests a particular program.
Branch Testing
A test suite can achieve 100% statement coverage without executing all possible branches.
Statement Coverage
Number of executed statements/Number of statements
Statements vs Branches
Traversing all edges of a graph causes all nodes to be visited. Test suites that satisfy branch adequacy criterion for a program also satisfy the statement adequacy criterion for the same program.
Condition Testing
All branches can still miss conditions.
Branch Coverage exposes
faults in how a computation has been decomposed into cases:
- Intuitively attractive: Check programmer’s case analysis
- But only roughly: Groups cases with the same outcome
Condition Coverage
Considers case analysis in more detail but also individual conditions in a compound Boolean expression.
Basic Condition Testing
Adequacy Criterion = Each basic condition must be executed at least once. These can be satisfied without satisfying branch coverage.
Branch And Condition Adequacy
Cover all conditions and decisions
Compound Condition Adequacy
Cover all possible evaluations of compound conditions. Cover all branches of a decision tree