Sie sind auf Seite 1von 10

122 Int. J. Bio-Inspired Computation, Vol. 8, No.

2, 2018
2016

Test case optimisation a nature inspired approach


using bacteriologic algorithm

Praveen Ranjan Srivastava


Information Technology and Systems Group,
Indian Institute of Management (IIM),
Rohtak-124001, India
Email: praveenrsrivastava@gmail.com

Abstract: Software testing is prime concern for the software industry and researchers. In the
software testing process test cases play an important and significant role. Optimisations of test
cases are essential to test the software effectively. Finding maximum number of faults and
rectifying them before actual software release is most complex and critical during software
development process. This paper deals with software test case optimisation using bacteriologic
algorithm (BA) and requirement mapping-based approach. Test case optimisation deals with
selecting effective test cases having maximum code coverage and fault detection capability,
consequently minimising and prioritising the test cases.

Keywords: test suite; test case optimisation; software development life cycle; SDLC; genetic
algorithm; GA; bacteriologic algorithm; BA.

Reference to this paper should be made as follows: Srivastava, P.R. (2016) 8 ‘Test case
optimisation a nature inspired approach using bacteriologic algorithm’, Int. J. Bio-Inspired
Computation, Vol. 8, No. 2, pp.122–131.

Biographical notes: Praveen Ranjan Srivastava is working as an Assistant Professor in the


Information Technology and Systems Group at the Indian Institute of Management (IIM),
Rohtak, India. He is currently doing research in the area of software management and decision
science and data analytics. His research areas are software testing, quality and effort
management, software release management, e-commerce and business intelligence, expert
system and advanced soft computing techniques. He has published more than 120 research
papers in various leading international journals and conferences in the area of software
engineering and management. He is the Editor-in-Chief of the International Journal of Software
Engineering, Technology and Applications (IJSETA), published by Inderscience. He is also a
member of editorial board of various leading journals.

1 Introduction branch detection, fault detection, etc. (Rothermel et al.,


2001).
Software engineering is the concept to manage the software
In this paper, the technique proposed for test case
(Pressman, 2001). The software to be reliable it is required
minimisation and prioritisation is the bacteriologic
to test the software exhaustively. But exhaustive testing
algorithm (BA) combined with requirement mapping
is not practical as well as cost efficient. Thus various
(Jeffrey and Gupta, 2007; Galeebathullah and Indumathi,
techniques for test case reduction and optimisation must be
2010). Requirement mapping is used to map the test cases
employed to reduce the cost of testing.
with various requirements extracted from code like branch
When some functional and non-functional areas of
coverage, variable def-use, etc. The matrices obtained from
software are changed, enhanced or reconfigured, it needs to
this process will be used to determine initial test suite’s size
be retested to uncover the new faults introduced into it. This
and fitness calculation in BA. Then BA is applied to obtain
is called regression testing (Pressman, 2001; Rothermel
minimised and prioritised set of test suites, with maximum
et al., 2001). Regression test suites being too large to
code coverage and fault detection capability.
reexecute in given time, some methodology should be
Next section of this paper investigates some background
applied to reduce the number of test cases and reorder them,
work; definitions of some already established concepts are
ultimately to reduce the cost and timing constraints of
explained in Section 3; further the basic architecture and
testing process. This can be achieved by using one or more
algorithm for proposed approach are described in detail in
of the two techniques viz. test case minimisation or
Section 4. Finally, the conclusions are mentioned in
prioritisation. Test case minimisation deals with reducing
Section 5.
the number of test suites by eliminating redundant test
cases. Test case prioritisation is reordering of the test suites
according to an appropriate criterion like code coverage,

Copyright © 2016 Inderscience Enterprises Ltd.


Test case optimisation a nature inspired approach using bacteriologic algorithm 123

2 Background and motivation work overhead of generating mutants (in case of mutation-based
testing) and testing each of them.
The aim of software engineering is desirable to develop
This paper here presents a BA and requirement
high quality software in a cost-effective manner. In this
mapping-based approach for test case optimisation in case
regard software testing is an important and complex phase
of regression testing. It searches for fittest bacteria globally,
during the software development life cycle (SDLC). It is
i.e., in all generations.
estimated that effort consumed by software testing process
is nearly 50% of the total software effort (Pressman, 2001;
Rothermel et al., 2001). This is the reason and motivation
3 Definitions and concepts
for finding this work. From past few years, various
researchers have been engaged in finding methods for test This section explains some useful terms and already
case minimisation and prioritisation, so that the whole established concepts in context of optimisation of test cases.
system can be effectively tested in given time. The first The optimisation here involves minimising and prioritising
approach used for test suite minimisation is the classical the test cases explained as follows:
Greedy approach (Cormen et al., 2001). This uses a function
that finds out the test cases in test suite that satisfy most of 3.1 Test case minimisation (Harrold et al., 1993)
the requirements and removes those requirements from the
requirement set. This process is continued recursively until Initially, a set of test cases are present with the tester as this
all the requirements are satisfied. technique is designed to work for regression testing.
Harrold et al. (1993) (HGS) proposed a technique which Minimisation of the test cases is carried out using BA
selects a set of test cases from a test suite that could keeping two considerations. First, the test suites created
represent the entire test suite in terms of coverage, i.e., it should consist of minimum number of test cases with
will have the same coverage as that of test suite. maximum branch and fault coverage. And second the
The main drawback in above two approaches is that the number of test suites should be optimal.
fault detection capability of test suites has been reduced.
Wong et al. (1995) suggested that keeping all-uses 3.2 Test case prioritisation (Rothermel et al., 2001)
coverage constant, if test suite’s size is reduced, then little
or no reduction in its fault detection effectiveness is In regression testing large number of test suits are present
examined. but due to strict time constraint, it is not feasible to test each
Von Ronne (1999) generalised the HGS algorithm for and every test suit over the code. So it is required to arrange
support each conditions in multiple times. the test suits according to some criteria. This paper proposes
In contrast to previous studies, Rothermal et al.’s (1998, prioritisation of test suits on the basis of branch coverage
2001) empirical study showed that minimisation of test and fault detection capability.
suites severely affects their fault detection capabilities.
Tallam and Gupta (2005) developed another heuristic 3.3 Basic GA
called the delayed-greedy strategy to minimise the test Holland (1992) first introduced the concept of GAs. These
suites while considering the coverage requirements. algorithms were influenced by Darwin’s theory of
Then, the next significant work in the field of the evolution. GAs automatically search in the input area for
software testing was the use of genetic algorithm (GA) for data with the maximum usage. GAs requires a fitness
test case optimisation. These were developed by Holland function, capable of calculating the quality of chromosomes
(1992), based on the process of evolution of biological (a chromosome is a collection of genes).
organisms. Krishnamoorthi and Mary (2009) have proposed Figure 1 shows the basic GA.
a test suite prioritisation technique for regression testing
using GA, but the problem here with GA is that it stuck into Figure 1 Basic GA flow diagram
the local optimum result, i.e., it does not searches for best
optimal result in all generations. And also they have done
time-based prioritisation which requires the extra overhead
of calculating the execution time of every test case.
A recent kind of evolutionary method adapted from GA
is called BA (Baudry et al., 2005), which is inspired by the
nature of bacteria. Some researchers have shown that this
variant of GA can also be used for test case optimisation
and performs better than GA. Rad et al. (2010) have used
genetic and BA for optimising testing data in mutation
testing. Similarly Baudry et al. (2005) have proposed an
approach for test case optimisation in mutation-based
testing using both genetic and BA. Their comparison study GAs use selection, crossover and mutation genetic
shows that BA performs better than GA, but here it requires operators.
124 P.R. Srivastava

1 Selection: in this process two chromosomes are The minimisation algorithm which uses these matrices
selected for crossover and mutation. Chromosomes decides the initial test suite size and then test suites are
with high fitness value have high probability of generated by randomly selecting the test cases. These form
selection. the initial population for bacteriological algorithm. Then,
selection and mutation operations are applied and new
2 Crossover: this gene operator selects a random
descendants are formed. This process is repeated until
crossover point and makes new descendants by
stopping criteria is met.
crossover of parents. The simplest way is one-point
The fitness function, fit used here for calculating fitness
crossover, which selects a gene as crossover point. The
of test suites is the metric inferred as sum of product of
parents gene before or beyond the crossover point are
respective weights with bc and fda which can be directly
exchanged arbitrarily, resulting two new descendants.
obtained from the two tables formed by requirement
3 Mutation: crossover process is followed by mutation mapping.
process, which randomly changes the new descendants.
fit = w1 * bc + w 2 * fda

3.4 Bacteriologic algorithm where bc is branch coverage (obtained from branch


coverage table) and fda is fault detection ability(obtained
The BA is basically a variant of GA (Rad et al., 2010;
from fault coverage table).
Baudry et al., 2005). It is inspired by the nature of bacteria.
w1 and w2 are weights ranging from 0 to 1. They depict
As a bacterium never crosses-over, so crossover operator is
the significance of each metric which is going to change for
removed here. The genetic operators used in this algorithm
individual program. Different values of these weights cover
are selection and mutation. A memorisation function is
different metrics like
introduced here, which can memorise the fittest bacteria of
each population. There can be a threshold for memorisation • w1 > w2 incline towards ‘all p-use and some c-use’
function which indicates the number of bacteria of each
• w1 < w2 incline towards ‘all c-use and some p-use’
population to be memorised. The basic flow diagram of BA
is shown in Figure 2. • (w1 = w2)! = 0 incline towards ‘some c-use and some
p-use’.
Figure 2 BA flow diagram
If only branch coverage is taken into consideration for test
suite size’s and fitness calculation, then regardless of the
values of w1 and w2, it tends towards ‘all p-use’ metric. For
this case w2 will be equal to zero.
If only fault coverage (def-use table) is taken into
consideration, then regardless of the values of w1 and w2, it
tends towards ‘all c-use’ metric. For this case w1 will be
equal to zero.
Both the weights cannot be zero at the same time. These
weights are required to be chosen by the tester by
thoroughly analysing the source code.
The requirements extracted from the source code can be
The next part presents the proposed approach in detail. the branches, variables def-use, etc. These requirements are
mapped with the test cases using a mapping function, which
gives branch coverage and variable def-use tables. Now a
4 Proposed approach minimisation algorithm like the classical greedy approach
(Cormen et al., 2001) can be used to find one test suite with
This section presents the proposed approach for test case maximum branch coverage and fault detection capability.
optimisation. The basic architecture is shown in Figure 3, This test suit gives an optimal test suite’s size L. Now test
and the proposed algorithm is explained after that. suites of size L are randomly generated from initial test
cases. These test suites will now act as initial population of
4.1 Basic architecture bacteria for BA. Say, TS1 and TS2 are the two test suites
selected by the selection operator for mutation. The
Figure 3 shows the basic architecture of proposed approach.
memorisation function (Baudry et al., 2005) will memorise
It takes ‘source code’ and a ‘set of test cases’ as input, and
the most fit bacteria after mutation carried out on every
gives minimised and prioritised set of test suites as output.
generation. A memorisation threshold will decide how
Using Requirement mapping technique, the test cases are
many bacteria to be memorised for each generation. The
mapped with the requirements extracted from the code, and
process is continued until stopping criteria is met, which can
two matrices are formed:
be number of generations or test suites of required fitness.
a branch coverage matrix (branch coverage table)
b fault coverage matrix (definition-use table).
Test case optimisation a nature inspired approach using bacteriologic algorithm 125

Figure 3 Basic architecture diagram of proposed approach

Next part shows the algorithm for the proposed approach 4.2 Proposed algorithm
and then a case study is taken which thoroughly explains the
The below algorithm shows the steps involved in proposed
algorithm.
approach for test case minimisation and prioritisation. It
takes two inputs as
126 P.R. Srivastava

1 source code by the tester by carefully examining the code and nature of
the program. The stopping criteria can be set as number of
2 initial set of test cases.
generations as far as we are getting bacteria of required
The output is minimised and prioritised set of test suites. fitness. The weights w1 and w2 depends upon the nature of
Rb is the set of extracted branches from the source code program, like for ‘type of triangle’ shown in Table 5, only
and Rc is the set of extracted variable def-use pair. Tablebc is branches, i.e., p-use were there and no def-use were found.
the branch coverage table and Tablefda is the variable So w1 should be given more weight than w2. Def-use table
def-use table. TS is a test suite which gives the optimal will not be constructed for this and value of w2 can be set to
length L here. The weights w1 and w2, both cannot be zero zero. The rounds of mutation per generation and the
at the same time. If instead of test cases, test suites are memorisation threshold can be set by the tester. As we have
present then the steps 5, 6 and 7 becomes insignificant. examined the mutation rounds for each generation should be
more than the number of test suites, which ensures that
Input: source code, S almost every test suite gets mutated in a generation. The
Set of initial test cases, ti memorisation threshold depends on the number of bacteria
Output: minimised and prioritised test suites. and upto what fitness value are to be memorised for each
Algorithm: generation. This algorithm can be more understood by
taking an example. The next part presents a case study
1 Extract branches as requirements from source code S
which explains the algorithm thoroughly.
Rb = {B1, B2, B3....Bn}
2 Map initial test cases, ti, with Rb
4.3 Case study
Tablebc = map_fun(ti, Rb)
For thorough explanation of the proposed approach, a
3 Find define-use of different variables, from source code S
source code of binary search (written in C) is taken from
Rc = {a1(line x, line y)....an(line x, line y)}
‘Data Structure using C and C++’ by Tanenbaum (2008),
4 Map initial test cases, ti, with Rc which is given as input to the algorithm and returns the
Tablefda = map_fun(ti, Rc) position of the element to be searched in the array.
5 Find a test suite TS with maximum branch coverage and
Returns pointer to the position of seeked number, val
fault detection ability
int * binary_search ( intval)
TS = find(Tablefda, Tablebc, ti)
{
6 Find optimal length of test suites as
unsigned int L = 0, R = array_length(arr), M;
L = find_length(TS)
while (L <R)
7 Generate random test suites TSi = {TS1, TS2,....TSn}of
length L from ti {
8 Apply bacteriologic algorithm over TSi M = (L+R− 1)/2;
8.1 Calculate fitness for each bacterium in TSi if (val = = arr [M])
fiti = w1 * bci + w2 * fdai return arr+M;
where bc = branch coverage of bacterium (obtained else if (val<arr [M])
from Tablebc) R = M;
fda = fault detection ability (obtained from Tablefda) else
w1 and w2 are weights ranging between 0 and 1. L = M+1;
8.2 Arrange all bacterium in TSi in descending order of }
fiti
return NULL;
8.3 Apply mutation
}
8.4 Recalculate fiti
Source code S
8.5 Memorise fittest bacteria
8.6 Add to next generation In the above source code L, R and val are variables for
8.7 Repeat from 8.1 until stopping criteria is not met. which the set of the initial test cases (ti) are given as second
(stopping criteria here can be number of generations) input to the algorithm:
9 Rearrange all memorised bacteria in descending order of
Test Cases (ti):
fiti, which prioritises them.
Variables: L, R, val
The above algorithm has certain considerations like the
stopping criteria, the memorisation threshold (Baudry et al., The sample array, arr[] = –14, –7, 3, 8, 12} is taken for
2005), i.e., the maximum number of bacteria of each designing the test cases(ti) which are shown in Table 1.
generation to be memorised, the weights w1 and w2, number
of mutation rounds per generation. These are to be decided
Test case optimisation a nature inspired approach using bacteriologic algorithm 127

Table 1 Set of test cases for source code S Table 2 Branch coverage table (Tablebc)

Test cases Values(L, R, val) Test case/branches Values B1 B2 B3 B4


t1 0, 4, –14 t1 0, 4, –14 X X X
t2 0, 4, 8 t2 0, 4, 8 X X X
t3 0, 4, –15 t3 0, 4, –15 X X
t4 0, 4, 9 t4 0, 4, 9 X X
t5 0, 4, –7 X X
t5 0, 4, –7
t6 0, 4, 3 X X X
t6 0, 4, 3
t7 0, 4, –8 X X
t7 0, 4, –8
t8 0, 4, 4 X X
t8 0, 4, 4
t9 0, 4, –1 X X
t9 0, 4, –1 t10 0, 4, 1 X X
t10 0, 4, 1 t11 0, 5, –14 X X X
t11 0, 5, –14 t12 0, 5, 12 X X X
t12 0, 5, 12 t13 0, 5, –15 X X
t13 0, 5, –15 t14 0, 5, 13 X X
t14 0, 5, 13 t15 0, 5, –7 X X
t15 0, 5, –7 t16 0, 5, 8 X X X
t16 0, 5, 8 t17 0, 5, –8 X X

t17 t18 0, 5, 9 X X
0, 5, –8
t19 0, 5, 3 X X X
t18 0, 5, 9
t20 0, 5, 5 X X
t19 0, 5, 3
Note: The ‘X’ in column Bi and row ti depicts that
t20 0, 5, 5 branch Bi is covered by corresponding test case ti.
Now further process involves the following steps: Step 3: Extract variable def-use pair from source code S as
Step 1: Extract branches from source code S as: V (line x, line y), where V is a variable which is defined at
line x and used at line y. Here the variable-def means that
1. int * binary_search ( intval)
the variable is either initialised by some value which can be
2. { a constant or result of any expression, and the variable-use
3. unsigned int L = 0, R = array_length(arr), M; means that where that variable is used in some computation.
4. B1 while (L <R) In source code S the following def-use pairs are
5. {
extracted-
6. M = (L+R− 1)/2; Rc = {L(3, 6), R(3, 6), M(6,8), M(6,10), M(6,12)}
7. B2 if (val = = arr [M])
E.g., L(3,6) depicts here that variable L is defined at line
8. return arr+M;
number 3 and then used at line number 6.
9. B3 else if (val<arr [M])
Step 4: Map initial test cases ti (from Table 1) with Rc to
10. R = M;
form Tablefda (fault coverage table). This is shown in
11. B4 else Table 3.
12. L = M+1; The ‘X’ in Table 3 depicts that a variable’s definition
13. } and use both are covered by corresponding test case ti.
14. return NULL; For example ‘X’ in row t1 and corresponding column L
(3, 6) is showing that test case t1 is covering both definition
15. }
(at line 3) and use (at line 6) of L.
So, the set of branches Rb = {B1, B2, B3, B4}
Step 2: Map initial test cases ti (from Table 1) with Rb and
form a branch coverage Tablebc. This is shown in Table 2.
128 P.R. Srivastava

Table 3 Fault coverage table (Talefda) If the tester is only having test cases, not test suites then he
requires to calculate the optimal size of a test suite,
Testcase/def-use L(3, 6) R(3, 6) M(6, 8) M(6, 10) M(6, 12)
otherwise the calculations involved in step 5, step 6 and
t1 X X X X step 7 are not required.
t2 X X X X
Step 8: Apply BA on test suites generated after step 7, for
t3 X X X number of generations until stopping criteria is not met. The
t4 X X X stopping criteria can be number of generations here. For
t5 X X X every generation, test suites having highest fitness are
t6 X X X X selected by the selection operator and mutation is applied
over them. The mutation operator randomly exchanges test
t7 X X X
cases between test suites. This process is repeated several
t8 X X X times for every generation.
t9 X X X For example during this process, at any time let the
t10 X X X selection operator chooses two test suites (bacteria) as
t11 X X X X TS4 = {t4, t9} and TS7 = {t13, t14}. The mutation operator
chooses to exchange the first test cases of these test
t12 X X X X
suites. So after mutation the new test suites comes as
t13 X X X TS4 = {t13, t9} and TS7 = {t4, t14}. This process of
t14 X X X selection and mutation is carried out several times and new
t15 X X X test suites are created. Now after every generation the
t16 X X X X fitness calculation of the generated test suites is required.
For example:
t17 X X X
t18 X X X Fitness calculation of TS4 = {t13, t9} :
t19 X X X X
Test case t13 covers branches B1 and B3; test case t9 covers
t20 X X X
branches B1 and B4 (from Table 2). So the test suite TS4
Step 5: By using minimisation algorithm, find a test suite covered 3 branches out of total 4 branches. So branch
which has maximum branch coverage and fault detection coverage of TS4 will be:
ability. For this both the tables, i.e., Tables 2 and 3 can be bc = (3 / 4) *100 = 75%
combined and classical Greedy approach (Cormen et al.,
2001) can be applied. It finds out the test cases that satisfy Similarly, t13 covers L(3, 6), R(3, 6), M(6, 10) and t9
most of the requirements and removes those requirements covers L(3, 6), R(3, 6), M(6, 12) (from Table 3). So the test
from the requirement set. This process is continued suite TS4 covered 4 def-use pairs out of total 5, so fault
recursively until all the requirements are satisfied, e.g., here detection ability (fda) of TS4 will be:
test case t1 covers branches B1, B2, B3 (from Table 2) and fda = (4 / 5) *100 = 80%
def-use L(3, 6), R(3, 6), M(6, 8), M(6, 10) (from Table 3).
Now these requirements are removed and search for test Let the weights taken here be w1 = 1 and w2 = 0, i.e., it
case which can cover rest of the requirements. Then test tends to cover ‘all p-use and some c-use’ here. Therefore
case t2 covers branches B1, B2, B4(from Table 2) and fitness value of test suite TS4 will be
def-use L(3, 6), R(3, 6), M(6, 8), M(6, 10) (from Table 3).
So both t1 and t2 are covering all branches and def-use. fit = (1* 75) + (0 *80) = 75%
They both can form a test suite with hundred percent bc and The most fit bacteria (test suites) of each generation will be
fda. We get a test suite TS as TS = {t1, t2}. memorised according to a memorisation threshold
Step 6: Now find length of TS (number of test cases in TS), (maximum number of bacteria of each generation to be
which will give an optimal test suite size, L = length (TS), memorised) which is determined by the tester and finally
here L = 2. these bacteria are arranged in descending order of their
fitness value, which gives minimised and prioritised test
Step 7: Form initial test suites of size L by randomly taking suites according to branch coverage and fault detection
the test cases from ti. capability.
Here the following 10 test suites of size L = 2 are For this case study of binary search, the stopping criteria
formed for the initial test case (ti): were set as number of generations. We had run it for ten
TS1 = {t1, t6} , TS2 = {t2, t7} , TS3 = {t3, t8} , TS4 = {t4,generations.
t9} , Here weights w1 is set to one and w2 as zero.
Although the weights values shows that we are inclining
TS5 = {t5, t10} , TS6 = {t11, t12} , TS7 = {t13, t14} , towards branch coverage, yet first the results from Table 4
TS8 = {t15, t16} , TS9 = {t17, t18} , TS10 = {t19, t20} . showing that first six test suites covered all branches and
def-use.
Test case optimisation a nature inspired approach using bacteriologic algorithm 129

As a result of an execution we have got ten test suites as proposed algorithm five different source codes have been
shown in Table 4. tested and Table 5 shows the analysis that BA is performing
better than GA in some aspects.
Table 4 Test suites comes as a result of BA The first example in Table 5, i.e., ‘type of triangle’ has
no def-use variables; it had only p-uses. The number of test
Test suites Test cases bc fda fit
cases are selected according to worst case testing, i.e., by 5n
TS1 ts11, ts6 100 100 100 where n is the number of variables for which test cases are
TS2 ts3, ts12 100 100 100 to be designed. In our case the ‘bubble sort’ can have 3,125
TS3 ts1, ts14 100 100 100 test cases i worst case, but for feasibility we have designed
TS4 ts11, ts18 100 100 100 625 test cases. Graphical representation of percent reduction
in test cases by GA and BA (from Table 5) is shown in
TS5 ts17, ts6 100 100 100
Figure 5.
TS6 ts1, ts18 100 100 100 Figure 5 shows graphically the reduction in test cases
TS7 ts1, ts7 75 80 75 after applying bacteriologic and GA. Clearly the
TS8 ts15, ts12 75 80 75 performance of BA is better than GA for every sample
TS9 ts5, ts18 75 80 75 program. For, e.g., for ‘type of triangle’ program, initial test
cases were 125. BA reduced it to 15 test cases and GA
TS10 ts4, ts9 50 60 50
reduced it to 45 cases. All the reduced test cases were
The above test suites are prioritised according to fit value prioritised according to their fitness values (fit). This
and shown in graphical form in Figure 4. This graph is analysis shows that the proposed approach works well for
showing the prioritised test suites and their corresponding regression test case optimisation. Introduction of
bc, fda and fit values. memorisation function in BA makes it capable to search for
From Figure 4, it can be observed that the first six test fittest bacteria globally, i.e., in all generations whereas GA
suites we got have 100% branch coverage (bc) and fault does the local search. The approach described in this paper
detection ability (fda). Further to check the feasibility of the gives an efficient method to minimise and also prioritise the
test cases.

Figure 4 Graph showing test suites from Table 4 and their fitness values

Table 5 BA and GA tested on five sample programs

Title Loc Branch Def-use Number of test cases % Reduction after BA % Reduction after GA
Type of triangle 25 8 0 125 88 64
LCM 17 3 8 25 92 80
Greatest number 15 3 3 125 88 84
Bubble sort 20 5 10 625 84 72
Armstrong number 23 3 8 25 92 84
130 P.R. Srivastava

Figure 5 Graph showing reduction of test for five sample programs from Table 5

5 Conclusions Harrold, M.J., Gupta, R. and Sofa, M.L. (1993) ‘A methodology


for controlling the size of a test suite’, ACM Transactions on
This paper suggests an approach for the test case Software Engineering and Methodology, Vol. 2, No. 3,
minimisation and prioritisation using a BA and requirement pp.270–285.
mapping technique for improving the fault detection Holland, J.H. (1992) Adaptation in Nature and Artificial Systems:
capability of the test cases. The analysis of this new An Introductory Analysis with Applications to Biology,
approach on a number of examples and graphs shows that Control, and Artificial Intelligence, MIT Press, Cambridge.
this technique improves the performance of the genetic as Jeffrey, D. and Gupta, N. (2007) ‘Improving fault detection
well as BA to a significant level in the terms of fault capability by selectively retaining test cases during test suite
reduction’, IEEE Transactions on Software Engineering,
detection and code coverage capability of the test suits.
Vol. 33, No. 2, pp.108–123.
Further research can also emphasise the performance
Krishnamoorthi, R. and Mary, S.A.S.A. (2009) ‘Regression test
comparison of this algorithm with other methods suite prioritization using genetic algorithms’, International
(Askarzadeh, 2014; Trunfio, 2014; Gao et al., 2013) may Journal of Hybrid Information Technology, Vol. 2, No. 3,
also prove to be fruitful. pp.35–51.
Pressman, R.S. (2001) Software Engineering: A Practitioner’s
Approach, 5th ed., McGraw Hill Publications, USA.
References Rad, M.F., Akbari, F. and Bakht, A.J. (2010) ‘Implementation of
Askarzadeh, A. (2014) ‘An innovative artificial immune common genetic and bacteriological algorithms in optimizing
optimisation algorithm for solving complex optimisation testing data in mutation testing’, Computational Intelligence
problems’, Int. J. of Bio-Inspired Computation, Vol. 6, No. 6, and Software Engineering (CiSE), pp.1–6.
pp.409–415. Rothermal, G., Harrold, M.J., Ostrin, J. and Hong, C. (1998)
Baudry, B., Fleurey, F., Jézéquel, J-M. and Le Traon, Y. (2005) ‘An empirical study of the effects of minimization on the
‘Automatic test case optimization: a bacteriologic algorithm’, fault detection capabilities of test suites’, Proceedings
Software, IEEE, Vol. 22, No. 2, pp.76–82. of the Fourteenth International Conference on Software
Maintenance, Betheseda, MD, USA, pp.34–43.
Baudry, B., Fleurey, F., Marc, J. and Le Traon, Y. (2005) ‘From
genetic to bacteriological algorithms for mutation-based Rothermal, G., Untch, R.H., Chu, C. and Harrold, M.J. (2001)
testing’, Software testing, Verification and Reliability, ‘Prioritizing test cases for regression testing’, IEEE
Vol. 15, No. 2, pp.73–96. Transactions on Software Engineering, Vol. 27, No. 10,
pp.929–948.
Cormen, T.H., Leiserson, C.E. and Rivest, R.L. (2001)
Introduction to Algorithms, MIT Press, Cambridge. Rothermel, G., Untch, R.J. and Chu, C. (2001) ‘Prioritizing test
cases for regression testing’, IEEE Transactions on Software
Galeebathullah, B. and Indumathi, C.P. (2010) ‘A novel approach Engineering, Vol. 27, No. 10, pp.929–948.
for controlling a size of a test suite with simple technique’,
(IJCSE) International Journal on Computer Science and Tallam, S. and Gupta, N. (2005) ‘A concept analysis inspired
Engineering, Vol. 2, No. 3, pp.614–618. greedy algorithm for test suite minimization’, in Proceedings
of the Sixth Workshop Program Analysis for Software Tools
Gao, X-Z., Wang, X. and Zenger, K. (2013) ‘A modified harmony and Engineering, Lisbon, Portugal, pp.35–42.
search method for wind generator design’, Int. J. of
Bio-Inspired Computation, Vol. 5, No. 6, pp.336–349. Tanenbaum, A.M. (2008) Data Structures using C and C++,
2nd ed., Prentice Hall India, USA.
Test case optimisation a nature inspired approach using bacteriologic algorithm 131

Trunfio, G.A. (2014) ‘Enhancing the firefly algorithm through a Wong, W.E., Horgan, J.R., London, S. and Mathur, A.P. (1995)
cooperative coevolutionary approach: an empirical study on ‘Effect of test set minimization on fault detection
benchmark optimisation problems’, Int. J. of Bio-Inspired effectiveness’, Proceedings in Seventeenth international
Computation, Vol. 6, No. 2, pp.108–125. conference on Software Engineering, Seattle, Washington,
Von Ronne, J. (1999) Test Suite Minimization: An Empirical USA, pp.41–50.
Investigation, Bachelor thesis, June.

Das könnte Ihnen auch gefallen