A Documentation-based Constraint Generation Method for Java APIs.

Zejun Zhang,Shaobo Wu,Renhe Jiang,Minxue Pan,Tian Zhang
DOI: https://doi.org/10.1145/3275219.3275229
2018-01-01
Abstract:As the efficiency of constraint solvers increases, constraint solving has been widely used in many applications of software engineering, such as test case generation, program synthesis and code search. However, encoding source code into constraints is not an easy task. Particularly, when it comes to complex data structures of library functions, existing work cannot generate effective constraints. In this paper, we propose a documentation-based method to generate constraint for Java APIs. It mainly uses Natural Language Processing (NLP) techniques to construct syntactic trees by extracting the specifications of methods. Then it uses predefined constraint templates to generate constraint models by traversing the syntactic trees. Our approach successfully models 228 methods for 11 Java container classes and string-related classes. We summarize 12 functional behavior and formulate 21 constraint templates for these classes. Compared with other tools, our approach models most of methods about string-related classes, and more importantly, generates constraint models for Java container classes that other tools cannot. In order to evaluate the effectiveness of our constraint models, we apply them into test case generation. The experimental result shows that constraint models we generate have practical use.
What problem does this paper attempt to address?