Abstract
The Java Enterprise Edition (Java EE) platform and its persistence API are widely adopted technologies to develop applications that interact with database systems. Many control flows of these applications strongly depend on a specific database state. This paper presents an automatic test-case generation approach for applications in this environment. The approach generates both test data for the application’s input, as well as entity objects for the different database states that are required to cover a respective control flow. We integrate constraints from symbolically executing a control flow with constraints on a required database state. We also support typical Java EE functionalities in the symbolic execution, e.g. dependency injection. An experimental evaluation shows an increase in control-flow coverage by our approach.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Similar content being viewed by others
Notes
- 1.
http://docs.oracle.com/html/E13946_04/ejb3_langref.html, accessed January 2017.
- 2.
http://arquillian.org/, accessed March 2017.
- 3.
If an explored path contains a bug, the input values that trigger it can be derived from the path condition.
- 4.
https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html, accessed March 2017.
- 5.
- 6.
From a database point of view, this corresponds to a constraint \(e1.foreignKey = e2.primaryKey\).
- 7.
http://wildfly.org/, accessed March 2017.
- 8.
http://arquillian.org/, accessed March 2017.
- 9.
- 10.
http://www.eclemma.org/jacoco/, accessed March 2017.
References
Ait-Kaci, H.: Warren’s Abstract Machine: A Tutorial Reconstruction. MIT Press, Cambridge (1991)
Arcuri, A., Fraser, G.: Java enterprise edition support in search-Based JUnit test generation. In: Sarro, F., Deb, K. (eds.) SSBSE 2016. LNCS, vol. 9962, pp. 3–17. Springer, Cham (2016). doi:10.1007/978-3-319-47106-8_1
Diakopoulos, N., Cass, S.: Interactive: The Top Programming Languages 2016. IEEE Spectrum (2016). http://spectrum.ieee.org/static/interactive-the-top-programming-languages-2016
Ebersole, S.: Semantic Query Model and Interpreter for HQL/JPQL and JPA Criteria Queries. Hibernate (2017). https://github.com/hibernate/hibernate-semantic-query
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)
Ernsting, M., Majchrzak, T.A., Kuchen, H.: Dynamic solution of linear constraints for test case generation. In: Margaria, T., Qiu, Z., Yang, H. (eds.) 6th International Conference on Theoretical Aspects of Software Engineering, pp. 271–274. IEEE, Beijing (2012)
Fraser, G., Arcuri, A.: EvoSuite: automatic test suite generation for object-oriented software. In: Proceedings of the 19th ACM SIGSOFT Symposium and the 13th European Conference on Foundations of Software Engineering, pp. 416–419. ACM (2011)
Gould, C., Su, Z., Devanbu, P.: Static checking of dynamically generated queries in database applications. In: Proceedings of the 26th International Conference on Software Engineering, pp. 645–654. IEEE Computer Society (2004)
King, J.C.: Symbolic execution and program testing. Commun. ACM 19(7), 385–394 (1976)
Kuchcinski, K., Szymanek, R.: Jacop - Java constraint programming solver. In: Proceedings of of CP Solvers: Modeling, Applications, Integration, and Standardization (2013)
Lindholm, T., Yelln, F., Bracha, G., Buckley, A.: The Java Virtual Machine Specification, Java SE 8 Edion. Addison Wesley, Boston (2014)
Majchrzak, T.A., Kuchen, H.: Automated test case generation based on coverage analysis. In: Proceedings of the 3rd IEEE International Symposium on Theoretical Aspects of Software Engineering, pp. 259–266. Tianjin, China (2009)
Pacheco, C., Lahiri, S.K., Ernst, M.D., Ball, T.: Feedback-directed random test generation. In: Proceedings of the 29th International Conference on Software Engineering, pp. 75–84. IEEE Computer Society (2007)
Parr, T.: The Definitive ANTLR 4 Reference. Pragmatic Bookshelf, Raleigh (2013)
Prasetya, I.: T3i: a tool for generating and querying test suites for Java. In: Proceedings of the 2015 10th Joint Meeting on Foundations of Software Engineering, pp. 950–953. ACM (2015)
Sakti, A., Pesant, G., Guéhéneuc, Y.G.: Instance generator and problem representation to improve object oriented code coverage. IEEE Trans. Softw. Eng. 41(3), 294–313 (2015)
Taneja, K., Zhang, Y., Xie, T.: MODA: automated test generation for database applications via mock objects. In: Proceedings of the IEEE/ACM International Conference on Automated Software Engineering, pp. 289–292. ACM (2010)
Yi, Q., Yang, Z., Guo, S., Wang, C., Liu, J., Zhao, C.: Postconditioned symbolic execution. In: 2015 IEEE 8th International Conference on Software Testing, Verification and Validation (ICST), pp. 1–10. IEEE (2015)
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2017 Springer International Publishing AG
About this paper
Cite this paper
Fuchs, A., Kuchen, H. (2017). Unit Testing of Database-Driven Java Enterprise Edition Applications. In: Gabmeyer, S., Johnsen, E. (eds) Tests and Proofs. TAP 2017. Lecture Notes in Computer Science(), vol 10375. Springer, Cham. https://doi.org/10.1007/978-3-319-61467-0_4
Download citation
DOI: https://doi.org/10.1007/978-3-319-61467-0_4
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-319-61466-3
Online ISBN: 978-3-319-61467-0
eBook Packages: Computer ScienceComputer Science (R0)