Object Orientation adds a level of complexity to testing, whilst frameworks and techniques have to adapt, the encapsulated nature of OO helps to define a finite scope. With minor adaption most methodologies can be adapted to test this technology. Object Orientation also provides opportunities to enhance out testing repertoire.
The concept of Object Orientation binds data and associated methods indo discrete packages or Classes. Consequently these Classes, once instantiated into objects have state. The methods associated with the object instance can assumed to behave differently dependant on the inner state of the object it’s self. Testing frameworks and oracle are required to subscribe to this notion in order to function correctly; Oracles are required to understand the concept of object equivalence, and test harnesses are required to instantiate object instances and set their state prior to exciting individual tests.
Whilst Object Orientation adds the complexity of state, it also adds clearly defined interfaces that lend themselves to testing. Class definitions facilitate the definition for test cases for intra class (unit) testing. Indeed such interfaces make prime candidates for automated testing. Further the encapsulation help to define the scope for testing. Private methods for example can only eve be invoked in a give context, by the object it’s self. With respect to non Object Oriented structural programming, no such constraints exist, consequently tester cannot know all possible uses of a function, particularly in the cases of support libraries.
However subscribing to this notation has benefits; Automated unit testing can be greatly enhanced due to the very nature of object orientation. With tools like JUnit , it is possible for the test harness to automatically inspect class definitions and generate the unit test skeletons for the function described by the object interface definitions.
Stat in particular allows us to focus on new state based testing techniques at the class level, Stat base testing previously would have only been possible for areas of the application that were state machine based of when and overall understanding of a systems state was definable. The structuren nature of object oriented programs and facets such as polymorphism, and encapsulation offer opportunities for further research. (LABICHE, na)
Inspection based methodologies such as Fagan Inspections are not affected by the introduction of object oriented technology, though inspectors are expected to be familiar with the technology and understand its ramifications. Likewise Black box testing is not affected by the introduction of Object Orientation simply because the approach takes the stand point of not knowing anything about the implementation.
The segmented nature of Object Orientation also lends itself to enhanced Test project management and estimation. In a similar fashion to defining finite interfaces, object orientation provides a finite number of discrete classes. The management of test projects, in particular test measurement metrics are greatly enhanced. Rough estimate for test coverage can easily be obtained, and estimates of the number of test cases for unit testing can be directly derived from the code itself.
Whilst object orientation adds the complexity of state, the segmentation provided by clear interfaces and encapsulation assists in the development of finite test cases which is particularly of benefit to test automation. In generally whilst methodologies and frameworks must that these differences in to account, the vast majority of methodologies can still prove effective with minor adaptation.
LABICHE, Y. (na) On Testing Object-Oriented Programs. [online] Available At: http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.31.4545&rep=rep1&type=pdf Accessed:29-3-2009