Logic Coverage

Predicate - an expression that evaluates to a boolean value

Clauses - predicates withtout logical operators

Logic Operators

¬\neg: negation
\wedge: and
\vee: or
\rightarrow: right arrow
\oplus: xor
\leftrightarrow: equivalence

Notations

PP: a set of predicates
CC: all caluses making up the predicates of PP

CpC_p: caluses of the predicate pp

Coverages

Predicate Coverage (PC)

For each pPp\in P, TR contains two requirements

  1. pp evaluates to true
  2. pp evaluates to false

  3. Analogous to edge coverage on a CFG

  4. Very coarse grained

Caluse Coverage (CC)

For each cCc\in C, TR contains two requirements

  1. cc evaluates to true
  2. cc evaluates to false

Combinatorial Coverage (CoC)

For each pPp\in P, TR has test requirements for the clauses in CpC_p

  • Also known as multiple condition coverage
  • Unscalable, since the number of test requirements while finite, grows exponentially.

Symbol for Clause and Predicate

For predicate pp and clause cc

pc=truep_c=true: cc replaced by true
pc=falsep_c=false: cc replaced by false

e.g. p=acp=a\wedge c
pc=trueatruep_c=true \Rightarrow a\wedge true

  • If cc can never determine pp, then cc is redundant with respect to pp
    • You can write pp without using cc

Constructing a Truth Table

pa=pa=truepa=falsep_a=p_{a=true}\oplus p_{a=false}

If the major clause is aa, then the row in the truth table is testable for a if pa=truep_a = true

Active Clause Coverage (ACC)

For each pPp\in P and making each caluse ciCpc_i\in C_p major, choose assignments for minor clauses cjc_j, jij\neq i such that cic_i determines pp. TR has requirements for each cic_i: cic_i evaluates to true and cic_i evaluates to false.

  • The cjc_js may be different when cic_i evaluates to true and cic_i evaluates to false.
  • No restriction on the cjc_j

General Active Clause Coverage (GACC)

For each pPp\in P and letting each clause ciCpc_i\in C_p be a major caluse, choose minor cluase value cjc_j such that cic_i determines pp. TR contains two test requirements for each cic_i: cic_i evaluates to true and cic_i evaluates to false.

  • Does not subsumes PCPC but subsumes CCCC

Correlated Active Cluase Coverage (CACC)

For each pPp\in P and letting each clause cic_i be major, choose minor clause values for cjc_j such that cic_i determines pp. TR contains two requirements for each cic_i: cic_i evaluates to true and cic_i evaluates to false.

The values chosen for cjc_j must cause pp to be true and for one value of cic_i and false for the other.

  • Values chosen for cjc_j must cause pp to be true for one value of cic_i and false for the other
  • Must also satisfy GACC
  • Must make pp true and false for each clause

Restricted Active Clause Coverage (RACC)

For each pPp\in P and letting each clause cic_i be major, choose minor clause values for cjc_j such that cic_i determines pp. TR contains two requirements for each cic_i: cic_i evaluates to true and cic_i evaluates to false.

The values for each cjc_j must be the same when cic_i is true and when cic_i is false

  • Must have the same minor caluse in the test set for each major clause
  • Harder to satisfy

Infeasibility

  • A test requirement tt is infeasible if no test case can satisfy test requirement tt.
Could be caused by
  • Predicate is unreachable in its context
  • Method containing the predicate never assigns appropriate values to its variables to cause the desired caluse values
  • A cluase never determines a predicate and you are trying to achieve an active cluase coverage criterion

Workarounds

  1. Satisfy feasible test requirements, dro pinfeasible test requirements
  2. If you can't satisfy a particular coverage criterion, use a looser criterion (e.g. settle for CACC if you can't satisfy RACC)

Achieving Logic Coverage

  1. Identify the predicates pPp\in P in the program fragement under test
  2. Figure out how to reach each of the predicates
  3. Make cc determine pp (for the active clause criteria$$
  4. Find values for variables to meet various criteria

results matching ""

    No results matching ""