Test Adequacy Flashcards

1
Q

Structural Analysis

A

Study how much of the structure of a program we have actually tested

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Dataflow Analysis

A

We study test adequacy from the point of view of the extent to which different data flows are managed

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Static Testing

A

Testing of a program through analysis of artefacts without actually executing the SUT, ex. requirements testing or code reviews.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Dynamic Testing

A

Test a system via techniques that involve execution of the system under test. Black Box/White Box

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Black Box Testing

A

driven by specifications, assumes no knowledge of a system’s internal workings

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

White Box Testing

A

Driven by knowledge of a system’s internal workings

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Gray Box Testing

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Structural Testing

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Structural Testing in Practice

A
  • 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.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Control Flow Graph (CFG)

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Test Case

A

Set of inputs, execution conditions, and a pass/fail criterion

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Test Case Specification

A

A requirement to be satisfied by one or more actual test cases

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Test Suite

A

A set of test cases

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Test Obligation

A

Partial test case specification, requiring some property deemed important to thorough testing

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Adequacy Criterion

A

A predicate deciding whether or not a particular test suite adequately tests a particular program.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Branch Testing

A

A test suite can achieve 100% statement coverage without executing all possible branches.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

Statement Coverage

A

Number of executed statements/Number of statements

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

Statements vs Branches

A

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.

19
Q

Condition Testing

A

All branches can still miss conditions.

20
Q

Branch Coverage exposes

A

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

21
Q

Condition Coverage

A

Considers case analysis in more detail but also individual conditions in a compound Boolean expression.

22
Q

Basic Condition Testing

A

Adequacy Criterion = Each basic condition must be executed at least once. These can be satisfied without satisfying branch coverage.

23
Q

Branch And Condition Adequacy

A

Cover all conditions and decisions

24
Q

Compound Condition Adequacy

A

Cover all possible evaluations of compound conditions. Cover all branches of a decision tree

25
Q

Modified Condition/Decision (MC/DC) Motivation

A

Effectively test important combinations of conditions without exponential blowup in test suite size. Important combinations means each basic condition shown to independently affect the outcome of each decision.

26
Q

MCDC Requires

A
  • For each basic condition C, two test cases:
  • Values of all evaluated conditions except C are the same
  • Compound condition as a whole evaluates to true for one and false for the other
27
Q

Path Adequacy

A

Consider combinations of decisions along paths. Adequacy criterion: each path must be executed at least once.

28
Q

If number of paths in a program with loops is unbounded

A

Simple criterion of path adequacy is usually impossible to satisfy

29
Q

Boundary Interior Path Testing

A

Group paths that only differ in the sub-path they follow when repeating the body of a loop. The set of paths from the root of the tree to each leaf is the required set of subpaths for boundary/interior coverage.

30
Q

Loop Boundary Adequacy

A

Variant of the boundary/interior criterion that treats loop boundaries similarly but is less stringent wrt other differences on paths.

31
Q

A test suite satisfies the loop boundary adequacy criterion if

A

for every loop:
- In at least one test case the loop body is iterated 0 times
- In at least one case the loop body is iterated once
- In at least one case the loop body is iterates 2+ times

32
Q

Cyclomatic Number

A

Number of independent paths in the CFG

33
Q

Cyclomatic Adequacy

A

If e = #edges, n = #nodes, c = #connected components of a graph, it is:
e - n + c for an arbitrary graph
e - n + 2 for a CFG

34
Q

Cyclomatic Coverage

A

Counts the number of independent paths that have been exercised, relative to cyclomatic complexity

35
Q

The Infeasibility Problem

A

Sometimes criteria may not be satisfiable, this criterion requires execution of:
- Statements that cannot be executed as a result of defensive programming/code reuse
- Conditions that cannot be satisfied as a result of interdependent conditions
- Paths that cannot be executed as a result of interdependent decision
- Unreachable code is normal even in well maintained systems

36
Q

Def Use Pair

A

Associates a point in a program with a point where it is used. Def: Where a variable gets a value. Use: Extraction of a value from a variable

37
Q

Definition Clear Path

A

Path along the CFG from a definition to a use of the same variable without another definition of the variable between. This is what forms a def-use pair.

38
Q

Direct Data Dependence Graph

A

Made up of:
Nodes - as in the CFG
Edges: def-use (du) pairs labelled with variable name

39
Q

Control Dependence

A

Data Dependence: Where did these values come from?
Control Dependence: Which statement controls if this statement executes?

40
Q

Dominators

A

Pre-Dominators can be used to make an intuitive notion of “controlling decision” precise.
Post-Dominators are calculated in the reverse of the control flow graph, using a special exit node as the root.

41
Q

Data Flow Testing Motivation

A
  • Middle ground in structural testing: statement and branch coverage don’t test interactions. Distinguish important paths.
  • Intuition: Statements interact through data flow.
42
Q

DU Pair

A

A pair of definition and use for some variable, such that at least one DU path exists from the definition to the use.

43
Q

DU Path

A

A definition-clear path on the CFG starting from a definition to a use of a same variable. Definition clear: Value is not replaced on a path. Loops could create infinite DU paths between a def and a use.

44
Q

Data Flow Testing Adequacy Criteria

A
  • All DU pairs: At least one test case each
  • All DU paths: Each simple (non looping) path is exercised by at least one test case
  • All definitions: For each def, there is at least one test case which exercises a DU pair containing it.