RUS  ENG
Full version
JOURNALS // Proceedings of the Institute for System Programming of the RAS // Archive

Proceedings of ISP RAS, 2024 Volume 36, Issue 2, Pages 59–72 (Mi tisp873)

On the automated unit tests generation for Java applications using spring framework

K. A. Shishin, I. V. Muravev, E. K. Kulikov

Saint Petersburg State University

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.

Keywords: Software testing, automated unit test generation, Spring, mocking, UnitTestBot Java

Language: English

DOI: 10.15514/ISPRAS-2024-36(2)-5



© Steklov Math. Inst. of RAS, 2024