Software test platform for improving coverage rate precision
By recording code running trajectory and analyzing coverage data on the software test platform, accurately identifying functions and use cases that need to be tested, solving the problems of low coverage and low testing efficiency in traditional testing work, and achieving more efficient and accurate software testing.
Patent Information
- Application Number
- CN202411535704.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-31
- Publication Date
- 2025-03-14
AI Technical Summary
Traditional software testing work is subjective in human testing and maintenance pressure in automated testing, resulting in low coverage, low testing efficiency and frequent bugs.
It provides an accurate software testing platform for improving coverage, which can record code running trajectories, analyze code coverage data, determine the executed code lines, trace the functions and use cases that need to be tested, generate coverage reports, and optimize the scope and accuracy of automated tests.
It realizes more accurately identifying the scope of use cases that need to be regressed to tests, improves the coverage and accuracy of tests, reduces test risks, improves the synergistic efficiency of development and testing, and optimizes automated testing.
Smart Images

Figure CN119621541A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data processing, and in particular to a precise software testing platform with improved coverage. Background Art
[0002] In the traditional testing field, testing is performed by automated testing and manual testing. However, due to the drawbacks of each method, the testing work has become a burden.
[0003] In terms of human testing, it is too influenced by subjective human factors. Each time a version is released, testers rely entirely on their personal experience to determine the scope of impact of the change on the system. Usually, either the test scope is too small, resulting in missed tests, or the test scope is too large, the cost is too high, resulting in delayed delivery.
[0004] Compared with manual testing, automated testing can avoid the drawbacks of manual testing. However, with the continuous iteration of software, the number of automated use cases will accumulate more and more, from hundreds to tens of thousands. At this time, due to the need to pay attention to test stability, running time, and a large number of repeated test scenarios and codes, the overall test return rate does not increase with the increase in the number of use cases. Instead, maintenance and troubleshooting become a burden on the daily work of testers. They are overwhelmed and have no energy to invest their time in more useful exploratory testing and analysis work, which leads to frequent bugs. Summary of the invention
[0005] The purpose of the present invention is to provide a software testing platform with improved coverage, so as to solve the above problems.
[0006] In order to achieve the above object, the present invention provides the following technical solutions:
[0007] A software testing platform for improving coverage and accuracy, comprising:
[0008] S01. Record the code running track when executing the test to obtain a code coverage data set;
[0009] S02, performing cleaning and sorting based on the acquired code coverage data set to obtain code lines of the code coverage data set;
[0010] S03, analyzing the obtained code lines to determine whether they have been executed, and if so, tracing back through the code lines to obtain functions and use cases that need to be tested;
[0011] S04. Generate coverage reports and provide feedback based on the functions and use cases that need to be tested.
[0012] Preferably, the code base for executing the test is further included, and the code running track recorded in step S01 when executing the test includes:
[0013] S11, performing a quick scan based on the code base to obtain code that is different from the code base and is covered by the test;
[0014] S12, sorting the original code in the code library and the covered code to obtain a first code data set;
[0015] S13, sorting the codes in the code base that are not covered by the test to obtain a second-generation code data set, and generating test cases based on the second-generation code data set;
[0016] The code coverage data set includes a first code data set.
[0017] Preferably, the code line obtained in step S02 can be associated with each code block, method and class, and the test case associated therewith can be obtained through the method and class to obtain the test case corresponding to the code line.
[0018] Preferably, the execution recording of the code running track when executing the test in S01 includes two execution modes: automatic recording and manual selection.
[0019] Preferably, the coverage report generated in step S04 includes charts and key indicators to help understand the effect of test coverage.
[0020] Preferably, the coverage report generated in step S04 further comprises generating different test combination results based on the covered code lines according to the obtained functions and use cases that need to be tested.
[0021] Preferably, the method further includes recording the code coverage data set, code lines, and functions and use cases that need to be tested obtained after the test in step S01 is executed, so as to generate a historical record stored by a timestamp.
[0022] Preferably, multiple users are allowed to execute step S01 simultaneously.
[0023] In the above technical solution, the present invention provides a coverage-enhanced accurate software testing platform, which has the following beneficial effects:
[0024] 1. By identifying the changed code and obtaining the changed program, precise testing can more accurately define the scope of use cases that require regression testing.
[0025] 2. Provide test measurement results based on the changed program or call chain dimension to determine whether the changed program code of this test is fully covered, thereby helping the tester to more accurately assess the test risk and form the test output standard.
[0026] 3. When executing test cases, accurate testing is performed on failed cases, thereby providing a visual call relationship to help testers quickly locate problems and improve the collaborative efficiency of development and testing.
[0027] 4. By introducing automation and connecting with existing automated testing platforms, relationships are established during the automated testing process to further optimize the scope and accuracy of automated testing. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present invention. For ordinary technicians in this field, other drawings can also be obtained based on these drawings.
[0029] Figure 1 A schematic diagram of an embodiment of the present invention;
[0030] Figure 2 A flowchart provided for an embodiment of the present invention. DETAILED DESCRIPTION
[0031] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0032] like Figure 1 and Figure 2 As shown, a coverage-enhanced accurate software testing platform comprises:
[0033] S01. Record the code running track when executing the test (including automatic recording and manual selection of two execution modes) to obtain a code coverage data set;
[0034] S02, performing cleaning and sorting based on the acquired code coverage data set to obtain code lines of the code coverage data set;
[0035] S03. Analyze the obtained code lines to determine whether they have been executed. If they have been executed, trace back through the code lines to obtain the functions and use cases that need to be tested;
[0036] S04. Generate coverage reports and provide feedback based on the functions and use cases that need to be tested.
[0037] Specifically, step S01 in the above embodiment allows multiple users to execute simultaneously, and is displayed on the client in the form of a list showing a list of all current test items. Users can view the basic information of each item, that is, the header item name, status, test progress, etc. of the list.
[0038] Furthermore, the above test method allows users to create, edit, delete and manage test cases and automated test cases during execution. Users can import and adjust test cases and automated test cases for different test projects. And users can search, filter and reuse test cases in the library. Search and filter include code library and historical records, while the test cases in the reuse library are "generating test cases based on the second-generation code data set" and "storing the code library for executing test applications."
[0039] In the above technology, by identifying the changed code and obtaining the changed program, precise testing can more accurately define the scope of use cases that require regression testing. And based on the changed program or call chain dimension, test measurement results are provided to determine whether the changed program code of this test is fully covered, thereby helping the tester to more accurately assess the test risk and form a test output standard. Secondly, when the test case is executed, precise testing targets the failed case, thereby providing a visual call relationship, helping the tester to quickly locate the problem and improve the collaborative efficiency of development testing. Furthermore, by introducing automation and docking with the existing automated testing platform, relationships are established during the automated testing process to further optimize the scope and accuracy of automated testing.
[0040] Embodiment 2
[0041] The code running trace recorded in step S01 of the first embodiment includes:
[0042] S11. Perform a quick scan based on the code base to obtain code that is different from the code base and is covered by the test;
[0043] S12, sorting the original code and the covered code in the code library to obtain a first code data set;
[0044] S13, sorting out the codes in the code base that are not covered by the test to obtain a second-generation code data set, and generating test cases based on the second-generation code data set;
[0045] The code coverage data set includes a first code data set.
[0046] Specifically, by quickly scanning the code base, you can identify which parts of the code are not covered by the current test cases. This helps to find blind spots in test coverage and ensure that all code paths are properly tested. Quick scanning can greatly improve the efficiency of code analysis, especially when the code base is large, and can quickly locate parts that need further testing. By organizing the covered code into a first code data set, it can be clear which code has been covered by test cases. This helps to evaluate the comprehensiveness and effectiveness of the test. By organizing the uncovered code (the second code data set), it can be clear which code has not been tested, which is a key step in discovering potential risks and untested logic. Generating new test cases based on uncovered code can fill the gaps in test coverage and ensure that all code paths are properly tested.
[0047] Embodiment 3
[0048] The code lines obtained in step S02 according to the first embodiment described above can be associated with each code block, method and class, and the test cases associated therewith can be obtained through the methods and classes to obtain the test cases of the corresponding code lines.
[0049] Specifically, the system can accurately know whether each line of code has been executed based on the coverage data. Each line of code can be associated with each code block, method and class, and this method and class will also be associated with the corresponding test case. By establishing a binding relationship from code to use case, we can perform two-way traceability. Once the developer modifies the code, it can be traced back to the corresponding test case through the link, thereby helping testers to effectively shorten the test scope and accurately find the functions and use cases that need to be tested.
[0050] Embodiment 4
[0051] The coverage report generated in step S04 of the first embodiment includes charts and key indicators to help understand the effect of test coverage.
[0052] Secondly, the coverage report generated in step S04 also includes generating different test combination results based on the covered code lines according to the obtained functions and use cases that need to be tested.
[0053] Specifically, the data and charts in the coverage report can clearly reflect which functions or lines of code have been tested and which have not been tested, thereby helping the team to objectively evaluate the effectiveness of the current test. By analyzing the report, the team can identify weaknesses in the test and make improvements in the subsequent development and testing process to ensure that all important functions are reasonably tested.
[0054] Secondly, the different test combination results generated in the report are based on the covered code lines, which means that the test cases are not just simple repeated tests, but form a combination covering different scenarios and paths. This can help identify potential problems and vulnerabilities. By creating combined tests based on different code lines, you can ensure that different code paths and boundary conditions are tested, thereby increasing the chances of discovering problems and improving the reliability of the code.
[0055] Embodiment 5
[0056] Based on the above embodiment 1, it also includes recording the code coverage data set, code lines, and functions and use cases that need to be tested obtained after the test in step S01 is executed, so as to generate a historical record stored by a timestamp.
[0057] Specifically, recording the code coverage data set means that each time the test is executed, the corresponding coverage data will be stored. This data can be used to track changes in code coverage over time, reflecting the effectiveness of test strategies and practices. And the history allows the team to conduct comparative analysis of coverage at different time points, thereby identifying optimization points and areas for improvement. Secondly, recording the code lines and related test functions and use cases in detail provides a comprehensive view of the testing process. This is very important for future review, verification and debugging.
[0058] Furthermore, storing historical records with timestamps means that each test coverage result is associated with the specific execution time. Such time series data provides a clear timeline, making it easier for the team to understand the historical evolution of test coverage.
[0059] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0060] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0061] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0062] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0063] The present invention uses specific embodiments to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for those skilled in the art, according to the idea of the present invention, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.
[0064] The embodiments of the present application also provide a specific implementation of an electronic device capable of implementing all steps of the method in the above embodiments, and the electronic device specifically includes the following contents:
[0065] Processor, memory, communications interface and bus;
[0066] Wherein, the processor, memory, and communication interface communicate with each other via the bus;
[0067] The processor is used to call the computer program in the memory, and when the processor executes the computer program, all the steps in the method in the above embodiment are implemented.
[0068] The embodiments of the present application also provide a computer-readable storage medium capable of implementing all the steps of the method in the above embodiments, wherein a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, all the steps of the method in the above embodiments are implemented.
[0069] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the hardware + program embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment. Although the embodiment of this specification provides the method operation steps described in the embodiment or flow chart, more or less operation steps can be included based on conventional or non-creative means. The order of steps listed in the embodiment is only one way of executing the order of many steps, and does not represent the only execution order. When the device or terminal product in practice is executed, it can be executed in sequence or in parallel according to the method shown in the embodiment or the accompanying drawings (for example, a parallel processor or a multi-threaded processing environment, or even a distributed data processing environment). The term "include", "include" or any other variant thereof is intended to cover non-exclusive inclusion, so that the process, method, product or device including a series of elements includes not only those elements, but also includes other elements that are not explicitly listed, or also includes elements inherent to such a process, method, product or device. In the absence of more restrictions, it is not excluded that there are other identical or equivalent elements in the process, method, product or device including the elements. For the convenience of description, the above device is described by dividing it into various modules according to its functions. Of course, when implementing the embodiments of this specification, the functions of each module can be implemented in the same one or more software and / or hardware, or the module implementing the same function can be implemented by a combination of multiple sub-modules or sub-units. The device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the coupling or direct coupling or communication connection between each other shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms. The present invention is described with reference to the flowchart and / or block diagram of the method, device (system) and computer program product according to the embodiments of the present invention. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the process and / or box in the flowchart and / or block diagram can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the process Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0070] Those skilled in the art will appreciate that the embodiments of this specification may be provided as methods, systems or computer program products. Therefore, the embodiments of this specification may be in the form of a complete hardware embodiment, a complete software embodiment or an embodiment combining software and hardware. Moreover, the embodiments of this specification may be in the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes. Each embodiment in this specification is described in a progressive manner, and the same and similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts refer to the partial description of the method embodiment. In the description of this specification, the description of the reference term "one embodiment", "some embodiments", "example", "specific example", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the embodiment of this specification.
[0071] In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. In addition, those skilled in the art may combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples, without contradicting each other. The above is only an embodiment of the embodiment of this specification and is not intended to limit the embodiment of this specification. For those skilled in the art, the embodiment of this specification may have various changes and variations. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the embodiment of this specification shall be included in the scope of the claims of the embodiment of this specification.
Claims
1. A software testing platform with improved coverage, characterized in that: include: S01. Record the code running track when executing the test to obtain a code coverage data set; S02, performing cleaning and sorting based on the acquired code coverage data set to obtain code lines of the code coverage data set; S03, analyzing the obtained code lines to determine whether they have been executed, and if so, tracing back through the code lines to obtain functions and use cases that need to be tested; S04. Generate coverage reports and provide feedback based on the functions and use cases that need to be tested.
2. The coverage-enhanced accurate software testing platform according to claim 1, characterized in that: The code base for storing the execution of the test application is also included. The track of the code execution when executing the test in step S01 includes: S11, performing a quick scan based on the code base to obtain code that is different from the code base and is covered by the test; S12, sorting the original code in the code library and the covered code to obtain a first code data set; S13, sorting the codes in the code base that are not covered by the test to obtain a second-generation code data set, and generating test cases based on the second-generation code data set; The code coverage data set includes a first code data set.
3. The coverage-enhanced accurate software testing platform according to claim 1, characterized in that: The code line obtained in step S02 can be associated with each code block, method and class, and the test case associated therewith can be obtained through the method and class to obtain the test case corresponding to the code line.
4. The coverage-enhanced accurate software testing platform according to claim 1, characterized in that: The execution recording in S01 includes two execution modes: automatic recording and manual selection, of the code running track when executing the test.
5. The coverage-enhanced accurate software testing platform according to claim 1, characterized in that: The coverage report generated in step S04 includes charts and key indicators to help understand the effect of test coverage.
6. The coverage-enhanced accurate software testing platform according to claim 1, characterized in that: The coverage report generated in step S04 also includes generating different test combination results based on the covered code lines according to the obtained functions and use cases that need to be tested.
7. The coverage-enhanced accurate software testing platform according to claim 1, characterized in that: It also includes recording the code coverage data set, code lines, and functions and use cases that need to be tested obtained after the test in step S01 is executed, so as to generate a historical record stored by a timestamp.
8. The coverage-enhanced accurate software testing platform according to claim 1, characterized in that: When executing step S01, multiple users are allowed to execute it simultaneously.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the steps of improving the coverage accuracy software testing platform as described in any one of claims 1 to 8 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of improving the coverage accuracy software testing platform as described in any one of claims 1 to 8 are implemented.