Skip to main content

Ant Colony Optimization for Object-Oriented Unit Test Generation

  • Conference paper
  • First Online:
Swarm Intelligence (ANTS 2020)

Part of the book series: Lecture Notes in Computer Science ((LNTCS,volume 12421))

Included in the following conference series:

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.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Notes

  1. 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. 2.

    JaCoCo is a free code coverage library for Java: https://www.eclemma.org/jacoco/.

  3. 3.

    https://randoop.github.io/randoop/.

References

  1. Allen, F.E.: Control flow analysis. ACM SIGPLAN Not. 5, 1–19 (1970)

    Article  Google Scholar 

  2. 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)

    Google Scholar 

  3. 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

    Chapter  Google Scholar 

  4. 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)

    Google Scholar 

  5. 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)

    Google Scholar 

  6. 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)

    Google Scholar 

  7. 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)

    Article  Google Scholar 

  8. Bidgoli, A.M., Haghighi, H.: Augmenting ant colony optimization with adaptive random testing to cover prime paths. J. Syst. Softw. 161, 110495 (2020)

    Article  Google Scholar 

  9. 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

    Chapter  Google Scholar 

  10. 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)

    Google Scholar 

  11. 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)

    Google Scholar 

  12. 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)

    Google Scholar 

  13. Fraser, G., Arcuri, A.: Evolutionary generation of whole test suites. In: International Conference On Quality Software (QSIC), pp. 31–40. IEEE (2011)

    Google Scholar 

  14. Fraser, G., Arcuri, A.: A large scale evaluation of automated unit test generation using EvoSuite. Trans. Softw. Eng. Methodol. (TOSEM) 24(2), 8 (2014)

    Google Scholar 

  15. Gulwani, S., Polozov, O., Singh, R., et al.: Program synthesis. Found. Trends Program. Lang. 4(1–2), 1–119 (2017)

    Google Scholar 

  16. 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)

    Google Scholar 

  17. Hara, A., Watanabe, M., Takahama, T.: Cartesian ant programming. In: International Conference on Systems, Man, and Cybernetics, pp. 3161–3166. IEEE (2011)

    Google Scholar 

  18. Harman, M., Mansouri, S.A., Zhang, Y.: Search-based software engineering: trends, techniques and applications. Comput. Surv. (CSUR) 45(1), 11 (2012)

    Google Scholar 

  19. 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)

    Google Scholar 

  20. Korel, B.: Automated software test data generation. Trans. Softw. Eng. 16(8), 870–879 (1990)

    Article  Google Scholar 

  21. 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)

    Google Scholar 

  22. 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)

    Google Scholar 

  23. 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)

    Article  Google Scholar 

  24. 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)

    Google Scholar 

  25. 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)

    Google Scholar 

  26. 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)

    Google Scholar 

  27. 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)

    Article  Google Scholar 

  28. Socha, K., Dorigo, M.: Ant colony optimization for continuous domains. Eur. J. Oper. Res. 185(3), 1155–1173 (2008)

    Article  MathSciNet  Google Scholar 

  29. 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)

    Google Scholar 

  30. 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)

    Google Scholar 

  31. 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)

    Google Scholar 

  32. 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)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Dan Bruce .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2020 Springer Nature Switzerland AG

About this paper

Check for updates. Verify currency and authenticity via CrossMark

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)

Publish with us

Policies and ethics