ConUT: Condition-Aware Test Generation for Complex Java Code
Ruiguo Yu, Ruiqi Dong, Xi Xiao, Xiaogang Zhu, Shaohua Wang, Sheng Wen, Qing Li
Key points
From the paper's conclusion- We evaluate ConUT on eight real-world Java projects characterized by high-complexity “logic hotspots.” Experimental results demonstrate that ConUT outperforms state-of-the-art baselines, achieving an average branch coverage of 72.84% and line coverage of 83.87%.
Abstract
Automatically generating high-coverage unit tests for complex Java methods remains a formidable challenge, particularly when execution paths are guarded by intricate control-flow nesting and cross-class state dependencies. Existing LLM-based approaches predominantly follow a goal-driven paradigm , relying on unguided code synthesis within a vast search space to satisfy coverage objectives. Lacking explicit guidance on how to construct the precise object states required for complex predicates, these methods suffer from a construction-reachability gap, ultimately resulting in insufficient coverage for complex methods. This paper introduces ConUT, a condition-aware unit test generation framework centered on the paradigm of Configuration-Driven Guidance, which is a strategy that bridges the gap between abstract branch targets and concrete code realization by providing the LLM with structured instantiation recipes. Our core insight is that the implicit causal chain leading to a target branch can be explicitly manifested via static analysis and distilled into structured guidance. ConUT utilizes Backward Dependency Tracing (BDT) to identify the fields and method calls that influence predicates, and distills these findings into structured Configuration Templates ( C cfg ). These templates serve as a “semantic roadmap,” pruning the LLM’s search space and transitioning it from a stochastic generator into a guided logic realizer. We evaluate ConUT on eight real-world Java projects characterized by high-complexity “logic hotspots.” Experimental results demonstrate that ConUT outperforms state-of-the-art baselines, achieving an average branch coverage of 72.84% and line coverage of 83.87%. Notably, ConUT exceeds the best baseline in average branch coverage by 11.94 percentage points while utilizing 67% fewer test cases.
Read the paper
Discussion
Science Skim's AI key points, plus readers' public thoughts
Readers' thoughts
No reader thoughts yet.
Related papers
- Context Matters: Improving the Practical Reliability of LLM-Based Unit Test Generation (Experience Paper)Proceedings of the ACM on Software Engineering · 2026
- AgentTester: Improve Coverage in Automated Test Generation With Multi‐Agent as OptimizerSoftware Testing, Verification and Reliability · 2026
- Beyond Coverage and Mutation: A Blind-Spot Analysis of LLM-Generated Unit TestsarXiv · 2026
- TestPrism: Rethinking Test Evaluation Beyond a Single ReferencearXiv · 2026
- CONCUR: Benchmarking LLMs for Concurrent Code GenerationProceedings of the ACM on Software Engineering · 2026
- Compiling Large Multi-modal Requirement Documents into Runnable Software Systems: From an Agentic Test-Driven PerspectiveProceedings of the ACM on Software Engineering · 2026