TATG: Tracking-Aware Testing Objective for LLM-based Test Generation
2026-07-03 • Software Engineering
Software Engineering
AI summaryⓘ
The authors address the difficulty of automatically creating tests for complex Java methods, which need to cover many different parts and detect errors effectively. They note that previous tools like KTester and PANTA don't keep track of which specific testing goals have been met, causing inefficiencies. Their new method, TATG, tracks these goals carefully during test creation and uses a two-step process to first cover code areas and then improve error detection. Experiments show that TATG outperforms earlier tools in coverage and fault detection on many challenging Java methods, matching some industrial tools in effectiveness.
unit test generationJava methodsbranch coveragemutation testingstatic analysisdynamic feedbackLLM-based testingtesting requirementsstructural coveragefault detection
Authors
Guancheng Wang, Qinghua Xu, Lionel C. Briand
Abstract
Complex Java methods remain challenging for automated unit test generation because achieving high coverage and fault detection often requires satisfying branch-specific testing requirements that are not directly visible from a focal method. Recent LLM-based approaches, such as KTester, PANTA, and MUTGEN, leverage project context, static analysis, coverage feedback, or mutation guidance. However, they do not explicitly represent and track individual testing requirements across iterations. As a result, generation may repeatedly target satisfied requirements while overlooking unresolved branches and weak assertions. Existing approaches also optimize structural coverage and mutation effectiveness separately. We present TATG, a tracking-aware LLM-based unit test generation approach. TATG introduces a unified objective representation that captures testing requirements derived from static analysis and dynamic feedback. The representation enables fine-grained tracking of satisfied and unresolved requirements throughout generation. TATG further employs a two-stage workflow: structural rounds improve coverage, followed by mutation-guided hardening rounds that strengthen assertions and improve fault detection. We evaluate TATG on 141 complex Java methods, including the 110 KTester subjects and 31 additional challenging methods. Compared with KTester and PANTA, TATG improves line coverage, branch coverage, and mutation score by 22.15, 20.14, and 37.66 percentage points on average. On a selected subset of focal methods, TATG also achieves performance comparable to a proprietary industrial test generation tool while achieving higher line coverage and mutation score.