



























































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




























































Gursaran Reader Dept. of Mathematics Dayalbagh Educational Institute
Gursaran
Dayalbagh Educational Institute
Gursaran
Dayalbagh Educational Institute
What is the test criterion?
What constitutes an adequate test?
Gursaran
Dayalbagh Educational Institute
Reliability
Validity
Gursaran
Dayalbagh Educational Institute
Test Data Adequacy Criteria as Measurements A test data adequacy criterion is a function
P x S x T ->
( p
s
t ) =
r
means that the adequacy of testing the program
p
by the test set
t
with respect to the specification
s
is of degree
r
according to the criterion
. The greater the real number
r
the more adequate the testing.
[Zhu et al., 1997]
Gursaran
Dayalbagh Educational Institute
Structural
Fault Based
Error Based
Program Based
Specification Based
[Zhu et al., 1997]
Gursaran
Dayalbagh Educational Institute
s
CFG Node s
int triType(int a, int b, int c) {
1
int type = PLAIN;
1
if (a > b)
2
swap(a, b);
3
if (a > c)
4
swap(a,c);
5
if (b > c)
6
swap(b, c);
7
if (a == b) {
8
if (b == c)
9
type = EQUILATERAL;
else
10
type = ISOSCELES; }
11
else if (b == c)
12
type = ISOSCELES;
13/
e return type;
}
Gursaran
Dayalbagh Educational Institute
An
input vector
I is a vector I = (x
1
, x
2
,... x
k
) of input
variables to a program.
The
domain of an input variable
x
, 1i^
i
k, is the set of all
values that x
i^
can take on.
The
domain of a program
is the cross product D = D
x
x
xk
where each D
xi
is the domain of the input variable
x
.i^
program input
x
is a single point in the k-dimensional input
space D,
x
path
through a CFG is a sequence P =< n
1
, n
2
,... n
m
such that for i, 1
i < m, (n
, ni
i+
A path is
feasible
if there exists a program input x for which
the path is traversed during program execution.
Gursaran
Dayalbagh Educational Institute
Finite Applicability
can always be satisfied by a finite test set.
Problems
Infinite number of different paths
Infeasibility
Limit testing to feasible versions of adequacy criteria
Leads to the
undecidability
problem
Whether a statement in a program is feasible or not isundecidable
It is not possible to take an adequacy criterion anddetermine whether an input exists that satisfies it.
[Zhu et al., 1997]
Gursaran
Dayalbagh Educational Institute
Automated Test Data Generation: ACompromise
The
undecidable
problem
Attempt under resource limitations
If resources are exhausted, the attempt fails
What is the best that we can do within the allocatedresources?
Gursaran
Dayalbagh Educational Institute
Reduce the problem of test data generation to a sequence ofsubgoals each of which can be solved using functionminimisation
Assume
simple
relational expressions involving arithmetic
expressions
E
1
E
2
E
2
1
< 0
or F < 0
[Korel, 1990]
Gursaran
Dayalbagh Educational Institute
Branch predicates can be transformed into anequivalent predicate
F(x)
rel 0, rel
∈
{ <, <=, = },
x
∈
D,
where
[Korel, 1990]
Gursaran
Dayalbagh Educational Institute
The function F is
Problem of test data generation isreduced to function minimisation:
Find an input
x
that minimizes
F(x)
taken is
branch
when ,
negative
or 0
taken is
branch
when ,
v p
x
F
F <= 0
Gursaran
Dayalbagh Educational Institute
7
F < 0
3 4 6
9
5 8
1
2
Constraints?
The Branch Conditionmay not be reached forcertain inputs
Treat the problem ofreaching the branchcondition as a subgoalbefore minimizing
F(x)