Graph Coverage Flashcards
In a _____ box approach, we consider only the requirements or inputs for a test
black
In a _____ box approach, we factor in the program implementation to our tests
white
Describe statement coverage and branch coverage
Statement coverage: How many statements did the suite test
Branch coverage: How many of the condition outcomes were tested
In Control Flow Graphs, what do nodes and edges represent?
Nodes: Program Code
Edges: Execution paths that the program may take
What are the 4 types of nodes in a Control Flow Graph? Describe them.
Entry Node: 0 incoming edges
Exit Node: 0 outgoing edges
Decision/Branch Node: >1 outgoing edges
Join Node: >1 incoming edges
In Control Flow Graphs, straight line sequences of codes are ______ into basic blocks
grouped
Node coverage can be more useful than statement. Why?
We can remove irrelevant information as lines of code will be grouped together and removes double counting
In a CFG, statement and branch coverage can be replaced with what?
Node and Edge coverage
How do node and edge coverage compare?
Edge coverage tests everything that statement coverage does, as you are testing the edges, rather than the nodes of the graph
Is full coverage realistic in practice? Why?
No, because of reachability (syntactic [early returns], semantic [condition never false])
In CFG coverage, the ____ taken by each test can matter (the combinations of our conditions matter).
path
Is it feasible to test all paths in a CFG? Why?
No, because there can be a graph with many decisions and there can be loops (infinite paths)
How do we compromise when we test paths in a CFG? Are these compromises good?
Edge pair coverage: Test paths with length <= 2 (related if statements tend to be grouped)
Specified path coverage: Given a number k, test k paths
What is a simple path? What is a prime path?
A path between nodes where no node appears more than once, except maybe for the first and last
A prime path is a simple path that is not a subpath of any other simple path
What is the use of a simple path when testing CFGs?
Captures the acyclic behaviors of a program