Uncovering Business Logic Bugs via Semantics-Driven Unit Test Generation (Experience Paper)
Abstract
Business logic bugs violate intended business semantics and are particularly prevalent in enterprise software. Yet most existing unit test generation techniques are code-centric, making such bugs difficult to expose. We present SeGa, a semantics-driven unit test generation technique for uncovering business logic bugs. SeGa constructs a semantic knowledge base from product requirement documents, represented as a set of functionality entries that group related requirements under a common business intent. Given a focal method, SeGa retrieves the relevant functionality entries and derives fine-grained business scenarios with explicit preconditions, triggering actions, expected outcomes, and semantic constraints to guide LLM-based test generation. We evaluate SeGa on four industrial Go projects containing 60 real-world business logic bugs. SeGa detects 22∼25 more bugs than four state-of-the-art LLM-based techniques and improves precision by 26.9%∼34.3%. Deployment across 6 production repositories further uncovers 16 previously unknown business logic bugs that were confirmed and fixed by developers, demonstrating SeGa's practical value. From our industrial study, we summarize a series of lessons and suggestions for practical use and future research.
Ask Lune
Know this paper in minutes, not an afternoon.
Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.
1 top-tier paper has cited it since. Know what they found before your reviewers do.
Lune can draw on
the full paper · the top-tier papers that cite it · related work
Free to start. No credit card required.
Lineage
- CodaMosa: Escaping Coverage Plateaus in Test Generation with Pre-trained Large Language Models cites TOGA: A Neural Method for Test Oracle Generation
- Fuzz4All: Universal Fuzzing with Large Language Models cites CodaMosa: Escaping Coverage Plateaus in Test Generation with Pre-trained Large Language Models
- Context Matters: Improving the Practical Reliability of LLM-Based Unit Test Generation (Experience Paper) cites CodaMosa: Escaping Coverage Plateaus in Test Generation with Pre-trained Large Language Models
- Context Matters: Improving the Practical Reliability of LLM-Based Unit Test Generation (Experience Paper) cites TOGA: A Neural Method for Test Oracle Generation
- Context Matters: Improving the Practical Reliability of LLM-Based Unit Test Generation (Experience Paper) cites On the Evaluation of Large Language Models in Unit Test Generation
- Code-Aware Prompting: A Study of Coverage-Guided Test Generation in Regression Setting using LLM cites CodaMosa: Escaping Coverage Plateaus in Test Generation with Pre-trained Large Language Models
- Code-Aware Prompting: A Study of Coverage-Guided Test Generation in Regression Setting using LLM cites TOGA: A Neural Method for Test Oracle Generation
- On the Evaluation of Large Language Models in Unit Test Generation cites CodaMosa: Escaping Coverage Plateaus in Test Generation with Pre-trained Large Language Models
- On the Evaluation of Large Language Models in Unit Test Generation cites TOGA: A Neural Method for Test Oracle Generation
Cited by top-tier papers1
Builds on18
- CodaMosa: Escaping Coverage Plateaus in Test Generation with Pre-trained Large Language ModelsCaroline Lemieux, Jeevana Priya Inala, Shuvendu K. Lahiri, Siddhartha SenICSE 2023 · 221 citations
- Fuzz4All: Universal Fuzzing with Large Language ModelsChunqiu Steven Xia, Matteo Paltenghi, Jia Le Tian, Michael Pradel et al.ICSE 2024 · 155 citations
- TOGA: A Neural Method for Test Oracle GenerationElizabeth Dinella, Gabriel Ryan, Todd Mytkowicz, Shuvendu K. LahiriICSE 2022 · 92 citations
- Code-Aware Prompting: A Study of Coverage-Guided Test Generation in Regression Setting using LLMGabriel Ryan, Siddhartha Jain, Mingyue Shang, Shiqi Wang et al.FSE 2024 · 68 citations
- On the Evaluation of Large Language Models in Unit Test GenerationLin Yang, Chen Yang, Shutao Gao, Weijing Wang et al.ASE 2024 · 42 citations
Related papers
- INTENTFIX: Automated Logic Vulnerability Repair via LLM-Driven Intent ModelingJinseok Heo, Dongwook Choi, Jinyoung Kim, Misoo Kim et al.ICSE 2026
- LLM-Powered Test Case Generation for Detecting Bugs in Plausible ProgramsKaibo Liu, Zhenpeng Chen, Yiyang Liu, Jie M. Zhang et al.ACL 2025 · 20 citations
- A Knowledge Enhanced Large Language Model for Bug LocalizationYue Li, Bohan Liu, Ting Zhang, Zhiqi Wang et al.FSE 2025 · 3 citations
- Enhancing Exploratory Testing by Large Language Model and Knowledge GraphYanqi Su, Dianshu Liao, Zhenchang Xing, Qing Huang et al.ICSE 2024 · 19 citations
- Measuring the Influence of Incorrect Code on Test GenerationDong Huang, Jie M. Zhang, Mark Harman, Mingzhe Du et al.ICSE 2026
