You are on page 1of 4

2016 3rd International Conference on Electronic Design (ICED), August 11-12, 2016, Phuket, Thailand

Implementation of Artificial Bee Colony Algorithm


for T-way Testing
Mohd Shaiful Aziz Rashid Ali, Rozmie R. Othman, Zainor Ridzuan Yahya, Mohd Zamri Zahir Ahmad, Nuraminah
Ramli
School of Computer and Communication Engineering,
Kampus Pauh Putra, Universiti Malaysia Perlis,
02600 Arau, Perlis
shaifulaziz@unimap.edu.my, rozmie@unimap.edu.my, zainoryahya@unimap.edu.my, zamri.zahir@yahoo.com,
nuraminah.ramli@gmail.com

Abstract— Literature evidences have demonstrated the reducing the number of test cases as compared to exhaustive
effectiveness of the sampled t-way test suite for defect detection in testing. While reducing the number of test cases that need to be
software testing. The main task in implementing t-way testing executed, t-way test also has been proven to capture most of the
strategies is constructing best possibility test case. There are software bugs, where in most published case studies are
several methods that have been proposed but none of them can be comparable to exhaustive testing.
claimed to be the best result because t-way are considered as NP-
hard problem. In this paper, the concept of artificial bee colony Alsewari and Zamli have surveyed and shown that the
(ABC) will be proposed as the idea in constructing t-way testing existing optimization algorithm still has its limitations for each
test suit. Due to the limitation of classical optimization in solving strategy, therefore suggesting a new test idea and test suite
larger scale combinatorial and highly non-linear problems, constructions. [10] Driven by this challenge, this paper proposes
researchers are moving to employ the intelligent behaviour of an artificial bee colony (ABC) based t-way strategy. ABC is
swarm known as Swarm Intelligence. ABC was introduced by claimed to be one of good search abilities on many optimization.
Karaboga in 2005 is an optimization algorithm based on honey bee [1] A recent study has shown that ABC performs significantly
swarm which has been applied in solving real world application. better or at least comparable to other swarm intelligence
algorithm [2]
Keywords— t-way testing, artificial bee colony
To facilitate the discussion, this paper is divided into 4
I. INTRODUCTION sections. Section 2 overviews of T-way strategies while Section
Currently, software design has become more complex with 3 explains the proposed strategy and in Section 4 covers our
increasing line of code and functionality to cater the demands of conclusions and future works.
customers and the advancement of hardware and computing
technology (i.e. in terms of processing power as well as the II. OVERVIEW OF T-WAY STRATEGIES
storage capacity). Additionally, current trend in software In order to demonstrate the generation of t-way test suite,
development often integrates several interconnected parts within let’s consider the hypothetical system shown in Figure 1. The
a single program in order to produce a large integrated software system consists of four input parameters (i.e. A, B, C and D) and
system. For these reasons, many combinations of input for each input parameter there are two possible values. To
parameters, hardware configurations, software configurations facilitate the discussion, a symbolic representation of parameters
and system platforms need to be tested and verified against the values is used (as shown in Table 1). For a complete or
given requirements. Auto pilot function in flight technology is exhaustive testing, 16 test cases are needed (i.e. 24=16 test
one of the best example of an integrated software system to cases). The exhaustive test cases are depicted in Table 2.
demonstrate the importance of software testing to verify whether
the system is working properly before it can fly in the real world.
To test all possible combinations, exhaustive testing is perhaps
the most effective testing strategy. However, due to time and
cost constraints, exhaustive testing is impractical and not cost
efficient [3]. Thus, many sampling strategies such as boundary
value, decision table and equivalence partitioning are used in
fault detection and prevention. But the main problem with this
static and dynamic sampling is that the items are not effective to
tackle bugs due to interaction [6]. As a better option, t-way Fig. 1. Hypothetical system
strategies have been developed in the literature in last 20 years Table 1: Symbolic representation for system in Figure 1
adopting different approaches such as Algebraic, pure
Input A B C D
computational and optimization algorithm. Here, t represents the
Symbolic a0 b0 c0 d0
interaction strength between parameters. Literature evidences Representation a1 b1 c1 d1
[4-10] have demonstrated the capability of t-way test testing in

978-1-5090-2160-4/16/$31.00 ©2016 IEEE 591


2016 3rd International Conference on Electronic Design (ICED), August 11-12, 2016, Phuket, Thailand

Table 2: Exhaustive test suite Table 4: 2-way test suite


T# A B C D T# A B C D
1 a0 b0 c0 d0 1 a0 b0 c0 d0
2 a0 b0 c0 d1 2 a0 b0 c0 d1
3 a0 b0 c1 d0 4 a0 b0 c1 d1
4 a0 b0 c1 d1 5 a0 b1 c0 d0
5 a0 b1 c0 d0 9 a1 b0 c0 d0
6 a0 b1 c0 d1 11 a1 b0 c1 d0
7 a0 b1 c1 d0 12 a1 b0 c1 d1
8 a0 b1 c1 d1 13 a1 b1 c0 d0
9 a1 b0 c0 d0 16 a1 b1 c1 d1
10 a1 b0 c0 d1
11 a1 b0 c1 d0
12 a1 b0 c1 d1 For example a system with 30 inputs with each input has 2
13 a1 b1 c0 d0 possible values. If exhaustive testing needs to be implemented,
14 a1 b1 c0 d1 we need to execute 230 (1073741824) test cases in completing
15 a1 b1 c1 d0 the whole test. This will effect the time in producing the
16 a1 b1 c1 d1
software and the cost will also increase. That is the reason why
To generate a t-way test suite, the interaction strength, t, some company take risk of doing random testing or also known
needs to be decided. As a general rule of thumb, the lower the as Monkey testing. T-way testing was introduced to make sure
interaction strength the more reduction of test cases can be all the test cases are covered in the testing within a short period
expected and the interaction strength itself can range from 2 (i.e. of time. Motivated to this, research in this area has been a
pairwise testing or 2-way testing) to the number of input concerned by the researcher.
parameters (which equivalent to exhaustive testing). For this
example, let’s consider the generation of 2-way test suite or III. PROPOSED STRATEGY
commonly referred as pairwise test suite. Until today, there are no T-way strategies based on
Artificial Bee Colony (ABC), although ABC is claimed to be a
Since we are considering the interaction strength of two, we powerful optimization method in solving combinatorial
are expecting faults caused by the interaction of two input problem [1-2]. For this reason, we proposed an artificial Bee
parameters. Based on the system in Figure 1, combinations of Colony based t-way strategy.
two input parameters are AB, AC, AD, BC, BD and CD. The
interaction of these input parameters combinations produce ABC was proposed by Karaboga in 2005. The idea of ABC
tuples which has been tabulated in Table 3. After considering is to study the social behaviour of bees in finding nectar for their
tuples that only covered by each paired, result in table 4 is hive. All bees can be classified into three categories
produced. The test suite has been reduced from 16 (exhaustive 1) Employed bees
testing) to 9, which a saving of 25 percent.
2) Onlookers bees
Table 3: 2-way tuples 3) Scout bees
Interacting Tuples Interacting Tuples The process starts when employed bees are able to exploit
Parameter Produced T# Parameter Produced T# food sources and they will carry information regarding food
a0,bo 1 b0,co 1 sources back to the hive and share this information with the
onlooker bees. The information is shared by employed bees by
a0,b1 5 b0,c1 4 dancing inside the hive near the onlooker bees. The dance will
include the following information which are direction of the
a1,b0 9 b1,c0 13
food source, the quality rating of the food source and the
A,B a1,b1 16 B,C b1,c1 16 distance from the hive to the food source. All these information
will be evaluated by the onlooker bees which are waiting inside
a0,co 1 b0,do 1 the hive. The abandon food source will be replaced by a new
a0,c1 4 b0,d1 12 food source that has been scouted by the scout bees. The
proposed algorithm is shown in Figure 2.
a1,c0 9 b1,d0 13

A,C a1,c1 16 B,D b1,d1 16 A. Initialization


a0,do 1 c0,do 1
In this initial stage all the routes that were formed regarding
a0,d1 4 c0,d1 2 the location of the food source and will be selected by the bees
to determine which one is the best and is the solution for their
a1,d0 9 c1,d0 11 problems. At this stage, given the experimental value of each
A,D a1,d1 16 C,D c1,d1 16
possible solution is equal to 0. The initialization process of the

592
2016 3rd International Conference on Electronic Design (ICED), August 11-12, 2016, Phuket, Thailand

possible solutions (food source) is done randomly by the The onlooker bee will evaluate the information given by
following equation: the employed bee and calculate the probability of each possible
solution by using the following formula:
= + (0,1). − (1)[2]
= ∑
(4)[2]
Where:
: Initialization possible solutions i with parameter j
Where:
: The value of the smallest possible solutions based = value solution fitness i
on parameters j.
: Greatest value possible solutions based on ∑ = the amount of the fitness i to SN
parameters j
(0,1) : A random value between 0 and 1 Once the probability of each possible value of the solution
= 1 . . . SN, SN is the number of possible solutions (food is calculated, the onlooker bee will choose a possible solution
source). which will be explored further by Scout Bee using the roulette
= 1 . . . D, D is the number of parameters wheel method.

B. Employed Bee Phase E. Scout Bee Phase


Upon finding a new location of food source, a new route To apply the method roulette-wheel, selected at random
will be created by using the following equation: real number between [0, 1] for each possible solution. If the
value of pi is greater than the random number specified,
= + . − (2)[2] therefore the scout bee will assign the scout bees returning to
expand the possibilities for a solution that was chosen in
Where: accordance with the previous stage of the worker bees. Once
: New food source elected, the expanded possible solutions, will be applied to a
: value of the possible solution i with parameter j greedy selection between possible solution xi with the new
= 1 . . . SN, SN is the number of possible solutions (food value is the result of expansion of vi. If value vi is less than value
source) vi, so value vi will be considered equal to the value xi.
Otherwise, value vi is stored as the value of the experiment. This
= 1 . . . D, D is the number of parameters
process is repeated until the amount of expansion is in
= 1 . . . SN, SN is the number of parameters used
accordance with the possible solutions. After all possible
 : Random real number between [-1, 1]
solutions have a value of trial, would have been possible
solutions with maximum experimental values and the
After each possible solution are extended, it will be applied possibility of the solution of choice the best solution. The
to a greedy selection between the values possible for solution xi process of returning to the stage of Employed Bee Phase will
with the new value that is the result of the expansion of vi. If be repeated until the limiting criteria are met, which is a limiting
value vi is less than the value xi, so value vi will be considered criterion in the number of bees in a colony.
equal to the value xi and the value of the experiment is still
worth 0. If not, xi stored value and the value of the i-th F. Adapting ABC algorithm to the t-way problem
experiment coupled with a 1. This process is repeated until the A few modification is needed in adapting the ABC algorithm
amount is equal to the expansion the amount of food sources. for solution of t-way problem. This because most of parameter
in t-way method is using integer value. Tuples are become the
C. The evaluation phase of population food source. Initialization equation (1) is modified as the
After each possible solution are extended and compared following function:
with the initial value of the initialization, the next step is the
calculation of the quality of each possible solution using the = + (0,1). − +1 (5)
following fitness function:
Where:
, ( )≥0 : value in is integer number
( ) ( ) (3)[2]
1 + | ( )| , ( ) < 0 Beside that formula for the new location equation (2)
also need to be modified to suit with the application as below:
Where:
= 1 . . . SN, SN is the number of possible solutions (food
source). =[ + . − ]% +1 (6)
The changes is to make the range of random number until
D. Onlooker Bee Phase the maximum values and converted to integer values. The
calculation for fitness is calculated as here:

593
2016 3rd International Conference on Electronic Design (ICED), August 11-12, 2016, Phuket, Thailand

scout bees and dismissal. Next, the algorithm will be


=∑ (7) implemented and the performance (i.e. in terms of generated test
suite size) will be compared against other strategy using several
Where: benchmarking experiments.
wk is the number of uncovered tuples for kth input-output
relationship

Based on the fitness value, the best food source will be ACKNOWLEDGMENT
selected. Figure 2 shows the Proposed Artificial Bee Genetic This research is partially funded by the generous
Algorithm for T-way testing. Last but not least, the stopping MOHE fundamental grant “Fundamental study on the
criteria will be checked. Once a complete t-way test suite has effectiveness measurement of partially executed t-way test suite
been generated (i.e. no more uncovered tuples), the generation for software testing”, and the “Tabung Penyelidikan Jangka
process will stop. Otherwise, a new food source will be Pendek – Anugerah Kecemerlangan UniMAP”.
generated and employed bee phase will be repeated.

Start

REFERENCES
Initialize food source
[1] Yunfeng Xu, Ping Fan, and Ling Yuan, “A Simple and Efficient Artificial
Bee Colony Algoritm,” in Hindawi Publishing Corporation Mathematical
Employed Bee Phase Problems in Engineering, 2013, Article ID 526315.
[2] D. Karaboga and B. Akay, “A Comparative Study of Artificial Bee
Colony Algoritm,” Applied Mathematics and Computation, vol. 214, no.
1, pp. 108–132, 2009.
Onlooker Bee Phase [3] Bertolino, A. Software Testing Research: Achievements, Challenges,
Dreams. in Future of Software Engineering Conference. 2007.
Minneapolis, Minnesota, USA.
[4] R. R. Othman and K. Z. Zamli, “T-Way strategies and Its Applications for
Abandon food? Combinatorial Testing,” in International Journal on New Computer
Architectures and Their Applications, 2011, pp. 459–473.
[5] R. R. Othman, K. Z. Zamli, and L. E. Nugroho, “A General Variable
Strength T-Way Strategy Supporting Flexible Interactions,” Maejo Int. J.
Scout Bee Phase Sci. Technol., vol. 6, no. 3, pp. 415–429, 2012.
[6] R. R. Othman and K. Z. Zamli, “T-Way Strategies: A Critical Survey and
Analysis,” Int. J. Digit. Content Technol. its Appl., vol. 7, no. 9, pp. 222–
Store best food source 235, 2013.
[7] K. Z. Zamli, M. F. J. Klaib, M. I. Younis, N. A. M. Isa, and R. Abdullah,
“Design And Implementation Of A T-Way Test Data Generation Strategy
With Automated Execution Tool Support,” Inf. Sci. (Ny)., vol. 181, no.
9, pp. 1741–1758, 2011.
Uncovered tuples?
[8] J. Czerwonka, “Pairwise Testing In Real World,” in Proceedings of 24th
Pacific Northwest Software Quality Conference, 2006, pp. 419–430.
[9] R. R. Othman and K. Z. Zamli, “ITTDG: Integrated T-way Test Data
Generation Strategy for Interaction Testing,” Sci. Res. Essays, vol. 6, no.
List optimal test suite 17, pp. 3638–3648, 2011.
[10] A. R. A. Alsewari and K. Z. Zamli, “An Orchestrated Survey on T-Way
Test Case Generation Strategies Based on Optimization Algorithms,” in
The 8th International Conference on Robotic, Vision, Signal Processing
End & Power Applications, vol. 291, H. A. Mat Sakim and M. T. Mustaffa,
Eds. Singapore: Springer Singapore, 2014, pp. 255–263.
[11] M. B. Cohen, C. J. Colbourn, P. B. Gibbons, and W. B. Mugridge,
Fig. 2. Proposed Artificial Bee Genetic Algorithm for T-way testing “Constructing Test Suites for Interaction Testing,” in Proceedings of 25th
IEEE International Conference on Software Engineering, 2003, pp. 38–
48.
[12] T. Shiba, T. Tsuchiya, and T. Kikuno, “Using Artificial Life Techniques
IV. CONCLUSION AND FUTURE WORK To Generate Test Cases For Combinatorial Testing,” in Proceedings of
the 28th Annual Intl.Computer Software and Applications Conf.
(COMPSAC’04), 2004, pp. 72–77.
In this paper, Artificial Bee Colony algorithm is proposed in
[13] X. Chen, Q. Gu, A. Li, and D. Chen, “Variable Strength Interaction
solving issue in t-way testing field. The algorithm consists of 5 Testing With An Ant Colony System Approach,” in Proceedings of 16th
phases which are initialization, employed bees, onlooker bees Asia-Pacific Software Engineering Conference, 2009, pp. 160–167

594

You might also like