Unit tests help detect faults and prevent regressions, but writing them manually is costly. Automated unit test generation involves constructing inputs that exercise the code and oracles that express expected behavior. Large language models (LLMs) can use code and natural-language context to construct tests, but generated tests may fail to compile or execute, contain invalid assertions, or have limited ability to detect faults. We conducted a systematic literature review and mapping study of 178 publications with eligible full-text reports available by 31 July 2026. We organize the literature using a lifecycle-oriented analytical framework that covers test construction and quality assurance. Across the reviewed studies, context enrichment addresses missing project information, while iterative validation and repair use compiler and execution feedback to revise generated tests. These mechanisms help make tests executable, although their contributions to oracle correctness and fault detection vary across tasks and evaluation settings. Meanwhile, benchmark validity, test maintainability, and industrial reliability remain open concerns. Finally, we discuss opportunities in evaluation, context and specification use, hybrid techniques, and agentic workflows.
翻译:暂无翻译