With the development of the times,the agile development model has been popularized in domestic development teams.More and more development teams have realized the efficiency brought by agile development.Automated testing is a very important part of agile development.It responds to changing requirements by conducting regression tests with automated tests.The use of an automated testing framework can reduce the difficulty and cost of Web UI automation testing,enabling the project to truly implement UI-level automated testing,allowing the team to enjoy the benefits of automated testing.The lottery prediction system is a comprehensive sports lottery platform that provides users with professional and comprehensive lottery information paid reading services,lottery data analysis,user interactive communities and other value-added services.Due to manual testing methods for regression testing can no longer meet the needs of the work.In order to ensure the correctness of the code submitted in the agile project development and the efficiency of the test,a Selenium-based UI automated testing framework was developed.The framework combines the tools of TestNG and Jenkins to implement the following functions:using Feed4TestNG to implement data-driven mode,separating test logic from data,using page object mode to simplify test scripts,and enhancing test script maintenance efficiency;building object map and using external file storage the positioning method and positioning expression of the elements on the tested page to achieve separation of element positioning expression and the program;using HttpClient to achieve the API interface request operation so that meet a variety of test needs;support automatic generation of test data function;support keyword verification and database verification;implement failed test cases automatically rerun to ensure that the use case failures are caused by system functional defects;use Log4j output text execution log and save the failed page screenshots so that testers can quickly locate the error;support output detailed HTML test report and automatic sending of test report mails;supports distributed concurrent testing to reduce test time,while also facilitating compatibility and multithreading testing;realize continuous integration to quickly feedback project quality and other functions.Throughout the project,the author independently completed the design and implementation of the public library module,page object management module,use case management module and execution module.At the same time,the author completed the preparation of 80%test cases for the project.The lottery prediction system automated testing framework has been put into the test work.Through practice,it has been proved that the use of an automated test framework significantly improves the efficiency of test set execution and enables rapid automated regression testing,which can quickly give feedback to the development team on software quality. |