Abstract:Due to the polymorphism and other complex characteristics of object-oriented programs, it is difficult to judge the specific types of objects pointed by pointers and references only by static analysis in software unit testing. In order to solve this problem, the abstract memory model of classes is studied, and an operation semantic simulation algorithm of classes is proposed. During path analysis, the scope of the class to which the variable belongs is limited by constructing and updating the abstract memory model. For unit testing, the random testing based on input domain is optimized, and a path based random testing method is proposed to obtain the type set of input variables. Experiments show that the abstract memory model of classes combined with the operation semantic simulation algorithm can effectively extract the constraints related to classes in the path, and the path based random test method can significantly improve the efficiency of testing compared with the input domain based random test method.