{"status":"ok","message-type":"work","message-version":"1.0.0","message":{"indexed":{"date-parts":[[2026,10,2]],"date-time":"2026-10-02T10:40:15Z","timestamp":1790937615459,"version":"4.1.0"},"reference-count":46,"publisher":"Association for Computing Machinery (ACM)","issue":"FSE","license":[{"start":{"date-parts":[[2026,6,30]],"date-time":"2026-06-30T00:00:00Z","timestamp":1782777600000},"content-version":"vor","delay-in-days":0,"URL":"https:\/\/creativecommons.org\/licenses\/by\/4.0\/legalcode"}],"funder":[{"DOI":"10.13039\/501100001809","name":"National Natural Science Fundation of China","doi-asserted-by":"crossref","award":["62572300"],"award-info":[{"award-number":["62572300"]}],"id":[{"id":"10.13039\/501100001809","id-type":"DOI","asserted-by":"crossref"}]},{"name":"Minister of Education, Singapore","award":["MOE-T2EP20124-0017"],"award-info":[{"award-number":["MOE-T2EP20124-0017"]}]},{"name":"Minister of Education, Singapore","award":["MOET32020-0004"],"award-info":[{"award-number":["MOET32020-0004"]}]},{"name":"National Research Foundation, Singapore and the Cyber Security Agency under its National Cybersecurity R&D Programme","award":["NCRP25-P04-TAICeN"],"award-info":[{"award-number":["NCRP25-P04-TAICeN"]}]},{"name":"DSO National Laboratories under the AI Singapore Programme","award":["AISG2-GC-2023-008-1B"],"award-info":[{"award-number":["AISG2-GC-2023-008-1B"]}]}],"content-domain":{"domain":[],"crossmark-restriction":false},"short-container-title":["Proc. ACM Softw. Eng."],"published-print":{"date-parts":[[2026,6,30]]},"abstract":"<jats:p>Test cases are essential for software development and maintenance. In practice, developers derive multiple test cases from an implicit pattern based on their understanding of requirements and inference of diverse test scenarios, each validating a specific behavior of the focal method. However, producing comprehensive tests is time-consuming and error-prone: many important tests that should have accompanied the initial test are added only after a significant delay, sometimes only after bugs are triggered.<\/jats:p>\n                  <jats:p>Existing automated test generation techniques largely focus on code coverage. Yet in real projects, practical tests are seldom driven by code coverage alone, since test scenarios do not necessarily align with control-flow branches. Instead, test scenarios originate from requirements, which are often undocumented and implicitly embedded in a project's design and implementation. However, developer-written tests are frequently treated as executable specifications; thus, even a single initial test that reflects the developer's intent can reveal the underlying requirement and the diverse scenarios that should be validated.<\/jats:p>\n                  <jats:p>In this work, we propose TestGeneralizer, a framework for generalizing test cases to comprehensively cover test scenarios. TestGeneralizer orchestrates three stages: (1) enhancing the understanding of the requirement and scenario behind the focal method and initial test; (2) generating a test scenario template and crystallizing it into various test scenario instances; and (3) generating and refining executable test cases from these instances. To ensure accuracy and completeness, TestGeneralizer combines rule-based prompts, automatically optimized via a prompt auto-tuning technique, with crucial project knowledge retrieved through program analysis. We evaluate TestGeneralizer against three state-of-the-art baselines (EvoSuite, gpt-o4-mini, and ChatTester) on 12 open-source Java projects, covering 506 multi-test focal methods and 1,637 test scenarios. TestGeneralizer achieves significant improvements: +57.67% and +59.62% over EvoSuite, +37.44% and +32.82% over gpt-o4-mini, and +31.66% and +23.08% over ChatTester, in mutation-based and LLM-assessed scenario coverage, respectively. In a field study, we submitted 27 generalized tests overlooked by developers; 16 were accepted and merged into official repositories, demonstrating the practical usefulness of TestGeneralizer.<\/jats:p>","DOI":"10.1145\/3808216","type":"journal-article","created":{"date-parts":[[2026,6,30]],"date-time":"2026-06-30T17:06:14Z","timestamp":1782839174000},"page":"4760-4781","source":"Crossref","is-referenced-by-count":3,"title":["Generalizing Test Cases for Comprehensive Test Scenario Coverage"],"prefix":"10.1145","volume":"3","author":[{"ORCID":"https:\/\/orcid.org\/0000-0002-0828-5544","authenticated-orcid":false,"given":"Binhang","family":"Qi","sequence":"first","affiliation":[{"name":"National University of Singapore, Singapore, Singapore"}],"role":[{"vocabulary":"crossref","role":"author"}]},{"ORCID":"https:\/\/orcid.org\/0000-0001-8255-0118","authenticated-orcid":false,"given":"Yun","family":"Lin","sequence":"additional","affiliation":[{"name":"Shanghai Jiao Tong University, Shanghai, China"}],"role":[{"vocabulary":"crossref","role":"author"}]},{"ORCID":"https:\/\/orcid.org\/0009-0009-6222-2892","authenticated-orcid":false,"given":"Xinyi","family":"Weng","sequence":"additional","affiliation":[{"name":"Shanghai Jiao Tong University, Shanghai, China"}],"role":[{"vocabulary":"crossref","role":"author"}]},{"ORCID":"https:\/\/orcid.org\/0009-0005-0554-4028","authenticated-orcid":false,"given":"Chenyan","family":"Liu","sequence":"additional","affiliation":[{"name":"National University of Singapore, Singapore, Singapore"}],"role":[{"vocabulary":"crossref","role":"author"}]},{"ORCID":"https:\/\/orcid.org\/0000-0001-7654-5574","authenticated-orcid":false,"given":"Hailong","family":"Sun","sequence":"additional","affiliation":[{"name":"Beihang University, Beijing, China"}],"role":[{"vocabulary":"crossref","role":"author"}]},{"ORCID":"https:\/\/orcid.org\/0000-0002-4364-6595","authenticated-orcid":false,"given":"Gordon","family":"Fraser","sequence":"additional","affiliation":[{"name":"University of Passau, Passau, Germany"}],"role":[{"vocabulary":"crossref","role":"author"}]},{"ORCID":"https:\/\/orcid.org\/0000-0002-6512-8326","authenticated-orcid":false,"given":"Jin Song","family":"Dong","sequence":"additional","affiliation":[{"name":"National University of Singapore, Singapore, Singapore"}],"role":[{"vocabulary":"crossref","role":"author"}]}],"member":"320","published-online":{"date-parts":[[2026,6,30]]},"reference":[{"key":"e_1_2_1_1_1","doi-asserted-by":"publisher","DOI":"10.1145\/3663529.3663839"},{"key":"e_1_2_1_2_1","doi-asserted-by":"publisher","DOI":"10.1016\/j.ins.2007.11.024"},{"key":"e_1_2_1_3_1","unstructured":"Spark authors. [n. d.]."},{"key":"e_1_2_1_4_1","doi-asserted-by":"publisher","DOI":"10.1145\/3092703.3092715"},{"key":"e_1_2_1_5_1","volume-title":"2018 IEEE\/ACM 40th International Conference on Software Engineering: Companion (ICSE-Companion).","author":"Braione Pietro","year":"2018","unstructured":"Pietro Braione, Giovanni Denaro, Andrea Mattavelli, and Mauro Pezz\u00e8. 2018. SUSHI: a test generator for programs with complex structured inputs. In 2018 IEEE\/ACM 40th International Conference on Software Engineering: Companion (ICSE-Companion)."},{"key":"e_1_2_1_6_1","first-page":"209","volume-title":"OSDI","volume":"8","author":"Cadar Cristian","year":"2008","unstructured":"Cristian Cadar, Daniel Dunbar, Dawson R Engler, et al. 2008. Klee: unassisted and automatic generation of high-coverage tests for complex systems programs.. In OSDI, Vol. 8. 209-224."},{"key":"e_1_2_1_7_1","unstructured":"cron-utils authors. 2018. Infinite loop when daylight savings time starts at midnight #332. https:\/\/github.com\/ jmrozanec\/cron-utils\/issues\/332."},{"key":"e_1_2_1_8_1","unstructured":"cron-utils authors. 2018. Test Case for Issue #332. https:\/\/github.com\/jmrozanec\/cron-utils\/blob\/master\/src\/test\/java\/ com\/cronutils\/Issue332Test.java."},{"key":"e_1_2_1_9_1","doi-asserted-by":"publisher","DOI":"10.1145\/3510003.3510141"},{"key":"e_1_2_1_10_1","doi-asserted-by":"publisher","DOI":"10.1109\/ICSE55347.2025.00210"},{"key":"e_1_2_1_11_1","unstructured":"Eclipse JDT Language Server Authors. 2025. Eclipse JDT Language Server. https:\/\/github.com\/eclipse-jdtls\/eclipse.jdt.ls."},{"key":"e_1_2_1_12_1","doi-asserted-by":"publisher","DOI":"10.1145\/2025113.2025179"},{"key":"e_1_2_1_13_1","volume-title":"Shan Gao, and Michael Lyu.","author":"Gao Shuzheng","year":"2025","unstructured":"Shuzheng Gao, Chaozheng Wang, Cuiyun Gao, Xiaoqian Jiao, Chun Yong Chong, Shan Gao, and Michael Lyu. 2025. The Prompt Alchemist: Automated LLM-Tailored Prompt Optimization for Test Case Generation. arXiv:2501.01329"},{"key":"e_1_2_1_14_1","doi-asserted-by":"publisher","DOI":"10.1145\/1065010.1065036"},{"key":"e_1_2_1_15_1","doi-asserted-by":"publisher","DOI":"10.1145\/3415153"},{"key":"e_1_2_1_16_1","doi-asserted-by":"publisher","DOI":"10.1109\/ICSE48619.2023.00194"},{"key":"e_1_2_1_17_1","doi-asserted-by":"publisher","DOI":"10.1145\/3715737"},{"key":"e_1_2_1_18_1","doi-asserted-by":"publisher","DOI":"10.1109\/ICSE48619.2023.00085"},{"key":"e_1_2_1_19_1","volume-title":"2023 38th IEEE\/ACM International Conference on Automated Software Engineering (ASE). IEEE, 14-26","author":"Li Tsz-On","year":"2023","unstructured":"Tsz-On Li, Wenxi Zong, Yibo Wang, Haoye Tian, Ying Wang, Shing-Chi Cheung, and Jeff Kramer. 2023. Nuances are the key: Unlocking chatgpt to find failure-inducing tests with differential prompting. In 2023 38th IEEE\/ACM International Conference on Automated Software Engineering (ASE). IEEE, 14-26."},{"key":"e_1_2_1_20_1","doi-asserted-by":"publisher","DOI":"10.1145\/3468264.3468619"},{"key":"e_1_2_1_21_1","doi-asserted-by":"publisher","DOI":"10.1145\/3395363.3397358"},{"key":"e_1_2_1_22_1","doi-asserted-by":"publisher","DOI":"10.21105\/joss.01891"},{"key":"e_1_2_1_23_1","doi-asserted-by":"publisher","DOI":"10.1145\/3661167.3661273"},{"key":"e_1_2_1_24_1","volume-title":"Test Intention Guided LLM-Based Unit Test Generation. In 2025 IEEE\/ACM 47th International Conference on Software Engineering (ICSE). 1026-1038","author":"Nan Zifan","year":"2025","unstructured":"Zifan Nan, Zhaoqiang Guo, Kui Liu, and Xin Xia. 2025. Test Intention Guided LLM-Based Unit Test Generation. In 2025 IEEE\/ACM 47th International Conference on Software Engineering (ICSE). 1026-1038."},{"key":"e_1_2_1_25_1","volume-title":"2023 IEEE\/ACM 45th International Conference on Software Engineering (ICSE). IEEE, 2111-2123","author":"Nie Pengyu","year":"2023","unstructured":"Pengyu Nie, Rahul Banerjee, Junyi Jessy Li, Raymond J Mooney, and Milos Gligoric. 2023. Learning deep semantics for test completion. In 2023 IEEE\/ACM 45th International Conference on Software Engineering (ICSE). IEEE, 2111-2123."},{"key":"e_1_2_1_26_1","volume-title":"91af2eb. https: \/\/github.com\/ofdrw\/ofdrw\/commit\/91af2ebec12cb5eb9a4a4a74b96b2a06504e21e7#diff- 29573571d1af02d4502f7fc750f378c0ba807a539b9cdfac1899c03dd1c6c789R22","author":"Reader OFD","unstructured":"ofdrw authors. 2023. OFD Reader & Writer. Commit Version: 91af2eb. https: \/\/github.com\/ofdrw\/ofdrw\/commit\/91af2ebec12cb5eb9a4a4a74b96b2a06504e21e7#diff- 29573571d1af02d4502f7fc750f378c0ba807a539b9cdfac1899c03dd1c6c789R22."},{"key":"e_1_2_1_27_1","unstructured":"ofdrw authors. 2023. OFD Reader & Writer. Commit Version: 9f82f37. https: \/\/github.com\/ofdrw\/ofdrw\/commit\/9f82f37022d9b0d020ca56f40832ebf876b786c4#diff- 94ead98a7ae23957cc9c48bb19f5ab36ee48e0e478b75ed480e31b0b779b9a08R515."},{"key":"e_1_2_1_28_1","unstructured":"ofdrw authors. 2025. OFD Reader & Writer. https:\/\/github.com\/ofdrw\/ofdrw."},{"key":"e_1_2_1_29_1","unstructured":"OpenAI. 2025. Introducing OpenAI o3 and o4-mini. https:\/\/openai.com\/index\/introducing-o3-and-o4-mini\/."},{"key":"e_1_2_1_30_1","doi-asserted-by":"publisher","DOI":"10.1145\/1297846.1297902"},{"key":"e_1_2_1_31_1","unstructured":"pitest authors. 2025. State of the art mutation testing system for the JVM. https:\/\/github.com\/hcoles\/pitest."},{"key":"e_1_2_1_32_1","volume-title":"Intention-driven generation of project-specific test cases. arXiv preprint arXiv:2507.20619","author":"Qi Binhang","year":"2025","unstructured":"Binhang Qi, Yun Lin, Xinyi Weng, Yuhuan Huang, Chenyan Liu, Hailong Sun, Zhi Jin, and Jin Song Dong. 2025. Intention-driven generation of project-specific test cases. arXiv preprint arXiv:2507.20619 (2025)."},{"key":"e_1_2_1_33_1","first-page":"235","article-title":"Dreamloc: A deep relevance matchingbased framework for bug localization","volume":"71","author":"Qi Binhang","year":"2021","unstructured":"Binhang Qi, Hailong Sun, Wei Yuan, Hongyu Zhang, and Xiangxin Meng. 2021. Dreamloc: A deep relevance matchingbased framework for bug localization. IEEE Transactions on Reliability 71, 1 (2021), 235-249.","journal-title":"IEEE Transactions on Reliability"},{"key":"e_1_2_1_34_1","volume-title":"An empirical evaluation of using large language models for automated unit test generation","author":"Sch\u00e4fer Max","year":"2023","unstructured":"Max Sch\u00e4fer, Sarah Nadi, Aryaz Eghbali, and Frank Tip. 2023. An empirical evaluation of using large language models for automated unit test generation. IEEE Transactions on Software Engineering (2023)."},{"key":"e_1_2_1_35_1","doi-asserted-by":"publisher","DOI":"10.1145\/1095430.1081750"},{"key":"e_1_2_1_36_1","volume-title":"Proceedings of the 33rd ACM SIGSOFT International Symposium on Software Testing and Analysis. 1211-1222","author":"Shin Jiho","year":"2024","unstructured":"Jiho Shin, Sepehr Hashtroudi, Hadi Hemmati, and Song Wang. 2024. Domain Adaptation for Code Model-Based Unit Test Case Generation. In Proceedings of the 33rd ACM SIGSOFT International Symposium on Software Testing and Analysis. 1211-1222."},{"key":"e_1_2_1_37_1","doi-asserted-by":"publisher","DOI":"10.1109\/SCAM63643.2024.00025"},{"key":"e_1_2_1_38_1","doi-asserted-by":"crossref","first-page":"1381","DOI":"10.1109\/TR.2021.3101318","article-title":"Production monitoring to improve test suites","volume":"71","author":"Tiwari Deepika","year":"2021","unstructured":"Deepika Tiwari, Long Zhang, Martin Monperrus, and Benoit Baudry. 2021. Production monitoring to improve test suites. IEEE Transactions on Reliability 71, 3 (2021), 1381-1397.","journal-title":"IEEE Transactions on Reliability"},{"key":"e_1_2_1_39_1","volume-title":"Shao Kun Deng, and Neel Sundaresan","author":"Tufano Michele","year":"2020","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)."},{"key":"e_1_2_1_40_1","volume-title":"Can large language models write good property-based tests? arXiv preprint arXiv:2307.04346","author":"Vikram Vasudev","year":"2023","unstructured":"Vasudev Vikram, Caroline Lemieux, Joshua Sunshine, and Rohan Padhye. 2023. Can large language models write good property-based tests? arXiv preprint arXiv:2307.04346 (2023)."},{"key":"e_1_2_1_41_1","volume-title":"Hoon Wei Lim, and Jin Song Dong","author":"Wang Hongtai","year":"2025","unstructured":"Hongtai Wang, Ming Xu, Yanpei Guo, Weili Han, Hoon Wei Lim, and Jin Song Dong. 2025. RulePilot: An LLM-Powered Agent for Security Rule Generation. arXiv:2511.12224 [cs.CR] https:\/\/arxiv.org\/abs\/2511.12224"},{"key":"e_1_2_1_42_1","volume-title":"Variable Renaming-Based Adversarial Test Generation for Code Model: Benchmark and Enhancement. ACM Transactions on Software Engineering and Methodology","author":"Wen Jin","year":"2025","unstructured":"Jin Wen, Qiang Hu, Yuejun Guo, Maxime Cordy, and Yves Le Traon. 2025. Variable Renaming-Based Adversarial Test Generation for Code Model: Benchmark and Enhancement. ACM Transactions on Software Engineering and Methodology (2025)."},{"key":"e_1_2_1_43_1","doi-asserted-by":"publisher","DOI":"10.1145\/3597503.3639121"},{"key":"e_1_2_1_44_1","volume-title":"Enhancing LLM-based Test Generation for Hard-to-Cover Branches via Program Analysis. CoRR abs\/2404.04966","author":"Yang Chen","year":"2024","unstructured":"Chen Yang, Junjie Chen, Bin Lin, Jianyi Zhou, and Ziqi Wang. 2024. Enhancing LLM-based Test Generation for Hard-to-Cover Branches via Program Analysis. CoRR abs\/2404.04966 (2024)."},{"key":"e_1_2_1_45_1","doi-asserted-by":"publisher","DOI":"10.1145\/3660783"},{"key":"e_1_2_1_46_1","doi-asserted-by":"publisher","DOI":"10.1145\/3715778"}],"container-title":["Proceedings of the ACM on Software Engineering"],"original-title":[],"language":"en","link":[{"URL":"https:\/\/dl.acm.org\/doi\/pdf\/10.1145\/3808216","content-type":"unspecified","content-version":"vor","intended-application":"similarity-checking"}],"deposited":{"date-parts":[[2026,6,30]],"date-time":"2026-06-30T18:30:21Z","timestamp":1782844221000},"score":1,"resource":{"primary":{"URL":"https:\/\/dl.acm.org\/doi\/10.1145\/3808216"}},"subtitle":[],"short-title":[],"issued":{"date-parts":[[2026,6,30]]},"references-count":46,"journal-issue":{"issue":"FSE","published-print":{"date-parts":[[2026,6,30]]}},"alternative-id":["10.1145\/3808216"],"URL":"https:\/\/doi.org\/10.1145\/3808216","relation":{},"ISSN":["2994-970X"],"issn-type":[{"value":"2994-970X","type":"electronic"}],"subject":[],"published":{"date-parts":[[2026,6,30]]}}}