| With the increase of the scale and complexity of software,the trend of multi-terminalization and microservice require higher software quality.The quality of core back-end service is more prominent which means white-box testing becomes a necessary refined method to reduce risks.Because of limited time of the testing and the high requirements of whitebox testing on the testers,automated test case generation system is demanded to improve the efficiency and quality of testing.In the field of automated test case generation,genetic algorithms are the most common method in practice.External factors including the genotype-to-phenotype conversion and fitness function by genetic algorithms have a decisive impact on the efficiency,availability and certainty of the test case generation system.The main work of this thesis is to first investigate the research background and related technologies of automatic generation of white-box test cases.Then,with the difficulties of this application being studied,this thesis expounds the solutions and experimental content and results,which based on the automatic use case generation method of genetic algorithm.After all this work,an automatic test case generation system based on search is designed and implemented,which also has been applied into the production environment.Including the functions of scanning the system under test,automatically generating test cases,managing test case information and displaying test cases,the automatic generation of test cases realizes the configuration function of test coverage strategy and the processing of constraint information of tested objects.The system is divided into two parts,one is to automatically generate the test case part,which realizes the configuration function of the test coverage strategy and the processing of the constraint information,enhancing the flexibility and scalability of the application;the other is the test case management part,which manages and shows the test case optimization effect directly reflected by the test case through visual code coverage details.According to the specification of software engineering,this thesis describes the requirement analysis content,the outline design scheme of system architecture,the detailed design content of modules,the realization work of important modules,and the process and result of system test of automatic test case generation system based on search at great length.The main contribution of this thesis is to propose corresponding solutions to the technical difficulties in the generation of white box test cases and to improve the scope and efficiency of the generation process of white-box test cases.Aiming at the difficulties of the encoding and decoding process,this thesis proposes a tree nested reflection scheme to complete the conversion of genotypes-to-phenotypes,and recursively parses and assigns values to the internal field obtained by reflection for composite data types.At the same time,for the difficulties of fitness evaluation,it proposes a bytecode-hot-update method to complete the instrumentation,usees a customized class loader and only compile the needed parts to improve the efficiency of the fitness evaluation.In addition,by sampling the measured classes on the Defect4J dataset and comparing with EvoSuite and Randoop,this thesis verifies the effect of the complex object data type encoding scheme on improving the coverage and the fitness evaluation using local calls and bytecode hot update methods to improve the performance of the algorithm.. |