Generating Test Cases for Overloaded Object-Oriented Programs using EGS (Extended General State-charts)

Overloading and polymorphism are two important aspects in object-oriented programming languages. When an class has either of these two specialities and is depicted with a state-chart which characterizes the behaviour of the class, problems arise. Such as different transition arcs are labelled with the same name but may represent similar duties on that state-chart. General state-charts (GS) can be used as patterns to model the overloading and polymorphism aspects of C++ programs. Furthermore, method functions can be mapped to a general state-chart to form an extended general state-chart (EGS). From these, state-transition trees can be generated. Errors, which occurs when overloaded/polymorphism functions are invoked against the wrong object, are hard to detect by state-based testing. This is because the resultant states after executing the messages could be the same as the expected states. In this class (unit) testing paper, we try to use EGS to produce legal and illegal test cases in order to test a class which has overloaded functions. The illegal test cases show all possible misusages of the overloaded functions. Overloading in object-oriented programming languages lets programmers use the same name for different functions in the same scope. However, testers must be concerned that the objects can not receive improper messages. For example, if an object receives messages with wrongly overloaded functions, undetected ambiguous errors could occur. Furthermore, no syntax errors may occur, and even the resultant state of the object may be correct. Therefore such errors can not be detected using state-based testing. The common testing approach is to test a class under test with “correct” test cases, and then to inspect whether the output is correct or not. If the output is incorrect (or unexpected), some errors could still exist in the class. Another method is to test a class with “incorrect” test cases, and if the output looks correct, we can say the class still has errors. Similarly, if an object accepts inappropriate overloaded functions and works, this also suggests errors. A GS is also a state-chart in which a generalized transition arc can represent several transition arcs but only if they have same behaviour. An EGS (refined from a GS) can be used to depict an object class which has overloaded functions. A state-transition tree, generated from the EGS, will

[1]  David J. Robson,et al.  The state-based testing of object-oriented programs , 1993, 1993 Conference on Software Maintenance.

[2]  J. Gerring A case study , 2011, Technology and Society.

[3]  Daniel Hoffman,et al.  A case study in class testing , 1993, CASCON.

[4]  Daniel Hoffman,et al.  Graph-based Class Testing , 1994, Aust. Comput. J..

[5]  Ian M. Mitchell,et al.  An automatic test case generator derived from state-based testing , 1998, Proceedings 1998 Asia Pacific Software Engineering Conference (Cat. No.98EX240).

[6]  Robert C. Martin Designing Object Oriented C++ Applications Using The Booch Method , 1995 .

[7]  D. J. Robson,et al.  State-Based Testing and Inheritance , 1993 .

[8]  Simon Stobart,et al.  A Method for Automatic Class Testing (MACT) Object-Oriented Programs Using A State-based Testing Method , 1997 .

[9]  David J. Robson,et al.  A State-Based Approach to the Testing of Class-Based Programs , 1995, Softw. Concepts Tools.

[10]  David Chenho Kung,et al.  Object state testing for object-oriented programs , 1995, Proceedings Nineteenth Annual International Computer Software and Applications Conference (COMPSAC'95).