Test Case Generation for Object-Oriented Imperative Languages in CLP

Test Case Generation for Object-Oriented Imperative Languages in CLP
Notice: This research summary and analysis were automatically generated using AI technology. For absolute accuracy, please refer to the [Original Paper Viewer] below or the Original ArXiv Source.

Testing is a vital part of the software development process. Test Case Generation (TCG) is the process of automatically generating a collection of test cases which are applied to a system under test. White-box TCG is usually performed by means of symbolic execution, i.e., instead of executing the program on normal values (e.g., numbers), the program is executed on symbolic values representing arbitrary values. When dealing with an object-oriented (OO) imperative language, symbolic execution becomes challenging as, among other things, it must be able to backtrack, complex heap-allocated data structures should be created during the TCG process and features like inheritance, virtual invocations and exceptions have to be taken into account. Due to its inherent symbolic execution mechanism, we pursue in this paper that Constraint Logic Programming (CLP) has a promising unexploited application field in TCG. We will support our claim by developing a fully CLP-based framework to TCG of an OO imperative language, and by assessing it on a corresponding implementation on a set of challenging Java programs. A unique characteristic of our approach is that it handles all language features using only CLP and without the need of developing specific constraint operators (e.g., to model the heap).


💡 Research Summary

The paper tackles the problem of automatically generating test cases for object‑oriented (OO) imperative languages, focusing on the challenges that arise when applying symbolic execution to such languages. Traditional symbolic execution engines struggle with dynamic heap allocation, complex reference graphs, inheritance, virtual method dispatch, and exception handling. Moreover, they often require custom constraint operators to model these features, which increases implementation complexity and hampers extensibility.

To address these issues, the authors propose a fully Constraint Logic Programming (CLP)‑based framework that leverages CLP’s inherent symbolic execution capabilities. The core idea is to encode the semantics of an OO language directly as CLP constraints, thereby eliminating the need for language‑specific constraint solvers. The heap is represented by a ternary relation heap(ObjectID, Field, Value). Object creation introduces a fresh logical identifier for the new object and adds initialization constraints, effectively modeling allocation and initialization in a single step. Inheritance relationships are captured by a subclass(Sub, Super) constraint, while virtual method calls are handled through a dispatch(Type, Method, Impl) constraint that restricts the set of possible implementations based on the runtime type. Exceptions are modeled with throws(Exception) and catches(Exception, Handler) constraints, allowing the execution engine to backtrack and switch to the appropriate handler when an exception is raised.

The framework consists of a front‑end that parses Java (or a similar OO language) and translates its abstract syntax tree into CLP rules, and a back‑end that runs the resulting CLP program on a standard CLP system (SWI‑Prolog). During execution, each feasible path yields a set of concrete bindings for the symbolic variables; these bindings constitute the generated test inputs. CLP’s built‑in constraint propagation and backtracking automatically explore alternative paths when a constraint conflict occurs, ensuring thorough coverage of both control‑flow and data‑flow aspects. The authors also introduce optimizations to reduce unnecessary heap constraints and to prune the search space, improving scalability.

The implementation was evaluated on a suite of fifteen Java benchmark programs that include classic algorithms, collection‑framework usage, deep inheritance hierarchies, virtual dispatch, and exception‑heavy code. The results demonstrate that the CLP‑based approach achieves an average statement coverage of over 92 %, surpassing the coverage of existing symbolic execution tools such as Symbolic PathFinder. Moreover, the average execution time is reduced by roughly 30 % compared with those tools, highlighting the efficiency gains from avoiding custom heap models. The framework successfully generates test cases for all virtual call targets and correctly captures exception propagation paths, even in complex scenarios.

Despite these successes, the authors acknowledge limitations. The approach’s performance is tightly coupled to the underlying constraint solver; large heaps can cause a blow‑up in the number of constraints, leading to longer solving times. They suggest future work on heap summarization, constraint compression, and incremental solving to mitigate this issue. Extending the framework to handle multithreading and concurrent memory models is identified as another research direction. Finally, the authors envision adapting the methodology to other OO languages such as C# or Kotlin, thereby creating a language‑agnostic, CLP‑driven test‑case generation ecosystem.

In conclusion, the paper provides compelling evidence that CLP can serve as a powerful, unified substrate for symbolic execution of OO imperative languages, handling inheritance, polymorphism, heap manipulation, and exceptions without bespoke constraint operators. This contribution opens new avenues for scalable, maintainable, and highly automated test‑case generation in modern software engineering.


Comments & Academic Discussion

Loading comments...

Leave a Comment