A Fitness Function for Search-based Testing of Java Classes, which is Based on the States Reached by the Object under Test

Authors

  • Ina Papadhopulli

  • Elinda Mece

Keywords:

structural testing, test case generation, search based software testing, fitness function, object state, coverage criteria, mutation score

Abstract

Genetic Algorithms are among the most efficient search-based techniques to automatically generate unit test cases today. The search is guided by a fitness function which evaluates how close an individual is to satisfy a given coverage goal. There exists several coverage criteria but the default criterion today is branch coverage. Nevertheless achieving high or full branch coverage does not imply that the generated test suite has good quality. In object oriented programs the state of the object affects its behavior. Thereupon, test cases that put the object under test, in new states are of interest in the testing context. In this article we propose a new fitness function which takes into consideration three factors for evaluation: the approach level, the branch distance and the new states reached by a test case. The coverage targets are still the branches, but during the search, the state of the object under test evolves with the scope to produce individuals that discover interesting features of the class and as a consequence can discover errors. We implemented this fitness function in the eToc tool. In our experiments the usage of the proposed fitness function towards the original fitness function results in a relative increase of 15.6% in the achieved average mutation score with the cost of a relative increase of 12.6% in the average test suite size.

How to Cite

Ina Papadhopulli, & Elinda Mece. (2016). A Fitness Function for Search-based Testing of Java Classes, which is Based on the States Reached by the Object under Test. Global Journal of Computer Science and Technology, 16(C2), 5–15. Retrieved from https://computerresearch.org/index.php/computer/article/view/1399

A Fitness Function for Search-based Testing of Java Classes, which is Based on the States Reached by the Object under Test

Published

2016-03-15