Abstract
Software testing is a much needed activity to ensure quality of software systems, and a large and effective test suite has the potential to identify defects. However, substantial effort is required when implementing test cases, due to the knowledge that developers have to acquire on the structure and behaviour of the system under test, and for the time needed to write many test cases to cover most of the execution paths. This paper proposes an automatic approach to generate templates of test cases. A generated test template consists of a JUnit assert, a method call and some default parameters, and can be customised by the developer, since generated code is easy to read. In the proposed approach, some selected industrial software repositories have been analysed to determine the most frequent assert used according to the return type of a method call. Then, such a frequency is used to guide the generation of new test cases for other software systems. The approach has been assessed on real-world Java projects, proving that generated test cases increase application code coverage considerably, while exhibiting readability and effectiveness.
Author supplied keywords
Cite
CITATION STYLE
Midolo, A., & Tramontana, E. (2023). Automatic Generation of Accurate Test Templates based on JUnit Asserts. In ACM International Conference Proceeding Series (pp. 125–131). Association for Computing Machinery. https://doi.org/10.1145/3631908.3631926
Register to see more suggestions
Mendeley helps you to discover research relevant for your work.