Abstract
Generating useful unit tests for object-oriented programs is difficult for traditional optimization methods. One not only needs to identify values to be used as inputs, but also synthesize a program which creates the required state in the program under test. Many existing Automated Test Generation (ATG) approaches combine search with performance-enhancing heuristics. We present Tiered Ant Colony Optimization (Taco) for generating unit tests for object-oriented programs. The algorithm is formed of three Tiers of ACO, each of which tackles a distinct task: goal prioritization, test program synthesis, and data generation for the synthesised program. Test program synthesis allows the creation of complex objects, and exploration of program state, which is the breakthrough that has allowed the successful application of ACO to object-oriented test generation. Taco brings the mature search ecosystem of ACO to bear on ATG for complex object-oriented programs, providing a viable alternative to current approaches. To demonstrate the effectiveness of Taco, we have developed a proof-of-concept tool which successfully generated tests for an average of 54% of the methods in 170 Java classes, a result competitive with industry standard Randoop.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Notes
- 1.
For our implementation of Taco the following values were used: \(\rho _0 = 50\), \(\gamma _m = 0.5\), \(\delta _m = 0.05\). With a minimum pheromone of 1 and maximum of 100.
- 2.
JaCoCo is a free code coverage library for Java: https://www.eclemma.org/jacoco/.
- 3.
References
Allen, F.E.: Control flow analysis. ACM SIGPLAN Not. 5, 1–19 (1970)
Alshahwan, N., Harman, M.: Automated web application testing using search based software engineering. In: International Conference on Automated Software Engineering (ASE), pp. 3–12. IEEE/ACM (2011)
Arcuri, A.: Many independent objective (MIO) algorithm for test suite generation. In: Menzies, T., Petke, J. (eds.) SSBSE 2017. LNCS, vol. 10452, pp. 3–17. Springer, Cham (2017). https://doi.org/10.1007/978-3-319-66299-2_1
Arcuri, A., Fraser, G., Galeotti, J.P.: Generating TCP/UDP network data for automated unit test generation. In: Joint Meeting on Foundations of Software Engineering (ESEC/FSE), pp. 155–165. ACM (2015)
Ayari, K., Bouktif, S., Antoniol, G.: Automatic mutation test input data generation via ant colony. In: Annual Conference on Genetic and Evolutionary Computation (GECCO), pp. 1074–1081. ACM (2007)
Baars, A., et al.: Symbolic search-based testing. In: 2011 26th IEEE/ACM International Conference on Automated Software Engineering (ASE 2011), pp. 53–62. IEEE (2011)
Barr, E.T., Harman, M., McMinn, P., Shahbaz, M., Yoo, S.: The oracle problem in software testing: a survey. Trans. Softw. Eng. 41(5), 507–525 (2014)
Bidgoli, A.M., Haghighi, H.: Augmenting ant colony optimization with adaptive random testing to cover prime paths. J. Syst. Softw. 161, 110495 (2020)
Bruce, D., Menéndez, H.D., Clark, D.: Dorylus: an ant colony based tool for automated test case generation. In: Nejati, S., Gay, G. (eds.) SSBSE 2019. LNCS, vol. 11664, pp. 171–180. Springer, Cham (2019). https://doi.org/10.1007/978-3-030-27455-9_13
Campos, J., Panichella, A., Fraser, G.: EvoSuite at the SBST 2019 tool competition. In: International Workshop on Search-Based Software Testing (SBST), pp. 29–32. IEEE/ACM (2019)
Chen, X., Gu, Q., Zhang, X., Chen, D.: Building prioritized pairwise interaction test suites with ant colony optimization. In: International Conference on Quality Software, pp. 347–352. IEEE (2009)
Farah, R., Harmanani, H.M.: An ant colony optimization approach for test pattern generation. In: Canadian Conference on Electrical and Computer Engineering, pp. 001397–001402. IEEE (2008)
Fraser, G., Arcuri, A.: Evolutionary generation of whole test suites. In: International Conference On Quality Software (QSIC), pp. 31–40. IEEE (2011)
Fraser, G., Arcuri, A.: A large scale evaluation of automated unit test generation using EvoSuite. Trans. Softw. Eng. Methodol. (TOSEM) 24(2), 8 (2014)
Gulwani, S., Polozov, O., Singh, R., et al.: Program synthesis. Found. Trends Program. Lang. 4(1–2), 1–119 (2017)
Gupta, N.K., Rohil, M.K.: Using genetic algorithm for unit testing of object oriented software. In: International Conference on Emerging Trends in Engineering and Technology, pp. 308–313. IEEE (2008)
Hara, A., Watanabe, M., Takahama, T.: Cartesian ant programming. In: International Conference on Systems, Man, and Cybernetics, pp. 3161–3166. IEEE (2011)
Harman, M., Mansouri, S.A., Zhang, Y.: Search-based software engineering: trends, techniques and applications. Comput. Surv. (CSUR) 45(1), 11 (2012)
Kifetew, F., Devroey, X., Rueda, U.: Java unit testing tool competition-seventh round. In: International Workshop on Search-Based Software Testing (SBST), pp. 15–20. IEEE/ACM (2019)
Korel, B.: Automated software test data generation. Trans. Softw. Eng. 16(8), 870–879 (1990)
Kushida, J.i., Hara, A., Takahama, T., Mimura, N.: Cartesian ant programming introducing symbiotic relationship between ants and aphids. In: International Workshop on Computational Intelligence and Applications (IWCIA), pp. 115–120. IEEE (2017)
Li, K., Zhang, Z., Liu, W.: Automatic test data generation based on ant colony optimization. In: International Conference on Natural Computation, vol. 6, pp. 216–220. IEEE (2009)
Mao, C., Xiao, L., Yu, X., Chen, J.: Adapting ant colony optimization to generate test data for software structural testing. Swarm Evol. Comput. 20, 23–36 (2015)
Pacheco, C., Lahiri, S.K., Ernst, M.D., Ball, T.: Feedback-directed random test generation. In: International Conference on Software Engineering (ICSE), pp. 75–84. IEEE (2007)
Rojas, S.A., Bentley, P.J.: A grid-based ant colony system for automatic program synthesis. In: Late Breaking Papers at the Genetic and Evolutionary Computation Conference. Citeseer (2004)
Roux, O., Fonlupt, C.: Ant programming: or how to use ants for automatic programming. In: Proceedings of ANTS, vol. 2000, pp. 121–129. Springer, Berlin (2000)
Sharifipour, H., Shakeri, M., Haghighi, H.: Structural test data generation using a memetic ant colony optimization based on evolution strategies. Swarm Evol. Comput. 40, 76–91 (2018)
Socha, K., Dorigo, M.: Ant colony optimization for continuous domains. Eur. J. Oper. Res. 185(3), 1155–1173 (2008)
Srivastava, P.R., Baby, K.: Automated software testing using metahurestic technique based on an ant colony optimization. In: International Symposium on Electronic System Design, pp. 235–240. IEEE (2010)
Toffola, L.D., Pradel, M., Gross, T.R.: Synthesizing programs that expose performance bottlenecks. In: International Symposium on Code Generation and Optimization (CGO), pp. 314–326. ACM (2018)
Vats, P., Mandot, M., Gosain, A.: A comparative analysis of ant colony optimization for its applications into software testing. In: Innovative Applications of Computational Intelligence on Power, Energy and Controls with Their Impact on Humanity (CIPECH). pp. 476–481. IEEE (2014)
Wappler, S., Wegener, J.: Evolutionary unit testing of object-oriented software using strongly-typed genetic programming. In: Annual Conference on Genetic and Evolutionary Computation, pp. 1925–1932 (2006)
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2020 Springer Nature Switzerland AG
About this paper
Cite this paper
Bruce, D., Menéndez, H.D., Barr, E.T., Clark, D. (2020). Ant Colony Optimization for Object-Oriented Unit Test Generation. In: Dorigo, M., et al. Swarm Intelligence. ANTS 2020. Lecture Notes in Computer Science(), vol 12421. Springer, Cham. https://doi.org/10.1007/978-3-030-60376-2_3
Download citation
DOI: https://doi.org/10.1007/978-3-030-60376-2_3
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-030-60375-5
Online ISBN: 978-3-030-60376-2
eBook Packages: Computer ScienceComputer Science (R0)