Artificial Bee Colony Algorithms And Software Testing Computer Science Essay

Published: Last Edited:

This essay has been submitted by a student. This is not an example of the work written by our professional essay writers.

The emerging area in the field of optimization is swarm intelligence. Various meta-heuristics algorithms based on swarm intelligence have been developed by many researchers. These algorithms have been developed by modeling the behaviors of swarm of animals and insects such as birds, bees, ants, fishes etc. The main focus of these algorithms is on the collective behavior which results from the local interactions between the individuals and with their environment. The Artificial Bee Colony Algorithm which has been recently introduced [1] is also a swarm based meta-heuristic algorithm. The algorithm models the intelligent foraging behavior of honey bees and has been introduced for optimizing various numerical problems. This paper gives a brief introduction about Artificial Bee Colony algorithm and also presents a review of applications of Artificial Bee Colony Algorithm in the field of software testing.


Swarm Intelligence, Artificial Bee Colony Algorithm, Software Testing.


Swarm intelligence as a discipline deals with the artificial and natural systems which are composed of many individuals and they coordinate using the decentralized control and self organization [2]. The main focus of the discipline is on the collective behavior. Local interaction amongst the individuals and with their environment results into collective behavior. Some of the swarm based meta-heuristics algorithms are Particle Swarm Optimization, Ant Colony Optimization, and Artificial Bee Colony Optimization. Dervis Karaboga [1] in 2005 defined the artificial bee colony algorithm, which is the most recently introduced swarm based meta-heuristics algorithm. Since its inception, artificial bee colony algorithm has been applied in various fields. It also finds application in the field of software testing, which is one of the most indispensible phase of the software development lifecycle.

This paper is divided into five sections. The next section gives a brief introduction about the nature of bees. Section 3 describes the artificial bee colony algorithm. Section 4 presents a review of application of artificial bee colony algorithm in the field of software testing and the last section give the comparative analysis of the applications on different parameters.


2.1 Components of Bee Colony

The bee (Apis Mellifera) native to Europe and Africa is a social and domestic animal. Bees feed on nectar and pollens, where nectar is the prime source of energy and pollens act as supplements of proteins and other nutrients. Pollen is mostly used as food for larvae [3]. Generally the bee colony consists of a single queen bee that is responsible for laying eggs, thousand of male bees called drones and thousands of worker bees, which are the sterile bees and the young bee larvae called broods.

2.2 Bees Dance

Bees randomly searches for food source positions with good supply of nectar. Once a bee finds such a position, it goes back to the hive and communicates about the food source position by dancing in the comb. If the foraging bee finds the food source position close to hive, it performs a simple round dance and if the food source position is far from the hive, then it performs waggle dance. Waggle dance basically forms an eight like figure and the distance and the direction of the food source is indicated by this dance. The speed of the dance conveys the distance. The inclination of the dance (angle between the sun, relative to hive and the food source) indicates the direction of the food source [4].

3. Artificial Bee Colony Algorithm

The artificial bee colony algorithm consists of 3 types of bees- the employed bee, onlooker bee and the scout bee. Scout bee is responsible for carrying out random searches in the environment. A bee who visits the food source visited by it previously is called an employed bee and the bee that waits in the beehive for decision making is called the onlooker bee. Both exploration and exploitation processes are carried out by all the three bees. In the ABC algorithm it is assumed that the colony consists of equal number of employed bees and onlooker bees and for every food source there is an employed bee in the hive. The bee whose food source has been exhausted by other bees becomes a scout bee [5]. The bee has the capability of memorizing the location of the food source once it has been discovered and then immediately starts exploiting it. The foraging bee returns to the hive with load of nectar from the source and then unloads the nectar to a food store. The bee has the following three options after unloading the nectar [1]:

It becomes an uncommitted follower once the food source has been abandoned.

It dances and recruits other nest mates while returning to the same food source.

Without recruiting other bees, it continues to forage at the food source.

The search consist a cycle of three steps [1]. In the beginning, some food sources are randomly selected by the bees and the amount of nectar is also determined. Then these bees return to the hive and share this information by performing the waggle dance. In second stage, each employed bee goes to the food source visited by her in previous cycle and then by means of visual information, chooses a new food source in the neighborhood. In the third stage, an onlooker bee visits the food source position depending on the nectar information shared by the employed bees. The food source with maximum nectar quantity is selected by the onlooker bee. After arriving at the selected food source, the onlooker bee according to visual information chooses a new food source in the neighborhood of the selected food source. Once the food source is abandoned by the bee, a new food source is randomly selected by a scout and then the abandoned source is replaced by this new food source.

Depending upon the probabilistic value onlooker bee selects a food source. This value pi is calculated as [5]:

where SN is the number of food sources which is also equal to employed bees number (BN) and fiti is the fitness value of the solution i evaluated by its employed bee. The fitness value is proportional to the nectar amount of the food source. To produce a candidate food position from the old one, the algorithm uses the following expression [5]:

Where the random chosen indexes are k € {1, 2. . . BN} and j € {1, 2. . . D} and k is different from i. φij is a random number between [−1, 1]. It controls the production of a neighbor food source position around xij and the modification represents the comparison of neighbor food positions visually by the bee [5].

4. Application of Artificial Bee Colony Algorithm to Software Testing

Software testing is a type of multi variable optimization problem where generation and selection of efficient test cases cannot be achieved within permissible time bounds. Hence for solving these types of problems, meta-heuristics search algorithms have been proposed [6]. These algorithms help in finding the near optimal solution in reasonable running time. The artificial bee colony algorithm, which is also a meta-heuristics search algorithm, is capable of locating efficient solutions. The algorithm models the food foraging behavior of honey bees. The main focus of software testing is on uncovering as many errors as possible in the given time, as this would help in conforming the product to the requirement specifications and also to validate the quality of the software produced [7]. The following paragraphs give the review of application of artificial bee colony algorithm in the field of software testing.

Mala et al [6] applied artificial bee colony algorithm in the field of software test suite optimization. The approach is based on population based algorithm where every test case represents a possible solution for the optimization problem. A happiness value has been introduced for each test case corresponding to the fitness or quality of the associated solution. Here the three bees are replaced by search agent, selector agent and optimizer agent. Various properties of agents are autonomy, inter-operability and social ability [11]. These agents help in selecting efficient test cases from infinite number of test cases. The parallel behavior of the agents helps in generating the solution faster. Path coverage has been described as the test adequacy criteria. Initially random test cases are generated for all test paths or sequences. Along the path, as the search agent goes to an executable state, it monitors each test case and also determines a neighbor state. The happiness value is updated for every test case, along every test path. If a particular node is not covered by a particular test case, then that node gets eliminated. The selector agent starts a new search for locating the node with highest feasibility in that path. Only the test case with maximum happiness value is remembered and rests are removed from the memory. Based on the happiness value, the optimizer agent chooses one of the test cases and also selects a neighbor around that for evaluating its happiness value. Abandoned test cases are replaced with the new test cases as discovered by the selector agent and this is repeated until all the nodes have been visited once.

This algorithm was implemented on few sample problems and the results were compared to the results of application of Ant colony Optimization for test suite optimization. It was observed that ABC algorithm provided consistent results and the problems faced in ACO such as pheromone updation, memory and time overheads were not faced by ABC algorithm.

McCaffrey [8] applied simulated bee colony algorithm for generation of pair wise test sets. A pair wise test set is generally a collection of test vectors where all possible combination of pairs of values has been captured from different parameters. Here a bee has been modeled as a bee object with four types of data fields and the entire colony is represented as a hive object consisting of an array of bee objects [8]. An enumeration type which specifies the current role (active, scout and inactive) is the first field. The second field defines a 2-D array representing a bee's memory, which in turn would represent a partial solution. An integer value representing the quality of food source associated with data in bee's memory is the third field type and the fourth field is represented by the number of times a particular food source has been visited by the bee object without locating a neighbor source with higher quality value. The algorithm requires an initial seed value which can be any value equal or greater to number of test vectors which are representing a minimal solution. In the proposed algorithm, when the scout bee is in active role, then it leaves the hive and selects a random food location and compares the quality of food. If the quality of the food location is greater than the one in its memory, the memory gets updated with new food location. The simulated scout bee performs the waggle dance in hive and these dances are visible to all the inactive bees in the hive. In the algorithm, the number of times an active foraging bee visits a source has been fixed. Global counter variable helps in tracking the number of simulated bees in each role. Therefore when an active bee becomes inactive, then randomly an inactive bee is selected and gets transitioned to an active state.

The algorithm was run against seven pairwise tests set generation benchmark problem. The approach yielded good result in terms of test set size but the performance of the algorithm was slower as compared to other deterministic algorithms.

Mala et al [9] again proposed the use parallel behavior of the three bees for automated software test optimization. The main focus was to generate efficient test suite which can cover the software under test within time and less cost. The artificial bee colony algorithm system combines the local search conducted by the employed and onlooker bees with the global search carried out by scout bee. Hence it helps in attaining global or near-global optima. The test adequacy criteria applied here is ensuring the state coverage, path coverage and branch coverage. The cyclomatic complexity of the given program is known and it also indicates the number of independent paths. Three bee's functionality gets extended to three agents- search agent, selector agent and replace agent. The algorithm in [6] was implemented on 10 benchmark problems and the results were compared to sequential ABC, random testing and Genetic Algorithm. It was found that the performance of parallel ABC algorithm is better than the other approaches. In some cases random testing also produced better results as compared to genetics algorithm. For 100% coverage, the number of test cases needed was very less in parallel ABC as compared to other approaches. GA gave only 50% coverage due to strike up local optimal solution.

Dahiya et al [10] presented an ABC algorithm based approach for automatic generation of structural software tests. The working of the honey bee is reported as robust and adaptive by [12].The paper applied artificial bee colony based search algorithm for generating test data using symbolic execution technique of static structural testing and therefore corresponding to every path a compound predicate was constructed by 'anding' all the branch predicates of a path. The compound predicate should be evaluated to true by a candidate solution to become a valid test case.

For test data generation, random population of candidate solution is generated. Solutions are represented by position of flower patches. The profitability related to each flower is also measured. This profitability is replaced by the fitness of the positions in computer modeling. It includes various parameters such as nectar content in the flower, distance of flower from the beehive and sugar content in nectar etc. In the first phase of the algorithm; the employed bees modify elite flower patches' position w.r.t. neighborhood. In the second phase, the onlooker bees modify their patches' position w.r.t. elite patches' position. A greedy selection process is repeated after every phase where solution or flower patches compete among themselves for retention in the selected or elite flower patches, based on their fitness. Hence some solutions or flowers may migrate from one patch to another patch and some may get abandoned. These search phases of the bees are repeated until some termination criteria are met.

The algorithm was implemented on ten real world problems. The output suggested that the proposed algorithm had performed satisfactorily for most of the programs except for the programs having large input domains and various equality based path constraints.

5. Analysis and Discussion

Four different applications of Artificial Bee Colony algorithm in the field of software testing has been reviewed and based on the analysis a table has been formulated which compares all the applications on different parameters.


Application by

D Jeya Mala (2009)[6]

Application by James D McCaffrey (2009)[8]

Application by

D Jeya Mala (2010)[9]

Application by

S S Dahiya (2010)[10]

Main Objective

Test suite optimization

Generation of pairwise test sets

Automated software test optimization

Automatic generation of structural software tests.

Output obtained

Generated optimal results and it converges within less number of test runs.

Good results in terms of test set size and suggests the use where test sets are intended to be reused.

Generated global or near global optimal results and it converges within less number of test runs.

Generated test cases for all paths.

Tool used for implementation


PICT in C++

QICT in C#



Output Comparison

With Ant Colony Optimization Algorithm

With published results of 7 benchmark problems.

With Sequential ABC, Random Testing and Genetics Algorithm

No Comparison made

Behavior of Bees

Parallel behavior of bees

Sequential behavior

Parallel behavior

Sequential behavior

Cyclomatic complexity





Type of bees

Search Agent, Selector Agent, Optimizer Agent

Employed bee, Onlooker bee, Scout bee

Search agent, Selector agent, Replace Agent

Employed bee, Onlooker bee, Scout bee

Test Adequacy Criteria

Path Coverage

Not Mentioned

Path coverage, Branch Coverage, State coverage

Path coverage


Not Mentioned

Longer generation time

Not mentioned

Did not perform well on programs having large input domain and many equality based path constraints.

Benchmark problem used

6 problems

7 benchmark problems


10 real world problems

Table1. Comparison of various applications of ABC algorithm

Mala et al [6] applied artificial bee colony algorithm for test suite optimization and the results obtained were better than the use of Ant Colony Optimization. McCaffrey [8] applied ABC algorithm for generation of pairwise test sets and suggested the use where test sets are intended to be reused. Mala et al [9] again applied ABC algorithm for automated software test optimization and compared the output with that of sequential ABC algorithm, Random Testing and Genetics Algorithm. For 100% coverage the number of test cases needed was very less in parallel ABC algorithm. Dahiya et al [10] used ABC algorithm for automatic generation of structural software tests. The algorithm performed satisfactorily except for programs with large input domains.

6. Conclusion

In this research the artificial bee colony algorithm has been studied and a review based on application of the artificial bee colony algorithm in the field of software testing has been performed. Based on review a table has been formulated which compares all the applications on different parameters. It was also observed that the current application of artificial bee colony algorithm is in the field of structural testing and for test suite optimization only.