Information Technology Reference
In-Depth Information
To deal with a constraint, it is first translated into the form of forbidden combina-
tions. For each forbidden combination
σ ={ (
p i 1 ,
v i 1 ), (
p i 2 ,
v i 2 ),...,(
p i l ,
v i l ) }
,
the following PB constraint is generated:
A
v i 1 )
A
v i 2 ) −···−
A
v i l ) ≥−
l
+
1
;
(3.4)
(
p i 1 ,
(
p i 1 ,
(
p i 1 ,
The objective function to minimize is the summation of the negation of all uncov-
ered target combinations. Suppose the set of all uncovered target combinations is
U , then the objective function is:
min
:
U
B σ
(3.5)
σ
After the PBO problem is generated, the algorithm calls an external PBO solver
to solve the translated problem. The solution of the PBO problem can be easily
translated back into a test case. Besides, the solver can find the optimal solution for
the PBO problem, which corresponds to the test case that covers the greatest number
of uncovered target combinations. However, this will cost a lot of solving time and
may not contribute much to the reduction of the test suite size. Certain strategies
could be applied to prematurely stop the solver to get a near-optimal solution in a
relatively short period of time.
The validity of target combinations could be checked one by one during the
initialization of the set of target combinations. This may cost a lot of time when the
number of target combinations is large. But fortunately, there is another way to work
around. The validity of each target combination does not need to be checked during
initialization. The algorithm just continues trying to generate new test cases covering
as many uncovered target combinations as possible. If in a certain iteration, no more
target combinations can be covered by a valid test case, the test generation process
terminates, and all the remaining uncovered target combinations are invalid.
3.4.1 Example of PBO-Based Algorithm
Again, we generate a test suite for the SUT model of the web application example.
Suppose at a certain point of time, the generated test cases are as shown in Table 3.6 .
Table 3.6 Partialtestsuite
generated by PBO-based
algorithm
p 1
p 2
p 3
p 4
1
2
2
1
1
1
1
2
2
2
2
2
2
2
1
1
 
 
Search WWH ::




Custom Search