Method, system and equipment for improving efficiency of automatic regression test
By monitoring the database status and automatically restarting or reinstalling the database, breakpoints continue to run, the problem of inefficient CI automation regression testing is solved, the test cycle is shortened and efficiency is improved, and the rapid iteration needs of complex systems are met.
Patent Information
- Application Number
- CN202411180278.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-27
- Publication Date
- 2024-12-20
AI Technical Summary
Currently, CI automation regression testing is inefficient, especially when the database is down, it is necessary to re-run test cases from scratch, resulting in double testing cycles and it is difficult to support the needs of agile software development. The existing automated testing methods cannot meet the needs of complex testing scenarios.
By monitoring the database status, automatically restarting or reinstalling the database, continuing to run on breakpoints, collecting and saving test environment information to create defect orders, the efficiency of automated regression testing is improved.
It effectively shortens the cycle of database automation regression testing, improves testing efficiency, reduces maintenance costs and error risks, and meets the testing needs of rapid iteration of complex database systems.
Smart Images

Figure CN119166502A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of regression testing, and in particular to a method, system and device for improving the efficiency of automated regression testing. Background Art
[0002] As the complexity and iteration speed of database kernels increase, the number of test cases increases, and the importance of continuous integration (CI) automated regression testing becomes more and more prominent. However, it currently takes 9 hours to complete a round of CI automated testing, and if the database crashes during the execution, the test cases need to be rerun from scratch, causing the CI test cycle to increase exponentially, which is inefficient and difficult to support the demands of agile software development.
[0003] In order to solve the above problems, many companies and development teams have invested a lot of manpower in manual analysis and tried to solve the problem of regression test failure caused by database downtime through manual maintenance, which increased manpower and time costs. Although some automated testing methods currently available on the market have solved the problem of converting manual regression to automated regression to a certain extent, they cannot meet the testing needs of current complex testing scenarios.
[0004] Therefore, how to improve the efficiency of CI regression testing while improving the applicability of CI regression testing in complex testing scenarios and meeting the demands of agile development has become a technical problem that needs to be solved urgently. Summary of the invention
[0005] In view of this, in order to overcome the deficiencies of the prior art, the present invention aims to provide a method, system and device for improving the efficiency of automated regression testing.
[0006] According to a first aspect of the present invention, a method for improving the efficiency of automated regression testing is provided, the method comprising:
[0007] Install and start the database, and execute test cases based on the started database;
[0008] During the execution of test cases, monitor the database status and determine whether the database needs to be reinstalled based on the monitoring results;
[0009] During the execution of the test case, the test environment information is collected and saved, and a defect ticket is created based on the saved test environment information.
[0010] Preferably, in the method for improving the efficiency of automated regression testing of the present invention, installing and starting the database includes: after starting the CI build project, installing and starting the database by calling a database installation and startup script.
[0011] Preferably, in the efficiency improvement method of automated regression testing of the present invention, executing test cases relying on a started database includes: connecting the test cases to the started database, executing the test cases connected to the database, and after the test cases are executed, disconnecting the executed test cases from the started database.
[0012] Preferably, in the method for improving the efficiency of automated regression testing of the present invention, after all tests are executed, a test report is generated according to the execution results.
[0013] Preferably, in the method for improving the efficiency of automated regression testing of the present invention, during the execution of the test case, the database status is monitored, and according to the monitoring result, it is determined whether the database needs to be reinstalled, including:
[0014] By monitoring the database status, the database connection return value is collected, and the database process is judged whether it is normal according to the collected database connection return value;
[0015] When the database process is in normal state, continue to execute the test case;
[0016] When the database process is in an abnormal state, the database is restarted according to the preset restart threshold.
[0017] Preferably, in the method for improving the efficiency of automated regression testing of the present invention, when the database process is in an abnormal state, restarting the database according to a preset restart threshold comprises:
[0018] When the database is successfully restarted according to the preset restart threshold, the test case is connected to the restarted database and the test case is continued to be executed;
[0019] When the database restart fails according to the preset restart threshold, the database is reinstalled. After the database is successfully reinstalled, the test case is connected to the reinstalled database to continue executing the test case.
[0020] Preferably, in the efficiency improvement method of automated regression testing of the present invention, during the execution of test cases, test environment information is collected and saved, and a defect ticket is created based on the saved test environment information, including: when a database process is abnormal, test environment information is collected and saved, and a defect ticket is created based on the saved test environment information.
[0021] Preferably, in the method for improving the efficiency of automated regression testing of the present invention, the test environment information includes database logs, database core files, and test case numbers that cause database process exceptions.
[0022] According to a second aspect of the present invention, there is provided an efficiency improvement system for automated regression testing, the system comprising an efficiency improvement server, the efficiency improvement server being used to: install and start a database, and execute test cases relying on the started database; during the execution of the test cases, monitor the database status, and determine whether the database needs to be reinstalled based on the monitoring results; during the execution of the test cases, collect and save test environment information, and create a defect ticket based on the saved test environment information.
[0023] According to a third aspect of the present invention, a computer device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method described in the first aspect of the present invention when executing the program.
[0024] The efficiency improvement method, system and device of the automated regression test of the present invention effectively shortens the cycle of automated regression testing of the database by classifying and managing test cases, restarting the system after downtime and resuming running from breakpoints, improves the efficiency of automated regression testing, reduces maintenance costs and error risks, and meets the testing requirements for rapid iteration of complex database systems. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0026] Figure 1 This is a diagram showing an example of the architecture of a system for improving the efficiency of automated regression testing according to an embodiment of the present invention;
[0027] Figure 2 A technical principle diagram of a method for improving the efficiency of automated regression testing according to an embodiment of the present invention;
[0028] Figure 3 A schematic diagram of the structure of the device provided by the present invention. DETAILED DESCRIPTION
[0029] The embodiments of the present invention are described in detail below with reference to the accompanying drawings.
[0030] It should be noted that the following embodiments and features in the embodiments may be combined with each other in the absence of conflict; and, based on the embodiments in the present disclosure, all other embodiments obtained by ordinary technicians in the field without making any creative work are within the scope of protection of the present disclosure.
[0031] It should be noted that various aspects of the embodiments within the scope of the appended claims are described below. It should be apparent that the aspects described herein may be embodied in a wide variety of forms, and any specific structure and / or function described herein is merely illustrative. Based on the present disclosure, it should be understood by those skilled in the art that an aspect described herein may be implemented independently of any other aspect, and two or more of these aspects may be combined in various ways. For example, any number of aspects described herein may be used to implement the device and / or practice the method. In addition, other structures and / or functionalities other than one or more of the aspects described herein may be used to implement this device and / or practice this method.
[0032] The technical principles of the present invention are as follows:
[0033] The Python programming language is used to improve test efficiency. Python's concise syntax and powerful built-in functions are used to achieve a highly automated and modular test environment. Python's flexibility and readability make this framework easy to expand and maintain, while allowing for rapid adaptation to changing test requirements. The huge set of regression test cases is divided according to different database compatibility modes through use case classification to solve the problem of frequent switching of compatibility modes during use case execution and improve the efficiency of automated regression testing; in response to database downtime during regression case execution, a database automatic restart module is set up. If the database process crashes due to any reason, the database service can be automatically started to ensure that regression testing continues; in response to database restart failures, the database is automatically installed to ensure that regression testing continues until the test is completed.
[0034] Figure 1 FIG. 1 is an example diagram of the architecture of a system for improving the efficiency of automated regression testing according to an embodiment of the present invention. Figure 1 As shown, the system may include an efficiency improvement server 101, a communication network 102 and / or one or more efficiency improvement clients 103. Figure 1 The example shown is a plurality of efficiency improvement clients 103 .
[0035] The efficiency improvement server 101 can be any appropriate server for storing information, data, programs and / or any other suitable type of content. In some embodiments, the efficiency improvement server 101 can perform appropriate functions. For example, in some embodiments, the efficiency improvement server 101 can be used to improve the efficiency of automated regression testing. As an optional example, the efficiency improvement server 101 can be used to: install and start the database, and execute test cases based on the started database; during the execution of the test case, monitor the database status, and determine whether the database needs to be reinstalled based on the monitoring results; during the execution of the test case, collect and save the test environment information, and create a defect ticket based on the saved test environment information.
[0036] As another example, in some embodiments, the efficiency improvement server 101 may send the efficiency improvement method of the automated regression test to the efficiency improvement client 103 for the user to use according to the request of the efficiency improvement client 103 .
[0037] As an optional example, in some embodiments, the efficiency improvement client 103 is used to provide a visual efficiency improvement interface, which is used to receive a user's selection input operation to improve the efficiency of automated regression testing, and to, in response to the selection input operation, obtain the efficiency improvement interface corresponding to the option selected by the selection input operation from the efficiency improvement server 101 and display the efficiency improvement interface, wherein the efficiency improvement interface at least displays information on improving the efficiency of automated regression testing and operation options for improving the efficiency of automated regression testing.
[0038] In some embodiments, the communication network 102 can be any suitable combination of one or more wired and / or wireless networks. For example, the communication network 102 can include any one or more of the following: the Internet, an intranet, a wide area network (WAN), a local area network (LAN), a wireless network, a digital subscriber line (DSL) network, a frame relay network, an asynchronous transfer mode (ATM) network, a virtual private network (VPN), and / or any other suitable communication network. The efficiency improvement client 103 can be connected to the communication network 102 via one or more communication links (e.g., communication link 104), and the communication network 102 can be linked to the efficiency improvement server 101 via one or more communication links (e.g., communication link 105). The communication link can be any communication link suitable for transmitting data between the efficiency improvement client 103 and the efficiency improvement server 101, such as a network link, a dial-up link, a wireless link, a hard-wired link, any other suitable communication link, or any suitable combination of such links.
[0039] The efficiency-enhancing client 103 may include any one or more clients that present an interface related to improving the efficiency of automated regression testing in an appropriate form for use and operation by a user. In some embodiments, the efficiency-enhancing client 103 may include any suitable type of device. For example, in some embodiments, the efficiency-enhancing client 103 may include a mobile device, a tablet computer, a laptop computer, a desktop computer, and / or any other suitable type of client device.
[0040] Although the efficiency improvement server 101 is illustrated as one device, in some embodiments, any appropriate number of devices may be used to perform the functions performed by the efficiency improvement server 101. For example, in some embodiments, multiple devices may be used to implement the functions performed by the efficiency improvement server 101. Alternatively, a cloud service may be used to implement the functions of the efficiency improvement server 101.
[0041] Based on the above system, an embodiment of the present invention provides a method for improving the efficiency of automated regression testing, which is described below through the following embodiments.
[0042] Figure 2 FIG. 1 is a technical schematic diagram of a method for improving the efficiency of automated regression testing according to an embodiment of the present invention. Figure 2 As shown, the efficiency improvement method of the automated regression test of this embodiment can be executed on the efficiency improvement server. The efficiency improvement method of the automated regression test is implemented in the following manner:
[0043] The method of this embodiment installs and starts a database, and executes test cases based on the started database.
[0044] As an optional example, after starting the CI build project, the method of this embodiment installs and starts the database by calling the database installation and startup script. After starting the database, the test case is connected to the started database, and the test case connected to the database is executed. After the test case is executed, the completed test case is disconnected from the started database. When all test cases are executed, a test report is generated according to the execution results. In actual applications, the generated test report is given to the tester for analysis.
[0045] It should be noted that in the method of this embodiment, during the execution of the test case, the database status is monitored, and whether the database needs to be reinstalled is determined based on the monitoring results.
[0046] As an optional example, the database connection return value is collected by monitoring the database status, and whether the database process is normal is determined based on the collected database connection return value; when the database process is in a normal state, the test case continues to be executed; when the database process is in an abnormal state, the database is restarted according to the preset restart threshold.
[0047] It should be noted that in the method of this embodiment, when the database is successfully restarted according to the preset restart threshold, the test case is connected to the restarted database and the test case is continued to be executed; when the database is restarted according to the preset restart threshold, the database is reinstalled, and after the database is successfully reinstalled, the test case is connected to the reinstalled database and the test case is continued to be executed. For example, the preset restart threshold is 3, and when the restart fails 3 times, the database is reinstalled.
[0048] In the method of this embodiment, during the execution of the test case, the test environment information is collected and saved, and a defect ticket is created based on the saved test environment information.
[0049] During the entire CI execution process, if the database process cannot be connected, it means that the database has crashed. The database log and core files should be backed up, and the test case number that caused the crash should be recorded. The tester should submit a defect ticket to follow up on the defect handling.
[0050] As an optional example, when a database process is abnormal, test environment information is collected and saved, and a defect ticket is created based on the saved test environment information, wherein the test environment information includes database logs, database core files, and the test case number that caused the database process abnormality. In actual applications, those skilled in the art may select other test environment information according to actual application scenarios when implementing the method of this embodiment, and this embodiment does not limit this.
[0051] The method and system for improving the efficiency of automated regression testing according to the embodiments of the present invention effectively shorten the cycle of automated regression testing of databases, improve the efficiency of automated regression testing, reduce maintenance costs and error risks, and meet the testing requirements for rapid iteration of complex database systems by classifying and managing test cases, restarting after downtime, and resuming running from breakpoints.
[0052] like Figure 3 As shown, the present invention further provides a device, including a processor 310, a communication interface 320, a memory 330 for storing a computer program executable by the processor, and a communication bus 340. The processor 310, the communication interface 320, and the memory 330 communicate with each other through the communication bus 340. The processor 310 implements the above-mentioned method for improving the efficiency of automated regression testing by running the executable computer program.
[0053] Among them, the computer program in the memory 330 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.
[0054] The system embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, i.e., they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected based on actual needs to achieve the purpose of the solution of this embodiment. Those of ordinary skill in the art may understand and implement it without creative effort.
[0055] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods of each embodiment or some parts of the embodiment.
[0056] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed by the present invention should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.
Claims
1. A method for improving the efficiency of automated regression testing, characterized in that: The method comprises: installing and starting a database, and executing test cases depending on the started database; During the execution of test cases, monitor the database status and determine whether the database needs to be reinstalled based on the monitoring results; During the execution of the test case, the test environment information is collected and saved, and a defect ticket is created based on the saved test environment information.
2. The method for improving the efficiency of automated regression testing according to claim 1, characterized in that: Install and start the database, including: after starting the CI build project, install and start the database by calling the database installation and startup scripts.
3. The method for improving the efficiency of automated regression testing according to claim 1, characterized in that: Executing test cases that rely on a started database includes: connecting the test cases to the started database, executing the test cases connected to the database, and after the test cases are executed, disconnecting the executed test cases from the started database.
4. The method for improving the efficiency of automated regression testing according to claim 1, characterized in that: When all tests are executed, a test report is generated based on the execution results.
5. The method for improving the efficiency of automated regression testing according to claim 1, characterized in that: During the execution of the test case, monitor the database status and determine whether the database needs to be reinstalled based on the monitoring results, including: By monitoring the database status, the database connection return value is collected, and the database process is judged whether it is normal according to the collected database connection return value; When the database process is in normal state, continue to execute the test case; When the database process is in an abnormal state, the database is restarted according to the preset restart threshold.
6. The method for improving the efficiency of automated regression testing according to claim 5, characterized in that: When the database process is in an abnormal state, the database is restarted according to the preset restart threshold, including: When the database is successfully restarted according to the preset restart threshold, the test case is connected to the restarted database and the test case is continued to be executed; When the database restart fails according to the preset restart threshold, the database is reinstalled. After the database is successfully reinstalled, the test case is connected to the reinstalled database to continue executing the test case.
7. The method for improving the efficiency of automated regression testing according to claim 1, characterized in that: During the execution of the test case, the test environment information is collected and saved, and a defect ticket is created based on the saved test environment information, including: when the database process is abnormal, the test environment information is collected and saved, and a defect ticket is created based on the saved test environment information.
8. The method for improving the efficiency of automated regression testing according to claim 7, characterized in that: The test environment information includes database logs, database core files, and the test case number that caused the database process exception.
9. An efficiency improvement system for automated regression testing, characterized in that: The system includes an efficiency improvement server, which is used to: install and start the database, and execute test cases based on the started database; during the execution of the test cases, monitor the database status, and determine whether the database needs to be reinstalled based on the monitoring results; during the execution of the test cases, collect and save the test environment information, and create a defect ticket based on the saved test environment information.
10. A computer device, characterized in that: The computer device comprises a memory, a processor and a computer program stored in the memory and executable on the processor, and the processor implements the steps of the method according to any one of claims 1 to 8 when executing the program.
