{"status":"ok","message-type":"work","message-version":"1.0.0","message":{"indexed":{"date-parts":[[2026,8,27]],"date-time":"2026-08-27T05:11:52Z","timestamp":1787807512998,"version":"build-2784847793"},"reference-count":43,"publisher":"Association for Computing Machinery (ACM)","issue":"ISSTA","license":[{"start":{"date-parts":[[2025,6,22]],"date-time":"2025-06-22T00:00:00Z","timestamp":1750550400000},"content-version":"vor","delay-in-days":0,"URL":"https:\/\/www.acm.org\/publications\/policies\/publication-rights-and-licensing-policy"}],"funder":[{"DOI":"10.13039\/501100012166","name":"National Key Research and Development Program of China","doi-asserted-by":"publisher","award":["2022YFB4501900"],"award-info":[{"award-number":["2022YFB4501900"]}],"id":[{"id":"10.13039\/501100012166","id-type":"DOI","asserted-by":"publisher"}]},{"name":"Natural Science Basic Research Program of Shaanxi","award":["2024JC-YBQN-0732"],"award-info":[{"award-number":["2024JC-YBQN-0732"]}]}],"content-domain":{"domain":[],"crossmark-restriction":false},"short-container-title":["Proc. ACM Softw. Eng."],"published-print":{"date-parts":[[2025,6,22]]},"abstract":"<jats:p>Unit testing plays a crucial role in bug detection and ensuring software correctness. It helps developers identify errors early in development, thereby reducing software defects. In recent years, large language models (LLMs) have demonstrated significant potential in automating unit test generation. However, using LLMs to generate unit tests faces many challenges. 1) The execution pass rate of the test cases generated by LLMs is low. 2) The test case coverage is inadequate, making it challenging to detect potential risks in the code. 3) Current research methods primarily focus on languages such as Java and Python, while studies on C programming are scarce, despite its importance in the real world. To address these challenges, we propose STRUT, a novel unit test generation method. STRUT utilizes structured test cases as a bridge between complex programming languages and LLMs. Instead of directly generating test code, STRUT guides LLMs to produce structured test cases, thereby alleviating the limitations of LLMs when generating code for programming languages with complex features. First, STRUT analyzes the context of focal methods and constructs structured seed test cases for them. These seed test cases then guide LLMs to generate a set of structured test cases. Subsequently, a rule-based approach is employed to convert the structured set of test cases into executable test code. We conducted a comprehensive evaluation of STRUT, which achieved an impressive execution pass rate of 96.01%, along with 77.67% line coverage and 63.60% branch coverage. This performance significantly surpasses that of the LLMs-based baseline methods and the symbolic execution tool SunwiseAUnit. These results highlight STRUT\u2019s superior capability in generating high-quality unit test cases by leveraging the strengths of LLMs while addressing their inherent limitations.<\/jats:p>","DOI":"10.1145\/3728970","type":"journal-article","created":{"date-parts":[[2025,6,22]],"date-time":"2025-06-22T10:52:56Z","timestamp":1750589576000},"page":"2113-2135","source":"Crossref","is-referenced-by-count":7,"title":["STRUT: Structured Seed Case Guided Unit Test Generation for C Programs using LLMs"],"prefix":"10.1145","volume":"2","author":[{"ORCID":"https:\/\/orcid.org\/0009-0001-2216-5071","authenticated-orcid":false,"given":"Jinwei","family":"Liu","sequence":"first","affiliation":[{"name":"Xidian University, Xi'an, China"}],"role":[{"vocabulary":"crossref","role":"author"}]},{"ORCID":"https:\/\/orcid.org\/0000-0002-1170-587X","authenticated-orcid":false,"given":"Chao","family":"Li","sequence":"additional","affiliation":[{"name":"Beijing Institute of Control Engineering, Beijing, China"},{"name":"Beijing Sunwise Information Technology, Beijing, China"}],"role":[{"vocabulary":"crossref","role":"author"}]},{"ORCID":"https:\/\/orcid.org\/0000-0002-5762-3749","authenticated-orcid":false,"given":"Rui","family":"Chen","sequence":"additional","affiliation":[{"name":"Beijing Institute of Control Engineering, Beijing, China"},{"name":"Beijing Sunwise Information Technology, Beijing, China"}],"role":[{"vocabulary":"crossref","role":"author"}]},{"ORCID":"https:\/\/orcid.org\/0000-0003-4240-3855","authenticated-orcid":false,"given":"Shaofeng","family":"Li","sequence":"additional","affiliation":[{"name":"Xidian University, Xi'an, China"}],"role":[{"vocabulary":"crossref","role":"author"}]},{"ORCID":"https:\/\/orcid.org\/0000-0001-7218-4839","authenticated-orcid":false,"given":"Bin","family":"Gu","sequence":"additional","affiliation":[{"name":"Beijing Institute of Control Engineering, Beijing, China"}],"role":[{"vocabulary":"crossref","role":"author"}]},{"ORCID":"https:\/\/orcid.org\/0000-0002-6844-1246","authenticated-orcid":false,"given":"Mengfei","family":"Yang","sequence":"additional","affiliation":[{"name":"China Academy of Space Technology, Beijing, China"}],"role":[{"vocabulary":"crossref","role":"author"}]}],"member":"320","published-online":{"date-parts":[[2025,6,22]]},"reference":[{"key":"e_1_3_1_2_2","unstructured":"2006. \"xv6-riscv\". https:\/\/github.com\/mit-pdos\/xv6-riscv"},{"key":"e_1_3_1_3_2","unstructured":"2008. \"Klib: a Generic Library in C\". https:\/\/github.com\/attractivechaos\/klib"},{"key":"e_1_3_1_4_2","unstructured":"2014. \"Better String Library\". https:\/\/github.com\/websnarf\/bstrlib\/tree\/master."},{"key":"e_1_3_1_5_2","unstructured":"2015. \"crypto-algorithms\". https:\/\/github.com\/B-Con\/crypto-algorithms"},{"key":"e_1_3_1_6_2","unstructured":"2016. \"algorithm_c_data_structures\". https:\/\/github.com\/TheAlgorithms\/C\/tree\/master\/data_structures"},{"key":"e_1_3_1_7_2","unstructured":"2017. SunwiseAUnit. https:\/\/www.sunwiseinfo.com\/sunwiseaunit"},{"key":"e_1_3_1_8_2","unstructured":"2018. \"file\". https:\/\/github.com\/file\/file"},{"key":"e_1_3_1_9_2","unstructured":"2025. \"Data\". https:\/\/anonymous.4open.science\/r\/STRUT-C."},{"key":"e_1_3_1_10_2","doi-asserted-by":"publisher","unstructured":"Josh Achiam Steven Adler Sandhini Agarwal Lama Ahmad Ilge Akkaya Florencia Leoni Aleman Diogo Almeida Janko Altenschmidt Sam Altman Shyamal Anadkat et al. 2023. Gpt-4 technical report. arXiv preprint arXiv:2303.08774 (2023). https:\/\/doi.org\/10.48550\/arXiv.2303.08774 10.48550\/arXiv.2303.08774","DOI":"10.48550\/arXiv.2303.08774"},{"key":"e_1_3_1_11_2","doi-asserted-by":"publisher","DOI":"10.1016\/j.infsof.2024.107565"},{"key":"e_1_3_1_12_2","doi-asserted-by":"publisher","unstructured":"Luciano Baresi and Matteo Miraz. 2010. Testful: Automatic unit-test generation for java classes. In Proceedings of the 32nd ACM\/IEEE International Conference on Software Engineering-Volume 2. 281\u2013284. https:\/\/doi.org\/10.1145\/1810295.1810353 10.1145\/1810295.1810353","DOI":"10.1145\/1810295.1810353"},{"key":"e_1_3_1_13_2","volume-title":"Test-driven development: by example","author":"Beck Kent","year":"2003","unstructured":"Kent Beck. 2003. Test-driven development: by example. Addison-Wesley Professional."},{"key":"e_1_3_1_14_2","doi-asserted-by":"publisher","unstructured":"Shreya Bhatia Tarushi Gandhi Dhruv Kumar and Pankaj Jalote. 2024. Unit test generation using generative ai: A comparative performance analysis of autogeneration tools. In Proceedings of the 1st International Workshop on Large Language Models for Code. 54\u201361. https:\/\/doi.org\/10.1145\/3643795.3648396 10.1145\/3643795.3648396","DOI":"10.1145\/3643795.3648396"},{"key":"e_1_3_1_15_2","first-page":"209","volume-title":"Proceedings of the 8th USENIX Conference on Operating Systems Design and Implementation (San Diego, California) (OSDI\u201908)","author":"Cadar Cristian","year":"2008","unstructured":"Cristian Cadar, Daniel Dunbar, and Dawson Engler. 2008. KLEE: unassisted and automatic generation of high-coverage tests for complex systems programs. In Proceedings of the 8th USENIX Conference on Operating Systems Design and Implementation (San Diego, California) (OSDI\u201908). USENIX Association, USA, 209\u2013224."},{"key":"e_1_3_1_16_2","doi-asserted-by":"publisher","unstructured":"Ermira Daka Jos\u00e9 Campos Gordon Fraser Jonathan Dorn and Westley Weimer. 2015. Modeling readability to improve unit tests. In Proceedings of the 2015 10th Joint Meeting on Foundations of Software Engineering. 107\u2013118. https:\/\/doi.org\/10.1145\/2786805.2786838 10.1145\/2786805.2786838","DOI":"10.1145\/2786805.2786838"},{"key":"e_1_3_1_17_2","doi-asserted-by":"publisher","DOI":"10.1109\/ISSRE.2014.11"},{"key":"e_1_3_1_18_2","unstructured":"DeepSeek-AI Aixin Liu Bei Feng Bing Xue Bingxuan Wang Bochao Wu Chengda Lu Chenggang Zhao Chengqi Deng Chenyu Zhang Chong Ruan Damai Dai Daya Guo Dejian Yang Deli Chen Dongjie Ji Erhang Li Fangyun Lin Fucong Dai Fuli Luo Guangbo Hao Guanting Chen Guowei Li H. Zhang Han Bao Hanwei Xu Haocheng Wang Haowei Zhang Honghui Ding Huajian Xin Huazuo Gao Hui Li Hui Qu J. L. Cai Jian Liang Jianzhong Guo Jiaqi Ni Jiashi Li Jiawei Wang Jin Chen Jingchang Chen Jingyang Yuan Junjie Qiu Junlong Li Junxiao Song Kai Dong Kai Hu Kaige Gao Kang Guan Kexin Huang Kuai Yu Lean Wang Lecong Zhang Lei Xu Leyi Xia Liang Zhao Litong Wang Liyue Zhang Meng Li Miaojun Wang Mingchuan Zhang Minghua Zhang Minghui Tang Mingming Li Ning Tian Panpan Huang Peiyi Wang Peng Zhang Qiancheng Wang Qihao Zhu Qinyu Chen Qiushi Du R. J. Chen R. L. Jin Ruiqi Ge Ruisong Zhang Ruizhe Pan Runji Wang Runxin Xu Ruoyu Zhang Ruyi Chen S. S. Li Shanghao Lu Shangyan Zhou Shanhuang Chen Shaoqing Wu Shengfeng Ye Shengfeng Ye Shirong Ma Shiyu Wang Shuang Zhou Shuiping Yu Shunfeng Zhou Shuting Pan T. Wang Tao Yun Tian Pei Tianyu Sun W. L. Xiao Wangding Zeng Wanjia Zhao Wei An Wen Liu Wenfeng Liang Wenjun Gao Wenqin Yu Wentao Zhang X. Q. Li Xiangyue Jin Xianzu Wang Xiao Bi Xiaodong Liu Xiaohan Wang Xiaojin Shen Xiaokang Chen Xiaokang Zhang Xiaosha Chen Xiaotao Nie Xiaowen Sun Xiaoxiang Wang Xin Cheng Xin Liu Xin Xie Xingchao Liu Xingkai Yu Xinnan Song Xinxia Shan Xinyi Zhou Xinyu Yang Xinyuan Li Xuecheng Su Xuheng Lin Y. K. Li Y. Q. Wang Y. X. Wei Y. X. Zhu Yang Zhang Yanhong Xu Yanhong Xu Yanping Huang Yao Li Yao Zhao Yaofeng Sun Yaohui Li Yaohui Wang Yi Yu Yi Zheng Yichao Zhang Yifan Shi Yiliang Xiong Ying He Ying Tang Yishi Piao Yisong Wang Yixuan Tan Yiyang Ma Yiyuan Liu Yongqiang Guo Yu Wu Yuan Ou Yuchen Zhu Yuduan Wang Yue Gong Yuheng Zou Yujia He Yukun Zha Yunfan Xiong Yunxian Ma Yuting Yan Yuxiang Luo Yuxiang You Yuxuan Liu Yuyang Zhou Z. F. Wu Z. Z. Ren Zehui Ren Zhangli Sha Zhe Fu Zhean Xu Zhen Huang Zhen Zhang Zhenda Xie Zhengyan Zhang Zhewen Hao Zhibin Gou Zhicheng Ma Zhigang Yan Zhihong Shao Zhipeng Xu Zhiyu Wu Zhongyu Zhang Zhuoshu Li Zihui Gu Zijia Zhu Zijun Liu Zilin Li Ziwei Xie Ziyang Song Ziyi Gao and Zizheng Pan. 2024. DeepSeek-V3 Technical Report. arXiv:2412.19437 [cs.CL] https:\/\/arxiv.org\/abs\/2412.19437"},{"key":"e_1_3_1_19_2","doi-asserted-by":"publisher","DOI":"10.48550\/arXiv.2203.02337"},{"key":"e_1_3_1_20_2","doi-asserted-by":"publisher","DOI":"10.1145\/3624745"},{"key":"e_1_3_1_21_2","doi-asserted-by":"publisher","unstructured":"Gordon Fraser and Andrea Arcuri. 2011. Evosuite: automatic test suite generation for object-oriented software. In Proceedings of the 19th ACM SIGSOFT symposium and the 13th European conference on Foundations of software engineering. 416\u2013419. https:\/\/doi.org\/10.1145\/2025113.2025179 10.1145\/2025113.2025179","DOI":"10.1145\/2025113.2025179"},{"key":"e_1_3_1_22_2","doi-asserted-by":"publisher","unstructured":"Qiuhan Gu. 2023. Llm-based code generation method for golang compiler testing. In Proceedings of the 31st ACM Joint European Software Engineering Conference and Symposium on the Foundations of Software Engineering. 2201\u20132203. https:\/\/doi.org\/10.1145\/3611643.3617850 10.1145\/3611643.3617850","DOI":"10.1145\/3611643.3617850"},{"key":"e_1_3_1_23_2","doi-asserted-by":"publisher","unstructured":"Siqi Gu Chunrong Fang Quanjun Zhang Fangyuan Tian and Zhenyu Chen. 2024. TestART: Improving LLM-based Unit Test via Co-evolution of Automated Generation and Repair Iteration. arXiv preprint arXiv:2408.03095 (2024). https:\/\/doi.org\/10.48550\/arXiv.2408.03095 10.48550\/arXiv.2408.03095","DOI":"10.48550\/arXiv.2408.03095"},{"key":"e_1_3_1_24_2","doi-asserted-by":"publisher","DOI":"10.1109\/ICST.2015.7102580"},{"key":"e_1_3_1_25_2","doi-asserted-by":"publisher","DOI":"10.1109\/ICST53961.2022.00046"},{"key":"e_1_3_1_26_2","doi-asserted-by":"publisher","DOI":"10.1109\/ICST.2015.7102609"},{"key":"e_1_3_1_27_2","doi-asserted-by":"publisher","DOI":"10.1109\/ICSE48619.2023.00085"},{"key":"e_1_3_1_28_2","doi-asserted-by":"publisher","DOI":"10.18653\/v1\/2020.acl-main.703"},{"key":"e_1_3_1_29_2","doi-asserted-by":"publisher","DOI":"10.1109\/ASE.2015.49"},{"key":"e_1_3_1_30_2","doi-asserted-by":"publisher","unstructured":"Daye Nam Andrew Macvean Vincent Hellendoorn Bogdan Vasilescu and Brad Myers. 2024. Using an llm to help with code understanding. In Proceedings of the IEEE\/ACM 46th International Conference on Software Engineering. 1\u201313. https:\/\/doi.org\/10.1145\/3597503.3639187 10.1145\/3597503.3639187","DOI":"10.1145\/3597503.3639187"},{"key":"e_1_3_1_31_2","doi-asserted-by":"publisher","unstructured":"Carlos Pacheco and Michael D Ernst. 2007. Randoop: feedback-directed random testing for Java. In Companion to the 22nd ACM SIGPLAN conference on Object-oriented programming systems and applications companion. 815\u2013816. https:\/\/doi.org\/10.1145\/1297846.1297902 10.1145\/1297846.1297902","DOI":"10.1145\/1297846.1297902"},{"key":"e_1_3_1_32_2","doi-asserted-by":"publisher","DOI":"10.1109\/MS.2006.91"},{"key":"e_1_3_1_33_2","doi-asserted-by":"publisher","DOI":"10.1109\/MS.2006.91"},{"key":"e_1_3_1_34_2","doi-asserted-by":"publisher","DOI":"10.1109\/TSE.2014.2363479"},{"key":"e_1_3_1_35_2","doi-asserted-by":"publisher","DOI":"10.1109\/TSE.2023.3334955"},{"key":"e_1_3_1_36_2","doi-asserted-by":"publisher","DOI":"10.23919\/CSMS.2022.0027"},{"key":"e_1_3_1_37_2","doi-asserted-by":"publisher","DOI":"10.1145\/3650212.3680354"},{"key":"e_1_3_1_38_2","doi-asserted-by":"publisher","unstructured":"Yutian Tang Zhijie Liu Zhichao Zhou and Xiapu Luo. 2024. Chatgpt vs sbst: A comparative assessment of unit test suite generation. IEEE Transactions on Software Engineering (2024). https:\/\/doi.org\/10.48550\/arXiv.2307.00588 10.48550\/arXiv.2307.00588","DOI":"10.48550\/arXiv.2307.00588"},{"key":"e_1_3_1_39_2","doi-asserted-by":"publisher","unstructured":"Michele Tufano Dawn Drain Alexey Svyatkovskiy Shao Kun Deng and Neel Sundaresan. 2020. Unit test case generation with transformers and focal context. arXiv preprint arXiv:2009.05617 (2020). https:\/\/doi.org\/10.48550\/arXiv.2009.05617 10.48550\/arXiv.2009.05617","DOI":"10.48550\/arXiv.2009.05617"},{"key":"e_1_3_1_40_2","doi-asserted-by":"publisher","DOI":"10.1145\/3691620.3695501"},{"key":"e_1_3_1_41_2","doi-asserted-by":"publisher","unstructured":"Zhuokui Xie Yinghao Chen Chen Zhi Shuiguang Deng and Jianwei Yin. 2023. ChatUniTest: a ChatGPT-based automated unit test generation tool. arXiv preprint arXiv:2305.04764 (2023). https:\/\/doi.org\/10.48550\/arXiv.2305.04764 10.48550\/arXiv.2305.04764","DOI":"10.48550\/arXiv.2305.04764"},{"key":"e_1_3_1_42_2","doi-asserted-by":"publisher","unstructured":"Weixiang Yan Haitian Liu Yunkun Wang Yunzhe Li Qian Chen Wen Wang Tingyu Lin Weishan Zhao Li Zhu Hari Sundaram et al. 2023. Codescope: An execution-based multilingual multitask multidimensional benchmark for evaluating llms on code understanding and generation. arXiv preprint arXiv:2311.08588 (2023). https:\/\/doi.org\/10.48550\/arXiv.2311.08588 10.48550\/arXiv.2311.08588","DOI":"10.48550\/arXiv.2311.08588"},{"key":"e_1_3_1_43_2","doi-asserted-by":"publisher","DOI":"10.1145\/3660783"},{"key":"e_1_3_1_44_2","doi-asserted-by":"publisher","DOI":"10.1145\/267580.267590"}],"container-title":["Proceedings of the ACM on Software Engineering"],"original-title":[],"language":"en","link":[{"URL":"https:\/\/dl.acm.org\/doi\/pdf\/10.1145\/3728970","content-type":"unspecified","content-version":"vor","intended-application":"similarity-checking"}],"deposited":{"date-parts":[[2026,8,23]],"date-time":"2026-08-23T13:45:01Z","timestamp":1787492701000},"score":1,"resource":{"primary":{"URL":"https:\/\/dl.acm.org\/doi\/10.1145\/3728970"}},"subtitle":[],"short-title":[],"issued":{"date-parts":[[2025,6,22]]},"references-count":43,"journal-issue":{"issue":"ISSTA","published-print":{"date-parts":[[2025,6,22]]}},"alternative-id":["10.1145\/3728970"],"URL":"https:\/\/doi.org\/10.1145\/3728970","relation":{},"ISSN":["2994-970X"],"issn-type":[{"value":"2994-970X","type":"electronic"}],"subject":[],"published":{"date-parts":[[2025,6,22]]}}}