AN EFFICIENT APPROACH OF REGRESSION TESTING USING HIERARCHICAL DECOMPOSITION SLICING

The purpose of regression testing is to ensure that bug fixes and new functionality introduced in a new version of a software do not adversely affect the correct functionality inherited from the previous version. I have proposed a new slicing method to decompose a Java program into affected packages, classes, methods and statements identified with respect to the modification made in the program.Because java program has hierarchical characteristics(Package/Class/Method), this decomposition is based on this characteristic. I also have proposed an intermediate representation for Java programs that shows Package Level, Class Level, and Method Level Dependency. I have named this intermediate representation as Program Dependency Tree(PDT). This PDT is used to identify the program parts that are possibly affected by the change made to the program. With the help of PDT, we can obtain program slices. The packages, classes, methods, and statements thus affected are identified by traversing the Program Dependency Tree. The proposed approach maps the decomposed slice (comprising of the affected program parts) with the coverage information of the existing test suite to select the appropriate test cases for regression testing. 1. REGRESSION TESTING Regression testing is the process of validating modified software to provide confidence that the changed parts of the software behave as intended and that the unchanged parts of the software have not been adversely affected by the modifications. Modifications in the user requirements and growing expectations of the clients have forced the software to evolve at regular intervals of time. As the complexity of software increases, the cost and effort to maintain such complex software also increase. After making the required changes to the software, regression testing should be carried out in order to assure the validity of the modified part and to ensure that the changes do not affect other parts of the program. A system is said to regress if 1) a new component is added, or 2) a modification done to the existing component affects other parts of the program. Therefore, it is absolutely necessary to retest not only the changed code but also to retest the possible affected code due to the change. Regression testing is an expensive activity and normally accounts for half of the total cost of software maintenance [1]. It is essential to cut-down the cost of retesting the software by pursuing a selective approach to identify and retest only those parts of the program that are affected by the change. Gupta et al. [2] have identified two important problems in selective regression testing: (1) identifying those existing tests that must be rerun since they may exhibit different behavior in the changed program and (2) identifying those program components that must be retested to satisfy some coverage criterion.


REGRESSION TESTING
Regression testing is the process of validating modified software to provide confidence that the changed parts of the software behave as intended and that the unchanged parts of the software have not been adversely affected by the modifications. Modifications in the user requirements and growing expectations of the clients have forced the software to evolve at regular intervals of time. As the complexity of software increases, the cost and effort to maintain such complex software also increase. After making the required changes to the software, regression testing should be carried out in order to assure the validity of the modified part and to ensure that the changes do not affect other parts of the program. A system is said to regress if 1) a new component is added, or 2) a modification done to the existing component affects other parts of the program. Therefore, it is absolutely necessary to retest not only the changed code but also to retest the possible affected code due to the change. Regression testing is an expensive activity and normally accounts for half of the total cost of software maintenance [1]. It is essential to cut-down the cost of retesting the software by pursuing a selective approach to identify and retest only those parts of the program that are affected by the change. Gupta et al. [2] have identified two important problems in selective regression testing: (1) identifying those existing tests that must be rerun since they may exhibit different behavior in the changed program and (2) identifying those program components that must be retested to satisfy some coverage criterion.

PROGRAM SLICING
Program slicing is the computation of the set of programs statements, the program slice that may affect the values at some point of interest, referred to as a slicing criterion. Program slicing can be used in debugging to locate source of errors more easily. Program slicing is a method of separating out the relevant parts of a program with respect to a particular computation. Thus, slice of a program is a set of statements of the program that affects the value of a variable at a particular point of interest. A program slice at a statement s consists of a set of relevant statements of a program those directly or indirectly affects s. Program slicing was originally introduced by Mark Weiser [3] as a method for automatically decomposing programs by analyzing their data flow and control flow dependences starting from a subset of a program's behavior. Finding all statements in a program that directly or indirectly affect the value of a variable occurrence is referred to as Program Slicing.

APPLICATIONS OF PROGRAM SLICING
In the following, we briefly discuss some of the applications of program slicing.
• Testing: Software maintainers often carry out regression testing. Regression testing essentially implies retesting software after modification [4,5,6]. Even after the smallest change to a piece of code, extensive tests may be necessary which might involve running a large number of test cases to eliminate any unwanted behavior arising due to the change.
• Debugging: Programmers mentally slice a code while debugging it. Program slicing is useful for debugging, because it potentially allows one to ignore many statements in the process of localizing the bug. • Software Maintenance: One of the problems in software maintenance is that of the ripple effect, i.e., whether a code change in a program will affect the behavior of other codes of the program. To avoid this problem, it is necessary to know which variables in which statements will be affected by a modified variable, and which variables in which statements will affect a modified variable during software maintenance. The needs can be satisfied by slicing the program being maintained [7].
• Change Impact Analysis: In regression testing only those parts are tested that are affected by the changes made to the program. Software change impact analysis is the mechanism of finding out the unpredicted and potential effect of the changes and the propagation of the impact to other parts of the program. • Software Quality Assurance: Software quality assurance auditors have to locate safety critical code and to ascertain its effect throughout the system. Program slicing can be used to locate all code that influences the values of variables that might be part of a safety critical component. But beforehand these critical components have to be determined by domain experts.
• Other Applications of Program Slicing: Program slicing methods have been used in several other applications such as compiler optimization, detecting dead code, software portability analysis, program understanding, program verification, measuring class cohesion, etc.

PROPOSED WORK
The change in the user requirements and growing expectations of the customers has forced the software to evolve at regular intervals of time. As the complexity of the software increases, the cost and effort to maintain such complex software also increases. Therefore, regression testing has become an integral part of the software maintenance process. It is indispensable to make changes and modifications to an already tested program.

Figure1: Model for Dependency Tree &Hierarchical Slicing.
Instead of analyzing the data flow and control flow for an OO program as a whole, it is useful to employ the hierarchical structure of the OO programs (e.g. Java programs), to detect the impact of the changes made to the program. A Java program P, is composed of a set of packages, classes, methods and statements, organized in a hierarchical manner. Therefore, in hierarchical slicing, we first try to slice out the packages that might have been affected by the change. From the set of affected packages, we then slice out the affected classes. Then the affected methods and the statements inside those methods are sliced out for retesting. The above concept of hierarchical slicing can be explained by considering a slicing criterion (i.e. the point of modification) < s, v >, where s is the statement containing variable v. Let S(P) be the set of packages, classes, methods and statements of a program P. The steps of hierarchical slicing are as follows: Step-1 First, we detect the package p containing s and v and all other packages, based on their direct or indirect dependences on p caused due to import statements. All those packages which are not related to the package p are removed. By following this process, the package level slice obtained is marked as S1(P).
Step-2 Then, we analyze S(P), to find out all those classes that are related to the class containing s and v. All other irrelevant classes are removed to get the class level slice. The class level slice is marked as S2(P).
Step-3 Next, we analyze S(P) and delete all the member methods and variables that are not related to the method containing s and v. This results in the method level slice, which is marked as S3(P).
Step-4 Finally, to find out the statement level slice, we analyze S(P) and delete all the statements and predicates that are not related to statement s containing variable v. The slice thus obtained is marked as S4(P). This step wise extraction of the slices is known as hierarchical slicing. We use this concept of hierarchical slicing for selecting our regression test cases. Java being the most popular OO language, we are encouraged to consider Java programs. We propose a dependency tree of java program suitable for slicing and test case generations.

PROPOSED PROGRAM DEPENDENCY TREE OF JAVA PROGRAM
The proposed Program Dependency Tree is a hierarchical structure which displays dependency information. We classify these dependences based on their role in representing some Object-Oriented features at different hierarchical levels.
• Package level dependences: Package level dependence specifies the dependence of a package on another package. • Class level dependences: When a class uses the features of another class, this kind of dependency is shown under this. • Method level dependences: Message passing is an important feature in object-oriented programs realized through method invocation by the objects. When one method invokes another method, it passes messages in the form of parameters. In method level dependency, we can see all methods and their dependent methods.

PROPOSED HIERARCHICAL DECOMPOSITION (HD) SLICING ALGORITHM
Following is the proposed algorithm named Hierarchical Decomposition (HD) Slicing, for finding those program parts that are affected by the change. The node that corresponds to the statement of modification is taken as the slicing criterion to compute the slices.

IMPLEMENTATION
To implement the proposed methods of Program Slicing, Program Dependency Tree and Generating Regression Test cases, I have used Java Language with Net Beans IDE.
Dependency Tree (Unexplored): In this tree, there are two regions. First region is the Tree on left side, in which 3 types of dependencies are shown. Second region is the programs of all dependency which is placed in the center. Dependencies shown in the left side tells that which packages are dependent on any other package, which classes are dependent on any of the class & which methods are dependent on any methods.

Figure12: Validation Rule Setup
Test Case Generation: This form displays validation rules and list of test cases. Test case type is given which is either positive or negative. This is very much helpful in regression testing due to automatic generation of test cases.

CONCLUSION
We proposed an algorithm of java program slicing which is very useful in regression testing. This algorithm takes Program Dependency Tree as input and generates Package level slice, class level slice, method level slice and statement level slices. Using this slicing approach, we can quickly identify the affected program parts with respect to some modifications made to the program. The selected test cases are also found to be very efficient in detecting the regression errors.
The HD (Hierarchical Decomposition) Slicing algorithm is useful for software engineering applications that require computing slices at different program points. Because of its efficiency, very large systems can now be sliced in a very short time, opening new avenues for research. Applications for testing may also benefit from the fast computation time.

11.FUTURE SCOPE
The slicers can be used to develop efficient debuggers and test drivers for large scale object-oriented programs. We can plan to explore this possibility.An investigation into the suitability of the proposed Program Dependency Tree to represent dependences in other object-oriented programs (such as C#) will be studied in future. We also aim to calculate efficiency achieved in regression testing. Meaning, we must know that how much time our slicer saves in regression testing.