[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"doc-detail-85450-en":3,"doc-seo-85450-105":29,"detail-sidebar-cat-0-en-105":91},{"code":4,"msg":5,"data":6},0,"success",{"doc_id":7,"user_id":8,"nickname":9,"user_avatar":10,"doc_module":4,"category_id":11,"category_name":12,"doc_title":13,"doc_description":14,"doc_content":15,"file_id":16,"file_url":17,"file_type":18,"file_size":19,"view_count":20,"is_deleted":4,"is_public":20,"is_downloadable":20,"audit_status":20,"page_count":21,"language":22,"language_code":23,"site_id":24,"html_lang":23,"table_of_contents":25,"faqs":26,"seo_title":13,"seo_description":14,"update_tm":27,"read_time":28},85450,687197100911,"Himbo","https://ap-avatar.wpscdn.com/avatar/a000239b6f1da00475?x-image-process=image/resize,m_fixed,w_180,h_180&k=1782698725881665579",6,"Technology","TENET: One Step Toward Test-Driven Development for Repository-Level Code Generation","Test-Driven Development (TDD) couples writing executable tests with implementing code, and recent Large Language Model (LLM) advances enable agents to delegate code synthesis while using tests as specifications. However, repository-level TDD under developer-written tests is difficult due to three needs: selecting a representative test subset, using tests to augment retrieval and reasoning context, and refining implementations from sparse, noisy test feedback. TENET is an agentic framework that addresses these gaps with a diversity-maximizing test harness, tailored retrieval/debugging tools, and reflection-based iterative refinement, outperforming strong baselines on REPOCOD and RepoEval.","TENET: One Step Toward Test-Driven Development for Repository-Level Code Generation  \nYiran Hu, Nan Jiang , Shanchao Liang, Yi Wu, and Lin Tan  \nPurdue University  \n{hu954, liang422, jiang719, wu1827, [lintan](lintan}@purdue.edu)[}](lintan}@purdue.edu)[@purdue.edu](lintan}@purdue.edu)  \narXiv :2509 .24 148v 3 [ cs . SE] 12 Jul 2026  \nAbstract—Test-Driven Development (TDD) is a widely adopted practice that requires developers to create and execute tests alongside implementation. With recent advances in Large Language Models (LLMs), developers can shift from manually writing the code to defining tests as executable specificationsand delegating code synthesis to AI agents. However, enabling repository-level TDD under developer-written tests is challenging, requiring: (1) specification enhancement: identifying a concise yet representative test subset from large suites with rich task semantics; (2) retrieval augmentation: using tests to guide reasoning and context retrieval; and (3) test-driven refinement: interpreting test feedback for iterative improvement. We propose TENET, anagentic framework for repository-level code generation under the TDD paradigm. TENET includes: (1) a test harness mechanism that selects a concise test suite to maximize diversity of the target usage scenarios; (2) a tailored agent toolset for efficient retrieval and debugging; and (3) a reflection-based refinement workflow that iteratively analyzes failures and updates implementations. TENET consistently outperforms the strongest baselines across backbones, achieving 69.08% and 81.77% Pass@1 on REPOCOD and RepoEval with Claude Sonnet 4, improving by 9.49 and 2.17 percentage points, respectively. Additionally, we present the first systematic study of how test suite characteristics influence LLM agent performance in TDD settings.  \nIndex Terms—Test-Driven Development, Repository-Level Code Generation, Large Language Models, AI Agent.  \nI. INTRODUCTION  \nTest-Driven Development (TDD) is a widely adopted practice in software engineering that tightly couples the testing and implementation processes [1]: developers typically start by writing test cases that specify the desired behavior or capture potential failure scenarios, then incrementally implement andrefine code to satisfy these tests. Extensive studies have demonstrated that TDD improves implementation accuracy, code quality, and design clarity [2–11] .  \nIn the era of vibe coding [12], developers increasingly delegate code writing to large language models (LLMs) by providing high-level intentions. However, such descriptions often fail to capture detailed functionality, making it challenging for LLMs to implement correctly and sometimes even amplifying the ambiguity, especially with the repository-level context. This makes TDD even more crucial, as it systematically specifies and validates requirements through executable test cases to improve functional correctness. Recent industry practices further highlight the effectiveness of TDD in agentic coding workflows [13, 14] .  \nMicrosoft Office AI, work done independently of employer, [jnhsyxxy@gmail.com](jnhsyxxy@gmail.com)  \nFig. 1 shows how an LLM agent generates the target function for scikit-learn_ 304 from REPOCOD [15] . In the standard setting, the agent is given 1 the task description, 2 repository context, and 3 function specification. Based on these, it assumes that y_prob .shape[1](the size of distributions) is always greater than 1, since classification should involve at least two classes, and produces the implementation in 5 . However, scikit-learn also requires supporting singleton probability representations for binary classification (e.g., [0 . 9] instead of [0.1,0.9]), which cannot be inferred from 1 – 3 and the implementation in 5 fails on such inputs. In contrast, the TDD setting additionally provides 4 test cases that include such usage examples (the gray lines in 4 ) for specification enhancement, guiding the agent to generate the correct","cbCaigJLo9W7B8Ly","https://ap.wps.com/l/cbCaigJLo9W7B8Ly","pdf",985514,1,13,"English","en",105,"# Introduction\n## Test-Driven Development for AI-assisted coding\n## Challenges in repository-level TDD\n## Proposed framework: TENET","[{\"question\":\"What challenges does TENET address for repository-level test-driven development with LLM agents?\",\"answer\":\"TENET targets three challenges: enhancing specifications by choosing a representative subset from large test suites, augmenting retrieval using tests to guide reasoning and context, and refining code by interpreting sparse/noisy test feedback for iterative improvement.\"},{\"question\":\"How does TENET select tests to improve agent performance?\",\"answer\":\"TENET uses a test harness that selects a concise test suite designed to maximize diversity across target usage scenarios, so the agent receives representative behavioral signals.\"},{\"question\":\"What results does TENET report compared with existing baselines?\",\"answer\":\"TENET consistently outperforms strong baselines across backbones, reporting 69.08% and 81.77% Pass@1 on REPOCOD and RepoEval with Claude Sonnet 4, with improvements of 9.49 and 2.17 percentage points respectively.\"}]",1784203642,33,{"code":4,"msg":30,"data":31},"ok",{"site_id":24,"language":23,"slug":32,"title":13,"keywords":33,"description":14,"schema_data":34,"social_meta":86,"head_meta":88,"extra_data":90,"updated_unix":27},"tenet-one-step-toward-test-driven-development-for-repository-level-code-generation","",{"@graph":35,"@context":85},[36,53,68],{"@type":37,"itemListElement":38},"BreadcrumbList",[39,43,47,50],{"item":40,"name":41,"@type":42,"position":20},"https://docshare.wps.com","Home","ListItem",{"item":44,"name":45,"@type":42,"position":46},"https://docshare.wps.com/document/","Document",2,{"item":48,"name":12,"@type":42,"position":49},"https://docshare.wps.com/document/technology/",3,{"item":51,"name":13,"@type":42,"position":52},"https://docshare.wps.com/document/tenet-one-step-toward-test-driven-development-for-repository-level-code-generation/85450/",4,{"url":51,"name":13,"@type":54,"author":55,"headline":13,"publisher":57,"fileFormat":60,"inLanguage":23,"description":14,"dateModified":61,"datePublished":62,"encodingFormat":60,"isAccessibleForFree":63,"interactionStatistic":64},"DigitalDocument",{"name":9,"@type":56},"Person",{"url":40,"name":58,"@type":59},"DocShare","Organization","application/pdf","2026-07-17","2026-07-16",true,{"@type":65,"interactionType":66,"userInteractionCount":20},"InteractionCounter",{"@type":67},"ViewAction",{"@type":69,"mainEntity":70},"FAQPage",[71,77,81],{"name":72,"@type":73,"acceptedAnswer":74},"What challenges does TENET address for repository-level test-driven development with LLM agents?","Question",{"text":75,"@type":76},"TENET targets three challenges: enhancing specifications by choosing a representative subset from large test suites, augmenting retrieval using tests to guide reasoning and context, and refining code by interpreting sparse/noisy test feedback for iterative improvement.","Answer",{"name":78,"@type":73,"acceptedAnswer":79},"How does TENET select tests to improve agent performance?",{"text":80,"@type":76},"TENET uses a test harness that selects a concise test suite designed to maximize diversity across target usage scenarios, so the agent receives representative behavioral signals.",{"name":82,"@type":73,"acceptedAnswer":83},"What results does TENET report compared with existing baselines?",{"text":84,"@type":76},"TENET consistently outperforms strong baselines across backbones, reporting 69.08% and 81.77% Pass@1 on REPOCOD and RepoEval with Claude Sonnet 4, with improvements of 9.49 and 2.17 percentage points respectively.","https://schema.org",{"og:url":51,"og:type":87,"og:title":13,"og:site_name":58,"og:description":14},"article",{"robots":89,"canonical":51},"index,follow",{"doc_id":7,"site_id":24},{"code":4,"msg":5,"data":92},[93,97,101,105,110,113,118,123,128,131,135],{"id":20,"doc_module":4,"doc_module_name":45,"category_name":94,"show_sort_weight":95,"slug":96},"Story & Novel",90,"story-novel",{"id":46,"doc_module":4,"doc_module_name":45,"category_name":98,"show_sort_weight":99,"slug":100},"Literature",80,"literature",{"id":52,"doc_module":4,"doc_module_name":45,"category_name":102,"show_sort_weight":103,"slug":104},"Exam",70,"exam",{"id":106,"doc_module":4,"doc_module_name":45,"category_name":107,"show_sort_weight":108,"slug":109},5,"Comic",60,"comic",{"id":11,"doc_module":4,"doc_module_name":45,"category_name":12,"show_sort_weight":111,"slug":112},50,"technology",{"id":114,"doc_module":4,"doc_module_name":45,"category_name":115,"show_sort_weight":116,"slug":117},7,"Healthcare",40,"healthcare",{"id":119,"doc_module":4,"doc_module_name":45,"category_name":120,"show_sort_weight":121,"slug":122},8,"Research & Report",30,"research-report",{"id":124,"doc_module":4,"doc_module_name":45,"category_name":125,"show_sort_weight":126,"slug":127},9,"Religion & Spirituality",20,"religion-spirituality",{"id":126,"doc_module":4,"doc_module_name":45,"category_name":129,"show_sort_weight":126,"slug":130},"World Cup","world-cup",{"id":132,"doc_module":4,"doc_module_name":45,"category_name":133,"show_sort_weight":132,"slug":134},10,"Lifestyle","lifestyle",{"id":136,"doc_module":4,"doc_module_name":45,"category_name":137,"show_sort_weight":106,"slug":138},19,"General","general"]