SlideShare a Scribd company logo
S. Hallé
Sylvain Hallé
Université du Québec à Chicoutimi
CANADA
Test Suite Generation for
Boolean Conditions with
Equivalence Class Partitioning
CRSNG
NSERC
FormaliSE, May 2022
S. Hallé
Boolean Conditions
Software systems are filled with conditions that
modulate their behavior.
SELECT name FROM employees
WHERE YEAR(dob) < 1990 AND rank = 3;
if (a % 3 == 0 || (b > c + 6 && o.isReady())
{
...
}
Italic
Bold
+
Underline
OK
Reversed
+
c1
a
(8/1)
=b ≠b
(4/2)
<2 >2
⊤
⊤
=2
c3
(7/2)
=0 ≠0
(3/1)
⊤
⊤
a
≠c =c
(10/3)
⊤
(7/2)
=0 ≠0
(3/1)
⊤
⊤
c2
S. Hallé
Boolean Conditions
Test input generation is the problem of
(automatically) generating values given to a system
if (a % 3 == 0 || (b > c + 6 && o.isReady())
{
...
}
S. Hallé
Boolean Conditions
Test input generation is the problem of
(automatically) generating values given to a system
if (a % 3 == 0 || (b > c + 6 && o.isReady())
{
...
}
a = 3
b = 2
c = 1
o.isReady() = true
test case
S. Hallé
Boolean Conditions
Test input generation is the problem of
(automatically) generating values given to a system
if (a % 3 == 0 || (b > c + 6 && o.isReady())
{
...
}
a = 3
b = 2
c = 1
o.isReady() = true
test case
1
1
S. Hallé
Boolean Conditions
Test input generation is the problem of
(automatically) generating values given to a system
if (a % 3 == 0 || (b > c + 6 && o.isReady())
{
...
}
a = 3
b = 2
c = 1
o.isReady() = true
test case
else
{
...
}
2
a = 1
b = 2
c = 2
o.isReady() = false
2
Different values send the
execution on different paths
1
1
S. Hallé
...but what if the condition
is incorrect?
Boolean Conditions
Test input generation is the problem of
(automatically) generating values given to a system
if (a % 3 == 0 || (b > c + 6 && o.isReady())
{
...
}
a = 3
b = 2
c = 1
o.isReady() = true
test case
else
{
...
}
2
a = 1
b = 2
c = 2
o.isReady() = false
2
Different values send the
execution on different paths
1
1
S. Hallé
We must generate a test input for which the
condition sends the execution in the wrong branch
Boolean Conditions
a % 3 == 0 || (b > c + 6 && o.isReady())
a % 3 == 0 || (b ≥ c + 6 && o.isReady())
ACTUAL
EXPECTED
S. Hallé
a = 0
b = 6
c = 0
o.isReady() = true
4
We must generate a test input for which the
condition sends the execution in the wrong branch
Boolean Conditions
a % 3 == 0 || (b > c + 6 && o.isReady())
a % 3 == 0 || (b ≥ c + 6 && o.isReady())
ACTUAL
EXPECTED
S. Hallé
a = 0
b = 6
c = 0
o.isReady() = true
4
⊤ ⊥ ⊤
⊤ ⊤ ⊤
⊤
⊤
+
We must generate a test input for which the
condition sends the execution in the wrong branch
Boolean Conditions
a % 3 == 0 || (b > c + 6 && o.isReady())
a % 3 == 0 || (b ≥ c + 6 && o.isReady())
ACTUAL
EXPECTED
S. Hallé
a = 0
b = 6
c = 0
o.isReady() = true
a = 1
b = 7
c = 1
o.isReady() = false
+
4 5
We must generate a test input for which the
condition sends the execution in the wrong branch
Boolean Conditions
a % 3 == 0 || (b > c + 6 && o.isReady())
a % 3 == 0 || (b ≥ c + 6 && o.isReady())
ACTUAL
EXPECTED
S. Hallé
a = 0
b = 6
c = 0
o.isReady() = true
a = 1
b = 7
c = 1
o.isReady() = false
+
4 5
⊥ ⊥ ⊥
⊥ ⊤ ⊥
⊥
⊥
+
We must generate a test input for which the
condition sends the execution in the wrong branch
Boolean Conditions
a % 3 == 0 || (b > c + 6 && o.isReady())
a % 3 == 0 || (b ≥ c + 6 && o.isReady())
ACTUAL
EXPECTED
S. Hallé
a = 0
b = 6
c = 0
o.isReady() = true
a = 1
b = 7
c = 1
o.isReady() = false
+
+
a = 1
b = 7
c = 1
o.isReady() = true
4 5 6
We must generate a test input for which the
condition sends the execution in the wrong branch
Boolean Conditions
a % 3 == 0 || (b > c + 6 && o.isReady())
a % 3 == 0 || (b ≥ c + 6 && o.isReady())
ACTUAL
EXPECTED
S. Hallé
a = 0
b = 6
c = 0
o.isReady() = true
a = 1
b = 7
c = 1
o.isReady() = false
+
+
a = 1
b = 7
c = 1
o.isReady() = true
4 5 6
⊥ ⊥ ⊤
⊥ ⊤ ⊤
⊥
⊤
✓
We must generate a test input for which the
condition sends the execution in the wrong branch
Boolean Conditions
a % 3 == 0 || (b > c + 6 && o.isReady())
a % 3 == 0 || (b ≥ c + 6 && o.isReady())
ACTUAL
EXPECTED
S. Hallé
Making the condition true/false once is not
sufficient to reveal errors
The components of the condition must evaluate to
true/false in various combinations
⇒ Boolean condition coverage
We must generate a test input for which the
condition sends the execution in the wrong branch
Boolean Conditions
a % 3 == 0 || (b > c + 6 && o.isReady())
a % 3 == 0 || (b ≥ c + 6 && o.isReady())
ACTUAL
EXPECTED
S. Hallé
Several coverage criteria for Boolean conditions
have been proposed
Coverage Criteria
(x₀ ∧ ¬x₁ ∧ x₂) ∨ (x₁ ∧ x₃) ∨ (¬x₀ ∧ x₂ ∧ x₃)
S. Hallé
Several coverage criteria for Boolean conditions
have been proposed
Coverage Criteria
(x₀ ∧ ¬x₁ ∧ x₂) ∨ (x₁ ∧ x₃) ∨ (¬x₀ ∧ x₂ ∧ x₃)
Predicate coverage
Each variable has a test case where it is true, and
another test case where it is false
S. Hallé
Several coverage criteria for Boolean conditions
have been proposed
Coverage Criteria
(x₀ ∧ ¬x₁ ∧ x₂) ∨ (x₁ ∧ x₃) ∨ (¬x₀ ∧ x₂ ∧ x₃)
Combinatorial ("t-way") coverage
Each t-tuple of variables has test cases for all
combinations of their true/false values
Example: for t=2
S. Hallé
Several coverage criteria for Boolean conditions
have been proposed
Coverage Criteria
(x₀ ∧ ¬x₁ ∧ x₂) ∨ (x₁ ∧ x₃) ∨ (¬x₀ ∧ x₂ ∧ x₃)
Clause coverage
Each clause of the condition has a test case where
it is true and another test case where it is false
{
clause
S. Hallé
Several coverage criteria for Boolean conditions
have been proposed
Coverage Criteria
(x₀ ∧ ¬x₁ ∧ x₂) ∨ (x₁ ∧ x₃) ∨ (¬x₀ ∧ x₂ ∧ x₃)
Modified condition/decision coverage (MC/DC)
Predicate coverage + clause coverage + every
clause is shown to independently affect the
outcome
S. Hallé
Several coverage criteria for Boolean conditions
have been proposed
Coverage Criteria
(x₀ ∧ ¬x₁ ∧ x₂) ∨ (x₁ ∧ x₃) ∨ (¬x₀ ∧ x₂ ∧ x₃)
Modified condition/decision coverage (MC/DC)
Predicate coverage + clause coverage + every
clause is shown to independently affect the
outcome
⊥
⊥ ⊥ ⊥
x₀ = ⊥ x₁ = ⊥ x₂ = ⊥ x₃ = ⊥
S. Hallé
Several coverage criteria for Boolean conditions
have been proposed
Coverage Criteria
(x₀ ∧ ¬x₁ ∧ x₂) ∨ (x₁ ∧ x₃) ∨ (¬x₀ ∧ x₂ ∧ x₃)
Modified condition/decision coverage (MC/DC)
Predicate coverage + clause coverage + every
clause is shown to independently affect the
outcome
(x₀ ∧ ¬x₁ ∧ x₂) ∨ (x₁ ∧ x₃) ∨ (¬x₀ ∧ x₂ ∧ x₃)
⊥
⊥ ⊤ ⊥
x₀ = ⊥ x₁ = ⊥ x₂ = ⊥ x₃ = ⊥
⊤
x₀ = ⊥ x₁ = ⊤ x₂ = ⊥ x₃ = ⊤
S. Hallé
Several coverage criteria for Boolean conditions
have been proposed
Coverage Criteria
(x₀ ∧ ¬x₁ ∧ x₂) ∨ (x₁ ∧ x₃) ∨ (¬x₀ ∧ x₂ ∧ x₃)
MUMCUT Coverage
3 conditions expressed in terms of:
S. Hallé
Several coverage criteria for Boolean conditions
have been proposed
Coverage Criteria
(x₀ ∧ ¬x₁ ∧ x₂) ∨ (x₁ ∧ x₃) ∨ (¬x₀ ∧ x₂ ∧ x₃)
MUMCUT Coverage
3 conditions expressed in terms of:
Unique true point (UTP): test case that makes a
single clause evaluate to ⊤
S. Hallé
Several coverage criteria for Boolean conditions
have been proposed
Coverage Criteria
(x₀ ∧ ¬x₁ ∧ x₂) ∨ (x₁ ∧ x₃) ∨ (¬x₀ ∧ x₂ ∧ x₃)
MUMCUT Coverage
3 conditions expressed in terms of:
Unique true point (UTP): test case that makes a
single clause evaluate to ⊤ x₀ = ⊥ x₁ = ⊤ x₂ = ⊥ x₃ = ⊤
⊥ ⊤ ⊥
S. Hallé
Several coverage criteria for Boolean conditions
have been proposed
Coverage Criteria
(x₀ ∧ ¬x₁ ∧ x₂) ∨ (x₁ ∧ x₃) ∨ (¬x₀ ∧ x₂ ∧ x₃)
MUMCUT Coverage
3 conditions expressed in terms of:
Unique true point (UTP): test case that makes a
single clause evaluate to ⊤
Near false point (NFP): test case where the
condition is ⊥, but flipping a single variable
changes its value
S. Hallé
Several coverage criteria for Boolean conditions
have been proposed
Coverage Criteria
(x₀ ∧ ¬x₁ ∧ x₂) ∨ (x₁ ∧ x₃) ∨ (¬x₀ ∧ x₂ ∧ x₃)
MUMCUT Coverage
3 conditions expressed in terms of:
Unique true point (UTP): test case that makes a
single clause evaluate to ⊤
Near false point (NFP): test case where the
condition is ⊥, but flipping a single variable
changes its value
⊥ ⊥ ⊥
x₀ = ⊥ x₁ = ⊥ x₂ = ⊥ x₃ = ⊤
S. Hallé
Several coverage criteria for Boolean conditions
have been proposed
Coverage Criteria
(x₀ ∧ ¬x₁ ∧ x₂) ∨ (x₁ ∧ x₃) ∨ (¬x₀ ∧ x₂ ∧ x₃)
MUTP: each variable not in a UTP must be true/
false in at least one test
MNFP: each variable not in a NFP must be true/
false in at least one test
CUTP-NFP: all pairs of UTP and NFP for the same
clause that differ by a single variable flip must be
present
MUMCUT Coverage
1
2
3
S. Hallé
Each coverage criterion is expressed informally;
no uniform formal notation to define them all
Each criterion comes with its own algorithm to
generate test cases; the correctness/optimality of
these algorithms is often not demonstrated
Concrete implementations of these algorithms are
not easy to find (research papers); switching
criteria means switching programs
Must restart from scratch if developing a new
coverage criterion
In the current state of things...
Coverage Criteria
S. Hallé
Foundations based on concepts of algebra
Existing criteria become particular cases of this
model
Provides a test generation algorithm that works of
any criterion
Comes with a concrete and freely available
implementation
Goal: define a formal model of Boolean condition
coverage
Contribution
S. Hallé
Algebraic Definition of Coverage
Let X be a set of arbitrary symbols (variables). A
valuation is a total function ν : X → {⊤,⊥}. We
define as N the set of all valuations.
We denote by φ[ν] the result of evaluating φ by
setting its variables to the values defined by ν.
Let Φ be the set of Boolean formulas with variables
in X. A valuation ν ∈ N is a specific way of
evaluating a condition φ ∈ Φ.
Example: X = {x₀,x₁}
ν(x₀) = ⊤, ν(x₁) = ⊥
φ = x₀ ∧ ¬x₁
φ[ν] = ⊤
S. Hallé
Algebraic Definition of Coverage
Let τ : N → C be a total function mapping each
valuation ν to an element of a set C. An element c ∈
C is called a category.
Intuitively, τ classifies valuations into categories;
we call it a categorization function. Two valuations
ν and ν' are in the same equivalence class if
τ(ν) = τ(ν'). We note this ν ~ ν'.
The kernel of τ is the partition of N induced by the
quotient N/~. Each subset contains the valuations
that belong to the same category.
algebra!
S. Hallé
Algebraic Definition of Coverage
Example
X = {x₀,x₁}
There are 4 valuations in N:
ν₀ = {x₀ ↦ ⊤, x₁ ↦ ⊤}
ν₁ = {x₀ ↦ ⊤, x₁ ↦ ⊥}
ν₂ = {x₀ ↦ ⊥, x₁ ↦ ⊤}
ν₃ = {x₀ ↦ ⊥, x₁ ↦ ⊥}
S. Hallé
Define τ : N → {0,1} as
τ(ν) ={0 if ν(x₀) = ⊤
1 otherwise
Algebraic Definition of Coverage
Example
X = {x₀,x₁}
There are 4 valuations in N:
ν₀ = {x₀ ↦ ⊤, x₁ ↦ ⊤}
ν₁ = {x₀ ↦ ⊤, x₁ ↦ ⊥}
ν₂ = {x₀ ↦ ⊥, x₁ ↦ ⊤}
ν₃ = {x₀ ↦ ⊥, x₁ ↦ ⊥}
S. Hallé
Define τ : N → {0,1} as
τ(ν) ={0 if ν(x₀) ≠ ν(x₁)
1 otherwise
Algebraic Definition of Coverage
Example
X = {x₀,x₁}
There are 4 valuations in N:
ν₀ = {x₀ ↦ ⊤, x₁ ↦ ⊤}
ν₁ = {x₀ ↦ ⊤, x₁ ↦ ⊥}
ν₂ = {x₀ ↦ ⊥, x₁ ↦ ⊤}
ν₃ = {x₀ ↦ ⊥, x₁ ↦ ⊥}
S. Hallé
Define τ : N → {0,1} as
τ(ν) = the number of true variables in ν
2
1
0
Algebraic Definition of Coverage
Example
X = {x₀,x₁}
There are 4 valuations in N:
ν₀ = {x₀ ↦ ⊤, x₁ ↦ ⊤}
ν₁ = {x₀ ↦ ⊤, x₁ ↦ ⊥}
ν₂ = {x₀ ↦ ⊥, x₁ ↦ ⊤}
ν₃ = {x₀ ↦ ⊥, x₁ ↦ ⊥}
S. Hallé
ECP: methodology where test cases are divided in
partitions
Equivalence Class Partitioning
S. Hallé
Set of all possible
test cases
ECP: methodology where test cases are divided in
partitions
Equivalence Class Partitioning
S. Hallé
Set of all possible
test cases
Equivalence classes
ECP: methodology where test cases are divided in
partitions
Equivalence Class Partitioning
S. Hallé
Set of all possible
test cases
Equivalence classes
ECP: methodology where test cases are divided in
partitions
Equivalence Class Partitioning
Chosen test cases
S. Hallé
ECP: methodology where test cases are divided in
partitions
Equivalence Class Partitioning
Set of all possible
valuations (N)
Equivalence classes induced by τ
Representatives
S. Hallé
Algebraic Definition of Coverage
A test suite is a set of valuations (i.e. an element
V ∈ 2 ).
N
Define 𝜏(V) = ⋃
𝜈 ∈ V
{𝜏(𝜈)}
"the set of categories
present in the test suite"
A Boolean condition coverage criterion is called
algebraic if...
for every Boolean formula 𝜑,
there exists a function 𝜏,
such that a test suite V satisfies the criterion
if and only if 𝜏(V) = 𝜏(N). "all categories are
represented in V"
S. Hallé
𝜌(V) ∈ [0,1], and full coverage means 𝜌(V) = 1.
Algebraic Definition of Coverage
If a test suite V achieves partial coverage, it can
easily be quantified:
𝜌(V) =
𝜏(V)
𝜏(N)
coverage ratio of V fraction of all
categories that are
present in V
Note that we did not need to specify what specific
criterion we are talking about!
S. Hallé
Evaluation Trees
∧
∨ ¬
a ¬ c
b
∨
¬ b
c
φ = (a ∨ ¬b ∨ c) ∧ ¬(¬c ∨ b)
A valuation ν applied on a formula φ induces a
structure called an evaluation tree.
S. Hallé
ν = {a ↦ ⊤, b ↦ ⊥, c ↦ ⊤}
Each valuation "colors" the
structure differently
Each combination of ν and φ
produces a unique tree
Define as eν(φ) the function that produces
the evaluation tree of φ[ν].
Evaluation Trees
∧
∨ ¬
a ¬ c
b
∨
¬ b
c
φ = (a ∨ ¬b ∨ c) ∧ ¬(¬c ∨ b)
A valuation ν applied on a formula φ induces a
structure called an evaluation tree.
S. Hallé
Tree Transformation
Let T be the set of trees. We define T* as the set of
trees where nodes can be labeled with .
A tree transformation is a function 𝜏 : T* → T* that
turns an evaluation tree into another one.
Since trees are obtained by evaluating formulas, we
let 𝜏ν : Φ → T* be the function such that
?
^
𝜏ν(φ) = 𝜏(eν(φ))
^
i.e. for a valuation ν, 𝜏ν gets the evaluation tree for
φ and applies the transformation 𝜏 to it.
^
S. Hallé
Tree Transformation
We are free to define 𝜏 as we want.
∨
∧ ∧ ∧
a ¬ c
b
¬ ¬
a b
¬ b ¬
a c
S. Hallé
Tree Transformation
We are free to define 𝜏 as we want.
∨
∧ ∧ ∧
a ¬ c
b
¬ ¬
a b
¬ b ¬
a c
∨
∧
Keep only the root and its immediate
children.
∧ ∧
S. Hallé
Tree Transformation
We are free to define 𝜏 as we want.
∨
∧ ∧ ∧
a ¬ c
b
¬ ¬
a b
¬ b ¬
a c
∨
? ∧ ?
Turn every child of the root, except
the second, into , and trim the
descendants of the second node.
?
S. Hallé
Tree Transformation
We are free to define 𝜏 as we want.
∨
∧ ∧ ∧
a ¬ c
b
¬ ¬
a b
¬ b ¬
a c
Put under the root a leaf labelled a
and a leaf labelled b, in that order.
∨
a b
S. Hallé
Tree Transformation
We are free to define 𝜏 as we want.
∨
∧ ∧ ∧
a ¬ c
b
¬ ¬
a b
¬ b ¬
a c
Under every connective node,
keep only subtrees until the
first that determines its color
∨
∧ ∧ ∧
a ¬ c
b
¬ ¬
a b
¬ b ¬
a c
S. Hallé
Tree Transformation
For a given formula φ, some tree transformations
map more than one valuation to the same tree.
∧
∨ ¬
a ¬ c
b
∨
¬ b
c
φ
𝜏 = keep only the root and its immediate children
= (a ∨ ¬b ∨ c) ∧ ¬(¬c ∨ b)
S. Hallé
Tree Transformation
For a given formula φ, some tree transformations
map more than one valuation to the same tree.
∧
∨ ¬
a ¬ c
b
∨
¬ b
c
φ
𝜏 = keep only the root and its immediate children
= (a ∨ ¬b ∨ c) ∧ ¬(¬c ∨ b)
∧
∨ ¬
{a ↦ ⊥, b ↦ ⊤, c ↦ ⊥}
^
𝜏
S. Hallé
Tree Transformation
For a given formula φ, some tree transformations
map more than one valuation to the same tree.
∧
∨ ¬
a ¬ c
b
∨
¬ b
c
φ
𝜏 = keep only the root and its immediate children
= (a ∨ ¬b ∨ c) ∧ ¬(¬c ∨ b)
∧
∨ ¬
{a ↦ ⊥, b ↦ ⊤, c ↦ ⊥}
^
𝜏
{a ↦ ⊥, b ↦ ⊥, c ↦ ⊤}
{a ↦ ⊤, b ↦ ⊥, c ↦ ⊤}
∧
∨ ¬
^
𝜏
S. Hallé
Tree Transformation
For a given formula φ, some tree transformations
map more than one valuation to the same tree.
∧
∨ ¬
a ¬ c
b
∨
¬ b
c
φ
𝜏 = keep only the root and its immediate children
= (a ∨ ¬b ∨ c) ∧ ¬(¬c ∨ b)
∧
∨ ¬
{a ↦ ⊥, b ↦ ⊤, c ↦ ⊥}
^
𝜏
{a ↦ ⊥, b ↦ ⊥, c ↦ ⊤}
{a ↦ ⊤, b ↦ ⊥, c ↦ ⊤}
∧
∨ ¬
^
𝜏
∧
∨ ¬
^
𝜏
{a ↦ ⊥, b ↦ ⊥, c ↦ ⊥}
{a ↦ ⊥, b ↦ ⊤, c ↦ ⊤}
{a ↦ ⊤, b ↦ ⊥, c ↦ ⊥}
{a ↦ ⊤, b ↦ ⊤, c ↦ ⊥}
{a ↦ ⊤, b ↦ ⊤, c ↦ ⊤}
S. Hallé
Tree Transformation
Key observation: for a given formula, a tree
transformation partitions the set of valuations
according to the tree each is mapped to...
∧
∨ ¬
∧
∨ ¬
{⊥⊥⊤,⊤⊥⊤} ∅
∧
∨ ¬
∧
∨ ¬
{⊥⊥⊥,⊥⊤⊤,
⊤⊥⊥,⊤⊤⊥,⊤⊤⊤}
{⊥⊤⊥}
⇒ it defines an algebraic coverage criterion!
S. Hallé
1.
Questions
Are the coverage criteria mentioned earlier
algebraic?
2. If so, can we find a tree transformation for each
that results in the same partitioning of the test
input space?
S. Hallé
1.
Questions
Are the coverage criteria mentioned earlier
algebraic?
2. If so, can we find a tree transformation for each
that results in the same partitioning of the test
input space?
YES (except MUMCUT*)
*An over-approximation is shown to be algebraic
S. Hallé
1.
Questions
Are the coverage criteria mentioned earlier
algebraic?
2. If so, can we find a tree transformation for each
that results in the same partitioning of the test
input space?
YES (except MUMCUT*)
*An over-approximation is shown to be algebraic
YES (all details in the paper)
S. Hallé
Define 𝜏ₙ as:
An Example
Turn the root and every child of the root, except
the n-th, into , and trim the descendants of the
n-th node.
?
S. Hallé
Define 𝜏ₙ as:
An Example
Turn the root and every child of the root, except
the n-th, into , and trim the descendants of the
n-th node.
?
(x₀ ∧ ¬x₁ ∧ x₂) ∨ (x₁ ∧ x₃) ∨ (¬x₀ ∧ x₂ ∧ x₃)
Valuations are classified by 𝜏ₙ depending on the
value they give to the n-th clause.
n=2
? ∧ ? ? ∧ ?
? ?
?
∧ ? ?
∧ ?
? ?
n=1
? ∧
? ? ∧
?
? ?
n=3
S. Hallé
Define 𝜏ₙ as:
An Example
Turn the root and every child of the root, except
the n-th, into , and trim the descendants of the
n-th node.
?
(x₀ ∧ ¬x₁ ∧ x₂) ∨ (x₁ ∧ x₃) ∨ (¬x₀ ∧ x₂ ∧ x₃)
Valuations are classified by 𝜏ₙ depending on the
value they give to the n-th clause.
n=2
? ∧ ? ? ∧ ?
? ?
?
∧ ? ?
∧ ?
? ?
n=1
? ∧
? ? ∧
?
? ?
n=3
One valuation for each tree ⇒ clause coverage
S. Hallé
We define appropriate transformations for all
coverage criteria shown earlier... except MUMCUT.
A Word About MUMCUT
MUTP: each variable not in a UTP must be true/
false in at least one test
MNFP: each variable not in a NFP must be true/
false in at least one test
CUTP-NFP: all pairs of UTP and NFP for the same
clause that differ by a single variable flip must be
present
MUMCUT Coverage
1
2
3
S. Hallé
✓
algebraic
✓
algebraic
not algebraic? ?
We define appropriate transformations for all
coverage criteria shown earlier... except MUMCUT.
A Word About MUMCUT
MUTP: each variable not in a UTP must be true/
false in at least one test
MNFP: each variable not in a NFP must be true/
false in at least one test
CUTP-NFP: all pairs of UTP and NFP for the same
clause that differ by a single variable flip must be
present
MUMCUT Coverage
1
2
3
S. Hallé
✓
algebraic
✓
algebraic
not algebraic? ?
CUTP-NFP is defined on pairs of valuations, and not
on individual valuations
We define appropriate transformations for all
coverage criteria shown earlier... except MUMCUT.
A Word About MUMCUT
MUTP: each variable not in a UTP must be true/
false in at least one test
MNFP: each variable not in a NFP must be true/
false in at least one test
CUTP-NFP: all pairs of UTP and NFP for the same
clause that differ by a single variable flip must be
present
MUMCUT Coverage
1
2
3
S. Hallé
Generating Test Suites
A test suite for any algebraic criterion can be
obtained using the equivalence class partitioning
method. A possible way is using a hypergraph.
S. Hallé
Generating Test Suites
A test suite for any algebraic criterion can be
obtained using the equivalence class partitioning
method. A possible way is using a hypergraph.
⊥⊥⊤
⊥⊥⊥
⊥⊤⊤
⊤⊥⊥
⊤⊤⊥
⊤⊤⊤
⊥⊤⊥
⊤⊥⊤
1. Create one node for each valuation
S. Hallé
Generating Test Suites
A test suite for any algebraic criterion can be
obtained using the equivalence class partitioning
method. A possible way is using a hypergraph.
∧
∨
1
∧
∨
2
∧
∨
3 a 4 a 5
3
4
4
4
5
5
5
1
2
2
2
2
2. Add one hyperedge linking
the nodes mapped to
each tree induced by 𝜏
⊥⊥⊤
⊥⊥⊥
⊥⊤⊤
⊤⊥⊥
⊤⊤⊥
⊤⊤⊤
⊥⊤⊥
⊤⊥⊤
1. Create one node for each valuation
S. Hallé
Generating Test Suites
A test suite for any algebraic criterion can be
obtained using the equivalence class partitioning
method. A possible way is using a hypergraph.
∧
∨
1
∧
∨
2
∧
∨
3 a 4 a 5
3
4
4
4
5
5
5
1
2
2
2
2
2. Add one hyperedge linking
the nodes mapped to
each tree induced by 𝜏
⊥⊥⊤
⊥⊥⊥
⊥⊤⊤
⊤⊥⊥
⊤⊤⊥
⊤⊤⊤
⊥⊤⊥
⊤⊥⊤
1. Create one node for each valuation
3. Solve the hypergraph vertex
cover problem
S. Hallé
Generating Test Suites
A test suite for any algebraic criterion can be
obtained using the equivalence class partitioning
method. A possible way is using a hypergraph.
∧
∨
1
∧
∨
2
∧
∨
3 a 4 a 5
3
4
4
4
5
5
5
1
2
2
2
2
2. Add one hyperedge linking
the nodes mapped to
each tree induced by 𝜏
⊥⊥⊤
⊥⊥⊥
⊥⊤⊤
⊤⊥⊥
⊤⊤⊥
⊤⊤⊤
⊥⊤⊥
⊤⊥⊤
1. Create one node for each valuation
3. Solve the hypergraph vertex
cover problem
The selected nodes form the
test suite.
S. Hallé
Generating Test Suites
Cons
The hypergraph has 2|X|
nodes
The vertex cover problem has a high complexity
Pros
Guarantees full coverage for any algebraic
criterion
Optimal hypergraph cover ⇔ optimal test suite
Upper bound on complexity
Can solve for multiple criteria at once (instead of
separately + merging)
S. Hallé
Boolean Coverage Toolkit
These principles have been concretely implemented
in an open source Java library:
https://github.com/liflab/boolean-coverage-toolkit
Operator o = Or(And(a, Not(b), c),
And(Not(a), Not(b)), And(Not(a), b, Not(c)));
HologramNode n1 = o.evaluate(new Valuation(false,
false, true));
Truncation t = new FailFast(2);
HologramNode n2 = t.applyTo(n1);
Set<Truncation> set = new HashSet<>();
set.add(new KeepTop(2));
set.add(new KeepVariable(a));
HypergraphGenerator g = new HypergraphGenerator();
Hypergraph h = g.getGraph(o, set);
Iterator<?> it =
HittingSetRunner.runHittingSet(h).iterator();
while (it.hasNext()) {
Valuation v = g.getValuation(it.next());
}
S. Hallé
Create Boolean condition
Boolean Coverage Toolkit
These principles have been concretely implemented
in an open source Java library:
https://github.com/liflab/boolean-coverage-toolkit
Operator o = Or(And(a, Not(b), c),
And(Not(a), Not(b)), And(Not(a), b, Not(c)));
HologramNode n1 = o.evaluate(new Valuation(false,
false, true));
Truncation t = new FailFast(2);
HologramNode n2 = t.applyTo(n1);
Set<Truncation> set = new HashSet<>();
set.add(new KeepTop(2));
set.add(new KeepVariable(a));
HypergraphGenerator g = new HypergraphGenerator();
Hypergraph h = g.getGraph(o, set);
Iterator<?> it =
HittingSetRunner.runHittingSet(h).iterator();
while (it.hasNext()) {
Valuation v = g.getValuation(it.next());
}
S. Hallé
Create Boolean condition
Obtain an expression tree
and apply a transformation
Boolean Coverage Toolkit
These principles have been concretely implemented
in an open source Java library:
https://github.com/liflab/boolean-coverage-toolkit
Operator o = Or(And(a, Not(b), c),
And(Not(a), Not(b)), And(Not(a), b, Not(c)));
HologramNode n1 = o.evaluate(new Valuation(false,
false, true));
Truncation t = new FailFast(2);
HologramNode n2 = t.applyTo(n1);
Set<Truncation> set = new HashSet<>();
set.add(new KeepTop(2));
set.add(new KeepVariable(a));
HypergraphGenerator g = new HypergraphGenerator();
Hypergraph h = g.getGraph(o, set);
Iterator<?> it =
HittingSetRunner.runHittingSet(h).iterator();
while (it.hasNext()) {
Valuation v = g.getValuation(it.next());
}
S. Hallé
Create Boolean condition
Obtain an expression tree
and apply a transformation
Create tree transformations
Boolean Coverage Toolkit
These principles have been concretely implemented
in an open source Java library:
https://github.com/liflab/boolean-coverage-toolkit
Operator o = Or(And(a, Not(b), c),
And(Not(a), Not(b)), And(Not(a), b, Not(c)));
HologramNode n1 = o.evaluate(new Valuation(false,
false, true));
Truncation t = new FailFast(2);
HologramNode n2 = t.applyTo(n1);
Set<Truncation> set = new HashSet<>();
set.add(new KeepTop(2));
set.add(new KeepVariable(a));
HypergraphGenerator g = new HypergraphGenerator();
Hypergraph h = g.getGraph(o, set);
Iterator<?> it =
HittingSetRunner.runHittingSet(h).iterator();
while (it.hasNext()) {
Valuation v = g.getValuation(it.next());
}
S. Hallé
Create Boolean condition
Obtain an expression tree
and apply a transformation
Create tree transformations
Generate and solve
hypergraph
Boolean Coverage Toolkit
These principles have been concretely implemented
in an open source Java library:
https://github.com/liflab/boolean-coverage-toolkit
Operator o = Or(And(a, Not(b), c),
And(Not(a), Not(b)), And(Not(a), b, Not(c)));
HologramNode n1 = o.evaluate(new Valuation(false,
false, true));
Truncation t = new FailFast(2);
HologramNode n2 = t.applyTo(n1);
Set<Truncation> set = new HashSet<>();
set.add(new KeepTop(2));
set.add(new KeepVariable(a));
HypergraphGenerator g = new HypergraphGenerator();
Hypergraph h = g.getGraph(o, set);
Iterator<?> it =
HittingSetRunner.runHittingSet(h).iterator();
while (it.hasNext()) {
Valuation v = g.getValuation(it.next());
}
S. Hallé
Create Boolean condition
Obtain an expression tree
and apply a transformation
Create tree transformations
Generate and solve
hypergraph
Iterate over valuations of
the solution
Boolean Coverage Toolkit
These principles have been concretely implemented
in an open source Java library:
https://github.com/liflab/boolean-coverage-toolkit
Operator o = Or(And(a, Not(b), c),
And(Not(a), Not(b)), And(Not(a), b, Not(c)));
HologramNode n1 = o.evaluate(new Valuation(false,
false, true));
Truncation t = new FailFast(2);
HologramNode n2 = t.applyTo(n1);
Set<Truncation> set = new HashSet<>();
set.add(new KeepTop(2));
set.add(new KeepVariable(a));
HypergraphGenerator g = new HypergraphGenerator();
Hypergraph h = g.getGraph(o, set);
Iterator<?> it =
HittingSetRunner.runHittingSet(h).iterator();
while (it.hasNext()) {
Valuation v = g.getValuation(it.next());
}
S. Hallé
Experiments
We can compare the hypergraph-based approach
with existing tools and techniques:
Random selection
ACTS (combinatorial coverage)
mcdc (MC/DC coverage)
and results published in past papers
(implementation unavailable).
S. Hallé
Experiments
Test suite size
0
2
4
6
8
10
12
14
2 4 6 8 10 12 14
Hypergraph
MCDC
SAT
0
200
400
600
800
1000
1200
1400
1600
1800
0 200 400 600 800 1000 1200 1400 1600 1800
Hypergraph
Chen
G-CUN
MC/DC MUMCUT
The hypergraph approach generates test suites of
comparable size for MC/DC, but larger for
MUMCUT (over-approximated)
S. Hallé
Experiments
Solving for two criteria at once
Criteria Size ratio Time ratio
MC/DC + Clause
MC/DC + Predicate
MC/DC + MUMCUT
MC/DC + 2-way
MC/DC + 3-way
Clause + 2-way
Clause + 3-way
0.87
0.85
0.99
0.76
0.83
0.83
0.87
1.27
1.29
1.38
1.20
1.11
1.24
1.11
The hypergraph approach takes more time, but
produces smaller test suites than when two
independent solutions are merged
S. Hallé
Conclusion
Uniform theoretical framework to define coverage
criteria as equivalence classes induced by a tree
transformation
Generic algorithm to produce test suites according
to any algebraic coverage criterion
Opens the way to experiments with new coverage
criteria and benchmarking of existing ones.
Future work: extension to other logics, such as
temporal/description logics

More Related Content

Similar to Test Suite Generation for Boolean Conditions with Equivalence Class Partitioning (20)

PPT
11 whiteboxtesting
asifusman1998
 
PPS
Lesson 2....PPT 1
bhushan Nehete
 
PPTX
Testing part 2 bb
Ravi Prakash
 
PPT
testing(2).pptjjsieieo2i33kejjskskosowwiwk
mhuzaifasultan8
 
PPT
Whitebox testing
Oana Feidi
 
PPT
Testing Fundamentals
Kiran Kumar
 
DOC
White box-sol
Nguyen Duc Nhieu
 
PPT
Whitebox
Oana Feidi
 
PDF
Decision Testing and Decision Coverage. ISTQB Whitebox techniques with TestCo...
Radoslaw Smilgin
 
PPTX
Mathematic iii test case
syafiqahrahimi
 
PPTX
Mathematic iii test case
syafiqahrahimi
 
PPT
2. Lect 27 to 28 White box s/w testing.ppt
KomalSinghGill
 
PPTX
Software Testing Foundations Part 5 - White Box Testing
Nikita Knysh
 
PPTX
Structural Testing: When Quality Really Matters
TechWell
 
PPTX
Coding and testing In Software Engineering
Satya Bhushan Verma
 
PPT
white box testing.ppt
VISHNUSHANKARSINGH3
 
PDF
Tester contribution to Testing Effectiveness. An Empirical Research
Natalia Juristo
 
PDF
Software Engineering : Software testing
Ajit Nayak
 
PPS
Testing techniques
RaginiRohatgi
 
PPT
12 white box testing-fixed
Jasmine Tulin
 
11 whiteboxtesting
asifusman1998
 
Lesson 2....PPT 1
bhushan Nehete
 
Testing part 2 bb
Ravi Prakash
 
testing(2).pptjjsieieo2i33kejjskskosowwiwk
mhuzaifasultan8
 
Whitebox testing
Oana Feidi
 
Testing Fundamentals
Kiran Kumar
 
White box-sol
Nguyen Duc Nhieu
 
Whitebox
Oana Feidi
 
Decision Testing and Decision Coverage. ISTQB Whitebox techniques with TestCo...
Radoslaw Smilgin
 
Mathematic iii test case
syafiqahrahimi
 
Mathematic iii test case
syafiqahrahimi
 
2. Lect 27 to 28 White box s/w testing.ppt
KomalSinghGill
 
Software Testing Foundations Part 5 - White Box Testing
Nikita Knysh
 
Structural Testing: When Quality Really Matters
TechWell
 
Coding and testing In Software Engineering
Satya Bhushan Verma
 
white box testing.ppt
VISHNUSHANKARSINGH3
 
Tester contribution to Testing Effectiveness. An Empirical Research
Natalia Juristo
 
Software Engineering : Software testing
Ajit Nayak
 
Testing techniques
RaginiRohatgi
 
12 white box testing-fixed
Jasmine Tulin
 

More from Sylvain Hallé (20)

PDF
A Tree-Based Definition of Business Process Conformance (Talk @ EDOC 2024)
Sylvain Hallé
 
PDF
Monitoring Business Process Compliance Across Multiple Executions with Stream...
Sylvain Hallé
 
PDF
A Stream-Based Approach to Intrusion Detection
Sylvain Hallé
 
PDF
Event Stream Processing with BeepBeep 3
Sylvain Hallé
 
PDF
Smart Contracts-Enabled Simulation for Hyperconnected Logistics
Sylvain Hallé
 
PDF
Synthia: a Generic and Flexible Data Structure Generator (Long Version)
Sylvain Hallé
 
PDF
Test Sequence Generation with Cayley Graphs (Talk @ A-MOST 2021)
Sylvain Hallé
 
PDF
Efficient Offline Monitoring of LTL with Bit Vectors (Talk at SAC 2021)
Sylvain Hallé
 
PDF
A Generic Explainability Framework for Function Circuits
Sylvain Hallé
 
PDF
Detecting Responsive Web Design Bugs with Declarative Specifications
Sylvain Hallé
 
PDF
Streamlining the Inclusion of Computer Experiments in Research Papers
Sylvain Hallé
 
PDF
Writing Domain-Specific Languages for BeepBeep
Sylvain Hallé
 
PDF
Real-Time Data Mining for Event Streams
Sylvain Hallé
 
PDF
Technologies intelligentes d'aide au développement d'applications web (WAQ 2018)
Sylvain Hallé
 
PDF
Mining event streams with BeepBeep 3
Sylvain Hallé
 
PDF
LabPal: Repeatable Computer Experiments Made Easy (ACM Workshop Talk)
Sylvain Hallé
 
PDF
A "Do-It-Yourself" Specification Language with BeepBeep 3 (Talk @ Dagstuhl 2017)
Sylvain Hallé
 
PDF
Event Stream Processing with Multiple Threads
Sylvain Hallé
 
PDF
A Few Things We Heard About RV Tools (Position Paper)
Sylvain Hallé
 
PDF
Solving Equations on Words with Morphisms and Antimorphisms
Sylvain Hallé
 
A Tree-Based Definition of Business Process Conformance (Talk @ EDOC 2024)
Sylvain Hallé
 
Monitoring Business Process Compliance Across Multiple Executions with Stream...
Sylvain Hallé
 
A Stream-Based Approach to Intrusion Detection
Sylvain Hallé
 
Event Stream Processing with BeepBeep 3
Sylvain Hallé
 
Smart Contracts-Enabled Simulation for Hyperconnected Logistics
Sylvain Hallé
 
Synthia: a Generic and Flexible Data Structure Generator (Long Version)
Sylvain Hallé
 
Test Sequence Generation with Cayley Graphs (Talk @ A-MOST 2021)
Sylvain Hallé
 
Efficient Offline Monitoring of LTL with Bit Vectors (Talk at SAC 2021)
Sylvain Hallé
 
A Generic Explainability Framework for Function Circuits
Sylvain Hallé
 
Detecting Responsive Web Design Bugs with Declarative Specifications
Sylvain Hallé
 
Streamlining the Inclusion of Computer Experiments in Research Papers
Sylvain Hallé
 
Writing Domain-Specific Languages for BeepBeep
Sylvain Hallé
 
Real-Time Data Mining for Event Streams
Sylvain Hallé
 
Technologies intelligentes d'aide au développement d'applications web (WAQ 2018)
Sylvain Hallé
 
Mining event streams with BeepBeep 3
Sylvain Hallé
 
LabPal: Repeatable Computer Experiments Made Easy (ACM Workshop Talk)
Sylvain Hallé
 
A "Do-It-Yourself" Specification Language with BeepBeep 3 (Talk @ Dagstuhl 2017)
Sylvain Hallé
 
Event Stream Processing with Multiple Threads
Sylvain Hallé
 
A Few Things We Heard About RV Tools (Position Paper)
Sylvain Hallé
 
Solving Equations on Words with Morphisms and Antimorphisms
Sylvain Hallé
 
Ad

Recently uploaded (20)

PDF
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
PPTX
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
PDF
Transcript: Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
PDF
What’s my job again? Slides from Mark Simos talk at 2025 Tampa BSides
Mark Simos
 
PDF
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
PDF
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
PPTX
Agentforce World Tour Toronto '25 - Supercharge MuleSoft Development with Mod...
Alexandra N. Martinez
 
PPTX
Future Tech Innovations 2025 – A TechLists Insight
TechLists
 
PPTX
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
PDF
“Computer Vision at Sea: Automated Fish Tracking for Sustainable Fishing,” a ...
Edge AI and Vision Alliance
 
PDF
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
PPTX
Agentforce World Tour Toronto '25 - MCP with MuleSoft
Alexandra N. Martinez
 
PDF
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
PPTX
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
PDF
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
PDF
Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
PDF
Go Concurrency Real-World Patterns, Pitfalls, and Playground Battles.pdf
Emily Achieng
 
PDF
Peak of Data & AI Encore AI-Enhanced Workflows for the Real World
Safe Software
 
PDF
SIZING YOUR AIR CONDITIONER---A PRACTICAL GUIDE.pdf
Muhammad Rizwan Akram
 
PDF
How do you fast track Agentic automation use cases discovery?
DianaGray10
 
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
Transcript: Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
What’s my job again? Slides from Mark Simos talk at 2025 Tampa BSides
Mark Simos
 
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
Agentforce World Tour Toronto '25 - Supercharge MuleSoft Development with Mod...
Alexandra N. Martinez
 
Future Tech Innovations 2025 – A TechLists Insight
TechLists
 
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
“Computer Vision at Sea: Automated Fish Tracking for Sustainable Fishing,” a ...
Edge AI and Vision Alliance
 
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
Agentforce World Tour Toronto '25 - MCP with MuleSoft
Alexandra N. Martinez
 
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
Go Concurrency Real-World Patterns, Pitfalls, and Playground Battles.pdf
Emily Achieng
 
Peak of Data & AI Encore AI-Enhanced Workflows for the Real World
Safe Software
 
SIZING YOUR AIR CONDITIONER---A PRACTICAL GUIDE.pdf
Muhammad Rizwan Akram
 
How do you fast track Agentic automation use cases discovery?
DianaGray10
 
Ad

Test Suite Generation for Boolean Conditions with Equivalence Class Partitioning

  • 1. S. Hallé Sylvain Hallé Université du Québec à Chicoutimi CANADA Test Suite Generation for Boolean Conditions with Equivalence Class Partitioning CRSNG NSERC FormaliSE, May 2022
  • 2. S. Hallé Boolean Conditions Software systems are filled with conditions that modulate their behavior. SELECT name FROM employees WHERE YEAR(dob) < 1990 AND rank = 3; if (a % 3 == 0 || (b > c + 6 && o.isReady()) { ... } Italic Bold + Underline OK Reversed + c1 a (8/1) =b ≠b (4/2) <2 >2 ⊤ ⊤ =2 c3 (7/2) =0 ≠0 (3/1) ⊤ ⊤ a ≠c =c (10/3) ⊤ (7/2) =0 ≠0 (3/1) ⊤ ⊤ c2
  • 3. S. Hallé Boolean Conditions Test input generation is the problem of (automatically) generating values given to a system if (a % 3 == 0 || (b > c + 6 && o.isReady()) { ... }
  • 4. S. Hallé Boolean Conditions Test input generation is the problem of (automatically) generating values given to a system if (a % 3 == 0 || (b > c + 6 && o.isReady()) { ... } a = 3 b = 2 c = 1 o.isReady() = true test case
  • 5. S. Hallé Boolean Conditions Test input generation is the problem of (automatically) generating values given to a system if (a % 3 == 0 || (b > c + 6 && o.isReady()) { ... } a = 3 b = 2 c = 1 o.isReady() = true test case 1 1
  • 6. S. Hallé Boolean Conditions Test input generation is the problem of (automatically) generating values given to a system if (a % 3 == 0 || (b > c + 6 && o.isReady()) { ... } a = 3 b = 2 c = 1 o.isReady() = true test case else { ... } 2 a = 1 b = 2 c = 2 o.isReady() = false 2 Different values send the execution on different paths 1 1
  • 7. S. Hallé ...but what if the condition is incorrect? Boolean Conditions Test input generation is the problem of (automatically) generating values given to a system if (a % 3 == 0 || (b > c + 6 && o.isReady()) { ... } a = 3 b = 2 c = 1 o.isReady() = true test case else { ... } 2 a = 1 b = 2 c = 2 o.isReady() = false 2 Different values send the execution on different paths 1 1
  • 8. S. Hallé We must generate a test input for which the condition sends the execution in the wrong branch Boolean Conditions a % 3 == 0 || (b > c + 6 && o.isReady()) a % 3 == 0 || (b ≥ c + 6 && o.isReady()) ACTUAL EXPECTED
  • 9. S. Hallé a = 0 b = 6 c = 0 o.isReady() = true 4 We must generate a test input for which the condition sends the execution in the wrong branch Boolean Conditions a % 3 == 0 || (b > c + 6 && o.isReady()) a % 3 == 0 || (b ≥ c + 6 && o.isReady()) ACTUAL EXPECTED
  • 10. S. Hallé a = 0 b = 6 c = 0 o.isReady() = true 4 ⊤ ⊥ ⊤ ⊤ ⊤ ⊤ ⊤ ⊤ + We must generate a test input for which the condition sends the execution in the wrong branch Boolean Conditions a % 3 == 0 || (b > c + 6 && o.isReady()) a % 3 == 0 || (b ≥ c + 6 && o.isReady()) ACTUAL EXPECTED
  • 11. S. Hallé a = 0 b = 6 c = 0 o.isReady() = true a = 1 b = 7 c = 1 o.isReady() = false + 4 5 We must generate a test input for which the condition sends the execution in the wrong branch Boolean Conditions a % 3 == 0 || (b > c + 6 && o.isReady()) a % 3 == 0 || (b ≥ c + 6 && o.isReady()) ACTUAL EXPECTED
  • 12. S. Hallé a = 0 b = 6 c = 0 o.isReady() = true a = 1 b = 7 c = 1 o.isReady() = false + 4 5 ⊥ ⊥ ⊥ ⊥ ⊤ ⊥ ⊥ ⊥ + We must generate a test input for which the condition sends the execution in the wrong branch Boolean Conditions a % 3 == 0 || (b > c + 6 && o.isReady()) a % 3 == 0 || (b ≥ c + 6 && o.isReady()) ACTUAL EXPECTED
  • 13. S. Hallé a = 0 b = 6 c = 0 o.isReady() = true a = 1 b = 7 c = 1 o.isReady() = false + + a = 1 b = 7 c = 1 o.isReady() = true 4 5 6 We must generate a test input for which the condition sends the execution in the wrong branch Boolean Conditions a % 3 == 0 || (b > c + 6 && o.isReady()) a % 3 == 0 || (b ≥ c + 6 && o.isReady()) ACTUAL EXPECTED
  • 14. S. Hallé a = 0 b = 6 c = 0 o.isReady() = true a = 1 b = 7 c = 1 o.isReady() = false + + a = 1 b = 7 c = 1 o.isReady() = true 4 5 6 ⊥ ⊥ ⊤ ⊥ ⊤ ⊤ ⊥ ⊤ ✓ We must generate a test input for which the condition sends the execution in the wrong branch Boolean Conditions a % 3 == 0 || (b > c + 6 && o.isReady()) a % 3 == 0 || (b ≥ c + 6 && o.isReady()) ACTUAL EXPECTED
  • 15. S. Hallé Making the condition true/false once is not sufficient to reveal errors The components of the condition must evaluate to true/false in various combinations ⇒ Boolean condition coverage We must generate a test input for which the condition sends the execution in the wrong branch Boolean Conditions a % 3 == 0 || (b > c + 6 && o.isReady()) a % 3 == 0 || (b ≥ c + 6 && o.isReady()) ACTUAL EXPECTED
  • 16. S. Hallé Several coverage criteria for Boolean conditions have been proposed Coverage Criteria (x₀ ∧ ¬x₁ ∧ x₂) ∨ (x₁ ∧ x₃) ∨ (¬x₀ ∧ x₂ ∧ x₃)
  • 17. S. Hallé Several coverage criteria for Boolean conditions have been proposed Coverage Criteria (x₀ ∧ ¬x₁ ∧ x₂) ∨ (x₁ ∧ x₃) ∨ (¬x₀ ∧ x₂ ∧ x₃) Predicate coverage Each variable has a test case where it is true, and another test case where it is false
  • 18. S. Hallé Several coverage criteria for Boolean conditions have been proposed Coverage Criteria (x₀ ∧ ¬x₁ ∧ x₂) ∨ (x₁ ∧ x₃) ∨ (¬x₀ ∧ x₂ ∧ x₃) Combinatorial ("t-way") coverage Each t-tuple of variables has test cases for all combinations of their true/false values Example: for t=2
  • 19. S. Hallé Several coverage criteria for Boolean conditions have been proposed Coverage Criteria (x₀ ∧ ¬x₁ ∧ x₂) ∨ (x₁ ∧ x₃) ∨ (¬x₀ ∧ x₂ ∧ x₃) Clause coverage Each clause of the condition has a test case where it is true and another test case where it is false { clause
  • 20. S. Hallé Several coverage criteria for Boolean conditions have been proposed Coverage Criteria (x₀ ∧ ¬x₁ ∧ x₂) ∨ (x₁ ∧ x₃) ∨ (¬x₀ ∧ x₂ ∧ x₃) Modified condition/decision coverage (MC/DC) Predicate coverage + clause coverage + every clause is shown to independently affect the outcome
  • 21. S. Hallé Several coverage criteria for Boolean conditions have been proposed Coverage Criteria (x₀ ∧ ¬x₁ ∧ x₂) ∨ (x₁ ∧ x₃) ∨ (¬x₀ ∧ x₂ ∧ x₃) Modified condition/decision coverage (MC/DC) Predicate coverage + clause coverage + every clause is shown to independently affect the outcome ⊥ ⊥ ⊥ ⊥ x₀ = ⊥ x₁ = ⊥ x₂ = ⊥ x₃ = ⊥
  • 22. S. Hallé Several coverage criteria for Boolean conditions have been proposed Coverage Criteria (x₀ ∧ ¬x₁ ∧ x₂) ∨ (x₁ ∧ x₃) ∨ (¬x₀ ∧ x₂ ∧ x₃) Modified condition/decision coverage (MC/DC) Predicate coverage + clause coverage + every clause is shown to independently affect the outcome (x₀ ∧ ¬x₁ ∧ x₂) ∨ (x₁ ∧ x₃) ∨ (¬x₀ ∧ x₂ ∧ x₃) ⊥ ⊥ ⊤ ⊥ x₀ = ⊥ x₁ = ⊥ x₂ = ⊥ x₃ = ⊥ ⊤ x₀ = ⊥ x₁ = ⊤ x₂ = ⊥ x₃ = ⊤
  • 23. S. Hallé Several coverage criteria for Boolean conditions have been proposed Coverage Criteria (x₀ ∧ ¬x₁ ∧ x₂) ∨ (x₁ ∧ x₃) ∨ (¬x₀ ∧ x₂ ∧ x₃) MUMCUT Coverage 3 conditions expressed in terms of:
  • 24. S. Hallé Several coverage criteria for Boolean conditions have been proposed Coverage Criteria (x₀ ∧ ¬x₁ ∧ x₂) ∨ (x₁ ∧ x₃) ∨ (¬x₀ ∧ x₂ ∧ x₃) MUMCUT Coverage 3 conditions expressed in terms of: Unique true point (UTP): test case that makes a single clause evaluate to ⊤
  • 25. S. Hallé Several coverage criteria for Boolean conditions have been proposed Coverage Criteria (x₀ ∧ ¬x₁ ∧ x₂) ∨ (x₁ ∧ x₃) ∨ (¬x₀ ∧ x₂ ∧ x₃) MUMCUT Coverage 3 conditions expressed in terms of: Unique true point (UTP): test case that makes a single clause evaluate to ⊤ x₀ = ⊥ x₁ = ⊤ x₂ = ⊥ x₃ = ⊤ ⊥ ⊤ ⊥
  • 26. S. Hallé Several coverage criteria for Boolean conditions have been proposed Coverage Criteria (x₀ ∧ ¬x₁ ∧ x₂) ∨ (x₁ ∧ x₃) ∨ (¬x₀ ∧ x₂ ∧ x₃) MUMCUT Coverage 3 conditions expressed in terms of: Unique true point (UTP): test case that makes a single clause evaluate to ⊤ Near false point (NFP): test case where the condition is ⊥, but flipping a single variable changes its value
  • 27. S. Hallé Several coverage criteria for Boolean conditions have been proposed Coverage Criteria (x₀ ∧ ¬x₁ ∧ x₂) ∨ (x₁ ∧ x₃) ∨ (¬x₀ ∧ x₂ ∧ x₃) MUMCUT Coverage 3 conditions expressed in terms of: Unique true point (UTP): test case that makes a single clause evaluate to ⊤ Near false point (NFP): test case where the condition is ⊥, but flipping a single variable changes its value ⊥ ⊥ ⊥ x₀ = ⊥ x₁ = ⊥ x₂ = ⊥ x₃ = ⊤
  • 28. S. Hallé Several coverage criteria for Boolean conditions have been proposed Coverage Criteria (x₀ ∧ ¬x₁ ∧ x₂) ∨ (x₁ ∧ x₃) ∨ (¬x₀ ∧ x₂ ∧ x₃) MUTP: each variable not in a UTP must be true/ false in at least one test MNFP: each variable not in a NFP must be true/ false in at least one test CUTP-NFP: all pairs of UTP and NFP for the same clause that differ by a single variable flip must be present MUMCUT Coverage 1 2 3
  • 29. S. Hallé Each coverage criterion is expressed informally; no uniform formal notation to define them all Each criterion comes with its own algorithm to generate test cases; the correctness/optimality of these algorithms is often not demonstrated Concrete implementations of these algorithms are not easy to find (research papers); switching criteria means switching programs Must restart from scratch if developing a new coverage criterion In the current state of things... Coverage Criteria
  • 30. S. Hallé Foundations based on concepts of algebra Existing criteria become particular cases of this model Provides a test generation algorithm that works of any criterion Comes with a concrete and freely available implementation Goal: define a formal model of Boolean condition coverage Contribution
  • 31. S. Hallé Algebraic Definition of Coverage Let X be a set of arbitrary symbols (variables). A valuation is a total function ν : X → {⊤,⊥}. We define as N the set of all valuations. We denote by φ[ν] the result of evaluating φ by setting its variables to the values defined by ν. Let Φ be the set of Boolean formulas with variables in X. A valuation ν ∈ N is a specific way of evaluating a condition φ ∈ Φ. Example: X = {x₀,x₁} ν(x₀) = ⊤, ν(x₁) = ⊥ φ = x₀ ∧ ¬x₁ φ[ν] = ⊤
  • 32. S. Hallé Algebraic Definition of Coverage Let τ : N → C be a total function mapping each valuation ν to an element of a set C. An element c ∈ C is called a category. Intuitively, τ classifies valuations into categories; we call it a categorization function. Two valuations ν and ν' are in the same equivalence class if τ(ν) = τ(ν'). We note this ν ~ ν'. The kernel of τ is the partition of N induced by the quotient N/~. Each subset contains the valuations that belong to the same category. algebra!
  • 33. S. Hallé Algebraic Definition of Coverage Example X = {x₀,x₁} There are 4 valuations in N: ν₀ = {x₀ ↦ ⊤, x₁ ↦ ⊤} ν₁ = {x₀ ↦ ⊤, x₁ ↦ ⊥} ν₂ = {x₀ ↦ ⊥, x₁ ↦ ⊤} ν₃ = {x₀ ↦ ⊥, x₁ ↦ ⊥}
  • 34. S. Hallé Define τ : N → {0,1} as τ(ν) ={0 if ν(x₀) = ⊤ 1 otherwise Algebraic Definition of Coverage Example X = {x₀,x₁} There are 4 valuations in N: ν₀ = {x₀ ↦ ⊤, x₁ ↦ ⊤} ν₁ = {x₀ ↦ ⊤, x₁ ↦ ⊥} ν₂ = {x₀ ↦ ⊥, x₁ ↦ ⊤} ν₃ = {x₀ ↦ ⊥, x₁ ↦ ⊥}
  • 35. S. Hallé Define τ : N → {0,1} as τ(ν) ={0 if ν(x₀) ≠ ν(x₁) 1 otherwise Algebraic Definition of Coverage Example X = {x₀,x₁} There are 4 valuations in N: ν₀ = {x₀ ↦ ⊤, x₁ ↦ ⊤} ν₁ = {x₀ ↦ ⊤, x₁ ↦ ⊥} ν₂ = {x₀ ↦ ⊥, x₁ ↦ ⊤} ν₃ = {x₀ ↦ ⊥, x₁ ↦ ⊥}
  • 36. S. Hallé Define τ : N → {0,1} as τ(ν) = the number of true variables in ν 2 1 0 Algebraic Definition of Coverage Example X = {x₀,x₁} There are 4 valuations in N: ν₀ = {x₀ ↦ ⊤, x₁ ↦ ⊤} ν₁ = {x₀ ↦ ⊤, x₁ ↦ ⊥} ν₂ = {x₀ ↦ ⊥, x₁ ↦ ⊤} ν₃ = {x₀ ↦ ⊥, x₁ ↦ ⊥}
  • 37. S. Hallé ECP: methodology where test cases are divided in partitions Equivalence Class Partitioning
  • 38. S. Hallé Set of all possible test cases ECP: methodology where test cases are divided in partitions Equivalence Class Partitioning
  • 39. S. Hallé Set of all possible test cases Equivalence classes ECP: methodology where test cases are divided in partitions Equivalence Class Partitioning
  • 40. S. Hallé Set of all possible test cases Equivalence classes ECP: methodology where test cases are divided in partitions Equivalence Class Partitioning Chosen test cases
  • 41. S. Hallé ECP: methodology where test cases are divided in partitions Equivalence Class Partitioning Set of all possible valuations (N) Equivalence classes induced by τ Representatives
  • 42. S. Hallé Algebraic Definition of Coverage A test suite is a set of valuations (i.e. an element V ∈ 2 ). N Define 𝜏(V) = ⋃ 𝜈 ∈ V {𝜏(𝜈)} "the set of categories present in the test suite" A Boolean condition coverage criterion is called algebraic if... for every Boolean formula 𝜑, there exists a function 𝜏, such that a test suite V satisfies the criterion if and only if 𝜏(V) = 𝜏(N). "all categories are represented in V"
  • 43. S. Hallé 𝜌(V) ∈ [0,1], and full coverage means 𝜌(V) = 1. Algebraic Definition of Coverage If a test suite V achieves partial coverage, it can easily be quantified: 𝜌(V) = 𝜏(V) 𝜏(N) coverage ratio of V fraction of all categories that are present in V Note that we did not need to specify what specific criterion we are talking about!
  • 44. S. Hallé Evaluation Trees ∧ ∨ ¬ a ¬ c b ∨ ¬ b c φ = (a ∨ ¬b ∨ c) ∧ ¬(¬c ∨ b) A valuation ν applied on a formula φ induces a structure called an evaluation tree.
  • 45. S. Hallé ν = {a ↦ ⊤, b ↦ ⊥, c ↦ ⊤} Each valuation "colors" the structure differently Each combination of ν and φ produces a unique tree Define as eν(φ) the function that produces the evaluation tree of φ[ν]. Evaluation Trees ∧ ∨ ¬ a ¬ c b ∨ ¬ b c φ = (a ∨ ¬b ∨ c) ∧ ¬(¬c ∨ b) A valuation ν applied on a formula φ induces a structure called an evaluation tree.
  • 46. S. Hallé Tree Transformation Let T be the set of trees. We define T* as the set of trees where nodes can be labeled with . A tree transformation is a function 𝜏 : T* → T* that turns an evaluation tree into another one. Since trees are obtained by evaluating formulas, we let 𝜏ν : Φ → T* be the function such that ? ^ 𝜏ν(φ) = 𝜏(eν(φ)) ^ i.e. for a valuation ν, 𝜏ν gets the evaluation tree for φ and applies the transformation 𝜏 to it. ^
  • 47. S. Hallé Tree Transformation We are free to define 𝜏 as we want. ∨ ∧ ∧ ∧ a ¬ c b ¬ ¬ a b ¬ b ¬ a c
  • 48. S. Hallé Tree Transformation We are free to define 𝜏 as we want. ∨ ∧ ∧ ∧ a ¬ c b ¬ ¬ a b ¬ b ¬ a c ∨ ∧ Keep only the root and its immediate children. ∧ ∧
  • 49. S. Hallé Tree Transformation We are free to define 𝜏 as we want. ∨ ∧ ∧ ∧ a ¬ c b ¬ ¬ a b ¬ b ¬ a c ∨ ? ∧ ? Turn every child of the root, except the second, into , and trim the descendants of the second node. ?
  • 50. S. Hallé Tree Transformation We are free to define 𝜏 as we want. ∨ ∧ ∧ ∧ a ¬ c b ¬ ¬ a b ¬ b ¬ a c Put under the root a leaf labelled a and a leaf labelled b, in that order. ∨ a b
  • 51. S. Hallé Tree Transformation We are free to define 𝜏 as we want. ∨ ∧ ∧ ∧ a ¬ c b ¬ ¬ a b ¬ b ¬ a c Under every connective node, keep only subtrees until the first that determines its color ∨ ∧ ∧ ∧ a ¬ c b ¬ ¬ a b ¬ b ¬ a c
  • 52. S. Hallé Tree Transformation For a given formula φ, some tree transformations map more than one valuation to the same tree. ∧ ∨ ¬ a ¬ c b ∨ ¬ b c φ 𝜏 = keep only the root and its immediate children = (a ∨ ¬b ∨ c) ∧ ¬(¬c ∨ b)
  • 53. S. Hallé Tree Transformation For a given formula φ, some tree transformations map more than one valuation to the same tree. ∧ ∨ ¬ a ¬ c b ∨ ¬ b c φ 𝜏 = keep only the root and its immediate children = (a ∨ ¬b ∨ c) ∧ ¬(¬c ∨ b) ∧ ∨ ¬ {a ↦ ⊥, b ↦ ⊤, c ↦ ⊥} ^ 𝜏
  • 54. S. Hallé Tree Transformation For a given formula φ, some tree transformations map more than one valuation to the same tree. ∧ ∨ ¬ a ¬ c b ∨ ¬ b c φ 𝜏 = keep only the root and its immediate children = (a ∨ ¬b ∨ c) ∧ ¬(¬c ∨ b) ∧ ∨ ¬ {a ↦ ⊥, b ↦ ⊤, c ↦ ⊥} ^ 𝜏 {a ↦ ⊥, b ↦ ⊥, c ↦ ⊤} {a ↦ ⊤, b ↦ ⊥, c ↦ ⊤} ∧ ∨ ¬ ^ 𝜏
  • 55. S. Hallé Tree Transformation For a given formula φ, some tree transformations map more than one valuation to the same tree. ∧ ∨ ¬ a ¬ c b ∨ ¬ b c φ 𝜏 = keep only the root and its immediate children = (a ∨ ¬b ∨ c) ∧ ¬(¬c ∨ b) ∧ ∨ ¬ {a ↦ ⊥, b ↦ ⊤, c ↦ ⊥} ^ 𝜏 {a ↦ ⊥, b ↦ ⊥, c ↦ ⊤} {a ↦ ⊤, b ↦ ⊥, c ↦ ⊤} ∧ ∨ ¬ ^ 𝜏 ∧ ∨ ¬ ^ 𝜏 {a ↦ ⊥, b ↦ ⊥, c ↦ ⊥} {a ↦ ⊥, b ↦ ⊤, c ↦ ⊤} {a ↦ ⊤, b ↦ ⊥, c ↦ ⊥} {a ↦ ⊤, b ↦ ⊤, c ↦ ⊥} {a ↦ ⊤, b ↦ ⊤, c ↦ ⊤}
  • 56. S. Hallé Tree Transformation Key observation: for a given formula, a tree transformation partitions the set of valuations according to the tree each is mapped to... ∧ ∨ ¬ ∧ ∨ ¬ {⊥⊥⊤,⊤⊥⊤} ∅ ∧ ∨ ¬ ∧ ∨ ¬ {⊥⊥⊥,⊥⊤⊤, ⊤⊥⊥,⊤⊤⊥,⊤⊤⊤} {⊥⊤⊥} ⇒ it defines an algebraic coverage criterion!
  • 57. S. Hallé 1. Questions Are the coverage criteria mentioned earlier algebraic? 2. If so, can we find a tree transformation for each that results in the same partitioning of the test input space?
  • 58. S. Hallé 1. Questions Are the coverage criteria mentioned earlier algebraic? 2. If so, can we find a tree transformation for each that results in the same partitioning of the test input space? YES (except MUMCUT*) *An over-approximation is shown to be algebraic
  • 59. S. Hallé 1. Questions Are the coverage criteria mentioned earlier algebraic? 2. If so, can we find a tree transformation for each that results in the same partitioning of the test input space? YES (except MUMCUT*) *An over-approximation is shown to be algebraic YES (all details in the paper)
  • 60. S. Hallé Define 𝜏ₙ as: An Example Turn the root and every child of the root, except the n-th, into , and trim the descendants of the n-th node. ?
  • 61. S. Hallé Define 𝜏ₙ as: An Example Turn the root and every child of the root, except the n-th, into , and trim the descendants of the n-th node. ? (x₀ ∧ ¬x₁ ∧ x₂) ∨ (x₁ ∧ x₃) ∨ (¬x₀ ∧ x₂ ∧ x₃) Valuations are classified by 𝜏ₙ depending on the value they give to the n-th clause. n=2 ? ∧ ? ? ∧ ? ? ? ? ∧ ? ? ∧ ? ? ? n=1 ? ∧ ? ? ∧ ? ? ? n=3
  • 62. S. Hallé Define 𝜏ₙ as: An Example Turn the root and every child of the root, except the n-th, into , and trim the descendants of the n-th node. ? (x₀ ∧ ¬x₁ ∧ x₂) ∨ (x₁ ∧ x₃) ∨ (¬x₀ ∧ x₂ ∧ x₃) Valuations are classified by 𝜏ₙ depending on the value they give to the n-th clause. n=2 ? ∧ ? ? ∧ ? ? ? ? ∧ ? ? ∧ ? ? ? n=1 ? ∧ ? ? ∧ ? ? ? n=3 One valuation for each tree ⇒ clause coverage
  • 63. S. Hallé We define appropriate transformations for all coverage criteria shown earlier... except MUMCUT. A Word About MUMCUT MUTP: each variable not in a UTP must be true/ false in at least one test MNFP: each variable not in a NFP must be true/ false in at least one test CUTP-NFP: all pairs of UTP and NFP for the same clause that differ by a single variable flip must be present MUMCUT Coverage 1 2 3
  • 64. S. Hallé ✓ algebraic ✓ algebraic not algebraic? ? We define appropriate transformations for all coverage criteria shown earlier... except MUMCUT. A Word About MUMCUT MUTP: each variable not in a UTP must be true/ false in at least one test MNFP: each variable not in a NFP must be true/ false in at least one test CUTP-NFP: all pairs of UTP and NFP for the same clause that differ by a single variable flip must be present MUMCUT Coverage 1 2 3
  • 65. S. Hallé ✓ algebraic ✓ algebraic not algebraic? ? CUTP-NFP is defined on pairs of valuations, and not on individual valuations We define appropriate transformations for all coverage criteria shown earlier... except MUMCUT. A Word About MUMCUT MUTP: each variable not in a UTP must be true/ false in at least one test MNFP: each variable not in a NFP must be true/ false in at least one test CUTP-NFP: all pairs of UTP and NFP for the same clause that differ by a single variable flip must be present MUMCUT Coverage 1 2 3
  • 66. S. Hallé Generating Test Suites A test suite for any algebraic criterion can be obtained using the equivalence class partitioning method. A possible way is using a hypergraph.
  • 67. S. Hallé Generating Test Suites A test suite for any algebraic criterion can be obtained using the equivalence class partitioning method. A possible way is using a hypergraph. ⊥⊥⊤ ⊥⊥⊥ ⊥⊤⊤ ⊤⊥⊥ ⊤⊤⊥ ⊤⊤⊤ ⊥⊤⊥ ⊤⊥⊤ 1. Create one node for each valuation
  • 68. S. Hallé Generating Test Suites A test suite for any algebraic criterion can be obtained using the equivalence class partitioning method. A possible way is using a hypergraph. ∧ ∨ 1 ∧ ∨ 2 ∧ ∨ 3 a 4 a 5 3 4 4 4 5 5 5 1 2 2 2 2 2. Add one hyperedge linking the nodes mapped to each tree induced by 𝜏 ⊥⊥⊤ ⊥⊥⊥ ⊥⊤⊤ ⊤⊥⊥ ⊤⊤⊥ ⊤⊤⊤ ⊥⊤⊥ ⊤⊥⊤ 1. Create one node for each valuation
  • 69. S. Hallé Generating Test Suites A test suite for any algebraic criterion can be obtained using the equivalence class partitioning method. A possible way is using a hypergraph. ∧ ∨ 1 ∧ ∨ 2 ∧ ∨ 3 a 4 a 5 3 4 4 4 5 5 5 1 2 2 2 2 2. Add one hyperedge linking the nodes mapped to each tree induced by 𝜏 ⊥⊥⊤ ⊥⊥⊥ ⊥⊤⊤ ⊤⊥⊥ ⊤⊤⊥ ⊤⊤⊤ ⊥⊤⊥ ⊤⊥⊤ 1. Create one node for each valuation 3. Solve the hypergraph vertex cover problem
  • 70. S. Hallé Generating Test Suites A test suite for any algebraic criterion can be obtained using the equivalence class partitioning method. A possible way is using a hypergraph. ∧ ∨ 1 ∧ ∨ 2 ∧ ∨ 3 a 4 a 5 3 4 4 4 5 5 5 1 2 2 2 2 2. Add one hyperedge linking the nodes mapped to each tree induced by 𝜏 ⊥⊥⊤ ⊥⊥⊥ ⊥⊤⊤ ⊤⊥⊥ ⊤⊤⊥ ⊤⊤⊤ ⊥⊤⊥ ⊤⊥⊤ 1. Create one node for each valuation 3. Solve the hypergraph vertex cover problem The selected nodes form the test suite.
  • 71. S. Hallé Generating Test Suites Cons The hypergraph has 2|X| nodes The vertex cover problem has a high complexity Pros Guarantees full coverage for any algebraic criterion Optimal hypergraph cover ⇔ optimal test suite Upper bound on complexity Can solve for multiple criteria at once (instead of separately + merging)
  • 72. S. Hallé Boolean Coverage Toolkit These principles have been concretely implemented in an open source Java library: https://github.com/liflab/boolean-coverage-toolkit Operator o = Or(And(a, Not(b), c), And(Not(a), Not(b)), And(Not(a), b, Not(c))); HologramNode n1 = o.evaluate(new Valuation(false, false, true)); Truncation t = new FailFast(2); HologramNode n2 = t.applyTo(n1); Set<Truncation> set = new HashSet<>(); set.add(new KeepTop(2)); set.add(new KeepVariable(a)); HypergraphGenerator g = new HypergraphGenerator(); Hypergraph h = g.getGraph(o, set); Iterator<?> it = HittingSetRunner.runHittingSet(h).iterator(); while (it.hasNext()) { Valuation v = g.getValuation(it.next()); }
  • 73. S. Hallé Create Boolean condition Boolean Coverage Toolkit These principles have been concretely implemented in an open source Java library: https://github.com/liflab/boolean-coverage-toolkit Operator o = Or(And(a, Not(b), c), And(Not(a), Not(b)), And(Not(a), b, Not(c))); HologramNode n1 = o.evaluate(new Valuation(false, false, true)); Truncation t = new FailFast(2); HologramNode n2 = t.applyTo(n1); Set<Truncation> set = new HashSet<>(); set.add(new KeepTop(2)); set.add(new KeepVariable(a)); HypergraphGenerator g = new HypergraphGenerator(); Hypergraph h = g.getGraph(o, set); Iterator<?> it = HittingSetRunner.runHittingSet(h).iterator(); while (it.hasNext()) { Valuation v = g.getValuation(it.next()); }
  • 74. S. Hallé Create Boolean condition Obtain an expression tree and apply a transformation Boolean Coverage Toolkit These principles have been concretely implemented in an open source Java library: https://github.com/liflab/boolean-coverage-toolkit Operator o = Or(And(a, Not(b), c), And(Not(a), Not(b)), And(Not(a), b, Not(c))); HologramNode n1 = o.evaluate(new Valuation(false, false, true)); Truncation t = new FailFast(2); HologramNode n2 = t.applyTo(n1); Set<Truncation> set = new HashSet<>(); set.add(new KeepTop(2)); set.add(new KeepVariable(a)); HypergraphGenerator g = new HypergraphGenerator(); Hypergraph h = g.getGraph(o, set); Iterator<?> it = HittingSetRunner.runHittingSet(h).iterator(); while (it.hasNext()) { Valuation v = g.getValuation(it.next()); }
  • 75. S. Hallé Create Boolean condition Obtain an expression tree and apply a transformation Create tree transformations Boolean Coverage Toolkit These principles have been concretely implemented in an open source Java library: https://github.com/liflab/boolean-coverage-toolkit Operator o = Or(And(a, Not(b), c), And(Not(a), Not(b)), And(Not(a), b, Not(c))); HologramNode n1 = o.evaluate(new Valuation(false, false, true)); Truncation t = new FailFast(2); HologramNode n2 = t.applyTo(n1); Set<Truncation> set = new HashSet<>(); set.add(new KeepTop(2)); set.add(new KeepVariable(a)); HypergraphGenerator g = new HypergraphGenerator(); Hypergraph h = g.getGraph(o, set); Iterator<?> it = HittingSetRunner.runHittingSet(h).iterator(); while (it.hasNext()) { Valuation v = g.getValuation(it.next()); }
  • 76. S. Hallé Create Boolean condition Obtain an expression tree and apply a transformation Create tree transformations Generate and solve hypergraph Boolean Coverage Toolkit These principles have been concretely implemented in an open source Java library: https://github.com/liflab/boolean-coverage-toolkit Operator o = Or(And(a, Not(b), c), And(Not(a), Not(b)), And(Not(a), b, Not(c))); HologramNode n1 = o.evaluate(new Valuation(false, false, true)); Truncation t = new FailFast(2); HologramNode n2 = t.applyTo(n1); Set<Truncation> set = new HashSet<>(); set.add(new KeepTop(2)); set.add(new KeepVariable(a)); HypergraphGenerator g = new HypergraphGenerator(); Hypergraph h = g.getGraph(o, set); Iterator<?> it = HittingSetRunner.runHittingSet(h).iterator(); while (it.hasNext()) { Valuation v = g.getValuation(it.next()); }
  • 77. S. Hallé Create Boolean condition Obtain an expression tree and apply a transformation Create tree transformations Generate and solve hypergraph Iterate over valuations of the solution Boolean Coverage Toolkit These principles have been concretely implemented in an open source Java library: https://github.com/liflab/boolean-coverage-toolkit Operator o = Or(And(a, Not(b), c), And(Not(a), Not(b)), And(Not(a), b, Not(c))); HologramNode n1 = o.evaluate(new Valuation(false, false, true)); Truncation t = new FailFast(2); HologramNode n2 = t.applyTo(n1); Set<Truncation> set = new HashSet<>(); set.add(new KeepTop(2)); set.add(new KeepVariable(a)); HypergraphGenerator g = new HypergraphGenerator(); Hypergraph h = g.getGraph(o, set); Iterator<?> it = HittingSetRunner.runHittingSet(h).iterator(); while (it.hasNext()) { Valuation v = g.getValuation(it.next()); }
  • 78. S. Hallé Experiments We can compare the hypergraph-based approach with existing tools and techniques: Random selection ACTS (combinatorial coverage) mcdc (MC/DC coverage) and results published in past papers (implementation unavailable).
  • 79. S. Hallé Experiments Test suite size 0 2 4 6 8 10 12 14 2 4 6 8 10 12 14 Hypergraph MCDC SAT 0 200 400 600 800 1000 1200 1400 1600 1800 0 200 400 600 800 1000 1200 1400 1600 1800 Hypergraph Chen G-CUN MC/DC MUMCUT The hypergraph approach generates test suites of comparable size for MC/DC, but larger for MUMCUT (over-approximated)
  • 80. S. Hallé Experiments Solving for two criteria at once Criteria Size ratio Time ratio MC/DC + Clause MC/DC + Predicate MC/DC + MUMCUT MC/DC + 2-way MC/DC + 3-way Clause + 2-way Clause + 3-way 0.87 0.85 0.99 0.76 0.83 0.83 0.87 1.27 1.29 1.38 1.20 1.11 1.24 1.11 The hypergraph approach takes more time, but produces smaller test suites than when two independent solutions are merged
  • 81. S. Hallé Conclusion Uniform theoretical framework to define coverage criteria as equivalence classes induced by a tree transformation Generic algorithm to produce test suites according to any algebraic coverage criterion Opens the way to experiments with new coverage criteria and benchmarking of existing ones. Future work: extension to other logics, such as temporal/description logics