White Box Testing Flashcards
What is a control-flow graph?
Flow chart
- Directed graph
- Nodes are blocks of sequential statements
- Edges are transfers of control & may be labelled with predicate repping condition of control transfer
- Several conventions for these models with slight diffs e.g. hierarchical & concurrent)
- Blocks include if-then-else, while loops & switches
- UML activity diagrams can also be used to model CFGs
What is the subsumption hierarchy?
All-Coupling-Paths → All-Coupling-Uses → All-Coupling-Defs → Call Coupling
What is Integration test coverage criteria?
- Call-coupling - requires execution of all call sites in caller
- All-coupling-defs - requires that for each coupling def (last-def), min 1 coupling path to min 1 reachable coupling
use (first-use) executed - all-coupling-use - requires that for each coupling def (last-def), min 1 coupling path to each reachable coupling use executed
- all-coupling-paths - requires all loop-free coupling paths executed
What is a coupling du-path?
Path from last-def to first-use across 2 units (caller & callee)
What is the mutation coverage/score?
- Complete coverage kills all non-equiv mutants
- Each mutation is test req
- Num mutants depend on def on mutation operators & syntax/structure of software
- Num muntants tend to be large so may need random sampling
What are the types of mutant?
Stillborn, trivial and equivalent
Only mutants which behave differently to og program with no test cases to ID them are interesting
Stillborn mutant
Syntactically incorrect, killed by compiler
Trivial mutant
Killed by almost any test case
Equivalent mutant
Always acts in same behaviour as og program
What are the types of control-flow coverage?
Statement, decision, condition and path
Statement control-flow coverage
Same as =Node =Line
- Hypothesis/motivation for coverage criterion: Faults can’t be discovered if parts containing them not executed
- Statement coverage criterion: Equiv to covering all nodes in CFG
- Executing statement (code line) is weak guarantee of correctness but easy to achieve
- Several statements can execute same statements
- Can help with detecting certain types of detects but may lead to incompleteness
Decision control-flow coverage
- (=Edge =Branch)
- Based on program structure (CFG)
- Edge coverage criterion: Select test T such that by executing program under test P for each case t in T, each edge of P’s CFG traversed min 1x
- Must exercise all decisions that traverse Control flow of program with true/false values
Condition control-flow coverage
- Further strengthens edge coverage
- Condition coverage criterion:Derive/design test set T such that by executing program under test P for each element in T, each edge of P’s CFG traversed & all poss values of constituents of compound conditions as exercise min 1x
- Compound (composite) conditions: c1 & c2 or c3 where Ci’s relational expressions/boolean vars (atomic conditions)
Modified condition-decision coverage
- Only combos of values such that every atomic condition (consituent) Ci drives overall condition truth values x2 (true & false)
- To get test suite, take pair for each constituent & 2 min sets to satisfy them.
Path control-flow coverage
- Path coverage criterion: Select test set T such that by executing P for each test case t in T, all paths leading from initial to final node of P’s CFG traversed
- Num paths too large, if not infinite, some paths being infeasible and sometimes important to determine critical paths leading to more system load etc
- To tackle this, look for conditions executing loops 0 times, a max num times or an average num times
What are the 3 types of coupling between units?
Parameter, shared data (non-local vars) and external resource device) couple (refs of several modules to same external resource)
Call sites
statements in caller (A) where callee (B) invoked
Last defs
Set of nodes (in CFGs) that define x (var) for
which there’s def-clear path from node through call site or return to use in caller
First uses
Set of nodes (in CFGs) that “use” x & for which
there exists def-clear path between call site (if use is in caller) or callee entry point (if use in callee)
Coupling-Based Criteria
- Integration testing of units/modules assures they have consistent assumptions & comm correctly.
- Coupling between 2 units measures dependency
relations between them by reflecting interconnections between units; faults in 1 unit may affect coupled unit - Each module to be integrated should have passed isolated/unit test
- Must be performed at higher abstraction level - looking at program as atomic building blocks & focusing on interconnections
- Goal is to guide testers during integration testing, help define criterion to determine when to stop
integration testing (when given coupling coverage reached)