Java Enterprise Edition Support in Search-Based JUnit Test Generation

  • Andrea Arcuri
  • Gordon Fraser
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 9962)


Many different techniques and tools for automated unit test generation target the Java programming languages due to its popularity. However, a lot of Java’s popularity is due to its usage to develop enterprise applications with frameworks such as Java Enterprise Edition (JEE) or Spring. These frameworks pose challenges to the automatic generation of JUnit tests. In particular, code units (“beans”) are handled by external web containers (e.g., WildFly and GlassFish). Without considering how web containers initialize these beans, automatically generated unit tests would not represent valid scenarios and would be of little use. For example, common issues of bean initialization are dependency injection, database connection, and JNDI bean lookup. In this paper, we extend the EvoSuite search-based JUnit test generation tool to provide initial support for JEE applications. Experiments on 247 classes (the JBoss EAP tutorial examples) reveal an increase in code coverage, and demonstrate that our techniques prevent the generation of useless tests (e.g., tests where dependencies are not injected).


Java Enterprise Edition (JEE) Search-based testing Automated unit test generation Database 



This work is supported by the EPSRC project (EP/N023978/1) and by the National Research Fund, Luxembourg (FNR/P10/03).


  1. 1.
    Arcuri, A., Briand, L.: A hitchhiker’s guide to statistical tests for assessing randomized algorithms in software engineering. Softw. Test. Verification Reliab. 24(3), 219–250 (2014)CrossRefGoogle Scholar
  2. 2.
    Arcuri, A., Fraser, G.: Parameter tuning or default values? An empirical investigation in search-based software engineering. Empirical Softw. Eng. 18(3), 594–623 (2013)CrossRefGoogle Scholar
  3. 3.
    Arcuri, A., Fraser, G., Galeotti, J.P.: Automated unit test generation for classes with environment dependencies. In: IEEE/ACM International Conference on Automated Software Engineering (ASE), pp. 79–90 (2014)Google Scholar
  4. 4.
    Arcuri, A., Fraser, G., Galeotti, J.P.: Generating TCP/UDP network data for automated unit test generation. In: ACM SIGSOFT International Symposium on the Foundations of Software Engineering (FSE), pp. 155–165. ACM (2015)Google Scholar
  5. 5.
    Collberg, C., Proebsting, T.A.: Repeatability in computer systems research. Commun. ACM 59(3), 62–69 (2016)CrossRefGoogle Scholar
  6. 6.
    Emmi, M., Majumdar, R., Sen, K.: Dynamic test input generation for database applications. In: Proceedings of the 2007 International Symposium on Software Testing and Analysis, pp. 151–162. ACM (2007)Google Scholar
  7. 7.
    Fraser, G., Arcuri, A.: Evosuite: automatic test suite generation for object-oriented software. In: ACM SIGSOFT International Symposium on the Foundations of Software Engineering (FSE), pp. 416–419. ACM (2011)Google Scholar
  8. 8.
    Goncalves, A.: Beginning Java EE 7. Apress, New York (2013)CrossRefGoogle Scholar
  9. 9.
    Pacheco, C., Lahiri, S.K., Ernst, M.D., Ball, T.: Feedback-directed random test generation. In: ACM/IEEE International Conference on Software Engineering (ICSE), pp. 75–84 (2007)Google Scholar
  10. 10.
    Pan, K., Wu, X., Xie, T.: Guided test generation for database applications via synthesized database interactions. ACM Trans. Softw. Eng. Methodol. (TOSEM) 23(2), 12 (2014)CrossRefGoogle Scholar
  11. 11.
    Prasetya, I.S.W.B.: T3i: A tool for generating and querying test suites for Java. In: ACM SIGSOFT International Symposium on the Foundations of Software Engineering (FSE) (2015)Google Scholar
  12. 12.
    Sakti, A., Pesant, G., Gueheneuc, Y.G.: Instance generator and problem representation to improve object oriented code coverage. IEEE Trans. Softw. Eng. (TSE) 41, 294 (2015)CrossRefGoogle Scholar
  13. 13.
    Taneja, K., Zhang, Y., Xie, T.: Moda: automated test generation for database applications via mock objects. In: IEEE/ACM International Conference on Automated Software Engineering (ASE), pp. 289–292. ACM (2010)Google Scholar
  14. 14.
    Zhang, L., Ma, X., Lu, J., Xie, T., Tillmann, N., De Halleux, P.: Environmental modeling for automated cloud application testing. IEEE Softw. 29(2), 30–35 (2012)CrossRefGoogle Scholar

Copyright information

© Springer International Publishing AG 2016

Authors and Affiliations

  1. 1.Westerdals Oslo ACT, Faculty of TechnologyOsloNorway
  2. 2.University of LuxembourgLuxembourgLuxembourg
  3. 3.Department of Computer ScienceThe University of SheffieldSheffieldUK

Personalised recommendations