A Dependence Representation for Coverage Testing of Object-Oriented Programs

ESF Najumudheen, Rajib Mall, Debasis Samanata
2010 Journal of Object Technology  
We propose a dependence-based representation for object-oriented programs, named Call-based Object-Oriented System Dependence Graph (COSDG). Apart from structural features, COSDG captures important object-oriented features such as class, inheritance, and polymorphism. Novel features of COSDG include details of method visibility in a derived class, and different types of method call edges to distinguish between various calling contexts-simple, inherited, and polymorphic. We also propose an
more » ... so propose an algorithm for the construction of COSDG, and subsequently explain its working with an example. COSDG has been developed primarily to aid test coverage analysis. However, it can be used in a variety of other software engineering applications such as program slicing, software re-engineering, and debugging. [20] are some of the well known representations. Each of these captures some specific features of a program: CFG depicts the flow of control between various program elements, DFG depicts data flow information between various program elements, PDG captures both control and data dependences for a single procedure, SDG represents dependences and procedure calls between multiple procedures, and CG represents calling relationships between various modules of a program. These models were proposed to represent procedural programs. However, they cannot be used satisfactorily for object-oriented programs since the object-oriented paradigm introduces several features such as encapsulation, inheritance, polymorphism and dynamic binding. In the past, several researchers have proposed extensions to dependence-based representations such as PDG and SDG, to incorporate features specific to object-oriented programs. Some of them were intended to meet the specific needs of a particular application [17, 10, 11] , whereas some others were intended to support a variety of applications [13, 7] . Rothermel and Harrold proposed the class dependence graph (ClDG) [17]. Larsen and Harrold proposed a system dependence graph for objectoriented software (ESDG) [10]. Liang and Harrold proposed extensions to ESDG for the purpose of object-slicing [11]. Malloy et al. proposed a layered representation, the object-oriented program dependency graph (OPDG) [13]. Harrold and Rothermel proposed a family of representations for object-oriented software: class hierarchy graph (CHG), class call graph (CCG), class control flow graph (CCFG), class dependence graph (ClDG), and framed graph [7]. Although SDG and its modified versions have been used as intermediate representations for various software engineering applications [17, 10, 11, 23, 22, 9] , attempts to perform test coverage analysis of object-oriented programs based on a dependencebased representation are scarcely reported in the literature. Earlier work have used control flow graphs, data flow graphs, def-use graphs, and call graphs as intermediate representations to perform test coverage analysis [4, 21, 1, 12, 18, 19] , but not a dependence-based graph. Moreover, to perform an object-oriented coverage analysis, we need a representation that has the following aspects: be capable of capturing important object-oriented features, should help track the coverage of various program elements and features during execution, and facilitate accurate and efficient computation of object-oriented coverage measures. SDG or its modified versions either lack some of these aspects or possess unnecessary details (discussed in Section 6), and hence, cannot be used satisfactorily for test coverage analysis. Therefore, a specific representation is needed. In this paper, we propose a dependence-based representation, based on ESDG, for test coverage analysis of object-oriented programs. We have named our representation Call-based Object-Oriented System Dependence Graph (COSDG). Our representation incorporates dependence, flow, call graph, and inheritance details. Dependence details include control dependence, data dependence, and membership dependence. Flow details include control flow and data flow. Call graph details consists of simple, inherited, and polymorphic method calls. Inheritance details consists of inheritance hierarchy among classes, and method visibility in a derived class. Though COSDG was developed specifically for coverage analysis operations, it has all the essential features needed for use in a variety of other software engineering applications such as program slicing, software re-engineering, and program debugging. The rest of the paper is organized as follows. Section 2 provides the basic details needed to understand our representation. Section 3 describes our proposed represen-
doi:10.5381/jot.2010.9.4.a1 fatcat:2qzqjzavgng3rgcg7dnbufnjoy