Lune

ISSTA2026Top-tier venue

ConUT: Condition-Aware Test Generation for Complex Java Code

Ruiguo Yu, Ruiqi Dong, Xi Xiao, Xiaogang Zhu, Shaohua Wang, Sheng Wen, Qing Li

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.

Ask Lune

Know where this paper stands in minutes, not an afternoon.

Lune can read the top-tier papers that cite it and the ones closest to it, and tells you what it claims, what came after and where it falls short, each point cited to the paper it comes from. No skimming, no AI slop.

Questions to start from

Lune can draw on

its abstract · related work

Get the answer

Free to start. No credit card required.

Related papers

  1. Navigating the Labyrinth: Path-Sensitive Unit Test Generation with Large Language ModelsDianshu Liao, Xin Yin, Shidong Pan, Chao Ni et al.ASE 2025 · 2 citations
  2. LLM Test Generation via Iterative Hybrid Program AnalysisSijia Gu, Noor Nashid, Ali MesbahICSE 2026 · 6 citations
  3. Context Matters: Improving the Practical Reliability of LLM-Based Unit Test Generation (Experience Paper)Junjie Chen, Ziqi Wang, Lin Yang, Chen Yang et al.ISSTA 2026
  4. TestTailor: Generating High-Coverage Tests via Path-Proximal Tests with LLMsXiaoxuan Zhou, Yiling Lou, Jinhao Dong, Dan HaoFSE 2026
  5. HITS: High-coverage LLM-based Unit Test Generation via Method SlicingZejun Wang, Kaibo Liu, Ge Li, Zhi JinASE 2024 · 29 citations
Dusk over the sea between two cliffs drawn in fine vertical lines