A regression testing method, device and computing equipment
The modified function code and its function list are automatically determined by the computing device, and the corresponding relationship between functions and test cases is used to select test cases, which solves the problems of low efficiency and easy missed detection of existing regression testing methods, and achieves more efficient and effective regression testing.
Patent Information
- Application Number
- CN202010658744.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-07-09
- Publication Date
- 2025-05-02
- Estimated Expiration
- 2040-07-09
AI Technical Summary
The existing regression testing methods are inefficient and prone to missed testing, which is mainly due to the fact that manually selected test cases are affected by experience and status, resulting in low test effectiveness.
The computing device automatically determines the modified function code and its function list from the code to be tested, and uses the corresponding relationship between the functions corresponding to the first version of the software code and the test case, and selects the corresponding test case for regression testing.
It improves the effectiveness and efficiency of regression testing, avoids the influence of artificial factors, ensures comprehensive coverage of modified functional codes, and reduces missed tests.
Smart Images

Figure CN111831564B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of regression testing, and in particular to a regression testing method, device and computing equipment. Background Art
[0002] Regression testing refers to retesting the modified old code after modifying it to confirm that the modification has not introduced new errors or caused errors in other unmodified code. In the rapid iterative development of software, the continuous release of new software versions makes regression testing more frequent. Therefore, improving the effectiveness and efficiency of regression testing is very meaningful for the release of new software versions.
[0003] In order to improve the efficiency of regression testing, the current method of pre-selecting modified functional codes is mostly adopted, and testers select some test cases to test the modified functional codes. However, since the manual selection of test cases is easily affected by factors such as the experience and status of the testers, the effectiveness of regression testing is low, and it is easy to miss the modified functional codes.
[0004] Therefore, a regression testing method is needed that can improve the effectiveness of regression testing and avoid missed tests while ensuring the efficiency of regression testing, so as to solve the problems existing in the above technical solutions. Summary of the invention
[0005] To this end, the present invention provides a regression testing method, apparatus and computing device to solve or at least alleviate the above problems.
[0006] According to one aspect of the present invention, a regression testing method is provided, which is executed in a computing device, wherein the computing device is in communication with a test case library and a storage device, wherein the test case library includes a plurality of test cases, and the storage device stores a correspondence between functions corresponding to a first version of a software code and the test cases, wherein the method comprises the steps of:
[0007] Acquire a function code of a second version of software code to be tested that is changed relative to the first version of software code, the function code comprising one or more code segments, and the second version is higher than the first version;
[0008] Determine the functions included in each code segment and obtain a function list;
[0009] Based on the correspondence between the functions and the test cases, test cases corresponding to the functions in the function list are selected from the test case library for regression testing.
[0010] Optionally, the method further comprises:
[0011] Based on the results of regression testing, determine whether the selected test cases cover all modified functional codes;
[0012] If not, determining the function codes not covered by the selected test cases from the modified function codes;
[0013] Analyze the functional scenarios corresponding to the uncovered functional codes;
[0014] For the functional scenarios corresponding to the uncovered functional codes, test cases are designed for the uncovered functional codes to perform regression testing and obtain test results.
[0015] Optionally, the method further comprises:
[0016] Determine whether the test result is not less than a preset code coverage rate. If so, the regression test is completed, and the test result is the final regression test result;
[0017] If not, then determine the function codes not covered by all the test cases from the function codes, and perform the step of analyzing the function scenarios corresponding to the function codes not covered.
[0018] Optionally, the method further comprises:
[0019] If the selected test cases cover all functional codes, the test results are obtained after regression testing based on the selected test cases.
[0020] Optionally, the corresponding relationship between the function and the test case corresponding to the first version of the software code is established in the following manner:
[0021] Inserting a stub into the first version of the software code;
[0022] Running all test cases used in regression testing in the first version of the software code after the stub is inserted, and generating a code report corresponding to each test case;
[0023] Determine, according to the code report, a correspondence between the test case and the code segment of the first version of the software code;
[0024] Analyze the code segment through the code analysis tool to obtain the function corresponding to the code segment;
[0025] Based on the function corresponding to the code segment, a corresponding relationship between the test case and the function of the first version of the software code is established;
[0026] Based on the correspondence between the test case and the function of the first version of the software code, the correspondence between the function corresponding to the first version of the software code and the test case is determined.
[0027] Optionally, the functional code of the second version software code to be tested that is changed relative to the first version software code is obtained through a code management tool.
[0028] Optionally, the functions respectively included in each code segment are determined by a code analysis tool.
[0029] Optionally, the method further comprises:
[0030] A correspondence between functions and test cases corresponding to the second version of the software code is established for use in regression testing of the next version of the software code of the second version of the software code.
[0031] Optionally, establishing a correspondence between functions and test cases corresponding to the second version of the software code includes:
[0032] inserting a stub into the second version of the software code;
[0033] Running all test cases used in regression testing in the second version of the software code after the stub is inserted, and generating a code report for each test case;
[0034] Determine, according to the code report, a correspondence between the test case and the code segment of the second version of the software code;
[0035] Analyze the code segment through the code analysis tool to obtain the function corresponding to the code segment;
[0036] Based on the function corresponding to the code segment, establishing a correspondence between the test case and the function of the second version of the software code;
[0037] Based on the correspondence between the test cases and the functions of the second version of the software code, the correspondence between the functions of the second version of the software code and the test cases is determined.
[0038] According to one aspect of the present invention, a regression testing apparatus is provided and executed in a computing device, wherein the computing device is in communication with a test case library and a storage device, wherein the test case library includes a plurality of test cases, and the storage device stores a correspondence between functions corresponding to a first version of a software code and the test cases, wherein the apparatus comprises:
[0039] an acquisition module, through which a function code of a second version of the software code to be tested that is changed relative to the first version of the software code is acquired, the function code including one or more code segments, and the second version is higher than the first version;
[0040] A determination module, through which the functions included in each code segment are determined to obtain a function list;
[0041] A test module selects test cases corresponding to the functions in the function list from the test case library for regression testing based on the test module and the correspondence between the functions and the test cases.
[0042] According to one aspect of the present invention, a computing device is provided, comprising: at least one processor; and a memory storing program instructions, wherein the program instructions are configured to be suitable for being executed by the at least one processor, and the program instructions include instructions for executing the method as described above.
[0043] According to one aspect of the present invention, a readable storage medium storing program instructions is provided. When the program instructions are read and executed by a mobile terminal, the mobile terminal executes the above method.
[0044] According to the technical solution of the present invention, a regression testing method is provided. The method does not require manual assignment of test cases to the modified function code. Instead, the computing device 200 determines the modified function code and the function corresponding to the code segment of the modified function code from the code to be tested, and based on the correspondence between the function corresponding to the first version of the software code and the test case, selects the test case corresponding to the function of the code segment in the test case library for regression testing, so that the selected test case is more in line with the functional scenario corresponding to the modified function code, thereby improving the effectiveness of the regression test. Since there is no need to manually assign test cases to the modified function code, the regression test will not be affected by factors such as the experience and status of the tester, which further improves the effectiveness of the regression test and can effectively avoid the occurrence of missed tests.
[0045] The above description is only an overview of the technical solution of the present invention. In order to more clearly understand the technical means of the present invention, it can be implemented according to the contents of the specification. In order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] To achieve the above and related purposes, certain illustrative aspects are described herein in conjunction with the following description and accompanying drawings, which indicate various ways in which the principles disclosed herein can be practiced, and all aspects and their equivalents are intended to fall within the scope of the claimed subject matter. The above and other purposes, features and advantages of the present disclosure will become more apparent by reading the following detailed description in conjunction with the accompanying drawings. Throughout the present disclosure, the same reference numerals generally refer to the same parts or elements.
[0047] Figure 1 A schematic diagram of a regression testing system 100 according to an embodiment of the present invention is shown;
[0048] Figure 2 A schematic diagram of a computing device 200 according to an embodiment of the present invention is shown;
[0049] Figure 3 A flowchart of a method 300 for establishing a correspondence between functions of a first version of software code and test cases according to an embodiment of the present invention is shown;
[0050] Figure 4 A flowchart of a regression testing method 400 according to an embodiment of the present invention is shown;
[0051] Figure 5 A flowchart of a regression testing method 500 according to another embodiment of the present invention is shown;
[0052] Figure 6 A schematic diagram of a regression testing device 600 according to an embodiment of the present invention is shown. DETAILED DESCRIPTION
[0053] The exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided to enable a more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.
[0054] In the rapid iterative development of software, in order to ensure that the release of a new version of the software will not affect the normal use of users, regression testing is required before the release of the new version of the software to detect whether there are any problems with the updated version. Only after the regression test, the updated version of the software has no problems will the new version of the software be released. Therefore, the effectiveness and efficiency of regression testing are very important for the testing of software update versions.
[0055] In order to improve the effectiveness and efficiency of regression testing, the current method of pre-selecting modified functional codes is mostly adopted, and testers select some test cases to test the modified functional codes. However, since the manual selection of test cases is easily affected by factors such as the experience and status of the testers, the effectiveness of regression testing is low, and it is easy to miss the modified functional codes.
[0056] In order to solve the above problems, the present invention proposes a regression testing system 100. Figure 1 FIG. 1 is a schematic diagram of a regression testing system 100 according to an embodiment of the present invention. Figure 1As shown, the regression test system 100 includes a computing device 200, a storage device 110 and a test case library 120, and the computing device 200 is respectively connected to the storage device 110 and the test case library 120 in communication, for example, through a wired or wireless network connection. The storage device 110 stores the corresponding relationship between the functions of the previous version of the software code (i.e., the first version of the software code) of the second version of the software code to be tested, and in the process of software update iteration, all the codes in the current updated version of the software are used as the second version of the software code to be tested. In addition, the test case library 120 includes multiple test cases.
[0057] In order to solve the problem that the effectiveness of regression testing is low and the modified function code is easily missed due to manual selection of test cases for the modified function code, the computing device 200 determines the modified function code from the second version of the software code to be tested, and determines the functions included in each code segment in the modified function code to obtain a function list. The first version of the software code then selects test cases corresponding to the functions in the function list in the test case library 120 for regression testing based on the correspondence between the functions corresponding to the first version of the software code stored in the storage device 110 and the test cases.
[0058] In the regression test of the present invention, there is no need to manually assign test cases to the modified function code. Instead, the computing device 200 selects test cases corresponding to the functions in the function list for testing based on the function list corresponding to the modified function code and the correspondence between the functions corresponding to the first software version code and the test cases. This makes the selected test cases more consistent with the functional scenarios corresponding to the modified function code, thereby improving the effectiveness of the regression test. In addition, since the regression test will not be affected by factors such as the experience and status of the testers, the effectiveness of the regression test is further improved, and the occurrence of missed tests can also be effectively avoided.
[0059] In one embodiment, the computing device 200 may be implemented as a server, such as an application server, a Web server, etc.; it may also be implemented as a desktop computer, a laptop computer, a processor chip, a tablet computer, etc., but is not limited thereto. The computing device 200 may be connected to the storage device 110 and obtain data stored in the data storage device 110. For example, the computing device 200 may directly read the data in the storage device 110 (when the storage device 110 is a local database of the computing device 200), or may access the Internet via a wired or wireless method and obtain data in the storage device 110 via a data interface.
[0060] In one embodiment, the storage device 110 may be a database. Furthermore, the database may be a relational database, such as MYSQL, SqlServer, ACCESS, etc. The database of the storage device 110 may be a local database residing in the computing device 200, or may be a distributed database such as Hbase, etc., which is set at multiple geographical locations; the storage device 110 may also be a cache, such as a redis cache, etc. In short, the storage device 110 is used to store the correspondence between the functions corresponding to the first version of the software code and the test cases, or to store the correspondence between the functions corresponding to the previous multiple versions of the code to be tested and the test cases. It should be noted that the storage device 110 can also be used to store the correspondence between the functions corresponding to the second version of the software code to be tested and the test cases. The correspondence between the functions corresponding to the second version of the software code to be tested and the test cases is for the next version of the software code of the second version of the software code to be used in regression testing. The present invention does not limit the specific deployment and configuration of the storage device 110.
[0061] The regression testing method of the present invention may be executed in the computing device 200 . Figure 2 FIG. 2 shows a block diagram of a computing device 200 according to an embodiment of the present invention. Figure 2 As shown, in a basic configuration 202, computing device 200 typically includes a system memory 206 and one or more processors 204. A memory bus 208 may be used for communication between processor 204 and system memory 206.
[0062] Depending on the desired configuration, the processor 204 can be any type of processor, including but not limited to: a microprocessor (μP), a microcontroller (μC), a digital information processor (DSP), or any combination thereof. The processor 204 can include one or more levels of cache such as a primary cache 210 and a secondary cache 212, a processor core 214, and registers 216. An example processor core 214 can include an arithmetic logic unit (ALU), a floating point unit (FPU), a digital signal processing core (DSP core), or any combination thereof. An example memory controller 218 can be used with the processor 204, or in some implementations, the memory controller 218 can be an internal part of the processor 204.
[0063] Depending on the desired configuration, the system memory 206 can be any type of memory, including but not limited to: volatile memory (such as RAM), non-volatile memory (such as ROM, flash memory, etc.), or any combination thereof. The system memory 206 may include an operating system 220, one or more applications 222, and program data 224. The application 222 is actually a plurality of program instructions, which are used to instruct the processor 204 to perform corresponding operations. In some embodiments, the application 222 can be arranged to cause the processor 204 to operate using the program data 224 on the operating system.
[0064] The computing device 200 may also include an interface bus 240 that facilitates communication from various interface devices (e.g., output devices 242, peripheral interfaces 244, and communication devices 246) to the basic configuration 202 via the bus / interface controller 230. Example output devices 242 include a graphics processing unit 248 and an audio processing unit 250. They can be configured to facilitate communication with various external devices such as a display or speakers via one or more A / V ports 252. Example peripheral interfaces 244 may include a serial interface controller 254 and a parallel interface controller 256, which may be configured to facilitate communication with external devices such as input devices (e.g., keyboards, mice, pens, voice input devices, touch input devices) or other peripherals (e.g., printers, scanners, etc.) via one or more I / O ports 258. Example communication devices 246 may include a network controller 260, which may be arranged to facilitate communication with one or more other computing devices 262 via a network communication link via one or more communication ports 264.
[0065] A network communication link can be an example of a communication medium. Communication media can generally be embodied as computer-readable instructions, data structures, program modules in a modulated data signal such as a carrier wave or other transmission mechanism, and can include any information delivery medium. A "modulated data signal" can be a signal in which one or more of its data sets or its changes can be carried out in a manner that encodes information in the signal. As non-limiting examples, communication media can include wired media such as a wired network or a dedicated line network, and various wireless media such as sound, radio frequency (RF), microwave, infrared (IR) or other wireless media. The term computer-readable medium used herein can include both storage media and communication media.
[0066] In the computing device 200 according to the present invention, the application 222 includes multiple program instructions for executing the regression testing method 400. These program instructions can instruct the processor 204 to execute the regression testing method 400 of the present invention, so that the computing device 200 can allocate test cases to the modified functional code by executing the regression testing method of the present invention without manually allocating test cases, thereby improving the effectiveness of the regression test and effectively avoiding missed tests.
[0067] Since in the regression testing method 400 of the present invention, the corresponding test case is selected for the function corresponding to the modified functional code through the correspondence between the function corresponding to the first version of the software code and the test case, before executing the regression testing method 400 of the present invention, it is necessary to establish the correspondence between the function corresponding to the first version of the software code and the test case.
[0068] Figure 3 Flowchart of method 300 for establishing a correspondence between a function corresponding to a first version of software code and a test case according to an embodiment of the present invention. The method 300 may be executed in a computing device 200. Figure 3 As shown, the method starts at step S310.
[0069] In step S310, a stub is inserted into the first version of the software code. Program stubs are inserted into the program to ensure the original logical integrity of the tested code. Some code segments for collecting information (the code segments for collecting information are called probes or detectors) are implanted into the program. The code of the code segments is executed to obtain characteristic data of the code running. By analyzing the characteristic data, the logical coverage information of the test case in the code is obtained, so that the relationship between the test case and the code it covers can be obtained by inserting the program.
[0070] In one embodiment of the present invention, the first version of the software code is instrumented by using java's jacoco tool + changing the compilation command without changing the source code, or by using C++'s kcov + changing the compilation command without changing the source code, or by using go's gotest + changing the compilation command without changing the source code.
[0071] After inserting the stubs in the first version of the software code, through step S320, all the test cases used in the regression test are run in the first version of the software code after the insertion, and a code report for the test case is generated. Specifically, in the first version of the software code, all the test cases used in the regression test of the first version of the software code are run. The test case may be one or more. After the test case is executed, the code management tool will generate a code report corresponding to each test case. The code management tool can record all changes to the software, and all code management tools that can achieve the above functions are within the protection scope of the present invention. In one embodiment of the present invention, for example, the Github code management tool is used to record the code logic range covered by the test case in the code report of the test case.
[0072] After the code report of the test case is generated, in step S330, the correspondence between the test case and the code segment of the first version of the software code is determined according to the code report of the test case. Then in step S340, the code segment is analyzed by a code analysis tool to obtain the function corresponding to the code segment.
[0073] Code analysis tools can help people easily browse the key points and starting points of the entire project code, as well as learn the overall framework of the code. Therefore, code analysis tools can be used to obtain the functions corresponding to the code segments. Since there are many code analysis tools, the following will give examples of code analysis tools for different programming languages. For example, if you use C or C++ for programming, you can choose code analysis tools such as BLAST (Berkeley Lazy Abstraction Software verification Tool) and Cpplint; if you use Java for programming, you can choose Checkstyle code analysis tools; if you use JavaScript for programming, you can choose JSHint code analysis tools; if you use Python for programming, you can choose Pylint code analysis tools.
[0074] Then, in step S350, a correspondence between the test case and the function of the first version of the software code is established based on the function corresponding to the code segment. Finally, in step S360, based on the correspondence between the test case and the function of the first version of the software code, the correspondence between the function corresponding to the first version of the software code and the test case is determined and saved in the storage device 110, so that the computing device 200 can select the corresponding test case for the modified functional code during the regression test of the second version of the software code to be tested by obtaining the correspondence between the function and the test case of the first version of the software code from the storage device 110. Next, the regression testing method 400 of the present invention is described in detail in combination with the correspondence between the function and the test case of the first version of the software code that has been obtained.
[0075] Figure 4 FIG. 4 is a flow chart of a regression testing method 400 according to an embodiment of the present invention. The method 400 is executed in a computing device 200. Figure 4 As shown, the method starts at step S410.
[0076] In step S410, the functional code of the second version software code to be tested that has changed relative to the first version software code is obtained. The second version is higher than the first version, which is equivalent to the version of the second version software code to be tested being higher than the version of the first version software code. In one embodiment of the present invention, the functional code of the second version software code to be tested that has changed relative to the first version software code is obtained through a code management tool, and the modified functional code also includes one or more code segments.
[0077] Then, in step S420, the functions included in each code segment are determined to obtain a function list. Further, the function corresponding to each code segment of the modified functional code is determined by a code analysis tool, and a function list is obtained based on the function corresponding to each code segment. Thus, in step S430, based on the correspondence between the function corresponding to the first version of the software code and the test case, the test case corresponding to the function in the function list is selected from the test case library 120 for regression testing, so that the selected test case is more consistent with the function corresponding to the modified functional code, thereby improving the effectiveness of the regression test.
[0078] In addition, in the regression test of the present invention, there is no need to manually assign test cases to the modified functional code. Instead, the computing device 200 selects the test case corresponding to the function based on the function corresponding to the modified functional code and utilizes the correspondence between the function and the test case corresponding to the first version of the software code to perform the test. Therefore, the regression test will not be affected by factors such as the experience and status of the tester, further improving the effectiveness of the regression test and effectively avoiding the occurrence of missed tests.
[0079] Since the test cases selected in the above steps may not completely cover the modified functional code, in order to cover as much modified functional code as possible in the regression test and to better test the updated iterative code (i.e., the second version of the software code), it is necessary to further determine whether the selected test cases cover all modified functional codes based on the results of the regression test.
[0080] If the selected test cases do not cover all modified functional codes, determine the functional codes not covered by the selected test cases from the modified functional codes, analyze the functional scenarios corresponding to the uncovered functional codes, design test cases for the uncovered functional codes based on the functional scenarios corresponding to the uncovered functional codes, and perform regression testing to obtain test results.
[0081] In order to improve the code coverage during the regression testing process, in the present invention, the code coverage in the test results will also be compared with the preset code coverage. If the code coverage in the test results is greater than the preset code coverage, for example, the preset code coverage is 80%, if the code coverage of the test results is 81%, which is greater than the preset code coverage of 80%, the regression test is completed and the obtained test result is the final regression test result.
[0082] However, if the code coverage in the test results is 75%, which is less than the preset code coverage of 80%, the functional code not covered by the selected test cases and the designed test cases is determined from the modified functional code, and the functional scenarios corresponding to the uncovered functional code are continued to be analyzed. For the functional scenarios corresponding to the uncovered functional code, test cases are designed for the uncovered functional code, and regression testing is performed to obtain test results. The code coverage in the test results is continued to be compared with the preset code coverage until the code coverage in the test results is greater than the preset code coverage. The regression test is then completed, and the test result obtained from the last test is the regression test result.
[0083] However, if the selected test case covers all modified functional codes, then in step S430, a test result is obtained after performing regression testing based on the selected test case, which is the final test result of this regression test.
[0084] After the regression test of the second version of the software code to be tested is completed, a correspondence between the functions and test cases corresponding to the second version of the software code to be tested will be established for use by the next version of the second version of the software code during regression testing. The specific steps for establishing a correspondence between the functions and test cases corresponding to the second version of the software code are as follows:
[0085] Insert stubs in the second version of the software code, and run all test cases used in the regression testing of the second version of the software code in the second version of the software code after the stubs are inserted. The test case may be one or more. A code report for each test case is generated by a code management tool. According to the code report of each test case, the correspondence between the test case and the code segment of the second version of the software code is determined. The code segment is then analyzed by a code analysis tool to obtain the function corresponding to the code segment, and based on the function corresponding to the code segment, a correspondence between the test case and the function of the second version of the software code is established. Finally, according to the correspondence between the test case and the function of the second version of the software code, the correspondence between the function of the second version of the software code and the test case is determined, and saved in the storage device 110.
[0086] Therefore, when performing regression testing on the next version of the second version of the software code, the computing device 200 directly assigns test cases corresponding to functional scenarios to the modified code in the next version of the second version of the software code based on the correspondence between the functions and test cases of the second version of the software code stored in the storage device 110, thereby improving the effectiveness of the regression test.
[0087] Figure 5 1 is a flow chart of a regression testing method 500 including a complete working process according to an embodiment of the present invention. The method 500 is executed in a computing device 200. Figure 5 The complete working process of the regression testing method of the present invention is described. The method starts with step S501.
[0088] First, execute step S501 to obtain the function code of the second version of the software code to be tested that has been changed relative to the first version of the software code, continue to execute step S502, determine the functions included in each code segment in the function code based on step S501, obtain a function list, continue to execute step S503, based on the corresponding relationship between the functions corresponding to the first version of the software code stored in the storage device 110 and the test cases, select the test cases corresponding to the functions in the function list determined in step S502 in the test case library 120 for regression testing. Next, execute step S504, based on the result of the regression test, determine whether the selected test cases cover all the modified function codes, if not, execute step S505, determine the function codes not covered by the selected test cases from the modified function codes, continue to execute step S506, analyze the function scenarios corresponding to the uncovered function codes, continue to execute step S507, design test cases for the uncovered function codes for the function scenarios corresponding to the uncovered function codes, and perform regression testing to obtain the test results. Next, step S508 is executed to determine whether the test result is not less than the preset code coverage rate. If so, step S510 is executed to complete the regression test, and the test result is the final regression test result. If not, step S509 is executed to determine the function code not covered by all test cases from the modified function code, and jump to step S506 to continue to execute steps S506 to S510. However, if the selected test case covers all the modified function codes, step S510 is executed to perform regression testing based on the selected test case to obtain the test result.
[0089] Figure 6 A schematic diagram of a regression testing apparatus 600 according to an embodiment of the present invention is shown. The regression testing apparatus 600 is suitable for executing the regression testing method 400 of the present invention. The regression testing apparatus 600 resides in the computing device 200 so that the computing device 200 executes the regression testing method 400 of the present invention.
[0090] like Figure 6 As shown, the regression testing apparatus 600 includes an acquisition module 610 , a determination module 620 and a testing module 630 .
[0091] According to one embodiment, the acquisition module 610 acquires the function code of the second version software code to be tested that is changed relative to the first version software code, wherein the function code includes one or more code segments, and the second version is higher than the first version.
[0092] According to one embodiment, the functions respectively included in each code segment are determined by the determination module 620 to obtain a function list.
[0093] According to one embodiment, based on the test module 630 and the correspondence between functions and test cases, test cases corresponding to the functions in the function list are selected from the test case library for regression testing.
[0094] According to one embodiment, the functional code of the second version software code to be tested that has been changed relative to the first version software code is obtained through the acquisition unit 610, and the functions respectively included in each code segment of the functional code are determined through the determination module 620 to obtain a function list. Finally, based on the test module 630 and the correspondence between the function and the test case, the test case corresponding to the function in the function list is selected from the test case library for regression testing, so that the computing device 200 assigns the modified functional code to the test case that meets the functional scenario, thereby improving the effectiveness of the regression test. At the same time, the regression testing method of the present invention will not be affected by factors such as the experience and status of the tester on the regression test, thereby further improving the effectiveness of the regression test and effectively avoiding the occurrence of missed tests.
[0095] It should be noted that the acquisition module 610 is specifically used to execute the aforementioned step S410, the determination module 620 is specifically used to execute the method of the aforementioned step S420, and the testing module 630 is specifically used to execute the method of the aforementioned step S430.
[0096] A8 The method as described in any one of A1 to 7, further comprising:
[0097] A correspondence between functions and test cases corresponding to the second version of the software code is established for use in regression testing of the next version of the software code of the second version of the software code.
[0098] A9: The method as described in A8, wherein the establishing a correspondence between functions and test cases corresponding to the second version of the software code comprises:
[0099] inserting a stub into the second version of the software code;
[0100] Running all test cases used in regression testing in the second version of the software code after the stub is inserted, and generating a code report for each test case;
[0101] Determine, according to the code report, a correspondence between the test case and the code segment of the second version of the software code;
[0102] Analyze the code segment through the code analysis tool to obtain the function corresponding to the code segment;
[0103] Based on the function corresponding to the code segment, establishing a correspondence between the test case and the function of the second version of the software code;
[0104] Based on the correspondence between the test cases and the functions of the second version of the software code, the correspondence between the functions of the second version of the software code and the test cases is determined.
[0105] The various techniques described herein may be implemented in combination with hardware or software, or a combination thereof. Thus, the method and apparatus of the present invention, or some aspects or parts of the method and apparatus of the present invention may be in the form of program codes (i.e., instructions) embedded in a tangible medium, such as a removable hard disk, a USB flash drive, a floppy disk, a CD-ROM, or any other machine-readable storage medium, wherein when the program is loaded into a machine such as a computer and executed by the machine, the machine becomes a device for practicing the present invention.
[0106] In the case where the program code is executed on a programmable computer, the mobile terminal generally includes a processor, a storage medium readable by the processor (including volatile and non-volatile memory and / or storage elements), at least one input device, and at least one output device. The memory is configured to store the program code; the processor is configured to execute the regression testing method of the present invention according to the instructions in the program code stored in the memory.
[0107] By way of example and not limitation, readable media include readable storage media and communication media. Readable storage media stores information such as computer readable instructions, data structures, program modules or other data. Communication media generally embody computer readable instructions, data structures, program modules or other data in a modulated data signal such as a carrier wave or other transmission mechanism, and include any information transfer medium. Any combination of the above is also included within the scope of readable media.
[0108] In the description provided herein, algorithms and displays are not inherently related to any particular computer, virtual system or other device. Various general purpose systems can also be used together with the examples of the present invention. According to the above description, it is obvious that the structure required for constructing such systems. In addition, the present invention is not directed to any specific programming language either. It should be understood that various programming languages can be utilized to implement the content of the present invention described herein, and the above description of specific languages is for the purpose of disclosing the best mode of the present invention.
[0109] In the description provided herein, a large number of specific details are described. However, it is understood that embodiments of the present invention can be practiced without these specific details. In some instances, well-known methods, structures and techniques are not shown in detail so as not to obscure the understanding of this description.
[0110] Similarly, it should be understood that in order to streamline the present disclosure and aid in understanding one or more of the various inventive aspects, in the above description of exemplary embodiments of the present invention, the various features of the present invention are sometimes grouped together into a single embodiment, figure, or description thereof. However, this disclosed method should not be interpreted as reflecting the following intention: that the claimed invention requires more features than the features explicitly recited in each claim. More specifically, as reflected in the claims below, inventive aspects lie in less than all the features of the individual embodiments disclosed above. Therefore, the claims that follow the specific embodiment are hereby expressly incorporated into the specific embodiment, with each claim itself serving as a separate embodiment of the present invention.
[0111] Those skilled in the art will appreciate that the modules or units or components of the devices in the examples disclosed herein may be arranged in the devices described in the embodiment, or alternatively may be located in one or more devices different from the devices in the examples. The modules in the foregoing examples may be combined into one module or may be divided into multiple submodules.
[0112] Those skilled in the art will appreciate that the modules in the devices in the embodiments may be adaptively changed and arranged in one or more devices different from the embodiments. The modules or units or components in the embodiments may be combined into one module or unit or component, and in addition they may be divided into a plurality of submodules or subunits or subcomponents. Except that at least some of such features and / or processes or units are mutually exclusive, all features disclosed in this specification (including the accompanying claims, abstracts and drawings) and all processes or units of any method or device disclosed in this manner may be combined in any combination. Unless otherwise expressly stated, each feature disclosed in this specification (including the accompanying claims, abstracts and drawings) may be replaced by an alternative feature providing the same, equivalent or similar purpose.
[0113] In addition, those skilled in the art will appreciate that, although some embodiments described herein include certain features included in other embodiments but not other features, the combination of features of different embodiments is meant to be within the scope of the present invention and form different embodiments. For example, in the claims below, any one of the claimed embodiments may be used in any combination.
[0114] In addition, some of the embodiments are described herein as methods or combinations of method elements that can be implemented by a processor of a computer system or by other devices that perform the functions. Therefore, a processor with necessary instructions for implementing the method or method elements forms a device for implementing the method or method elements. In addition, the elements described herein of the device embodiments are examples of devices for implementing the functions performed by the elements for the purpose of implementing the invention.
[0115] As used herein, unless otherwise specified, the use of ordinal numbers "first," "second," "third," etc. to describe common objects merely indicates that different instances of similar objects are involved, and is not intended to imply that the objects so described must have a given order in time, space, order, or in any other manner.
[0116] Although the present invention has been described according to a limited number of embodiments, it will be apparent to those skilled in the art, with the benefit of the above description, that other embodiments may be envisioned within the scope of the invention thus described. In addition, it should be noted that the language used in this specification is selected primarily for readability and teaching purposes, rather than for explaining or defining the subject matter of the present invention. Therefore, many modifications and variations will be apparent to those skilled in the art without departing from the scope and spirit of the appended claims. The disclosure of the present invention is illustrative and not restrictive with respect to the scope of the present invention, and the scope of the present invention is defined by the appended claims.
Claims
1. A regression testing method is executed in a computing device, wherein the computing device is in communication with a test case library and a storage device, wherein the test case library includes a plurality of test cases, and the storage device stores a correspondence between functions corresponding to a first version of a software code and the test cases, wherein the method comprises the steps of: Obtaining a function code of a second version of the software code to be tested that is changed relative to the first version of the software code, wherein the function code includes one or more code segments, and the second version is higher than the first version; Determine the functions included in each code segment and obtain a function list; Based on the correspondence between the first version software code functions and the test cases, selecting the test cases corresponding to the functions in the function list from the test case library for regression testing; Determine whether the test result is not less than the preset code coverage rate. If so, the regression test is completed, and the test result is the final regression test result; If not, determine the functional codes not covered by all test cases from the functional codes, and perform the steps of analyzing the functional scenarios corresponding to the uncovered functional codes; The method further comprises: judging whether the selected test cases cover all modified functional codes according to the result of the regression test; If not, determining the function codes not covered by the selected test cases from the modified function codes; Analyze the functional scenarios corresponding to the uncovered functional codes; Design test cases for the uncovered functional codes according to the functional scenarios corresponding to the uncovered functional codes, perform regression testing, and obtain test results; Compare the code coverage rate in the test results obtained by regression testing the test cases designed for the uncovered functional codes with the preset code coverage rate until the code coverage rate in the test results is greater than the preset code coverage rate. The regression test is completed and the test result obtained by the last test is the regression test result. Establishing a correspondence between functions and test cases corresponding to the second version of the software code for use in regression testing of a next version of the software code of the second version of the software code, including: inserting a stub into the second version of the software code; Running all test cases used in regression testing in the second version of the software code after the stub is inserted, and generating a code report for each test case; Determine, according to the code report, a correspondence between the test case and the code segment of the second version of the software code; Analyze the code segment through the code analysis tool to obtain the function corresponding to the code segment; Based on the function corresponding to the code segment, establishing a correspondence between the test case and the function of the second version of the software code; Based on the correspondence between the test cases and the functions of the second version of the software code, the correspondence between the functions of the second version of the software code and the test cases is determined.
2. The method according to claim 1, further comprising: If the selected test cases cover all functional codes, the test results are obtained after regression testing based on the selected test cases.
3. The method of claim 2, wherein: The corresponding relationship between the functions and test cases corresponding to the first version of the software code is established in the following manner: Inserting a stub into the first version of the software code; Running all test cases used in regression testing in the first version of the software code after the stub is inserted, and generating a code report corresponding to each test case; Determine, according to the code report, a correspondence between the test case and the code segment of the first version of the software code; Analyze the code segment through the code analysis tool to obtain the function corresponding to the code segment; Based on the function corresponding to the code segment, a corresponding relationship between the test case and the function of the first version of the software code is established; Based on the correspondence between the test case and the function of the first version of the software code, the correspondence between the function corresponding to the first version of the software code and the test case is determined.
4. The method according to any one of claims 1 to 3, wherein: The functional code of the second version of the software code to be tested that is changed relative to the first version of the software code is obtained through a code management tool.
5. The method according to any one of claims 1 to 3, wherein: The functions included in each code segment are determined by code analysis tools.
6. A regression testing apparatus, executed in a computing device, the computing device being in communication with a test case library and a storage device, the test case library including a plurality of test cases, the storage device storing a correspondence between functions corresponding to a first version of a software code and the test cases, the apparatus comprising: an acquisition module, through which a function code of a second version of the software code to be tested that is changed relative to the first version of the software code is acquired, the function code including one or more code segments, and the second version is higher than the first version; A determination module, through which the functions included in each code segment are determined to obtain a function list; A first version software code test module, based on the test module and the correspondence between the functions and the test cases, selects test cases corresponding to the functions in the function list from the test case library for regression testing; The regression test device is also adapted to: determine whether the test result is not less than a preset code coverage rate, and if so, complete the regression test, and the test result is the final regression test result; If not, determine the functional codes not covered by all test cases from the functional codes, and perform the steps of analyzing the functional scenarios corresponding to the uncovered functional codes; Based on the results of regression testing, determine whether the selected test cases cover all modified functional codes; If not, determining the function codes not covered by the selected test cases from the modified function codes; Analyze the functional scenarios corresponding to the uncovered functional codes; Design test cases for the uncovered functional codes according to the functional scenarios corresponding to the uncovered functional codes, perform regression testing, and obtain test results; Compare the code coverage rate in the test results obtained by regression testing the test cases designed for the uncovered functional codes with the preset code coverage rate until the code coverage rate in the test results is greater than the preset code coverage rate. The regression test is completed and the test result obtained by the last test is the regression test result. Establishing a correspondence between functions and test cases corresponding to the second version of the software code for use in regression testing of a next version of the software code of the second version of the software code, including: inserting a stub into the second version of the software code; Running all test cases used in regression testing in the second version of the software code after the stub is inserted, and generating a code report for each test case; Determine, according to the code report, a correspondence between the test case and the code segment of the second version of the software code; Analyze the code segment through the code analysis tool to obtain the function corresponding to the code segment; Based on the function corresponding to the code segment, establishing a correspondence between the test case and the function of the second version of the software code; Based on the correspondence between the test cases and the functions of the second version of the software code, the correspondence between the functions of the second version of the software code and the test cases is determined.
7. A computing device comprising: at least one processor; as well as A memory storing program instructions, wherein the program instructions are configured to be executed by the at least one processor, and the program instructions include instructions for executing the method according to any one of claims 1 to 5.
8. A readable storage medium storing program instructions, when the program instructions are read and executed by a mobile terminal, the mobile terminal executes the method according to any one of claims 1 to 5.
Citation Information
Patent Citations
Method and apparatus for determining test case in need of regression testing
CN105302710A
Precision test method, apparatus and computer equipment
CN109240911A
Test case selection method combining static dependence and dynamic execution rules
CN110554954A