Though many learning-based approaches have been proposed for unit test generation and achieved remarkable performance, they still have limitations in relying on task-specific datasets. Recently, Large Language Models (LLMs) guided by prompt engineering have gained attention for their ability to handle a broad range of tasks, including unit test generation. Despite their success, LLMs may exhibit hallucinations when generating unit tests for focal methods or functions due to their lack of awareness regarding the project's global context. These hallucinations may manifest as calls to non-existent methods, as well as incorrect parameters or return values, such as mismatched parameter types or numbers. While many studies have explored the role of context, they often extract fixed patterns of context for different models and focal methods, which may not be suitable for all generation processes (e.g., excessive irrelevant context could lead to redundancy, preventing the model from focusing on essential information). To overcome this limitation, we propose RATester, which enhances the LLM's ability to generate more repository-aware unit tests through global contextual information injection. To equip LLMs with global knowledge similar to that of human testers, we integrate the language server gopls, which provides essential features (e.g., definition lookup) to assist the LLM. When RATester encounters an unfamiliar identifier (e.g., an unfamiliar struct name), it first leverages gopls to fetch relevant definitions and documentation comments, and then uses this global knowledge to guide the LLM. By utilizing gopls, RATester enriches the LLM's knowledge of the project's global context, thereby reducing hallucinations during unit test generation.
Beyond Repository Boundaries: Cross-Repository Graph Retrieval for Code Generation
Quantum AI & Cyber Security Institute, FPT Corporation(量子人工智能与网络安全研究所,FPT公司);Hanoi University of Science and Technology(河内科学技术大学);Rutgers University(罗格斯大学);The University of Melbourne(墨尔本大学);Center for AI Research, VinUniversity(VinUniversity人工智能研究中心)
CyberForge: Verified Vulnerability Injection at Repository Level for Cybersecurity Agent Training
National Institute of Standards and Technology(美国国家标准与技术研究院);Université Grenoble Alpes(格勒诺布尔阿尔卑斯大学);CNRS(法国国家科学研究中心);University of Maryland, College Park(马里兰大学帕克分校)
Beyond Function-Level Search: Repository-Aware Dual-Encoder Code Retrieval with Adversarial Verification
International Digital Economy Academy (IDEA)(国际数字经济学院);School of Electronic and Computer Engineering, Peking University(电子与计算机工程学院,北京大学);Shenzhen International Graduate School, Tsinghua University(深圳国际研究生院,清华大学)
Contextualized Code Pretraining for Code Generation
Key Lab of HCST (PKU), MOE(高性能计算技术教育部重点实验室;计算机科学与技术学院,北京大学);SCS, Peking University(计算机科学与技术的学院,北京航空航天大学);School of Computer Science & Technology, Beihang University(空间信息集成系统国家重点实验室,中国科学院软件研究所);National Key Laboratory of Space Integrated Information System, Institute of Software Chinese Academy of Sciences(互联网信息协同深圳市重点实验室,哈尔滨工业大学(深圳));Shenzhen Key Laboratory of Internet Information Collaboration, Harbin Institute of Technology, Shenzhen
Where Is the Cost of Third-Party API Routers in Agentic Software Development?
School of Computer Science, Shanghai Jiao Tong University(上海交通大学计算机科学学院);School of Software, Beihang University(北京航空航天大学软件学院);School of Computer Science, Peking University(北京大学计算机科学学院)
研究第三方 API 路由器在代理软件开发中的影响,通过实证研究编码代理中路由器端注入的四个干预级别,开发 SIDEL 框架评估代理,发现路由器端干预难测,客户端缓解措施未完全恢复控制,强调需提供商端输出完整性保证。
Enhancing Knowledge Density via Hierarchical Context Pruning for Retrieval-Augmented Repository-Level Code Completion
MIIT Key Laboratory of Pattern Analysis and Machine Intelligence(信息科技模式分析与机器智能国家重点实验室);College of Computer Science and Technology(计算机科学与技术学院);Huaneng Information Technology Co Ltd(华能信息技术有限公司);Hunan Vanguard Group Corporation Co Ltd(湖南 Vanguard集团有限公司);Tsinghua University(清华大学);Zhejiang University(浙江大学);PowerChina Huadong Engineering Co Ltd(国家电网华东工程有限公司)