MCP
arXivarXiv
Preprint
Published: December 3, 2026
cs.SE

Test-Centric Code Generation: Enhancing Test Diversity, Reliability, and Utilization

11122222
1 School of Computer Software, Tianjin University, China
2 HUAWEI Technologies, China
* Equal contribution
† Corresponding authors
Abstract
Large Language Models (LLMs) have made significant progress in code generation, yet the correctness of generated code remains a major challenge, particularly for complex programming tasks. Test-driven code generation offers a promising solution by leveraging automatically generated tests to guide code generation and verification. However, existing approaches often suffer from insufficient test correctness, limited test diversity, and inadequate utilization of test information. To address these limitations, we propose TCG, a test-centric code generation framework comprising three complementary components: Diverse Test Generation, which combines unit tests and property-based tests to improve behavioral coverage; Reliable Test Curation, which employs syntax checking and execution-based cross-validation to identify reliable tests; and Test-Centric Code Generation, which integrates test information into requirement understanding, code verification, and fault repair. We evaluate TCG using three representative LLMs across six function-level and repository-level code generation benchmarks, comparing it with nine representative baselines. Experimental results show that TCG consistently outperforms all applicable baselines across 18 experimental settings, achieving average improvements of 6.63% to 25.59% in Pass@1. These findings demonstrate the effectiveness of leveraging diverse, reliable tests throughout the code generation process.
0
AI overview
Reviews
Citation graph
Structured
This paper does not have an AI preview yet
Rating
No ratings yet
Rate
Community rating
—
/ 5
No ratings yet
Rating
—
Soundness
—
Presentation
—
Contribution
—
Confidence
—
Discussion
Top
Newest
Questions
Replication
Author
No comments yet — be the first