Toward Granular Automatic Unit Test Case Generation
Fabiano Pecorelli, Giovanni Grano, Fabio Palomba, Harald C. Gall,, Andrea De Lucia

TL;DR
This paper proposes a structured, two-step approach for automatic unit test case generation that ensures tests follow good design principles by covering individual methods and their interactions.
Contribution
It introduces a systematic method combining intra-method and intra-class test generation to improve test quality and structure.
Findings
Effective coverage of individual methods achieved
Enhanced testing of method interactions demonstrated
Structured approach outperforms random search-based methods
Abstract
Unit testing verifies the presence of faults in individual software components. Previous research has been targeting the automatic generation of unit tests through the adoption of random or search-based algorithms. Despite their effectiveness, these approaches do not implement any strategy that allows them to create unit tests in a structured manner: indeed, they aim at creating tests by optimizing metrics like code coverage without ensuring that the resulting tests follow good design principles. In order to structure the automatic test case generation process, we propose a two-step systematic approach to the generation of unit tests: we first force search-based algorithms to create tests that cover individual methods of the production code, hence implementing the so-called intra-method tests; then, we relax the constraints to enable the creation of intra-class tests that target the…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsSoftware Testing and Debugging Techniques · Software Engineering Research · Software Reliability and Analysis Research
