TATG: Tracking-Aware Testing Objective for LLM-based Test Generation

📅 2026-07-03
📈 Citations: 0
Influential: 0
📄 PDF
🤖 AI Summary
Existing LLM-driven approaches for Java unit test generation struggle to precisely satisfy branch-level testing requirements and lack explicit tracking of test objectives, often resulting in insufficient coverage and weak assertions. This work proposes TATG, the first method to incorporate an explicit test requirement tracking mechanism that unifies static analysis with dynamic feedback. TATG enables fine-grained monitoring of satisfied and unsatisfied test targets during generation and employs a two-stage strategy: first enhancing structural coverage and then strengthening assertions through mutation guidance. Experimental results on 141 complex Java methods demonstrate that TATG significantly outperforms KTester and PANTA, achieving average improvements of 22.15, 20.14, and 37.66 percentage points in line coverage, branch coverage, and mutation score, respectively, with performance in certain scenarios approaching that of industrial-grade tools.
📝 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.
Problem

Research questions and friction points this paper is trying to address.

unit test generation
LLM-based testing
branch coverage
mutation testing
test requirement tracking
Innovation

Methods, ideas, or system contributions that make the work stand out.

tracking-aware test generation
LLM-based testing
unified objective representation
two-stage workflow
mutation-guided hardening