Model-based regression test case prioritization

0 downloads 0 Views 307KB Size Report
Chhabi Rani Panigrahi. Rajib Mall. Department of Computer Science and Engineering. IIT Kharagpur, India-721302 e-mail: {chhabi, rajib}@cse.iitkgp.ernet.in.
ACM SIGSOFT Software Engineering Notes Page 1

November 2010 Volume 35 Number 6

Model-Based Regression Test Case Prioritization Chhabi Rani Panigrahi Rajib Mall Department of Computer Science and Engineering IIT Kharagpur, India-721302 e-mail: {chhabi, rajib}@cse.iitkgp.ernet.in Abstract

prioritize regression test cases for object-oriented programs. Our model represents all relevant object-oriented features such as inheritance, polymorphism, association and aggregation. When a change occurs to a program, both the original and modified programs are compared by a code differencer to find the modified statements. The identified changes are marked on the model. We construct a forward slice of the model with respect to each modified model element, to determine all the model elements that might be affected by a change. We construct backward slice with respect to each element of the model to identify the model elements that are indirectly tested by a test case. We have assigned higher priority to a test case that covers maximum number of affected model elements. The rest of the paper is organized as follows: In Section 1, we discuss background concepts required for our paper, and review the existing TCP techniques in Section 2. We present a brief discussion of EOSDG(Extended Object-oriented System Dependence Graph) and our TCP technique in Section 4. We present empirical results of our proposed technique in Section 5. In Section 6, we present a comparison of our technique with the related approaches, and conclude the paper in Section 7.

We propose a model-based regression test case prioritization technique for object-oriented programs. Our technique involves constructing a graph model of the source code to represent control and data dependences as well as static object relations such as inheritance, aggregation and association. We construct a forward slice of the model to identify all the model elements that may be affected by a change. Subsequently, the model elements are marked with the specific test case(s) testing it. We construct backward slice with respect to each model element executed by a test case to determine all elements indirectly tested by the test case. Then all the affected model elements and the elements being tested are used to prioritize test cases. Empirical studies carried out by us show that our technique increases the detection of number of faults on an average of 30 percent as compared to traditional approaches in detecting regression errors. Keywords: Software maintenance, Regression testing, Regression test selection, Test case prioritization, Modelbased test case prioritization.

Introduction

1

Whenever a program is modified, regression testing is carried out to ensure that no errors have been induced in the unmodified parts of the program. Regression testing is carried out after every maintenance effort, and typically accounts for half the total software maintenance costs [Kap04, LW89]. In order to reduce the cost and improve the effectiveness of regression testing, various approaches such as regression test selection (RTS) [HJL+ 01, RH94, RH97, RHD00], test suite minimization (TSM) [HGS93, MSY05, KT02] and test case prioritization (TCP) [EMR02, ERKM04, MRRE06, RUCH01, WSKR06] techniques have been proposed in the literature. An important limitation of both RTS and TSM approaches is that they do not impose any ordering among the selected test cases. As a result, these approaches do not provide the tester with the option of determining the best subset of test cases that can be used to meet some specified cost or time constraints [KP02, WSKR06]. However, TCP techniques mainly order regression test cases according to some criteria such as to increase the rate of fault detection or to achieve maximum code coverage. The existing program model based TCP techniques can not be used satisfactorily [RUCH01, KGH96] for TCP of object-oriented programs, because these do not consider object-oriented features like inheritance, polymorphism and various object relations. In this context, we propose a model-based approach to

Background Concepts

In this section, we review some important concepts that form the basis of our work. 1.1

Graph Model for Object-Oriented Programs

Horwitz et al. introduced the concept of System Dependence Graph (SDG) for procedural programs [HRB90]. Later, Larsen and Harrold extended SDG to model object-oriented programs [LH96]. In the rest of the paper, we refer to Larsen and Harrold’s SDG as LH-SDG. Each class in an LH-SDG is represented by a Class Dependence Graph (ClDG) [RH94]. A ClDG represents both control and data dependence relationships within a class. The root node of a ClDG is represented by a class entry vertex which represents the entry into a class. Each method in a class also has a method entry vertex. The class entry vertex is connected to the method entry vertex for each method in a class by class member edges. In a ClDG, the method calls are represented by call vertices. At each call vertex, actual-in and actual-out vertices are added. These are matched with the corresponding formal-in and formal-out vertices present at the entry to the called method. To represent derived class in an inheritance hierarchy, a CIDG is constructed for each derived class. A class entry vertex of a derived class is connected to the method entry vertex of each method in the derived class by class member

1

DOI: 10.1145/1874391.1874405

http://doi.acm.org/10.1145/1874391.1874405

ACM SIGSOFT Software Engineering Notes Page 2 S1 S2 CE3 S4 E5 S6 S7

#include using namespace std; class Coord { public: Coord( float a=0, float b=0 ) { x=a; y=b; } bool checkequal( Coord c ) { if( x==c.x&&y==c.y) return true; else return false; } float x, y;

E8 S9 S10 S11 S12 S13 };

E22 S23 S24 S25

int main( void ) { float x, y; coutx>>y;

S26 C27 S28 S29

Coord c1(x, y), c2(1, 1); if( c1.checkequal(c2)) { cout