| With the increasing growth of digital needs in contemporary society,web applications have been closely related to all areas of social life.In order to adapt to the rapidly changing needs of the software industry,the web application development gradually tends to Agile development.API testing,as a key part of web application in Agile development,has many problems.For example,iterative updating of system user interfaces leads to high consumption of API test case writing;redundant test cases and uncertain priority lead to low test efficiency;most of the test data are generated by equivalent class method,which leads to poor test quality due to lack of authenticity.Based on this,we need to design and implement a Web API test case generation system to improve the test efficiency and quality.The main tasks of this thesis are as following:(1)This thesis introduces the research background,significance of this thesis,analyze the requirements of the system,the design of the system architecture and functional modules in detail.The system has four main functional modules.The algorithm of Web API test case generation and test case prioritization are designed in detail.To ensure the authenticity of the test data,the data acquisition function is realized by using the opensource API interface provided by Google browser.(2)For the part of Web API test case generation,firstly,according to the characteristics that Web API test cases are composed of API interface parameters,the automatic generation problem of interface test cases is modeled as TSP problem,then an appropriate calculation method of the shortest path distance is designed and used as the fitness function,and finally genetic operation is introduced to discretize and improve the whale optimization algorithm to solve the TSP problem,so as to realize the automatic generation of test cases.In terms of test case prioritization,the Pareto optimal solution set is introduced to carry out multi-objective prioritization with the average fault detection rate and effective execution time as the optimization objectives.In order to enable the algorithm to quickly find the Pareto optimal solution and improve the diversity of the algorithm,the external elite solution set,differential mutation strategy and elite guidance strategy are introduced to improve the whale optimization algorithm,so as to realize the multi-objective prioritization of test cases.(3)The test results show that the functional modules of the system can operate normally,respond in time,and have reliability,stability and security. |