| The object-oriented programming language provides the features of inheritance,encapsulation,and polymorphism,which improves the reusability,security,and maintainability of the code.It brings great convenience to developers,but also brings certain challenges to software testing.Due to dynamic binding and polymorphism,the executable path of the program has increased sharply,and the relationships between methods and classes have become more complex,which brings great challenges to traditional class testing methods.The object-oriented program has a high reuse rate,which requires strict testing to avoid error propagation.In view of the above problems,this paper proposes a path-based class test method.Based on this model,the following researches are done in this paper:(1)Aiming at the problem of insufficient inter-class testing caused by class inheritance and polymorphism,a class member method control flow graph structure was proposed.First,the abstract representation model of the class is constructed through static analysis,and then the nodes are replaced and extended based on the traditional control flow graph to obtain a control flow structure suitable for object-oriented programs.(2)Aiming at the problem of the sudden increase of executable paths caused by the dynamic binding characteristics of classes,a class member-oriented path generation algorithm was proposed.By splitting a complete path into instantiated subpaths and basic subpaths,the number of paths is streamlined and the problem of path explosion is improved.(3)Aiming at the problem of extracting and solving complex path constraints of object-oriented programs,a path-oriented test case generation algorithm was proposed.The symbolic execution technology was used to complete the member method path analysis.The semantics and constraints of the variables on the path were accurately extracted through abstract memory modeling and introduced.The branch and bound algorithm speeds up the rate of constraint solving.Experiments show that the object-oriented program class test method proposed in this paper effectively improves the adequacy of inter-class testing,reduces unnecessary path selection to a certain extent,and automatically generates effective test cases for class member methods. |