Font Size: a A A

Research On Generation Of Web API Functional Test Cases Based On Reinforcement Learning

Posted on:2022-10-15Degree:MasterType:Thesis
Country:ChinaCandidate:J CaoFull Text:PDF
GTID:2518306497972489Subject:Computer Science and Technology
Abstract/Summary:PDF Full Text Request
In order to meet the ever-increasing digital demand,Web applications have penetrated into all areas of life.Web applications are increasingly adopting agile development and Dev Ops.Traditional manual testing methods will encounter many challenges in an agile environment,such as the high cost of writing test cases caused by UI changes;the uncertainty of test case priority leads to test efficiency Low;test data is difficult to manage,etc.In order to meet these challenges,a new testing method in the field of software testing-intelligent testing is proposed.It is a combination of automated testing,machine learning and continuous feedback.Automated testing provides a large amount of historical and real-time test data.The machine learning method continuously learns from the test data and finds system defects through standardized analysis.Intelligent testing methods can help testers improve testing efficiency and reduce software risks,and provide incremental high-quality software in each iteration cycle.Reinforcement learning is an important branch of machine learning.It can accept feedback from the environment to learn environment-related knowledge,and make optimal sequence decisions to achieve the optimal solution.Inspired by the reinforcement learning method,this paper proposes an intelligent test case generation method,which automatically generates Web application API functional test cases based on reinforcement learning.By defining Markov model,reward function,state transition strategy and model update strategy,this method establishes a test agent Xbot for the system under test.Xbot can continue to generate test cases with the highest risk priority at the moment,thus solving the problems of difficulty in writing and maintaining test cases in regression testing,uncertain test priority,high time-consuming and low efficiency of test execution in Web applications.The main work of this paper is as follows:First,we designed and implemented HTTP interface request recording tool Http Collector.Collect real user request data through the Http Collector tool,and extract the API interface of the system under test and the jump relationship between the interfaces to construct the abstract Markov model of the system under test.Second,based on the Q-Learning reinforcement learning method,a test agent Xbot is established,and it can continuously generate test cases with the highest risk priority in the current situation.The test agent Xbot is constructed by defining the state,action and reward function of the reinforcement learning model in the test case generation problem,and then using exploration and exploitation strategies to continuously generate test paths with priority.Assemble the test path and test data to obtain executable API function test cases,automatically execute the test cases and obtain test feedback results,and calculate the reward value to update Xbot according to the three defined reward functions.Third,on a practical Web open source application system,the effectiveness of the intelligent test case generation method proposed in this paper is experimentally verified.The results show that compared with manual test case generation,the method proposed in this paper has a significant improvement in the failure detection ability,test coverage and test efficiency of test cases.In addition,this method has strong scalability and practicability,and meets the testing requirements of Web applications in agile environments.
Keywords/Search Tags:Test Case Generation, Reinforcement Learning, Reward Function, Markov Model
PDF Full Text Request
Related items