Cross-cycle regression testing method, device, medium and electronic equipment
By automatically modifying the server system time and executing task units, the problems of high labor cost and low accuracy in cross-cycle regression testing in the existing technology are solved, and more efficient and accurate testing is achieved.
Patent Information
- Application Number
- CN202110290825.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-03-18
- Publication Date
- 2025-09-16
- Estimated Expiration
- 2041-03-18
AI Technical Summary
When performing cross-cycle regression testing, existing technologies require manual modification of system time, which increases labor costs and test time, is prone to errors, and reduces test accuracy.
By obtaining the application execution time and execution cycle in the cross-cycle regression test case, the test sequence and time of the target period and task unit are determined, the server system time is automatically modified, and the server system is called to execute the task unit for regression testing.
The time for cross-cycle testing is shortened and the accuracy is improved without the need for manual intervention, which reduces labor cost investment.
Smart Images

Figure CN115114140B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of application business logic testing, and in particular to a method, device, medium and electronic equipment for cross-cycle regression testing. Background Art
[0002] Currently, the business logic of many applications is time-dependent, meaning that the application's business logic exhibits periodic characteristics. For example, the business logic of application A is executed on a weekly basis, the business logic of application B is executed on a monthly basis, and the business logic of application C is executed on a daily (generally referring to workdays) basis. To ensure business continuity for each application in the system, regression testing spanning multiple days, weeks, and months is often required before the system is released. This long-term testing cycle requires completion within a short period of time, requiring coordination across teams and departments and is quite challenging. Currently, testers can complete cross-cycle testing by manually modifying the system time in the test environment. However, modifying the system time in this way increases labor costs and prolongs testing time. Furthermore, errors are prone to occur during the modification, which reduces test accuracy.
[0003] It should be noted that the information disclosed in the above background technology section is only used to enhance the understanding of the background of the present invention, and therefore may include information that does not constitute prior art known to ordinary technicians in this field. Summary of the Invention
[0004] The purpose of the embodiments of the present invention is to provide a method, device, medium and electronic equipment for cross-cycle regression testing, which can at least shorten the duration of cross-cycle testing to a certain extent and improve the accuracy of cross-cycle testing. Moreover, cross-cycle testing in this way does not require manual intervention, thereby reducing the investment in labor costs.
[0005] Other features and advantages of the present invention will become apparent from the following detailed description, or may be learned in part by practice of the present invention.
[0006] According to a first aspect of an embodiment of the present invention, a method for cross-cycle regression testing is provided, which is applied to a test scheduling system, wherein the method comprises: obtaining a cross-cycle regression test case, wherein the cross-cycle regression test case includes execution time and execution cycle of multiple applications, wherein the execution cycle of at least two applications among the multiple applications is different, each application among the multiple applications includes a plurality of task units, and the multiple applications are deployed in a server system; according to the execution time and execution cycle of the multiple applications, a plurality of target time periods are determined, and a test sequence and test time of each of the task units in each target time period are determined; for each target time period, the time of the server system is modified according to the test time, and the server system is called to execute each of the task units in the test sequence, so as to perform regression testing on the cross-cycle regression test case.
[0007] In some embodiments of the present invention, a number of target time periods are determined based on the execution time and execution cycle of the multiple applications, and the test order and test time of each task unit in each target time period are determined, including: determining a minimum execution cycle based on the execution cycle of the multiple applications; determining a number of target time periods based on the execution cycle of the multiple applications and the minimum execution cycle; determining a test order and test time of each task unit in each target time period based on the execution time of the multiple applications and the number of target time periods.
[0008] In some embodiments of the present invention, before modifying the time of the server system according to the test time, the method also includes: obtaining an IP list of the server; and determining, from the IP list of the server, the server IP associated with the identifier of each application in the multiple applications.
[0009] In some embodiments of the present invention, modifying the time of the server system according to the test time includes: modifying the time of the server system corresponding to the server IP according to the test time.
[0010] In some embodiments of the present invention, the task unit includes a head node, a working node, and a tail node; calling the server system to execute each task unit in accordance with the test sequence to perform regression testing on the cross-cycle regression test case includes: calling the server system to execute the head node, the working node, and the tail node in each task unit in sequence in accordance with the test sequence to perform regression testing on the cross-cycle regression test case.
[0011] In some embodiments of the present invention, executing the head node, working node and tail node in each of the task units to perform regression testing on the cross-cycle regression test case includes: executing the head node of the task unit, initializing the data, and using the initialization result as the test environment; executing the working node of the task unit, calling the application service through the interface according to preset parameters, and executing the application service in the test environment, and judging whether the execution result meets the expected result through assertion; executing the tail node of the task unit, cleaning up the tested data; and looping through the above steps to perform regression testing on the cross-cycle regression test case.
[0012] In some embodiments of the present invention, the method further includes: restoring the time of the server system after each of the task units is executed.
[0013] According to a second aspect of an embodiment of the present invention, a device for cross-cycle regression testing is provided, which is applied to a cross-cycle testing platform, and the device includes: a first acquisition module, used to obtain cross-cycle regression test cases, wherein the cross-cycle regression test cases include execution time and execution cycle of multiple applications, wherein the execution cycle of at least two applications among the multiple applications is different, each application among the multiple applications includes a plurality of task units, and the multiple applications are deployed in a server system; a first determination module, used to determine a plurality of target time periods according to the execution time and execution cycle of the multiple applications, and determine the test sequence and test time of each task unit in each target time period; a testing module, used to modify the time of the server system according to the test time for each target time period, and call the server system to execute each task unit in the test sequence to perform regression testing on the cross-cycle regression test cases.
[0014] In some embodiments of the present invention, the above-mentioned first determination module includes: a minimum execution cycle determination module, used to determine the minimum execution cycle based on the execution cycles of the multiple applications; a target time period determination module, used to determine several target time periods based on the execution cycles of the multiple applications and the minimum execution cycle; a test sequence determination module, used to determine the test sequence and test time of each task unit in each target time period based on the execution time of the multiple applications and several target time periods.
[0015] In some embodiments of the present invention, before modifying the time of the server system according to the test time, the device also includes: a second acquisition module for acquiring an IP list of the server; and a second determination module for determining, based on the identifier of each application in the multiple applications, the server IP associated with the identifier of each application from the IP list of the server.
[0016] In some embodiments of the present invention, modifying the time of the server system according to the test time includes: modifying the time of the server system corresponding to the server IP according to the test time.
[0017] In some embodiments of the present invention, the task unit includes a head node, a working node, and a tail node; calling the server system to execute each task unit in accordance with the test sequence to perform regression testing on the cross-cycle regression test case includes: calling the server system to execute the head node, the working node, and the tail node in each task unit in sequence in accordance with the test sequence to perform regression testing on the cross-cycle regression test case.
[0018] In some embodiments of the present invention, executing the head node, working node and tail node in each of the task units to perform regression testing on the cross-cycle regression test case includes: executing the head node of the task unit, initializing the data, and using the initialization result as the test environment; executing the working node of the task unit, calling the application service through the interface according to preset parameters, and executing the application service in the test environment, and judging whether the execution result meets the expected result through assertion; executing the tail node of the task unit, cleaning up the tested data; and looping through the above steps to perform regression testing on the cross-cycle regression test case.
[0019] In some embodiments of the present invention, the device method further includes: a recovery module, which recovers the time of the server system after each of the task units is executed.
[0020] According to a third aspect of an embodiment of the present invention, an electronic device is provided, comprising: one or more processors; a storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the method for cross-cycle regression testing as described in the first aspect of the above embodiment.
[0021] According to a fourth aspect of an embodiment of the present invention, a computer-readable medium is provided, on which a computer program is stored. When the program is executed by a processor, the method for cross-cycle regression testing as described in the first aspect of the above embodiment is implemented.
[0022] The technical solution provided by the embodiment of the present invention may have the following beneficial effects:
[0023] In the technical solutions provided by some embodiments of the present invention, a cross-cycle regression test case is obtained, wherein the cross-cycle regression test case includes the execution time and execution cycle of multiple applications. According to the execution time and execution cycle of the multiple applications, several target time periods are determined, and the test sequence and test time of each task unit in each target time period are determined. For each target time period, the time of the server system is modified according to the test time, and the server system is called to execute each task unit in the test sequence to perform regression testing on the cross-cycle regression test case. This can at least shorten the duration of the cross-cycle test to a certain extent and improve the accuracy of the cross-cycle test. Moreover, cross-cycle testing in this way does not require manual intervention, thereby reducing the investment in labor costs.
[0024] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] The accompanying drawings are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present invention, and together with the specification, are used to explain the principles of the present invention. Obviously, the drawings described below are only some embodiments of the present invention, and those skilled in the art can derive other drawings based on these drawings without inventive effort. In the drawings:
[0026] Figure 1A A schematic diagram showing an exemplary system architecture to which the method or apparatus for cross-cycle regression testing according to an embodiment of the present invention may be applied;
[0027] Figure 1B A schematic diagram schematically shows a business application server according to an embodiment of the present invention;
[0028] Figure 1C Schematically shows a schematic diagram of a cross-cycle test platform according to an embodiment of the present invention;
[0029] Figure 2 A flowchart of a method for cross-cycle regression testing according to an embodiment of the present invention is schematically shown;
[0030] Figure 3 A flowchart of a method for cross-cycle regression testing according to another embodiment of the present invention is schematically shown;
[0031] Figure 4 A flowchart of a method for cross-cycle regression testing according to another embodiment of the present invention is schematically shown;
[0032] Figure 5A flowchart of a method for cross-cycle regression testing according to another embodiment of the present invention is schematically shown;
[0033] Figure 6 A schematic diagram of executing a cross-cycle regression test task according to the present invention is schematically shown;
[0034] Figure 7 A block diagram schematically illustrates an apparatus for cross-cycle regression testing according to an embodiment of the present invention;
[0035] Figure 8 A block diagram schematically illustrates an apparatus for cross-cycle regression testing according to another embodiment of the present invention;
[0036] Figure 9 A block diagram schematically illustrates an apparatus for cross-cycle regression testing according to another embodiment of the present invention;
[0037] Figure 10 A block diagram schematically illustrates an apparatus for cross-cycle regression testing according to another embodiment of the present invention;
[0038] Figure 11 A schematic structural diagram of a computer system suitable for implementing an electronic device according to an embodiment of the present invention is shown. DETAILED DESCRIPTION
[0039] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in many forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this disclosure will be thorough and complete and will fully convey the concepts of the example embodiments to those skilled in the art.
[0040] In addition, the described features, structures or characteristics may be combined in one or more embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present invention. However, it will be appreciated by those skilled in the art that the technical solutions of the present invention can be practiced without one or more of the specific details, or other methods, components, devices, steps, etc. may be adopted. In other cases, known methods, devices, implementations or operations are not shown or described in detail to avoid blurring various aspects of the present invention.
[0041] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically separate entities. That is, these functional entities may be implemented in software, in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.
[0042] The flowcharts shown in the accompanying drawings are for illustrative purposes only and do not necessarily include all contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps may be decomposed, while others may be combined or partially combined. Therefore, the actual execution order may vary depending on the actual situation.
[0043] Figure 1A The diagram shows an exemplary system architecture to which the method or apparatus for cross-cycle regression testing according to an embodiment of the present invention may be applied.
[0044] like Figure 1A As shown, system architecture 100 may include server 101, server 102, server network 103, and server 104. Network 103 is a medium for providing communication links between server 101, server 102, and server 104. Network 103 may include various connection types, such as wired or wireless communication links or fiber optic cables.
[0045] It should be understood that Figure 1A The number of networks and servers in the example is merely illustrative. Any number of networks and servers may be used as needed. For example, a server may be a server cluster consisting of multiple servers.
[0046] Users can use servers 101 and 102 to interact with server 104 via network 103 to receive or send messages, etc. For example, server 104 can obtain cross-cycle regression test cases from servers 101 and 102. The cross-cycle regression test cases include the execution time and execution cycle of multiple applications. Based on the execution time and execution cycle of the multiple applications, several target time periods are determined, and the test sequence and test time of each task unit in each target time period are determined. For each target time period, the server system time is modified according to the test time, and the server system is called to execute each task unit in the test sequence to perform regression testing on the cross-cycle regression test cases. This can at least shorten the duration of the cross-cycle test to a certain extent and improve the accuracy of the cross-cycle test. Moreover, cross-cycle testing in this way does not require manual intervention, thereby reducing the investment in labor costs.
[0047] In some embodiments, the cross-cycle regression testing method provided by the embodiments of the present invention is generally executed by the server 104 . Accordingly, the cross-cycle regression testing apparatus is generally disposed in the server 104 .
[0048] refer to Figure 1B, the business application server 10 includes a server 11 for application A and a server 12 for application B. For example, the server 101 may be the server 11 for application A, and the server 102 may be the server 12 for application B. The server 11 for application A and the server 12 for application B may provide application services and time coordination services, respectively. In this embodiment, the application services and time coordination services provided by the server 11 for application A and the server 12 for application B may be the same as those provided by the server 11 for application A and the server 12 for application B. Figure 1C The cross-cycle test platform 20 in the system interacts to realize the testing of cross-cycle test cases.
[0049] refer to Figure 1C The cross-cycle test platform 20 may include a periodic test group A and a periodic test group B. The cross-cycle test platform 20 may be deployed in the server 104 to interact with the server 11 of application A and the server 12 of application B.
[0050] The number of periodic test groups in this embodiment is merely illustrative. Any number of periodic test groups may be provided as needed. A periodic test group (e.g., periodic test group A or periodic test group B) may include group management, server management, a main control program, and the like. The main program may be used to control the task unit and the time coordinator.
[0051] Specifically, a periodic test group can define a cross-period test case. This same cross-period test case may cover the execution time and execution cycles of multiple applications, where at least two of these applications have different execution cycles and each of these applications includes several task units. Furthermore, the same application service can contain multiple applications, meaning that the same application service may have multiple cross-period test cases.
[0052] Group management can be used to group applications by type. For example, since the same cross-cycle test case can include multiple applications, and multiple teams can develop and maintain multiple applications, groups are used to distinguish tasks between different teams and facilitate independent case management. Each group corresponds to a team, and each group corresponds to a set of task units.
[0053] Server management can be used to manage the IP addresses of application-related servers. For example, the IP addresses of application-related servers can be stored in the server IP list. An application can be deployed on at least one server. Because cross-cycle testing involves modifying the server system time, it is important to ensure that all related applications are using the same server system time. Therefore, before cross-cycle testing, the IP addresses of application-related servers can be added to the server IP list to facilitate centralized modification of the server system time.
[0054] The master control program can be used to control the task units and the time coordinator. For example, before each task unit is triggered, the time coordinator is controlled to modify the server system time based on the execution time and execution cycle of each task unit. For example, based on the execution time and execution cycle of multiple applications, several target time periods are determined. The test sequence and test time of each task unit in each target time period are determined. For each target time period, the server system time is modified based on the test time.
[0055] Task units can include head nodes, working nodes, and tail nodes. The head node is used to initialize the data of each application before cross-cycle testing. The working node is used to call application services through an interface according to preset parameters, execute the application services in the test environment, and determine whether the execution results meet the expected results through assertions. The tail node is used to clear all test data related to applications in different cycles after the cross-cycle test is completed. For example, each team configures a task unit for a cross-cycle test into the above-mentioned main control program. When a cross-cycle test case is started, all task units associated with the cross-cycle test case are first searched, and then the task units are classified into head nodes, working nodes, and tail nodes. The head node is used for data initialization. Then, the working node calls application services through an interface according to preset parameters, executes the application services in the test environment, and determines whether the execution results meet the expected results through assertions. Finally, the tail node is executed to perform data cleanup (such as deleting test data related to applications in different cycles) and restore the system time of each application server. In addition, each working node can be set as a key node or a non-key node. If it is a critical node, if it does not match the expected result after execution, the entire process will stop; if it is a non-critical node, if it does not match the expected result after execution, only the failure information will be recorded and other work nodes will continue to be executed.
[0056] refer to Figure 6 , the above-mentioned main program can be a timeline manager, and all task units are mounted on the timeline in chronological order, called in sequence by the main control program, and complete cross-cycle testing. For example, when the above-mentioned main program executes task unit 1 or task unit 2, it modifies the server system time according to the execution time (1:00 or 15:00) and execution cycle in each task unit, and then executes task pre-setting, task execution, task post-setting, and assertion in sequence according to the modified server system time. In this embodiment, task pre-setting can be used to call data related to the application, task execution can be to test the data at the modified server system time, task post-setting can be used to clear data related to the application, and assertion can be used to judge whether the call meets the expected result after each call of data.
[0057] Figure 2The flowchart of the method for cross-cycle regression testing according to an embodiment of the present invention is schematically shown.
[0058] like Figure 2 As shown, the method for cross-cycle regression testing may include steps S210 to S240.
[0059] In step S210, a cross-cycle regression test case is obtained, where the cross-cycle regression test case includes execution time and execution cycle of multiple applications, wherein the execution cycle of at least two applications among the multiple applications is different, each application in the multiple applications includes several task units, and the multiple applications are deployed in a server system.
[0060] In step S220 , a number of target time periods are determined according to the execution times and execution cycles of the multiple applications, and a test sequence and test time of each task unit in each target time period are determined.
[0061] In step S230, for each target period, the time of the server system is modified according to the test time, and the server system is called to execute each task unit according to the test sequence to perform regression testing on the cross-cycle regression test case.
[0062] The method can obtain a cross-cycle regression test case, wherein the cross-cycle regression test case includes the execution time and execution cycle of multiple applications, and determines a number of target time periods according to the execution time and execution cycle of the multiple applications, and determines the test sequence and test time of each task unit in each target time period. For each target time period, the time of the server system is modified according to the test time, and the server system is called to execute each task unit in the test sequence to perform regression testing on the cross-cycle regression test case. This can at least shorten the duration of the cross-cycle test to a certain extent and improve the accuracy of the cross-cycle test. Moreover, cross-cycle testing in this way does not require manual intervention, which reduces the investment in labor costs.
[0063] In one embodiment of the present invention, the above-mentioned cross-cycle regression test cases may include the execution time and execution cycle of multiple applications, wherein the execution time and execution cycle of multiple applications may include the execution time and execution cycle of different applications and / or the execution time and execution cycle of the same application. For example, multiple applications may be application A with a daily cycle unit, application A with a weekly cycle unit, and application A with a monthly cycle unit. For another example, multiple applications may be application A with a daily cycle unit, application B with a weekly cycle unit, and application C with a monthly cycle unit. For another example, multiple applications may be application A with a daily cycle unit, application A with a weekly cycle unit, application A with a monthly cycle unit, application B with a weekly cycle unit, and application C with a monthly cycle unit.
[0064] In one embodiment of the present invention, the above-mentioned multiple applications include several task units. For example, the task units may include a head node, a working node, and a tail node. The head node is used to initialize the data of each application before the cross-cycle test, thereby providing a test environment. The working node is used to call the application service through the interface according to preset parameters, and execute the application service in the test environment, and determine whether the execution result meets the expected result through assertion. The tail node is used to clear all test data related to applications in different cycles after the cross-cycle test is completed.
[0065] In one embodiment of the present invention, a number of target time periods are determined based on the execution times and execution cycles of multiple applications, and the test order and test time of each task unit within each target time period are determined. For example, a minimum execution cycle is determined based on the execution cycles of multiple applications, and a number of target time periods are determined based on the execution cycles and minimum execution cycle of the multiple applications. Then, a test order and test time of each task unit within each target time period are determined based on the execution times of the multiple applications.
[0066] In one embodiment of the present invention, for each of several target time periods, the server system time is modified according to the test time, and the server system is called to execute each task unit in the test order to perform regression testing on the cross-cycle regression test case. For example, the above-mentioned multiple applications are application A, application B, and application C. The execution cycle of application A is daily, the execution cycle of application B is weekly, and the execution cycle of application C is monthly. The execution time of application A is 8:00 am, the execution time of application B is 11:30 am, and the execution time of application C is 3:00 pm. In this case, the minimum execution cycle is determined to be daily. Based on the execution cycle and the minimum execution cycle of each application, several target time periods can be determined. For example, several target time periods can include 30 target time periods in units of days. Based on the 30 target time periods in units of days and the execution time of each application, the test order and test time of each task unit in the 30 target time periods in units of days are determined. The server system time is modified according to the test time, and the server system is called to execute each task unit in the test order to perform regression testing on the cross-cycle regression test case.
[0067] Figure 3 The flowchart of the method for cross-cycle regression testing according to another embodiment of the present invention is schematically shown.
[0068] like Figure 3 As shown, the above step S220 may specifically include steps S310 to S330.
[0069] In step S310 , a minimum execution cycle is determined according to the execution cycles of the multiple applications.
[0070] In step S320 , a number of target time periods are determined according to the execution cycles of the multiple applications and the minimum execution cycle.
[0071] In step S330 , the test sequence and test time of each task unit in each target time period are determined according to the execution time of the multiple applications and a number of target time periods.
[0072] This method can determine the minimum execution cycle based on the execution cycles of multiple applications, and determine several target time periods based on the execution cycles of multiple applications and the minimum execution cycle. Then, the test sequence and test time of each task unit in each target time period are determined based on the execution time of multiple applications and the several target time periods. The test sequence and test time determined in this way are more accurate and reasonable, which helps to improve the test efficiency subsequently.
[0073] In one embodiment of the present invention, the minimum execution cycle is determined based on the execution cycles of multiple applications. For example, the multiple applications are Application A, Application B, and Application C, and Application A has an execution cycle of days, Application B has an execution cycle of weeks, and Application C has an execution cycle of months. The applications are sorted according to the duration of their execution cycles, and the minimum execution cycle is determined to be one day based on the sorting results.
[0074] In one embodiment of the present invention, a number of target time periods are determined based on the execution cycles and minimum execution cycles of multiple applications. For example, the above-mentioned multiple applications are application A, application B, and application C, the execution cycle of application A is day, the execution cycle of application B is week, and the execution cycle of application C is month. Based on the above situation, the minimum execution cycle is determined to be day. If it is assumed that the current time is 2021.3.8, the target time periods may be 2021.3.8-00:00 to 24:00, 2021.3.9-00:00 to 24:00, 2021.3.10-00:00 to 24:00..., 2021.3.14-00:00 to 24:00, 2021.3.15-00:00 to 24:00, 2021.3 .16 - 00:00 to 24:00..., 2021.3.21 - 00:00 to 24:00, 2021.3.22 - 00:00 to 24:00, 2021.3.23 - 00:00 to 24:00..., 2021.3.28 - 00:00 to 24:00, 2021.3.29 - 00:00 to 24:00, 2021.3.30 - 00:00 to 24:00, ..., 2021.4.4 - 00:00 to 24:00, 2021.4.5 - 00:00 to 24:00, 2021.4.6 - 00:00 to 24:00. In this embodiment, the number of target time periods in the plurality of target time periods can be set according to actual test requirements.
[0075] In one embodiment of the present invention, the test order and test time of each task unit in each target time period are determined based on the execution time of multiple applications and several target time periods. For example, the above multiple applications are application A, application B, and application C. The execution cycle of application A is daily, the execution cycle of application B is weekly, and the execution cycle of application C is monthly. The execution time of application A is 8:00 am, the execution time of application B is 11:30 am, and the execution time of application C is 3:00 pm. Based on the above scheme, several target time periods can be 2021.3.8 - 00:00 to 24:00, 2021.3.9 - 00:00 to 24:00, 2021.3.10-00:00 to 24:00……, 2021.3.14-00:00 to 24:00, 2021.3.15-00:00 to 24:00, 2021.3.16-00:00 to 24:00……, 2021.3.21-00:00 to 24:00, 2021.3.22-00:00 to 24:00, 2021.3.23-00:00 to 24:00……, 2021. 3.28-00:00 to 24:00, 2021.3.29-00:00 to 24:00, 2021.3.30-00:00 to 24:00, ... 2021.4.4-00:00 to 24:00, 2021.4.5-00:00 to 24:00, 2021.4.6-00:00 to 24:00. In this case, the test sequence of each task unit from 2021.3.8-00:00 to 24:00 is determined. The order is to execute the task units of Application A. The test time for the task units of Application A is 8:00 AM on March 8, 2021... The test order for each task unit from 00:00 to midnight on March 14, 2021 is to execute the task units of Application A first, then the task units of Application B. The test time for the task units of Application A is 8:00 AM on March 14, 2021, and the test time for the task units of Application B is 11:30 AM on March 14, 2021. The test order for each task unit from 00:00 to midnight on March 21, 2021 is to execute the task units of Application A first, then the task units of Application B. The test time for the task units of Application A is 8:00 AM on March 21, 2021, and the test time for the task units of Application B is 11:30 AM on March 21, 2021. The test order of each task unit from 00:00 to 24:00 on March 28, 2021 is to execute the task unit of application A first, and then execute the task unit of application B. The test time of the task unit of application A is 8:00 am on March 28, 2021, and the test time of the task unit of application B is 11:30 am on March 14, 2021.The test order of each task unit from 00:00 to 24:00 on April 4, 2021 is to execute the task unit of application A first, and then execute the task unit of application C. The test time of the task unit of application A is 8:00 am on April 4, 2021, and the test time of the task unit of application C is 15:00 pm on April 4, 2021.
[0076] Figure 4 The flowchart of the method for cross-cycle regression testing according to another embodiment of the present invention is schematically shown.
[0077] Before step S230, the method may further include steps S410 and S420. Figure 4 shown.
[0078] In step S410, the IP list of the server is obtained.
[0079] In step S420, based on the identifier of each application in the plurality of applications, a server IP associated with the identifier of each application is determined from the server IP list.
[0080] The method can determine the server IP associated with each application's identification from the server's IP list based on the identification of each application among multiple applications, so as to subsequently modify the server system time based on the server IP associated with each application's identification.
[0081] In one embodiment of the present invention, before the cross-cycle test, the server IP of the application to be tested is added to the IP table of the above server, which facilitates the centralized modification of the server system time.
[0082] In one embodiment of the present invention, modifying the server system time based on the test time includes modifying the server system time corresponding to the server IP address based on the test time. For example, if the test time is the test time of the task unit of application A, the server IP address associated with application A is retrieved from the server IP list based on the identifier of application A, and the server system time corresponding to the server IP address associated with application A is modified based on the test time of the task unit of application A.
[0083] Figure 5 The flowchart of the method for cross-cycle regression testing according to another embodiment of the present invention is schematically shown.
[0084] like Figure 5 As shown, the above-mentioned calling of the server system to execute the head node, working node and tail node in each task unit in sequence according to the test order to perform regression testing on the cross-cycle regression test case may specifically include steps S510 to S540.
[0085] In step S510, the head node of the task unit is executed to initialize the data, and the initialization result is used as the test environment.
[0086] In step S520, the working node of the task unit is executed, the application service is called through the interface according to the preset parameters, and the application service is executed in the test environment, and whether the execution result meets the expected result is determined by assertion.
[0087] In step S530, the tail node of the task unit is executed to clean up the tested data.
[0088] In step S540 , the above steps are executed in a loop to perform regression testing on the cross-cycle regression test case.
[0089] The method can implement application testing at different cycles by looping through steps S510 to S530. For example, assertions can be used to determine whether the current call meets the expected result. This can accurately determine the timing of the next call and avoid erroneous calls, where the next call is triggered before the previous call is completed.
[0090] In one embodiment of the present invention, the head node of the execution task unit initializes data and uses the initialization result as the test environment. For example, application-related data is called through HTTP, Dubbo, or RPC interfaces, and the data is initialized, with the initialization result used as the test environment. In this embodiment, the HTTP, Dubbo, or RPC interface can be a remote interface published by the application service, used to simulate the operation of the production environment system.
[0091] In one embodiment of the present invention, the working node of the execution task unit calls the application service through the interface according to the preset parameters, executes the application service in the above-mentioned test environment, and judges whether the result of this execution meets the expected result by assertion. For example, the preset parameter is the application identifier, and the application service is called through the interface according to the application identifier, and the application service is executed in the above-mentioned test environment, and judges whether the result of this execution meets the expected result by assertion. In this embodiment, in the working node, the business application usually has scheduled task triggers or other system remote calls, etc. The working node simulates the client remote call or scheduled task to drive the overall business process. According to the trigger time set for each working node, the system time of the server is first modified, and then a remote call of the http, dubbo, or rpc interface is initiated. After the task is completed, the time modification and remote call of the next node are continued.
[0092] In one embodiment of the present invention, the above-mentioned assertion method can be triggered after the HTTP interface or RPC interface completes the data call to determine whether the call meets expectations. In addition, the HTTP interface or RPC interface can be a synchronous interface or an asynchronous interface. For example, if it is a synchronous interface, the assertion method is triggered to make a judgment after the interface calls the data. If it is an asynchronous interface, the assertion method is triggered to make a judgment after the interface completes processing the data, and then the next task is triggered to prevent the server system time from being modified before the previous asynchronous task is completed, causing the server system to be abnormal.
[0093] In one embodiment of the present invention, the above-mentioned expected results can be set according to the application of different cycles. For example, the expected results can generally be set to test pass or test fail.
[0094] Based on the aforementioned solution, the method further includes restoring the server system time after each task unit is executed. For example, after a cross-cycle test, all test data related to applications in different cycles is cleared to prevent such test data from occupying server storage space. The server system time is then updated to the current actual time, effectively preventing the server system from mistakenly processing other events based on the application's test time.
[0095] Figure 7 The figure schematically shows a block diagram of an apparatus for cross-cycle regression testing according to an embodiment of the present invention.
[0096] like Figure 7 As shown, the apparatus 200 for cross-cycle regression testing includes a first acquisition module 201 , a first determination module 202 and a testing module 203 .
[0097] Specifically, the first acquisition module 201 is configured to acquire a cross-cycle regression test case. The cross-cycle regression test case includes the execution time and execution cycle of multiple applications, wherein at least two of the multiple applications have different execution cycles, each of the multiple applications includes a plurality of task units, and the multiple applications are deployed in a server system.
[0098] The first determining module 202 is configured to determine a number of target time periods according to the execution times and execution cycles of the multiple applications, and determine a test sequence and test time for each task unit in each target time period.
[0099] The testing module 203 is configured to modify the time of the server system according to the test time for each target period, and call the server system to execute each task unit according to the test sequence to perform regression testing on the cross-cycle regression test case.
[0100] The cross-cycle regression testing device 200 can determine the test time of the application business logic of each current cycle based on the preset test period and the execution time of the application business logic of each cycle, modify the time of the server system based on the test time of the application business logic of each current cycle, and obtain the test time of the application business logic of different cycles in the server system. In the server system, data related to the application business logic of different cycles are called according to the test time of the application business logic of different cycles in the server system, and regression testing is performed on the data. This can at least shorten the duration of the cross-cycle test to a certain extent and improve the accuracy of the cross-cycle test. Moreover, cross-cycle testing in this way does not require manual intervention, which reduces the investment in labor costs.
[0101] According to an embodiment of the present invention, the apparatus 200 for cross-cycle regression testing can be used to implement Figure 2 The embodiment describes a method for cross-cycle regression testing.
[0102] In one embodiment of the present invention, the test module 203 is configured to modify the time of the server system corresponding to the server IP according to the test time.
[0103] In one embodiment of the present invention, the above-mentioned test module 203 is also configured to: call the server system to execute each of the task units in accordance with the test sequence to perform regression testing on the cross-cycle regression test case, including: call the server system to execute the head node, working node and tail node in each of the task units in accordance with the test sequence in order to perform regression testing on the cross-cycle regression test case. Specifically, executing the head node, working node and tail node in each of the task units to perform regression testing on the cross-cycle regression test case includes: executing the head node of the task unit, initializing the data, and using the initialization result as the test environment; executing the working node of the task unit, calling the application service through the interface according to the preset parameters, and executing the application service in the test environment, and judging whether the execution result meets the expected result by assertion; executing the tail node of the task unit, cleaning up the tested data; and looping through the above steps to perform regression testing on the cross-cycle regression test case.
[0104] Figure 8 The figure schematically shows a block diagram of an apparatus for cross-cycle regression testing according to another embodiment of the present invention.
[0105] like Figure 8 As shown, the first determining module 202 may specifically include a minimum execution cycle determining module 202 - 1 , a target time period determining module 202 - 2 and a test sequence determining module 202 - 3 .
[0106] Specifically, the minimum execution period determination module 202 - 1 is configured to determine a minimum execution period according to the execution periods of the multiple applications.
[0107] The target period determination module 202 - 2 is configured to determine a number of target periods according to the execution periods of the multiple applications and the minimum execution period.
[0108] The test sequence determination module 202 - 3 is configured to determine the test sequence and test time of each task unit in each target time period according to the execution time of the multiple applications and a number of target time periods.
[0109] The first determination module 202 can sort the execution time of the application business logic of each cycle in units of days, and obtain the execution order of the application business logic of each cycle in each day, so as to effectively manage the execution time of the application business logic of each cycle, and then determine the daily execution order of the application business logic of each cycle in the preset test segment according to the execution order of the application business logic of each cycle in each day, and determine the test time of the application business logic of each current cycle according to the daily execution order of the application business logic of each cycle in the preset test segment, so as to further improve the testing efficiency.
[0110] According to an embodiment of the present invention, the first determining module 202 can be used to implement Figure 3 The embodiment describes a method for cross-cycle regression testing.
[0111] Figure 9 The figure schematically shows a block diagram of an apparatus for cross-cycle regression testing according to another embodiment of the present invention.
[0112] like Figure 9 As shown, the apparatus 200 for cross-cycle regression testing may further include a second acquisition module 204 and a second determination module 205 .
[0113] Specifically, the second obtaining module 204 is used to obtain the IP list of the server.
[0114] The second determining module 205 is configured to determine, based on the identifier of each application in the plurality of applications, a server IP associated with the identifier of each application from the server IP list.
[0115] The cross-cycle regression test device 200 can determine the IP of the server related to the application business logic of each cycle from the server IP list according to the application business logic of different cycles, so as to modify the time of the server system according to the IP of the server related to the application business logic of each cycle.
[0116] According to an embodiment of the present invention, the apparatus 200 for cross-cycle regression testing can be used to implement Figure 4 The embodiment describes a method for cross-cycle regression testing.
[0117] Figure 10 The figure schematically shows a block diagram of an apparatus for cross-cycle regression testing according to another embodiment of the present invention.
[0118] like Figure 10 As shown, the apparatus 200 for cross-cycle regression testing may further include a recovery module 206 .
[0119] Specifically, the recovery module 206 recovers the time of the server system after each task unit is executed.
[0120] The recovery module 206 can restore the server system time after each task unit has completed execution. For example, after a cross-cycle test, all test data related to applications in different cycles is cleared to prevent such test data from occupying server storage space. The server system time is also updated to the current actual time, effectively preventing the server system from mistakenly processing other events based on the application's test time.
[0121] Since each module of the apparatus 200 for cross-cycle regression testing according to an exemplary embodiment of the present invention can be used to implement the above 2~ Figure 5 The steps of an exemplary embodiment of the method for cross-cycle regression testing are described, so for details not disclosed in the embodiment of the device of the present invention, please refer to the embodiment of the method for cross-cycle regression testing of the present invention described above.
[0122] It is understood that the first acquisition module 201, the first determination module 202, the testing module 203, the minimum execution cycle determination module 202-1, the target period determination module 202-2, the test sequence determination module 202-3, the second acquisition module 204, the second determination module 205, and the recovery module 206 can be implemented in a single module, or any one of these modules can be split into multiple modules. Alternatively, at least part of the functionality of one or more of these modules can be combined with at least part of the functionality of other modules and implemented in a single module. According to an embodiment of the present invention, at least one of the first acquisition module 201, the first determination module 202, the test module 203, the minimum execution cycle determination module 202-1, the target time period determination module 202-2, the test sequence determination module 202-3, the second acquisition module 204, the second determination module 205, and the recovery module 206 can be at least partially implemented as a hardware circuit, such as a field programmable gate array (FPGA), a programmable logic array (PLA), a system on a chip, a system on a substrate, a system on a package, an application-specific integrated circuit (ASIC), or can be implemented in hardware or firmware in any other reasonable way of integrating or packaging circuits, or in an appropriate combination of software, hardware, and firmware. Alternatively, at least one of the first acquisition module 201, the first determination module 202, the testing module 203, the minimum execution cycle determination module 202-1, the target time period determination module 202-2, the test sequence determination module 202-3, the second acquisition module 204, the second determination module 205, and the recovery module 206 can be at least partially implemented as a computer program module, and when the program is run by a computer, the functions of the corresponding module can be executed.
[0123] Reference below Figure 11 , which shows a schematic structural diagram of a computer system 300 of an electronic device suitable for implementing an embodiment of the present invention. Figure 11 The computer system 300 of the electronic device shown is only an example and should not limit the functions and scope of use of the embodiments of the present invention.
[0124] like Figure 11 As shown, the computer system 300 includes a central processing unit (CPU) 301, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 302 or the program loaded from the storage unit 308 to the random access memory (RAM) 303. Various programs and data required for system operation are also stored in the RAM 303. The CPU 301, ROM 302, and RAM 303 are connected to each other via a bus 304. An input / output (I / O) interface 305 is also connected to the bus 304.
[0125] The following components are connected to the I / O interface 305: an input section 306 including a keyboard, a mouse, and the like; an output section 307 including devices such as a cathode ray tube (CRT), a liquid crystal display (LCD), and a speaker; a storage section 308 including a hard disk; and a communication section 309 including a network interface card such as a LAN card or a modem. The communication section 309 performs communication processing via a network such as the Internet. A drive 310 is also connected to the I / O interface 305 as needed. Removable media 311, such as a magnetic disk, an optical disk, a magneto-optical disk, or a semiconductor memory, is installed in the drive 310 as needed, so that computer programs read therefrom can be installed into the storage section 308 as needed.
[0126] In particular, according to an embodiment of the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present invention includes a computer program product comprising a computer program carried on a computer-readable medium, the computer program comprising program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network via the communication section 309 and / or installed from a removable medium 311. When the computer program is executed by the central processing unit (CPU) 301, the above-mentioned functions defined in the system of the present application are performed.
[0127] It should be noted that the computer-readable medium described in the present invention can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of computer-readable storage media can include, but are not limited to, an electrical connection having one or more conductors, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In the present invention, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In the present invention, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. This propagated data signal can take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium that can transmit, propagate, or transport a program for use by or in conjunction with an instruction execution system, apparatus, or device. Program code embodied on a computer-readable medium may be transmitted using any suitable medium, including but not limited to wireless, wireline, optical fiber cable, RF, or any suitable combination thereof.
[0128] The flowcharts and block diagrams in the accompanying drawings illustrate the possible implementation architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present invention. In this regard, each box in the flowchart or block diagram can represent a module, program segment, or a part of code, and the above-mentioned module, program segment, or a part of code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in an order different from that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flowchart, and the combination of boxes in the block diagram or flowchart, can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0129] The units involved in the embodiments of the present invention may be implemented in software or hardware, and the units described may also be provided in a processor. In some cases, the names of these units do not limit the units themselves.
[0130] As another aspect, the present application further provides a computer-readable medium, which may be included in the electronic device described in the above embodiments, or may exist independently without being incorporated into the electronic device. The computer-readable medium carries one or more programs, and when the one or more programs are executed by the electronic device, the electronic device implements the cross-cycle regression testing method described in the above embodiments.
[0131] For example, the electronic device can implement Figure 2 As shown in: In step S210, a cross-cycle regression test case is obtained, and the cross-cycle regression test case includes the execution time and execution cycle of multiple applications, wherein the execution cycle of at least two applications in the multiple applications is different, each application in the multiple applications includes a plurality of task units, and the multiple applications are deployed in a server system. In step S220, a plurality of target time periods are determined based on the execution time and execution cycle of the multiple applications, and the test sequence and test time of each task unit in each target time period are determined. In step S230, for each target time period, the time of the server system is modified according to the test time, and the server system is called to execute each task unit in the test sequence to perform regression testing on the cross-cycle regression test case.
[0132] It should be noted that, although several modules or units of the device for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to an embodiment of the present invention, the features and functions of two or more modules or units described above can be concretized in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided into multiple modules or units to be concretized.
[0133] Through the description of the above embodiments, it is easy for those skilled in the art to understand that the example embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solution according to the embodiments of the present invention can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, and includes a number of instructions to enable a computing device (which can be a personal computer, a server, a touch terminal, or a network device, etc.) to execute the method according to the embodiments of the present invention.
[0134] Other embodiments of the present invention will readily occur to those skilled in the art after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present invention that follow the general principles of the invention and include common knowledge or customary techniques in the art not disclosed herein. The description and examples are to be considered as exemplary only, with the true scope and spirit of the invention being indicated by the following claims.
[0135] It should be understood that the present invention is not limited to the exact construction described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present invention is limited only by the appended claims.
Claims
1. A cross-cycle regression testing method, applied to a cross-cycle testing platform, wherein: The method includes: Obtaining a cross-cycle regression test case, where the cross-cycle regression test case includes execution time and execution cycle of multiple applications, wherein at least two of the multiple applications have different execution cycles, each of the multiple applications includes a plurality of task units, and the multiple applications are deployed in a server system; Determining a number of target time periods according to the execution times and execution cycles of the multiple applications, and determining a test sequence and test time for each of the task units in each target time period; For each target period, modifying the time of the server system according to the test time, and calling the server system to execute each of the task units according to the test sequence, so as to perform regression testing on the cross-cycle regression test case; Determining a plurality of target time periods according to the execution time and execution cycle of the plurality of applications, and determining a test sequence and a test time for each of the task units in each target time period includes: Sorting the plurality of applications according to their execution cycle durations, and determining a minimum execution cycle based on the sorting result; determining a plurality of target time periods according to the execution cycles of the plurality of applications and the minimum execution cycle; According to the execution time of the multiple applications and the target time periods, a test sequence and a test time of each task unit in each target time period are determined.
2. The method according to claim 1, characterized in that Before modifying the time of the server system according to the test time, the method further includes: Get the server's IP list; According to the identification of each application in the plurality of applications, a server IP associated with the identification of each application is determined from the server IP list.
3. The method according to claim 2, characterized in that Modifying the time of the server system according to the test time includes: According to the test time, the time of the server system corresponding to the server IP is modified.
4. The method according to claim 1, wherein The task unit includes a head node, a working node and a tail node; Calling the server system to execute each of the task units in accordance with the test sequence to perform regression testing on the cross-cycle regression test case includes: The server system is called to execute the head node, the working node and the tail node in each of the task units in sequence according to the test sequence, so as to perform regression testing on the cross-cycle regression test case.
5. The method according to claim 4, characterized in that Executing the head node, the working node, and the tail node in each of the task units to perform regression testing on the cross-cycle regression test case includes: Execute the head node of the task unit, initialize the data, and use the initialization result as the test environment; The working node that executes the task unit calls the application service through the interface according to the preset parameters, executes the application service in the test environment, and determines whether the execution result meets the expected result through assertion; Execute the tail node of the task unit and clean up the data after the test; The above steps are executed cyclically to perform regression testing on the cross-cycle regression test case.
6. The method according to any one of claims 1 to 5, characterized in that The method further includes: After each of the task units is completed, the server system is restored.
7. A cross-cycle regression testing device, applied to a cross-cycle testing platform, wherein: The device includes: a first acquisition module, configured to acquire a cross-cycle regression test case, wherein the cross-cycle regression test case includes execution time and execution cycle of multiple applications, wherein at least two of the multiple applications have different execution cycles, each of the multiple applications includes a plurality of task units, and the multiple applications are deployed in a server system; A first determining module is configured to determine a number of target time periods according to the execution time and execution cycle of the plurality of applications, and determine a test order and test time of each of the task units in each target time period; a testing module, configured to modify the time of the server system according to the test time for each target period, and call the server system to execute each task unit according to the test sequence, so as to perform regression testing on the cross-cycle regression test case; The first determination module includes: a minimum execution cycle determination module, a target time period determination module and a test sequence determination module; The minimum execution period determination module is configured to sort the execution periods of the plurality of applications according to their durations, and determine the minimum execution period according to the sorting result; The target period determination module is configured to determine a plurality of target periods according to the execution periods of the plurality of applications and the minimum execution period; The test sequence determination module is used to determine the test sequence and test time of each task unit in each target time period according to the execution time of the multiple applications and a number of target time periods.
8. An electronic device comprising: one or more processors; as well as A storage device is used to store one or more programs, and when the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 6.
9. A computer-readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Service system simulation processing method and device, electronic equipment and storage medium
CN111045932A
Method and device for adjusting system running time, computer equipment and storage medium
CN111078525A
System testing using time compression
US20180024916A1