Coverage rate report generation method and system and electronic equipment
By recording and integrating the identification information of the source data, the coverage report is generated, and the reporting inaccuracy problems caused by inconsistent JDK versions and untimely data storage are solved, and the accuracy and efficiency of coverage report are improved.
Patent Information
- Application Number
- CN202411328497.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-24
- Publication Date
- 2025-01-10
AI Technical Summary
The existing coverage report generation scheme depends on the consistency of the JDK version and the timely storage of coverage data, otherwise it will affect the accuracy of the report.
By recording the identification information of the source data and packaging it into a pre-set plug-in, build an application deployment image. When the test application is started, mount the overlay program to record the coverage data, and integrate the data to generate reports to ensure the data accuracy and consistency.
The factors that affect the accuracy of coverage reporting are eliminated, the accuracy of reporting is ensured, and the compilation process of binary files is cancelled, server resources are saved, and coverage reporting generation efficiency is improved.
Smart Images

Figure CN119292920A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of natural language processing, and in particular to a coverage report generation method, system and electronic device. Background Art
[0002] With the advancement of software technology and its wide application in various fields, software quality has become increasingly important. Traditional software quality assurance mainly relies on the tester's understanding of requirements and personal experience, and there will inevitably be omissions. It is difficult to completely ensure the quality of software by manual testing alone. Code coverage is an important auxiliary means of manual testing. The code coverage tool widely used in the industry analyzes the code coverage from the developer's perspective, inserts the stub when the application under test is started, monitors and records the execution path of the code, and generates a detailed coverage report after the test is completed, showing the code scope involved in the test activity, thereby measuring the integrity of the test.
[0003] However, the generation of coverage reports depends on coverage data, source code, and class files. The existing coverage report generation solution is to compile source code with JDK to generate class files. There are many official JDK versions. If the JDK version compiled when generating the report is inconsistent with the JDK version used when building the application image, it will affect the accuracy of the coverage report; the coverage data is stored in the memory of the application container under test. If the application is restarted and the coverage data is not saved in time, it will also affect the accuracy of the coverage report. Summary of the invention
[0004] In view of the above-mentioned shortcomings of the prior art, the present application discloses a coverage report generation method, system and electronic device, which are used to solve at least one of the above-mentioned technical problems.
[0005] The first aspect of the present application discloses a coverage report generation method, comprising: obtaining an application under test whose coverage is to be tested, and source data of the application under test; recording identification information of the source data, and packaging the identification information into a packaging plug-in pre-set in the source data, so as to build an application deployment image based on the source data and the identification information; when the application under test is started through the application deployment image, mounting a coverage program for recording coverage data, the coverage program storing path parameters for carrying the identification information; in response to a data download instruction, integrating the coverage data recorded by the coverage program with the identification information, and feeding back to a platform end, so that the platform end extracts the coverage data, the binary file corresponding to the identification information, and the source data respectively according to the integrated data, and generates a coverage report.
[0006] In certain embodiments of the first aspect of the present application, the identification information is packaged by a preset packaging plug-in to obtain a data resource package; the path of the data resource package is passed into the coverage program as a path parameter; in response to a data download instruction, the data resource package is obtained according to the path parameter, and the data resource package and coverage data are compressed to complete data integration.
[0007] In certain embodiments of the first aspect of the present application, data extraction is performed on the integrated data to obtain the identification information, wherein the identification information includes at least a database address and database branch information of the source data; the source data is obtained from the database based on the database address and the database branch information; source code is compiled on the source data to obtain the binary file; and a coverage report is generated based on the source data, the binary file and the coverage data.
[0008] In certain embodiments of the first aspect of the present application, the coverage program is used to implement monitoring request information, wherein the request information includes a container restart instruction and a data download instruction; in response to the container restart instruction, a data pull notification is sent to the platform end so that the platform end restarts the container after completing the coverage data pull; in response to the data download instruction, the data resource package is obtained according to the path parameter, and the data resource package and the coverage data are compressed to complete data integration.
[0009] In certain embodiments of the first aspect of the present application, first identification information for identifying the current database address and database branch and second identification information for identifying the changed database address and the changed database branch are simultaneously set in the plug-in of the source data; if the database address and / or database branch changes, the new database address and / or database branch is modified according to the second identification information so that the platform end obtains the source data from the changed database.
[0010] The second aspect of the present application discloses a coverage report generation method, comprising: downloading integrated coverage data, the integrated coverage data including coverage data recorded by a coverage program and identification information of source data, the identification information being pre-packaged and set in a packaging plug-in of the source data to build an application deployment image based on the source data and the identification information; when the application under test is started through the application deployment image, mounting a coverage program for recording coverage data, the coverage program storing a path parameter for carrying the identification information; according to the integrated data, respectively extracting the coverage data, a binary file corresponding to the identification information and the source data, and generating a coverage report.
[0011] In certain embodiments of the second aspect of the present application, data extraction is performed on the integrated data to obtain the identification information, wherein the identification information includes at least a database address and database branch information of the source data; the source data is obtained from the database based on the database address and the database branch information; source code is compiled on the source data to obtain the binary file; and a coverage report is generated based on the source data, the binary file and the coverage data.
[0012] In certain embodiments of the second aspect of the present application, first identification information for identifying the current database address and database branch and second identification information for identifying the changed database address and the changed database branch are simultaneously set in the plug-in of the source data; if the database address and / or database branch changes, the new database address and / or database branch is modified according to the second identification information, and the source data is obtained from the changed database, or, if the database address and / or database branch changes, the new database address and / or database branch is packaged so that the platform end obtains the source data from the changed database by updating the second identification information, or, if the database address and / or database branch changes, the new database address and / or database branch is packaged so that the platform end obtains the source data from the changed database by updating the second identification information.
[0013] The third aspect of the present application discloses a coverage report generation system, characterized in that it includes: a tested application container, used to obtain the tested application whose coverage is to be tested, and the source data of the tested application; a plug-in module, used to record the identification information of the source data, and package the identification information into a packaging plug-in pre-set in the source data, so as to build an application deployment image based on the source data and the identification information; an execution module, used to mount a coverage program for recording coverage data when the tested application is started through the application deployment image, and the coverage program stores a path parameter for carrying the identification information; a download module, used to respond to a data download instruction, integrate the coverage data recorded by the coverage program with the identification information, and feed it back to the platform end, the platform end, used to extract the coverage data, the binary file corresponding to the identification information and the source data according to the integrated data, and generate a coverage report.
[0014] The fourth aspect of the present application discloses an electronic device, comprising: a processor and a memory; the memory is used to store a computer program, and the processor is used to execute the computer program stored in the memory, so that the electronic device executes the above method.
[0015] The beneficial effects of the present application are as follows: the present application records the identification information of the source data and packages the identification information into a pre-set packaging plug-in. When the application under test is started through the application deployment image, the coverage program for recording the coverage data is mounted, and the coverage data recorded by the coverage program is integrated with the identification information, so that the platform side can extract the coverage data, the binary files corresponding to the identification information, and the source data according to the integrated data to generate a coverage report. On the one hand, the factors affecting the accuracy of the coverage report data are eliminated to ensure the accuracy of the coverage report data. On the other hand, the compilation process of the binary file is cancelled, and there is no need to deploy different versions of compilation services, which saves server resources and improves the efficiency of coverage report generation. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] Figure 1 This is an application environment diagram of a coverage report generation method in an embodiment of the present application;
[0017] Figure 2 It is a flowchart of a coverage report generation method in an embodiment of the present application;
[0018] Figure 3 This is a data integration flow chart of a coverage report generation method in an embodiment of the present application;
[0019] Figure 4 It is an overall interactive schematic diagram of a coverage report generation method in an embodiment of the present application;
[0020] Figure 5 It is a structural schematic diagram of a coverage report generation system in an embodiment of the present application;
[0021] Figure 6 It is a structural schematic diagram of an electronic device in an embodiment of the present application. DETAILED DESCRIPTION
[0022] The following describes the implementation methods of the present application through specific examples, and those skilled in the art can easily understand other advantages and effects of the present application from the contents disclosed in this specification. The present application can also be implemented or applied through other different specific implementation methods, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present application. It should be noted that the following embodiments and sub-samples in the embodiments can be combined with each other without conflict.
[0023] It should be noted that the illustrations provided in the following embodiments are only schematic illustrations of the basic concept of the present application, and thus the drawings only show components related to the present application rather than being drawn according to the number, shape and size of components in actual implementation. In actual implementation, the type, quantity and proportion of each component may be changed at will, and the component layout may also be more complicated.
[0024] In the following description, a large number of details are discussed to provide a more thorough explanation of the embodiments of the present application. However, it is obvious to those skilled in the art that the embodiments of the present application can be implemented without these specific details. In other embodiments, well-known structures and devices are shown in the form of block diagrams rather than in detail to avoid making the embodiments of the present application difficult to understand.
[0025] The terms "first", "second", etc. in the specification and claims of the embodiments of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the terms used in this way can be interchanged where appropriate, so as to describe the embodiments of the embodiments of the present disclosure described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions.
[0026] Unless otherwise stated, the term "plurality" means two or more.
[0027] In the embodiment of the present disclosure, the character " / " indicates that the preceding and following objects are in an "or" relationship. For example, A / B indicates: A or B.
[0028] The term "and / or" is a description of the association relationship between objects, indicating that three relationships can exist. For example, A and / or B means: A or B, or, A and B.
[0029] First of all, it should be noted that code coverage is a metric in software testing that describes the proportion and degree of source code being tested in a program. The resulting proportion is called code coverage, which is an indicator of software testing quality. It is used to evaluate whether the test cases in the test suite have executed enough statements, branches, functions, etc. in the source code. Code coverage is usually expressed as a percentage, indicating the proportion of tested code to the total code. Test engineers can adjust test cases, inputs, or configurations based on the report of code coverage testing to increase the code coverage of important functions.
[0030] In computer science, Agent has multiple meanings, usually referring to a program that can perform tasks independently. For example, in Python, Agent can represent different types of software agents, including but not limited to web crawlers, virtual assistants, intelligent agents, etc. In this embodiment, Agent is a code coverage program.
[0031] Combination Figure 1 As shown, an implementation environment diagram of a coverage report generation method system provided by an embodiment of the present disclosure includes a user end and a server end, wherein the user end and the server end are connected to a network and communicate with each other. In this application, the user end is the front end and the server end is the back end.
[0032] It should be understood that the coverage report generation method system is applied to the terminal. In some embodiments, the application end can be at least one of a computer device, a desktop device, a smart phone, and a tablet device; the platform end can be configured as an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, and big data and artificial intelligence platforms; the software can be an application program of the coverage report generation method, etc., but is not limited to the above forms.
[0033] Combination Figure 2 As shown, the embodiment of the present disclosure provides a flow chart of a coverage report generation method, including:
[0034] Step S210: Acquire the application under test whose coverage is to be tested and the source data of the application under test.
[0035] Among them, the application under test is set in the application container under test. Since code coverage is an important indicator to measure the quality of the test, it can be intuitively seen which codes are covered during the test and which codes are omitted. In this embodiment, based on the open source code coverage tool, the data accuracy of the generated coverage report can be solved. Starting from the source code required for the coverage report, class files (i.e. binary files), and coverage data, the impact of environmental differences and external factors is eliminated to ensure the accuracy of the coverage report and the credibility of the test results. Under normal circumstances, binary executable files on one platform cannot work on other platforms. Class files are binary files that can run on any hardware platform and operating system that supports the Java virtual machine.
[0036] Step S220: record the identification information of the source data, and package the identification information into a packaging plug-in pre-set in the source data, so as to build an application deployment image based on the source data and the identification information.
[0037] In one embodiment, building the deployment image of the application and creating the coverage task are performed on different platforms, and both require configuring the identification information of the application, such as the Git repository address and branch information.
[0038] A Git repository is a project working directory tracked and managed by Git. It contains the project's history and version information, and facilitates code branch management and version control. Git repositories store source data and object databases, which can be used for collaboration and code sharing while maintaining a complete development history. In the repository, changes to the code can be saved by committing, while the branch mechanism supports multi-threaded development processes, thereby enabling parallel development of versions. The repository stores the complete history of the project, including every commit, branch, tag, and so on. Git repositories are divided into local repositories and remote repositories. Local repositories are generally located on the developer's computer, and remote repositories are generally located on remote servers, which can be shared and collaborated by multiple developers. Local initialization can be done by executing the git init command in the local directory to create a new Git repository, or by cloning from a remote location, for example, by using the git clone command to copy a remote repository to a local location.
[0039] In one embodiment, if the two platforms are inconsistently configured or the branch is modified midway, the source code pulled when generating the report is inconsistent with the source code used to build the image, which will result in inaccurate coverage reports. Git branches are separated from the main line to perform other operations without affecting the main line, and the main line can continue to work, similar to threads. Finally, the branch can be merged into the main line after completing the work, and the branch can be deleted after the task is completed. The main line works independently, and the branch is used to solve temporary needs. The two are unrelated. Git's branch function does not need to copy all the data. It only needs to recreate a branch pointer to point to the commit object (commit) where the branch needs to be created, and then modify it and submit it. The pointer of the new branch will point to the latest submitted commit object, and the pointer of the original branch will point to the original location.
[0040] In this embodiment, by introducing a packaging plug-in into the source code project of the application under test, the application's Git repository address, branch and other information are put into the jar package when the application image is built, and the source code is pulled after parsing the Git repository address and branch information from the jar package when the coverage report is generated, ensuring that the source code used when generating the report is completely consistent with the source code when the application builds the image. The jar package in this embodiment is a package file format, which is usually used to aggregate many class files and related data and resources (text, images, etc.) into one file. In this embodiment, the coverage application can directly rely on the jar package, which is convenient for publishing application software or libraries on the platform.
[0041] Step S230: When the application under test is started through the application deployment image, a coverage program for recording coverage data is mounted, and the coverage program stores a path parameter for carrying the identification information.
[0042] In one embodiment, the jar package of the application under test is downloaded together with the coverage data, and the class files are extracted from the jar package to ensure that the class files used when generating the coverage report are consistent with the class files when the application under test is running, thereby ensuring the accuracy of the coverage data.
[0043] In one embodiment, an application deployment image is constructed, and a jar package of the application under test can be included in the image; when starting the application under test, the -javaagent parameter is added to start the code coverage agent instrumentation service, and the path where the jar package of the application under test is located is passed as a path parameter to the code coverage agent. After the code coverage agent is started, it will monitor data download requests and container restart events.
[0044] Step S240, in response to the data download instruction, integrate the coverage data recorded by the coverage program with the identification information, and feed it back to the platform end, so that the platform end can extract the coverage data, the binary file corresponding to the identification information and the source data respectively according to the integrated data, and generate a coverage report.
[0045] In one embodiment, after receiving a data download request, the tested application jar package and coverage data are compressed and integrated and returned to the download end. After receiving a container restart event, the coverage platform is notified to download the coverage data to avoid data loss. When generating a coverage report, the Git repository address, branch, and class file of the source code when building the image are extracted from the tested application jar package, and then the coverage report is generated.
[0046] Figure 3 is a data integration flow chart of a coverage report generation method in an embodiment of the present application, such as Figure 3 As shown, the coverage data recorded by the coverage program is integrated with the identification information, specifically including:
[0047] Step S310: Pack the identification information using a preset packaging plug-in to obtain a data resource package.
[0048] In one embodiment, a packaging plug-in is introduced into the source code of the application under test to package the identification information, wherein the identification information is used to record the Git repository address, branch information, etc. of the application source code, so as to pull the source code for use when generating a coverage report. When building an application deployment image, the packaging plug-in introduced into the application source code packs the application's Git repository address and branch information into a jar package, and then packs the application under test jar into the image.
[0049] Step S320: pass the path of the data resource package as a path parameter to the overlay program.
[0050] In one embodiment, when the application under test is started through the mirror, it is mounted through the code coverage program, that is, the code coverage Agent, and the jar package path of the application under test is passed as an input parameter to the code coverage Agent. After the code coverage Agent is started, it monitors data download requests and container restart events in real time.
[0051] Step S330 , in response to the data download instruction, obtaining a data resource package according to the path parameter, and compressing the data resource package and the coverage data to complete data integration.
[0052] In one embodiment, after receiving the data download instruction, the code coverage agent integrates and compresses the recorded coverage data and the jar package of the application under test, and returns it to the coverage platform. The coverage platform decompresses the downloaded compressed package, decompresses the jar package of the application under test and the coverage data file, and extracts the class file and the Git repository address and branch information of the application when building the image from the jar package of the application under test, pulls the source code from the code repository based on the extracted Git repository address and branch information, and finally generates a coverage report through the coverage data file, class file, and source code.
[0053] In one embodiment, when the application under test is started through the application deployment image, after mounting the coverage program for recording coverage data, it also includes:
[0054] S410: Monitor request information through an overlay program, where the request information includes a container restart instruction and a data download instruction.
[0055] In one embodiment, when the application under test is started through the mirror, the mount can be through the code coverage Agent of the secondary development in this embodiment, and the jar package path of the application under test is passed as an input parameter to the code coverage Agent. After the code coverage Agent is started, it monitors data download requests and container restart events in real time.
[0056] S420. In response to the container restart instruction, send a data pull notification to the platform end, so that the platform end restarts the container after completing the coverage data pull.
[0057] Figure 4 is an overall interactive schematic diagram of a coverage report generation method in an embodiment of the present application, such as Figure 4As shown in the figure, a packaging tool is introduced into the source code of the application under test, and the Git repository address and branch information are packaged into the jar package. When building the image, the jar package of the application under test is packaged into the image. The coverage platform calls the code coverage Agent service to download data, decompresses it to obtain the coverage data file and the jar package of the application under test, and extracts the class file and the Git repository address and branch information of the application when building the image from the jar. The source code is pulled from the code repository based on the extracted Git repository address and branch information. A coverage report is generated based on the source code, coverage data file, and class file.
[0058] In one embodiment, after receiving the container restart event, the code coverage agent notifies the coverage platform to pull the coverage data, and then restarts the container to avoid the loss of coverage data. The code coverage agent in this embodiment is a component in the code coverage tool, which can be an independent Java agent program that can dynamically collect code coverage information at runtime. For example, you can add the -javaagent parameter to the JVM startup parameters to load the code coverage agent and record the coverage data.
[0059] In one embodiment, packaging the identification information into a plug-in pre-set in the source data may specifically include:
[0060] The first identification information for identifying the current database address and database branch and the second identification information for identifying the changed database address and the changed database branch are simultaneously set in the plug-in of the source data; if the database address and / or database branch changes, the new database address and / or database branch is modified according to the pre-set second identification information, so that the platform end can obtain the source data from the changed database through the second identification information; the core of this method is to set the new database address and / or database branch in advance, and if the address or branch needs to be changed, it can be modified according to the pre-agreed address.
[0061] However, there are various reasons for modifying the database address and database branch. In another embodiment, different from the above embodiment, if the database address and / or database branch changes, the new database address and / or database branch can be packaged so that the platform can obtain the source data from the changed database by updating the second identification information.
[0062] In this embodiment, source code and class files are obtained from the jar package of the application under test to ensure the consistency of data when the application is running and when the report is generated; monitoring of container restart events avoids the loss of coverage data, and the accuracy of the coverage report is guaranteed through these three dimensions.
[0063] See also Figure 5 , is a schematic diagram of the structure of a coverage report generation method system in an embodiment of the present application, comprising:
[0064] A plug-in module, used to record identification information of source data, and package the identification information into a packaging plug-in pre-set in the source data, so as to construct an application deployment image based on the source data and the identification information;
[0065] An execution module, used for mounting a coverage program for recording coverage data when the application under test is started through the application deployment image, wherein the coverage program stores a path parameter for carrying the identification information;
[0066] A download module, for responding to a data download instruction, integrating the coverage data and identification information recorded by the coverage program, and feeding back the data to the platform end;
[0067] The platform side is used to extract the coverage data, the binary file corresponding to the identification information and the source data according to the integrated data, and generate a coverage report.
[0068] It should be noted that the coverage report generation method of the present application corresponds one-to-one to the coverage report generation method system, and the corresponding technical details and technical solutions refer to the above-mentioned coverage report generation method, which will not be repeated here.
[0069] Through the above method, there is no need to configure the application Git repository address, branch and other information on the coverage platform. You only need to build the image process configuration, and use it in multiple places. This avoids the risk of inaccurate data caused by asynchronous operations in the middle link; and there is no need to compile the source code, so the coverage report generation efficiency is higher. In addition, the source code and class required for the coverage report are obtained from the jar package of the application under test, which is more accurate. In this embodiment, the source code and class files are obtained from the jar package of the application under test to ensure the consistency of data when the application is running and when the report is generated; the monitoring of the container restart event avoids the loss of coverage data, and the accuracy of the coverage report is guaranteed through these three dimensions.
[0070] In addition, this application introduces a packaging plug-in into the code coverage program, downloads the jar package of the application under test at the same time as the coverage data, and extracts the class files from the jar package to ensure that the class files used when generating the coverage report are consistent with the class files when the application under test is running, thereby ensuring the accuracy of the coverage data. This application also adds event monitoring to the code coverage program, triggers the monitoring event before the container of the application under test is restarted, notifies the coverage platform to pull the coverage data, and restarts the container after the pulling is completed to avoid the loss of coverage data. When building the application image, the application's Git repository address, branch and other information are put into the jar package. When generating the coverage report, the Git repository address and branch information are parsed from the jar package and the source code is pulled to ensure that the source code used when generating the report is completely consistent with the source code when the application builds the image.
[0071] In other embodiments, the present disclosure also provides an electronic device, including: a processor and a memory; the memory is used to store a computer program, and the processor is used to execute the computer program stored in the memory, so that the electronic device executes the above method.
[0072] Figure 6 The structure diagram of the computer system suitable for implementing the electronic device of the embodiment of the present application is shown. It should be noted that: Figure 6 The computer system 600 of the electronic device shown is only an example and should not bring any limitation to the functions and application scope of the embodiments of the present application.
[0073] like Figure 6 As shown, the computer system 600 includes a central processing unit (CPU) 601, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 602 or the program loaded from the storage part 608 to the random access memory (RAM) 603, such as executing the method in the above embodiment. In the random access memory 603, various programs and data required for system operation are also stored. The central processing unit 601, the read-only memory 602 and the random access memory 603 are connected to each other through a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0074] The following components are connected to the input / output interface 605: an input section 606 including a keyboard, a mouse, etc.; an output section 607 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 608 including a hard disk, etc.; and a communication section 609 including a network interface card such as a LAN (Local Area Network) card, a modem, etc. The communication section 609 performs communication processing via a network such as the Internet. A drive 610 is also connected to the input / output interface 605 as needed. A removable medium 611, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 610 as needed so that a computer program read therefrom is installed into the storage section 608 as needed.
[0075] In particular, according to an embodiment of the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present application includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a computer program for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through the communication part 609, and / or installed from a removable medium 611. When the computer program is executed by the central processing unit 601, various functions defined in the system of the present application are executed.
[0076] The above description and the accompanying drawings fully illustrate the embodiments of the present disclosure so that those skilled in the art can practice them. Other embodiments may include structural, logical, electrical, process and other changes. The embodiments represent possible changes only. Unless explicitly required, separate components and functions are optional, and the order of operation may vary. Parts and subsamples of some embodiments may be included in or replace parts and subsamples of other embodiments. Moreover, the words used in this application are only used to describe the embodiments and are not used to limit the claims. As used in the description of the embodiments and the claims, unless the context clearly indicates, the singular forms of "a", "an" and "the" are intended to include plural forms as well. Similarly, the term "and / or" used in this application refers to any and all possible combinations of listings containing one or more associated ones. In addition, when used in the present application, the term "comprise" and its variants "comprises" and / or comprising refer to the presence of a stated sub-sample, whole, step, operation, element, and / or component, but do not exclude the presence or addition of one or more other sub-samples, wholes, steps, operations, elements, components and / or groups of these. In the absence of further restrictions, the elements defined by the sentence "comprising a ..." do not exclude the presence of other identical elements in the process, method or device comprising the elements. In this article, each embodiment may focus on the differences from other embodiments, and the same and similar parts between the various embodiments may refer to each other. For the methods, products, etc. disclosed in the embodiments, if they correspond to the method part disclosed in the embodiments, then the relevant parts can refer to the description of the method part.
[0077] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software may depend on the specific application and design constraints of the technical solution. Technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the embodiments of the present disclosure. Technicians can clearly understand that for the convenience and simplicity of description, the specific working process of the above-described system, device and unit can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.
[0078] In the embodiments disclosed herein, the disclosed methods and products (including but not limited to devices, equipment, etc.) can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of units can be 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 sub-samples can be ignored or not executed. In addition, 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 units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to implement this embodiment. In addition, each functional unit in the embodiment of the present disclosure may be integrated in a processing unit, or each unit may exist physically alone, or two or more units may be integrated in one unit.
[0079] The flowchart and block diagram in the accompanying drawings show the possible architecture, function and operation of the method, system and computer program product according to the embodiment of the present disclosure. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of the code, and a part of the module, program segment or code contains one or more executable instructions for realizing the specified logical function. In some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, which can depend on the functions involved. In the description corresponding to the flowchart and block diagram in the accompanying drawings, the operations or steps corresponding to different boxes can also occur in a different order from the order disclosed in the description, and sometimes there is no specific order between different operations or steps. For example, two consecutive operations or steps can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, which can depend on the functions involved. Each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, may be implemented by a dedicated hardware-based system that performs the specified functions or actions, or may be implemented by a combination of dedicated hardware and computer instructions.
Claims
1. A coverage report generation method, characterized in that: include: Obtain the application under test whose coverage is to be tested, and the source data of the application under test; Recording identification information of the source data, and packaging the identification information into a packaging plug-in pre-set in the source data, so as to construct an application deployment image based on the source data and the identification information; When the application under test is started through the application deployment image, a coverage program for recording coverage data is mounted, wherein the coverage program stores a path parameter for carrying the identification information; In response to the data download instruction, the coverage data recorded by the coverage program is integrated with the identification information and fed back to the platform end, so that the platform end extracts the coverage data, the binary file corresponding to the identification information and the source data according to the integrated data, and generates a coverage report.
2. The coverage report generation method according to claim 1, characterized in that: The step of integrating the coverage rate data recorded by the coverage program with the identification information includes: The identification information is packaged by a preset packaging plug-in to obtain a data resource package; Passing the path of the data resource package into the overlay program as a path parameter; In response to the data download instruction, the data resource package is obtained according to the path parameter, and the data resource package and the coverage data are compressed to complete data integration.
3. The coverage report generation method according to claim 2, characterized in that: The extracting the coverage data, the binary file corresponding to the identification information and the source data respectively, and generating a coverage report, includes: Extracting the integrated data to obtain the identification information, wherein the identification information at least includes a database address and database branch information of the source data; Obtaining the source data from a database according to the database address and database branch information; Compiling the source data into source code to obtain the binary file; A coverage report is generated based on the source data, the binary file, and the coverage data.
4. The coverage report generation method according to claim 1, characterized in that: When the application under test is started through the application deployment image, after mounting the coverage program for recording coverage data, the method further includes: Implementing monitoring request information through the overlay program, the request information includes a container restart instruction and the data download instruction; In response to the container restart instruction, a data pull notification is sent to the platform end, so that the platform end restarts the container after completing the coverage data pull; In response to the data download instruction, the data resource package is obtained according to the path parameter, and the data resource package and the coverage data are compressed to complete data integration.
5. The coverage report generation method according to claim 3, characterized in that: The step of packaging the identification information into a plug-in pre-set in the source data includes: Setting first identification information for identifying a current database address and a database branch and second identification information for identifying a changed database address and a changed database branch simultaneously in the source data plug-in; If the database address and / or database branch changes, the new database address and / or database branch is modified according to the preset second identification information, so that the platform end obtains the source data from the changed database through the second identification information; or, If the database address and / or database branch changes, the new database address and / or database branch is packaged so that the platform end can obtain the source data from the changed database by updating the second identification information.
6. A coverage report generation method, characterized in that: include: Downloading integrated coverage data, the integrated coverage data including coverage data recorded by the coverage program and identification information of source data, the identification information being pre-packaged and set in a packaging plug-in of the source data, so as to construct an application deployment image based on the source data and the identification information; When the application under test is started through the application deployment image, a coverage program for recording coverage data is mounted, wherein the coverage program stores a path parameter for carrying the identification information; According to the integrated data, the coverage data, the binary file corresponding to the identification information and the source data are respectively extracted, and a coverage report is generated.
7. The coverage report generation method according to claim 6, characterized in that: Extracting the coverage data, the binary file corresponding to the identification information, and the source data respectively, and generating a coverage report, including: Extracting the integrated data to obtain the identification information, wherein the identification information at least includes a database address and database branch information of the source data; Obtaining the source data from a database according to the database address and database branch information; Compiling the source data into source code to obtain the binary file; A coverage report is generated based on the source data, the binary file, and the coverage data.
8. The coverage report generation method according to claim 7, characterized in that: The step of packaging the identification information into a plug-in pre-set in the source data includes: Setting first identification information for identifying a current database address and a database branch and second identification information for identifying a changed database address and a changed database branch simultaneously in the source data plug-in; If the database address and / or database branch changes, the new database address and / or database branch is modified according to the second identification information, and the source data is obtained from the changed database; or, If the database address and / or database branch changes, the new database address and / or database branch is packaged so that the platform end can obtain the source data from the changed database by updating the second identification information.
9. A coverage report generation system, characterized in that: include: The tested application container is used to obtain the tested application with the test coverage and the source data of the tested application; A plug-in module, used to record the identification information of the source data, and package the identification information into a packaging plug-in pre-set in the source data, so as to build an application deployment image based on the source data and the identification information; An execution module, used for mounting a coverage program for recording coverage data when the application under test is started through the application deployment image, wherein the coverage program stores a path parameter for carrying the identification information; A download module, for responding to a data download instruction, integrating the coverage data recorded by the coverage program with the identification information, and feeding back the data to the platform end; The platform side is used to extract the coverage data, the binary file corresponding to the identification information and the source data respectively according to the integrated data, and generate a coverage report.
10. An electronic device, characterized in that: include: Processor and memory; The memory is used to store a computer program, and the processor is used to execute the computer program stored in the memory, so that the electronic device executes the method according to any one of claims 1 to 8.