Preview

Proceedings of the Institute for System Programming of the RAS (Proceedings of ISP RAS)

Advanced search

On the Automated Unit Tests Generation for Java Applications using Spring Framework

https://doi.org/10.15514/ISPRAS-2024-36(2)-5

Abstract

This paper considers the automated unit tests generation for programs written in Java using the Spring framework. Although several test generation tools for “pure” Java applications have been developed in recent decades, the features of this framework are mostly not taken into account. However, Spring is used to develop many industrial Java applications. At the same time, the presence of Spring components in the application for which the tests are generated imposes additional requirements not only on the code analysis approaches, but also on the structure of the generated tests. The main source of the information about object types and their properties is the Spring application context. The paper proposes an instrument for analyzing the application context, that in some cases allows generating test scenarios corresponding to real program executions and avoiding excessive mocking. The full initialization of the application context does not occur during this analysis. It makes the test generation safe for user data. The proposed instrument for analyzing the Spring context has been integrated into the UnitTestBot Java automatic test generation tool. We also provide examples of tests generated for real open-source projects.

About the Authors

Kirill Alexandrovich SHISHIN
St. Petersburg State University
Russian Federation

Student of the software engineering department of SPbU. Research interests: static code analysis tools, automated tests generation.



Ilia Vladimirovich MURAVEV
St. Petersburg State University
Russian Federation

Researcher of the software engineering department of SPbU. Research interests: static code analysis tools, automated tests generation, context-free grammars.



Egor Konstantinovich KULIKOV
St. Petersburg State University
Russian Federation

Cand. Sci. (Phys.-Math.), associate professor of the software engineering department of SPbU. Research interests: static code analysis tools, automated tests generation; local approximation methods and their parallelization.



References

1. Cristian C., Daniel D., Dawson E. KLEE: Unassisted and Automatic Generation of High-Coverage Tests for Complex Systems Programs. Proceedings of the 8th USENIX Conference on Operating Systems Design and Implementation (OSDI’08) USA: USENIX Association, 2008, pp. 209-224.

2. Workshop on Search-Based and Fuzz Testing, Available at: https://sbft24.github.io, accessed 24.06.2024.

3. Ivanov D. et al. UTBot Java at the SBST2022 Tool Competition. 2022 IEEE/ACM 15th International Workshop on Search-Based Software Testing (SBFT), 2022, pp. 39-40. DOI: 10.1145/3526072.3527529.

4. Ivanov D., Menshutin A., Pelevin M. et al. UTBot at the SBFT 2023 Java Tool Competition. 2023 IEEE/ACM International Workshop on Search-Based and Fuzz Testing (SBFT), 2023, pp. 68-69. DOI: 10.1109/SBFT59156.2023.00019.

5. Java Programming – The State of Developer Ecosystem in 2022 Infographic, JetBrains: Developer Tools for Professionals and Teams, Available at: https://www.jetbrains.com/lp/devecosystem-2022/, accessed 24.06.2024.

6. Fadatare R. Spring Boot Unit Testing Service Layer using JUnit and Mockito, Available at: https://www.javaguides.net/2022/03/spring-boot-unit-testing-service-layer.html, accessed 24.06.2024.

7. Overview: Spring Framework, Available at: https://docs.spring.io/spring-framework/reference/testing/spring-mvc-test-framework/server.html, accessed 24.06.2024.

8. Chathuranga S. Unit and Integration Testing in Spring Boot Micro Service, Available at: https://salithachathuranga94.medium.com/unit-and-integration-testing-in-spring-boot-micro-service-901fc53b0dff, accessed 24.06.2024.

9. Kim M., Xin Q., Sinha S., Orso A. Automated test generation for REST APIs: no time to rest yet. Proceedings of the 31st ACM SIGSOFT International Symposium on Software Testing and Analysis (ISSTA 2022), Association for Computing Machinery, New York, USA, 2022, pp. 289-301. DOI: 10.1145/3533767.3534401.

10. Baldoni R., Coppa E., Cono D’elia D., Demetrescu C., Finocchi, I. A Survey of Symbolic Execution Techniques. ACM Comput. Surv. 51, 3, Article 50, 2019. 39 p. DOI: 10.1145/3182657.

11. Fadatare R. 10+ Free Open Source Projects Using Spring Boot, Available at: https://www.javaguides.net/2018/10/free-open-source-projects-using-spring-boot.html, accessed 24.06.2024.


Review

For citations:


SHISHIN K.A., MURAVEV I.V., KULIKOV E.K. On the Automated Unit Tests Generation for Java Applications using Spring Framework. Proceedings of the Institute for System Programming of the RAS (Proceedings of ISP RAS). 2024;36(2):59-72. https://doi.org/10.15514/ISPRAS-2024-36(2)-5



Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 License.


ISSN 2079-8156 (Print)
ISSN 2220-6426 (Online)