Regression classes, there is not much research around

Regression Testing in Object-OrientedprogrammingProblem and Solutions 1.     Abstract Regression testing is an important activityduring the software maintenance phase. It is execution of a set of test casesafter changes are made to the system to make sure that nothing got broken whilemaking changes to the product.

It is important to regression test the productto make sure that the final product is stable and no new bugs are introduced. Sincethe object oriented testing is complex due to inter-dependencies amongst theclasses, there is not much research around it. In this paper we will see theproblems with regression testing in Objected-Oriented programming and the possiblesolutions for them. We will discuss the concept of an ORG diagram to come upwith the relations amongst the classes and also the class firewall to decideupon the dependencies amongst them. 2.     Introduction The Object Oriented programming is becomingpopular these days due to number of advantages offered by them. We should beable to understand some of the OOP’s terms clearly before going into theproblems which testers face while testing them.

We Will Write a Custom Essay Specifically
For You For Only $13.90/page!


order now

First is “Inheritance”, It is amechanism by which the subclass acquires all the properties and behavior of theparent class. Next comes polymorphism, which is a property by which a singleobject can take different forms based on context. Then we have encapsulationwhich deals with hiding the data and method inside the class. The outsideentities do not need to know how the functionality has been implemented insidethen class. Now regression testing in object orientedprogramming needs retesting of affected classes such that all the classes ,directly or indirectly dependent on the changing class are tested again to makesure that there are no negative impact on unchanged classes. This leads to fewproblems that we need to address before starting the testing i) How do weidentify the classes that are affected by the change, ii)  What approach do we take to test the affectedclasses.

 In this paper, we will look at these twoproblems and try to find answers for them. WE will look at different regressionstrategies. We will introduce the concept of an ORG (Object Relations Graph)diagram and Class Firewall , to address the above two problems.  3.     Problems The purpose of Regression testing is toprovide solution to the following problems with the object Oriented programstesting.

i.)             How to identify the affected classes due to change inclasses, variables or modules.ii.)            How to decide the order of testing those classes.iii.

)           How to decide the test coverage criterion for the classesthat need retesting.iv.)           How to reuse the previous test casesIn this paper , we will address  only the first two problems and theirsolutions.4.     Regression TestProcessThe Regression test process has the followingphases-1.     Find the class that is changing in the programThis is the firststep in starting the regression testing planning is to analyze and find theclass that was modified or added in the program.

This is usually easy as thereis enough documentation of the recent update made in the program.2.     Find the classes that are affected by the changingclassThe second step is toidentify the classes that are affected by the change or addition of the newclass in the program. This is difficult as it’s hard to determine therelationships between the complex classes and know what is that which isaffected in the class.3.

     Decide the order in which the classes need to beretested.Once we are doneisolating the affected class, the next step is to find the testing order. Theclasses that are directly affected by the changing  class are tested first followed by classesaffected indirectly.4.     Select the reusable test cases.

Next is filtrationof the already existing test cases, we need to find the existing test caseswhich will be meaningful in the current scenario as well. We can use them forregression testing.5.     New test cases generationFor the newly addedclasses or the changes made, we will need to perform test planning and testdesign to generate new test cases.6.     Test execution/ ReportingThis is the laststep in the regression testing cycle. The selected test cases are executed totest the system as a whole and results are reported.5.

     SolutionThesolution to the problems we discussed are as below:i) How to identify affected classes?The solution to this problem is provide by the ObjectRelations Graph which provides insight to the relationships between different classesin the program. The class firewall for the changed class will enclose all theaffected classes, directly or indirectly.ii) How to decide thetest order of affected classes?The solution to this problem is provided by the firewall.When we create firewall, we can identify the classes which are directlyaffected with the changing class and the classes affected indirectly.

Also forthe indirectly affected classes, we have different levels. Obviously, theclasses that are affected directly, need to be tested first followed by thefirst level of indirectly affected classes followed by second level of indirectclasses.We will discussthese solutions and their components in detail in the coming sections.  6.     Regression Strategy in traditionalsoftware testing Regression strategy provides the tester with the basic guidelines totest the software in a systematic and organized method. There are variousdifferent approaches available like one is based on number of test casesexecuted in the regression test.There can be two ways we can test the software based onnumber of test cases:a)    Re-execute all the test cases and the newly implementedfunctionalityb)    Select the reusable test cases from the test plan andre-execute them along with the newly implemented functionality.It is very costly to execute all the test cases inregression so mostly the second method is preferred where the test engineersfilter the reusable test cases from the test suite and execute them.

–           Fig1 – Regression Test StrategyThe other testingstrategy to test the object-oriented programs are:a.)  Thread-based testing- It combines together all the classesthat are needed to provide output to one set of input of the system. All thethreads are then tested at unit level and are then integrated. b.)  Use-based Testing –  In this approach, the testing begins with theindependent classes that use very few server classes. After these are tested,the dependent classes are tested. The layers of all depending classes aretested till all classes are covered.

But the above mentioned approaches are very costly as they need testingof all the classes and is very time consuming. We will use the concept of testing selected test scenarios fordeveloping the method to cost-effectively test the objected oriented software.The next important piece is to identify what is a change and how to identifyit.

 7.     Identifying Change in traditionalsoftware testing One of the biggest challenge in performing the regression testing isthat its really hard to identify the change in the software. If the change isisolated then it’s possible to really isolate the affected or dependentclasses. This task is tougher if the program is updated by different group ofpeople and testing is performed by a different set of people. The testers maynot know exactly what changed in the program.

Normally, there are three type ofcode changes in the object oriented software. They are listed below:a.)  Data Change – Any update in the definition, access scope ordeclaration of variable is considered a data change.

New data addition isconsidered as data change as well.b.)  Method Change – Any change in the method of the class comesunder method change. There are three sub-categories of the method change basedon type of changes. They are –i) Component Change– Changing a predicate or a local data variable in the method.

ii)Interface change – Changing access scope of the method.iii)ControlStructure Change – Changing the control statements inside methodc.)   Class Change – Change in the class is again divided in threecategories based on the type of changei) Component Change – Changing a method in the classii) Interfacechange – Changing access scope of the class.iii)Relation Change– Changing the relationship with the other classes. Different type of changes have different impact on the system. If thereis a requirement change the it will affect the system design, coding andtesting. If there are implementation changes, then it will affect the testdata, test cases and the test specification.

 8.     Regression Model – Object RelationGraph (ORG)  A ORG displays the relationships between different classes like aggregation,association and inheritance and their objects. This way ORG can be used toidentify the inter- dependency amongst the classes.  Nowto have clear understating of ORG, let’s first understand the differentrelationships that exist between the classes in the object orientedprogramming.

     I.        Inheritance – It is a IS-A type of relationship where achild class is creating using the code from the parent class. Eg: Apple is afruit. Here apple is the child class and fruit is the parent class.    II.

        Composition – It is a part of type of relationship where oneobject is part of anther object instance. Eg: Wheels are part of the car.  III.        Association – In this, the objects of two classes can beshared with each other but can exist independently as well.

Eg – Employee andmanager class.  IV.        Aggregation – It is a special form of association as it isone sided. One class acts as the owner. Eg : Student and address class. Eachstudent will have a address but its not necessary that each address has astudent too. The formal definition of Object Relation Graph according to (Kung, Gao,Hsia & Lin, 1993)  is , “An edgelabeled diagraph G=(V,L,E) is a directed graph, where V=(V1, V2,…..

,Vn} is afinite set of labels andE Í V X V X L is theset of labeled edges.”Let’s try to understand the concept clearly with a diagram.There are three different type of relationships that areshown in the diagram.

They are-i.)             Inheritanceii.)            Associationiii.)           AggregationThere are four different directed edges in the graphcorresponding to a relationship between the joining classes.Car is a super class and vehicle is type of car.

So thisrelation is an inheritance relationship which has been identified with an “I”. Thereis an association relationship between car and person which issingle-directional. A person can be associated with many cars but a car canonly be associated with one person. Fig2-Example Object Relations GraphEngine is a part of car and Tire is a part of car, so these areaggregation type of relationships.9.   Class Firewall  After the change insoftware, it needs retesting at different levels – classes, modules and subsystemsto make sure that nothing is broke.

Since we want cost-effective solutions andalso save the time, only a part of system is retested which is assumed to bemost affected by the change made. In this section we will discuss about theclass firewall which helps to isolate the effect of the change in any class. Weassume that no relations are updated within the classes. By definition, a classfirewall is a set of classes that are affected by change in any class C in theprogram. So if C is changed, then to ensure that system is working perfectly,we will need to test all the classes in the firewall.

Vehicle is a super classof class Car and Car inherits all its features from Vehicle. If Vehicle classis changed, then Car class needs to be retested as it inherits all it’sfeatures from super class Vehicle.The changes made in thesuper class can affected the inherited class in three different ways-i)               The subclass inherits the features of super class thathave been changed.ii)              The subclass access the members of super class which havechanged.iii)             There is no affect of the changing superclass. To derive a class firewall, according to (Kung, Gao, Heis& Chen, 1993), “we need to introduce a binary relation R from ORG =(V,L,E):Where R is the dependence relation as it defines the relationshipbetween classes. In all cases, C1 is dependent on C2 such that any code changesin C2 would affect the behavior of C1.

The computed firewall is asfollows:where R* is the transitiveclosure.  Any relation A on a setY is transitive if, for every a, b, c  in Y, whenever a A b and b A c then aA c. 10.  An example to demonstrate class firewall concept Let’s look at one simple class diagram and understand the differentconcepts introduced. As we can see there are ten classes in the program andthey are related to each other with different relations. The strongestrelationship between the classes is Inheritance followed by aggregation andthen association. The rule says that whichever class in directly linked withthe changing class needs to be re-tested.

For deciding the dependent classes atthe level two,  we need to see the typeof relation they have with other classes in the program. If it’s an inheritanceor an aggregation, then we need to include those classes for re-testing aswell. Lets assume that class C7 changed in the program below.Now we need to find the classes affected by that change. The classes which aredirectly linked to C7 that is C4, C3, C2, C9 and C8 will be retested as theydirectly interact with class C7 which has been modified. At the second level,we need to chek for each of the affected classes at first level, therelationship they have with the classes they are linked further.  Fig3 – Sample Class diagram Indirectly affected classes are C3, C10, C9, C5 and C6.They all will need to be retested to make sure that  no new bug is introduced in the program afterthe code change.

This method of identifying the affected classes from a code change willsave money and time. So it can prove to be very useful in industry.11.  Conclusion In this paper we discussed about the regression concepts and thenapplied them to object oriented software testing. We discussed the mostimportant problem with testing the object oriented program which isidentification of affected class.

We also presented how the Object RelationsGraph helps identifying the relationship and dependencies amongst classes. Alsothe class firewall can be really effective in reducing the number of classes tobe retested after code change.  Also itdecides the test order for the classes that are affected by the change in theprogram.