Uncovering Business Logic Bugs via Semantics-Driven Unit Test Generation

📅 2026-04-25
📈 Citations: 0
Influential: 0
📄 PDF

career value

163K/year
🤖 AI Summary
This work addresses the limitation of existing code-centric unit test generation approaches, which often fail to detect logical bugs violating business semantics in enterprise software. To bridge this gap, the authors propose SeGa, a novel method that explicitly models business semantics by constructing a semantic knowledge base from requirement documents. SeGa extracts functional specifications and generates fine-grained business scenarios comprising preconditions, triggering actions, expected outcomes, and semantic constraints to guide large language models in producing highly targeted unit tests. Empirical evaluation on four industrial Go projects demonstrates that SeGa identifies 22–25 additional real-world bugs compared to state-of-the-art baselines, achieving a precision improvement of 26.9%–34.3%. Furthermore, it uncovered 16 previously unknown vulnerabilities across six production repositories, all of which have since been confirmed and fixed.

Technology Category

Application Category

📝 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. From our industrial study, we summarize a series of lessons and suggestions for practical use and future research.
Problem

Research questions and friction points this paper is trying to address.

business logic bugs
unit test generation
semantic knowledge
enterprise software
requirement documents
Innovation

Methods, ideas, or system contributions that make the work stand out.

semantics-driven
unit test generation
business logic bugs
LLM-based testing
requirement-to-test