CN115292162A - Report generation method, report generation device, report generation apparatus, report generation medium, and program product - Google Patents
Report generation method, report generation device, report generation apparatus, report generation medium, and program product Download PDFInfo
- Publication number
- CN115292162A CN115292162A CN202210789942.7A CN202210789942A CN115292162A CN 115292162 A CN115292162 A CN 115292162A CN 202210789942 A CN202210789942 A CN 202210789942A CN 115292162 A CN115292162 A CN 115292162A
- Authority
- CN
- China
- Prior art keywords
- code
- text
- target
- source file
- file
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Prevention of errors by analysis, debugging or testing of software
- G06F11/3668—Testing of software
- G06F11/3672—Test management
- G06F11/3676—Test management for coverage analysis
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Prevention of errors by analysis, debugging or testing of software
- G06F11/3668—Testing of software
- G06F11/3696—Methods or tools to render software testable
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Computer Hardware Design (AREA)
- Quality & Reliability (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Debugging And Monitoring (AREA)
Abstract
本公开的实施例公开了报告生成方法、装置、设备、介质和程序产品。该方法的一具体实施方式包括:根据针对目标源文件的代码执行情况文件,生成覆盖率信息文本,其中,该目标源文件为目标版本的源文件;确定变更代码行信息集,其中,该变更代码行信息集中的变更代码行信息表征该目标源文件与历史源文件的代码差异的位置信息,其中,该历史源文件对应的版本早于该目标版本;根据该覆盖率信息文本,生成目标文本,其中,该目标文本表征该变更代码行信息集的覆盖率信息;根据该目标文本,生成针对该目标源文件的增量代码覆盖率报告。该实施方式可以精准地生成针对目标源文件的增量代码覆盖率报告。
Embodiments of the present disclosure disclose report generation methods, apparatuses, devices, media, and program products. A specific implementation of the method includes: generating a coverage information text according to a code execution situation file for a target source file, wherein the target source file is a source file of the target version; determining a set of changed code line information, wherein the change The changed code line information in the code line information set represents the location information of the code difference between the target source file and the historical source file, wherein the version corresponding to the historical source file is earlier than the target version; according to the coverage information text, the target text is generated , wherein the target text represents the coverage information of the changed code line information set; and according to the target text, an incremental code coverage report for the target source file is generated. This embodiment can accurately generate incremental code coverage reports for target source files.
Description
技术领域technical field
本公开的实施例涉及计算机技术领域,具体涉及报告生成方法、装置、设备、介质和程序产品。The embodiments of the present disclosure relate to the field of computer technology, and specifically relate to a report generating method, device, device, medium and program product.
背景技术Background technique
目前,在研发过程中,测试人员往往依据个人经验和对业务需求的理解,通过常态化的功能测试、边界测试、回归测试等方法,保障每次增量代码的测试质量。对于增量代码覆盖率报告的生成,通常采用的方式为:首先,相关测试人员统计增量代码信息。然后,根据增量代码信息,生成增量代码覆盖率报告。At present, in the research and development process, testers often use normalized functional testing, boundary testing, regression testing and other methods based on personal experience and understanding of business requirements to ensure the testing quality of each incremental code. For the generation of the incremental code coverage report, the usual method is: first, the relevant testers count the incremental code information. Then, an incremental code coverage report is generated based on the incremental code information.
然而,发明人发现,当采用上述方式来生成增量代码覆盖率报告,经常会存在如下技术问题:However, the inventors have found that when the incremental code coverage report is generated in the above manner, the following technical problems often exist:
增量代码信息往往错综复杂,且代码量往往较为庞大。在统计过程中,相关测试人员可能存在遗漏或多增代码的情况,导致后续生成的增量代码覆盖率报告不够精准。Incremental code information is often intricate, and the amount of code is often relatively large. During the statistical process, relevant testers may omit or add more codes, resulting in inaccurate incremental code coverage reports generated subsequently.
该背景技术部分中所公开的以上信息仅用于增强对本发明构思的背景的理解,并因此,其可包含并不形成本国的本领域普通技术人员已知的现有技术的信息。The above information disclosed in this Background section is only for enhancement of understanding of the background of the inventive concept and therefore it may contain information that does not form the prior art that is already known in this country to a person of ordinary skill in the art.
发明内容Contents of the invention
本公开的内容部分用于以简要的形式介绍构思,这些构思将在后面的具体实施方式部分被详细描述。本公开的内容部分并不旨在标识要求保护的技术方案的关键特征或必要特征,也不旨在用于限制所要求的保护的技术方案的范围。The Summary of the Disclosure is provided to introduce concepts in a simplified form that are described in detail in the Detailed Description that follows. The content of this disclosure is not intended to identify the key features or essential features of the claimed technical solution, nor is it intended to be used to limit the scope of the claimed technical solution.
本公开的一些实施例提出了报告生成方法、装置、设备、介质和程序产品,来解决以上背景技术部分提到的技术问题。Some embodiments of the present disclosure propose a report generation method, device, device, medium, and program product to solve the technical problems mentioned in the background art section above.
第一方面,本公开的一些实施例提供了一种报告生成方法,包括:根据针对目标源文件的代码执行情况文件,生成覆盖率信息文本,其中,上述目标源文件为目标版本的源文件;确定变更代码行信息集,其中,上述变更代码行信息集中的变更代码行信息表征上述目标源文件与历史源文件的代码差异的位置信息,其中,上述历史源文件对应的版本早于上述目标版本;根据上述覆盖率信息文本,生成目标文本,其中,上述目标文本表征上述变更代码行信息集的覆盖率信息;根据上述目标文本,生成针对上述目标源文件的增量代码覆盖率报告。In a first aspect, some embodiments of the present disclosure provide a method for generating a report, including: generating coverage information text according to a code execution status file for a target source file, wherein the above target source file is a source file of a target version; Determine the changed code line information set, wherein the changed code line information in the above changed code line information set represents the location information of the code difference between the above target source file and the historical source file, wherein the version corresponding to the above historical source file is earlier than the above target version ; According to the above-mentioned coverage information text, generate target text, wherein, the above-mentioned target text represents the coverage information of the above-mentioned changed code line information set; according to the above-mentioned target text, generate an incremental code coverage report for the above-mentioned target source file.
可选地,上述方法还包括:响应于接收到报告展示请求,将上述增量代码覆盖率报告发送至报告查询展示终端。Optionally, the above method further includes: in response to receiving the report display request, sending the above incremental code coverage report to the report query display terminal.
可选地,上述方法还包括:根据上述增量代码覆盖率报告,对上述目标源文件对应的测试用例进行调整。Optionally, the above method further includes: adjusting the test case corresponding to the above target source file according to the above incremental code coverage report.
可选地,变更代码行信息集中的变更代码行信息包括:代码变换的文件的文件名称和变更代码行。Optionally, the changed code line information in the changed code line information set includes: the file name of the code transformed file and the changed code line.
可选地,上述根据上述覆盖率信息文本,生成目标文本,包括:确定上述目标源文件中的、针对上述历史源文件的至少一个变更文件名称;根据上述至少一个变更文件名称和上述覆盖率信息文本,生成变更文本,其中,上述变更文本的文本内容为覆盖率信息文本内容中的、与上述至少一个变更文件名称相关联的内容,上述覆盖率信息文本内容为上述覆盖率信息文本的文本内容;根据上述变更文本、上述变更代码行信息集中的变更代码行信息包括的变更代码行和文件名称,生成上述目标文本。Optionally, generating the target text according to the above-mentioned coverage information text includes: determining at least one changed file name for the above-mentioned historical source file in the above-mentioned target source file; according to the above-mentioned at least one changed file name and the above-mentioned coverage information Text, generating a change text, wherein the text content of the change text is the content associated with the at least one change file name in the coverage information text content, and the coverage information text content is the text content of the coverage information text ; Generating the above target text according to the above-mentioned change text, the change code line and the file name included in the change code line information in the above-mentioned change code line information set.
可选地,上述确定上述目标源文件中的、针对上述历史源文件的至少一个变更文件名称,包括:根据上述代码执行情况文件,确定代码分支信息和代码提交记录;根据上述代码分支信息和代码提交记录,生成上述至少一个变更文本名称。Optionally, the above-mentioned determination of at least one changed file name for the above-mentioned historical source file in the above-mentioned target source file includes: determining code branch information and code submission records according to the above-mentioned code execution file; according to the above-mentioned code branch information and code Commit a record, generating at least one of the above changetext names.
第二方面,本公开的一些实施例提供了一种报告生成装置,包括:第一生成单元,被配置成根据针对目标源文件的代码执行情况文件,生成覆盖率信息文本,其中,上述目标源文件为目标版本的源文件;确定单元,被配置成确定变更代码行信息集,其中,上述变更代码行信息集中的变更代码行信息表征上述目标源文件与历史源文件的代码差异的位置信息,其中,上述历史源文件对应的版本早于上述目标版本;第二生成单元,被配置成根据上述覆盖率信息文本,生成目标文本,其中,上述目标文本表征上述变更代码行信息集的覆盖率信息;第三生成单元,被配置成根据上述目标文本,生成针对上述目标源文件的增量代码覆盖率报告。In the second aspect, some embodiments of the present disclosure provide a report generating device, including: a first generating unit configured to generate coverage information text according to the code execution status file for the target source file, wherein the target source The file is the source file of the target version; the determining unit is configured to determine the changed code line information set, wherein the changed code line information in the above-mentioned changed code line information set represents the position information of the code difference between the above-mentioned target source file and the historical source file, Wherein, the version corresponding to the above-mentioned historical source file is earlier than the above-mentioned target version; the second generation unit is configured to generate the target text according to the above-mentioned coverage information text, wherein the above-mentioned target text represents the coverage information of the above-mentioned changed code line information set ; The third generating unit is configured to generate an incremental code coverage report for the target source file according to the target text.
可选地,上述装置还包括:响应于接收到报告展示请求,将上述增量代码覆盖率报告发送至报告查询展示终端。Optionally, the above apparatus further includes: in response to receiving the report display request, sending the above incremental code coverage report to the report query display terminal.
可选地,上述装置还包括:根据上述增量代码覆盖率报告,对上述目标源文件对应的测试用例进行调整。Optionally, the above device further includes: adjusting the test case corresponding to the above target source file according to the above incremental code coverage report.
可选地,上述变更代码行信息集中的变更代码行信息包括:代码变换的文件的文件名称和变更代码行。Optionally, the changed code line information in the above changed code line information set includes: the file name and the changed code line of the file for code transformation.
可选地,第二生成单元可以进一步被配置成:确定上述目标源文件中的、针对上述历史源文件的至少一个变更文件名称;根据上述至少一个变更文件名称和上述覆盖率信息文本,生成变更文本,其中,上述变更文本的文本内容为覆盖率信息文本内容中的、与上述至少一个变更文件名称相关联的内容,上述覆盖率信息文本内容为上述覆盖率信息文本的文本内容;根据上述变更文本、上述变更代码行信息集中的变更代码行信息包括的变更代码行和文件名称,生成上述目标文本。Optionally, the second generation unit may be further configured to: determine at least one changed file name for the historical source file in the target source file; generate the changed file according to the at least one changed file name and the coverage information text Text, wherein, the text content of the above-mentioned change text is the content associated with the above-mentioned at least one changed file name in the coverage information text content, and the above-mentioned coverage information text content is the text content of the above-mentioned coverage information text; according to the above-mentioned change Text, the changed code line and the file name included in the changed code line information in the above changed code line information set, and generate the above target text.
可选地,第二生成单元可以进一步被配置成:根据上述代码执行情况文件,确定代码分支信息和代码提交记录;根据上述代码分支信息和代码提交记录,生成上述至少一个变更文本名称。Optionally, the second generating unit may be further configured to: determine code branch information and code submission records according to the above code execution situation file; generate the above at least one change text name according to the above code branch information and code submission records.
第三方面,本公开的一些实施例提供了一种电子设备,包括:一个或多个处理器;存储装置,其上存储有一个或多个程序,当一个或多个程序被一个或多个处理器执行,使得一个或多个处理器实现如第一方面中任一实现方式描述的方法。In a third aspect, some embodiments of the present disclosure provide an electronic device, including: one or more processors; The processor executes, so that one or more processors implement the method described in any implementation manner of the first aspect.
第四方面,本公开的一些实施例提供了一种计算机可读介质,其上存储有计算机程序,其中,程序被处理器执行时实现如第一方面中任一实现方式描述的方法。In a fourth aspect, some embodiments of the present disclosure provide a computer-readable medium on which a computer program is stored, wherein, when the program is executed by a processor, the method described in any implementation manner in the first aspect is implemented.
第五方面,本公开的一些实施例提供了一种计算机程序产品,包括计算机程序,计算机程序在被处理器执行时实现上述第一方面中任一实现方式所描述的方法。In a fifth aspect, some embodiments of the present disclosure provide a computer program product, including a computer program. When the computer program is executed by a processor, the method described in any implementation manner in the above first aspect is implemented.
本公开的上述各个实施例具有如下有益效果:通过本公开的一些实施例的报告生成方法可以精准地生成针对目标源文件的增量代码覆盖率报告。具体来说,造成增量代码覆盖率报告不够精准的原因在于:增量代码信息往往错综复杂,且代码量往往较为庞大。在统计过程中,相关测试人员可能存在遗漏或多增代码的情况,导致后续生成的增量代码覆盖率报告不够精准。基于此,本公开的一些实施例的报告生成方法,首先,根据针对目标源文件的代码执行情况文件,生成覆盖率信息文本,以用于后续生成表征变更代码行信息集的覆盖率信息的目标文本。接着,确定变更代码行信息集,以用于后续生成与变更代码行信息集对应的目标文本。进而,根据上述覆盖率信息文本,精准、高效地生成目标文本。其中,上述目标文本表征上述变更代码行信息集的覆盖率信息。最后,根据上述目标文本,可以精准、高效地生成针对上述目标源文件的增量代码覆盖率报告。The above-mentioned various embodiments of the present disclosure have the following beneficial effects: the incremental code coverage report for the target source file can be accurately generated through the report generation method of some embodiments of the present disclosure. Specifically, the reason why the incremental code coverage report is not accurate is that the incremental code information is often intricate and the code volume is often relatively large. During the statistical process, relevant testers may omit or add more codes, resulting in inaccurate incremental code coverage reports generated subsequently. Based on this, in the report generation method of some embodiments of the present disclosure, first, according to the code execution status file for the target source file, the coverage information text is generated for subsequent generation of the target representing the coverage information of the changed code line information set text. Next, the changed code line information set is determined for subsequent generation of target text corresponding to the changed code line information set. Furthermore, according to the above coverage information text, the target text is generated accurately and efficiently. Wherein, the above-mentioned target text represents the coverage information of the above-mentioned changed code line information set. Finally, based on the above target text, an incremental code coverage report for the above target source files can be generated accurately and efficiently.
附图说明Description of drawings
结合附图并参考以下具体实施方式,本公开各实施例的上述和其他特征、优点及方面将变得更加明显。贯穿附图中,相同或相似的附图标记表示相同或相似的元素。应当理解附图是示意性的,元件和元素不一定按照比例绘制。The above and other features, advantages and aspects of the various embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the drawings, the same or similar reference numerals denote the same or similar elements. It should be understood that the drawings are schematic and elements and elements have not necessarily been drawn to scale.
图1是根据本公开的一些实施例的报告生成方法的一个应用场景的示意图;FIG. 1 is a schematic diagram of an application scenario of a report generating method according to some embodiments of the present disclosure;
图2是根据本公开的报告生成方法的一些实施例的流程图;Figure 2 is a flow diagram of some embodiments of a report generation method according to the present disclosure;
图3是根据本公开的报告生成方法的另一些实施例的流程图;FIG. 3 is a flow chart of other embodiments of a report generating method according to the present disclosure;
图4是根据本公开的报告生成方法的一些实施例中的报告查询展示终端的操作示意图;4 is a schematic diagram of the operation of the report query display terminal in some embodiments of the report generation method according to the present disclosure;
图5是根据本公开的报告生成装置的一些实施例的结构示意图;Fig. 5 is a schematic structural diagram of some embodiments of a report generation device according to the present disclosure;
图6是适于用来实现本公开的一些实施例的电子设备的结构示意图。FIG. 6 is a schematic structural diagram of an electronic device suitable for implementing some embodiments of the present disclosure.
具体实施方式Detailed ways
下面将参照附图更详细地描述本公开的实施例。虽然附图中显示了本公开的某些实施例,然而应当理解的是,本公开可以通过各种形式来实现,而且不应该被解释为限于这里阐述的实施例。相反,提供这些实施例是为了更加透彻和完整地理解本公开。应当理解的是,本公开的附图及实施例仅用于示例性作用,并非用于限制本公开的保护范围。Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the disclosure are shown in the drawings, it should be understood that the disclosure may be embodied in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these examples are provided so that the understanding of this disclosure will be thorough and complete. It should be understood that the drawings and embodiments of the present disclosure are for exemplary purposes only, and are not intended to limit the protection scope of the present disclosure.
另外还需要说明的是,为了便于描述,附图中仅示出了与有关发明相关的部分。在不冲突的情况下,本公开中的实施例及实施例中的特征可以相互组合。It should also be noted that, for the convenience of description, only the parts related to the related invention are shown in the drawings. In the case of no conflict, the embodiments in the present disclosure and the features in the embodiments can be combined with each other.
需要注意,本公开中提及的“第一”、“第二”等概念仅用于对不同的装置、模块或单元进行区分,并非用于限定这些装置、模块或单元所执行的功能的顺序或者相互依存关系。It should be noted that concepts such as "first" and "second" mentioned in this disclosure are only used to distinguish different devices, modules or units, and are not used to limit the sequence of functions performed by these devices, modules or units or interdependence.
需要注意,本公开中提及的“一个”、“多个”的修饰是示意性而非限制性的,本领域技术人员应当理解,除非在上下文另有明确指出,否则应该理解为“一个或多个”。It should be noted that the modifications of "one" and "multiple" mentioned in the present disclosure are illustrative and not restrictive, and those skilled in the art should understand that unless the context clearly indicates otherwise, it should be understood as "one or more" multiple".
本公开实施方式中的多个装置之间所交互的消息或者信息的名称仅用于说明性的目的,而并不是用于对这些消息或信息的范围进行限制。The names of messages or information exchanged between multiple devices in the embodiments of the present disclosure are used for illustrative purposes only, and are not used to limit the scope of these messages or information.
下面将参考附图并结合实施例来详细说明本公开。The present disclosure will be described in detail below with reference to the accompanying drawings and embodiments.
图1是根据本公开一些实施例的报告生成方法的一个应用场景的示意图。Fig. 1 is a schematic diagram of an application scenario of a method for generating a report according to some embodiments of the present disclosure.
在图1的应用场景中,首先,电子设备101可以根据针对目标源文件102的代码执行情况文件103,生成覆盖率信息文本104。其中,上述目标源文件102为目标版本105的源文件。在本应用场景中,目标版本105可以是“2.1.3”。然后,电子设备101可以确定变更代码行信息集108。其中,上述变更代码行信息集108中的变更代码行信息表征上述目标源文件102与历史源文件106的代码差异的位置信息。其中,上述历史源文件106对应的版本107早于上述目标版本105。在本应用场景中,历史源文件106对应的版本107可以是“2.1.2”。变更代码行信息集108可以包括:“第一文件第23行”和“第二文件第4行”。进而,电子设备101可以根据上述覆盖率信息文本104,生成目标文本109。其中,上述目标文本109表征上述变更代码行信息集108的覆盖率信息。最后,电子设备101可以根据上述目标文本109,生成针对上述目标源文件102的增量代码覆盖率报告110。In the application scenario of FIG. 1 , first, the electronic device 101 may generate the
需要说明的是,上述电子设备101可以是硬件,也可以是软件。当电子设备为硬件时,可以实现成多个服务器或终端设备组成的分布式集群,也可以实现成单个服务器或单个终端设备。当电子设备体现为软件时,可以安装在上述所列举的硬件设备中。其可以实现成例如用来提供分布式服务的多个软件或软件模块,也可以实现成单个软件或软件模块。在此不做具体限定。It should be noted that the above-mentioned electronic device 101 may be hardware or software. When the electronic device is hardware, it can be realized as a distributed cluster composed of multiple servers or terminal devices, or as a single server or a single terminal device. When an electronic device is embodied as software, it can be installed in the hardware devices listed above. It can be implemented, for example, as a plurality of software or software modules for providing distributed services, or as a single software or software module. No specific limitation is made here.
应该理解,图1中的电子设备的数目仅仅是示意性的。根据实现需要,可以具有任意数目的电子设备。It should be understood that the number of electronic devices in FIG. 1 is merely illustrative. There may be any number of electronic devices depending on implementation needs.
继续参考图2,示出了根据本公开的报告生成方法的一些实施例的流程200。该报告生成方法,包括以下步骤:Continuing to refer to FIG. 2 , a
步骤201,根据针对目标源文件的代码执行情况文件,生成覆盖率信息文本。
在一些实施例中,上述报告生成方法的执行主体(例如图1所示的电子设备101)可以根据针对目标源文件的代码执行情况文件,生成覆盖率信息文本。其中,上述目标源文件为目标版本的源文件。上述目标源文件可以是针对目标项目的源文件。例如,目标项目可以是人脸识别项目。上述目标源文件可以是增量代码确定过程中,对应两个源文件中版本最新的源文件。目标源文件的代码执行情况文件可以是目标源文件的gcda文件。其中,gcda文件可以是由加了编译参数的编译后的源文件运行所产生的文件。例如,编译参数可以是“-fprofile-arcs”。gcda文件可以包括弧跳变的次数等信息。覆盖率信息文本可以是全量info文本。上述全量info文件可以表征目标源文件中所有代码的覆盖率信息。In some embodiments, the execution subject of the above report generation method (for example, the electronic device 101 shown in FIG. 1 ) may generate the coverage information text according to the code execution status file for the target source file. Wherein, the above target source file is the source file of the target version. The aforementioned target source file may be a source file for the target project. For example, the target item may be a face recognition item. The aforementioned target source file may be the source file corresponding to the latest version among the two source files during the incremental code determination process. The code execution status file of the target source file may be a gcda file of the target source file. Wherein, the gcda file may be a file generated by running a compiled source file with compilation parameters added. For example, the compile parameter could be "-fprofile-arcs". The gcda file can include information such as the number of arc jumps. Coverage information text can be full info text. The above-mentioned full info file can represent the coverage information of all codes in the target source file.
需要说明的是,上述目标源文件是经过相关开发用户准许后而获取的文件。且通过设置选择项,来确定是否允许使用目标源文件。上述选择项包括:允许获取的选项和不允许获取的选项。It should be noted that the above-mentioned target source files are files obtained with the permission of relevant development users. And by setting options, to determine whether to allow the use of target source files. The above selection items include: options that are allowed to be obtained and options that are not allowed to be obtained.
作为示例,上述执行主体可以根据针对目标源文件的代码执行情况文件和gcno文件,使用代码覆盖率工具(LOCV),来生成覆盖率信息文本。其中,上述gcno文件可以由-ftest-coverage产生。且上述gcno文件可以包括:重建基本块图和相应源码的行号的信息。As an example, the above execution subject may use a code coverage tool (LOCV) to generate the coverage information text according to the code execution status file and the gcno file for the target source file. Among them, the above gcno file can be generated by -ftest-coverage. And the above-mentioned gcno file may include: the information of reconstructing the basic block graph and the line number of the corresponding source code.
作为又一个示例,上述执行主体可以根据针对目标源文件的代码执行情况文件,通过从服务器对应数据库中获取的、后续用于生成覆盖率信息文本的各个参数信息和运行环境信息,来利用代码覆盖率工具,生成覆盖率信息文本。As yet another example, the above-mentioned execution subject can use code coverage by using various parameter information and operating environment information obtained from the corresponding database of the server and subsequently used to generate the coverage information text according to the code execution status file for the target source file coverage tool to generate coverage infotext.
可选地,在步骤201之前,步骤还包括:Optionally, before
上述执行主体可以利用预先封装的覆盖率信息处理软件包(SDK,SoftwareDevelopment Kit),获取上述代码执行情况文件。其中,上述覆盖率信息处理软件包可以实现覆盖率执行结果收集、生成、上报、清理、重置等功能。The aforementioned execution subject may use a pre-packaged coverage information processing software package (SDK, Software Development Kit) to obtain the aforementioned code execution status file. Wherein, the above-mentioned coverage information processing software package can realize functions such as collection, generation, reporting, cleaning, and reset of coverage execution results.
步骤202,确定变更代码行信息集。
在一些实施例中,上述执行主体可以确定变更代码行信息集。其中,上述变更代码行信息集中的变更代码行信息表征上述目标源文件与历史源文件的代码差异的位置信息。其中,上述历史源文件对应的版本早于上述目标版本。例如,历史源文件对应的版本为“1.3.2”。目标版本为“1.3.3”。上述位置信息可以是目标源文件与历史源文件之间的差异代码的代码行号。代码行号为代码行在对应代码文件中的行数。例如,代码行号为“148”。In some embodiments, the above-mentioned execution subject may determine the change code line information set. Wherein, the changed code line information in the changed code line information set represents position information of code differences between the target source file and the historical source file. Wherein, the version corresponding to the above-mentioned historical source file is earlier than the above-mentioned target version. For example, the version corresponding to the historical source file is "1.3.2". The target version is "1.3.3". The above location information may be code line numbers of difference codes between the target source file and the historical source file. The code line number is the line number of the code line in the corresponding code file. For example, the code line number is "148".
作为示例,上述执行主体可以使用git diff命令,来确定变更代码行信息集。As an example, the above execution subject can use the git diff command to determine the information set of the changed code line.
在一些实施例的一些可选的实现方式中,上述变更代码行信息集中的变更代码行信息包括:代码变换的文件的文件名称和变更代码行。In some optional implementation manners of some embodiments, the changed code line information in the above changed code line information set includes: the file name of the code transformed file and the changed code line.
可选地,变更代码行信息可以键值对形式的信息。变更代码行信息中键为代码变换的文件的文件名称,变更代码行信息中的值为变更代码行。Optionally, the changed code line information may be information in the form of key-value pairs. The key in the changed code line information is the file name of the code transformed file, and the value in the changed code line information is the changed code line.
步骤203,根据上述覆盖率信息文本,生成目标文本。
在一些实施例中,上述执行主体可以根据上述覆盖率信息文本,生成目标文本。其中,上述目标文本表征上述变更代码行信息集的覆盖率信息。In some embodiments, the execution subject may generate the target text according to the coverage information text. Wherein, the above-mentioned target text represents the coverage information of the above-mentioned changed code line information set.
作为示例,上述执行主体可以根据上述覆盖率信息文本,生成目标文本,包括以下步骤:As an example, the above execution subject may generate the target text according to the above coverage information text, including the following steps:
第一步,上述执行主体可以利用git diff命令,来确定变更代码行信息集中每个变更代码行信息对应的文件名称,得到文件名称集。In the first step, the above execution subject can use the git diff command to determine the file name corresponding to each changed code line information in the changed code line information set, and obtain the file name set.
第二步,上述执行主体可以从覆盖率信息文本中筛选出与文件名称集相对应的文本内容,以生成上述目标文本。In the second step, the above-mentioned execution subject can filter out the text content corresponding to the file name set from the coverage information text to generate the above-mentioned target text.
在一些实施例的一些可选的实现方式中,上述根据上述覆盖率信息文本,生成目标文本,可以包括以下步骤:In some optional implementations of some embodiments, generating the target text according to the above-mentioned coverage information text may include the following steps:
第一步,上述执行主体可以确定上述目标源文件中的、针对上述历史源文件的至少一个变更文件名称。其中,变更文件名称可以是目标源文件与历史源文件之间文件命名发生变换的文件的名称。In the first step, the execution subject may determine at least one changed file name for the historical source file in the target source file. Wherein, the changed file name may be the name of a file whose file naming has changed between the target source file and the historical source file.
作为示例,上述执行主体可以利用“git diff-name-only”命令来确定至少一个变更文件名称。As an example, the above execution subject may use the "git diff-name-only" command to determine at least one changed file name.
第二步,上述执行主体可以根据上述至少一个变更文件名称和上述覆盖率信息文本,生成变更文本。其中,上述变更文本的文本内容为覆盖率信息文本内容中的、与上述至少一个变更文件名称相关联的内容。上述覆盖率信息文本内容为上述覆盖率信息文本的文本内容。In the second step, the execution subject may generate a change text according to the at least one change file name and the coverage information text. Wherein, the text content of the above-mentioned change text is the content associated with the above-mentioned at least one change file name in the text content of the coverage information. The above-mentioned coverage information text content is the text content of the above-mentioned coverage information text.
作为示例,上述执行主体可以从上述覆盖率信息文本对应覆盖率信息文本内容中筛选出与至少一个变更文件名称相关联的文本内容,以生成变更文本。As an example, the execution subject may filter out the text content associated with at least one changed file name from the coverage information text corresponding to the coverage information text, so as to generate the change text.
第三步,上述执行主体可以根据上述变更文本、上述变更代码行信息集中的变更代码行信息包括的变更代码行和文件名称,生成上述目标文本。In the third step, the execution subject may generate the target text according to the changed text, the changed code line and the file name included in the changed code line information in the changed code line information set.
作为示例,首先,上述执行主体可以确定变更文本对应的文件名称,作为目标文件名称,得到目标文件名称集。然后,上述执行主体可以确定变更代码行信息集对应的文件名称集。接着,上述执行主体可以确定文件名称集与目标文件名称集之间的交集,得到相交文件名称集。最后,从变更文本中筛选出与上述相交文件名称集相对应的文本内容,以生成目标文本。As an example, first, the execution subject may determine the file name corresponding to the changed text as the target file name to obtain a target file name set. Then, the execution subject may determine the file name set corresponding to the changed code line information set. Next, the execution subject may determine the intersection between the file name set and the target file name set to obtain the intersecting file name set. Finally, the text content corresponding to the above intersecting file name set is filtered out from the changed text to generate the target text.
可选地,上述确定上述目标源文件中的、针对上述历史源文件的至少一个变更文件名称,可以包括以下步骤:Optionally, the above-mentioned determination of at least one changed file name for the above-mentioned historical source file in the above-mentioned target source file may include the following steps:
第一步,上述执行主体可以根据上述代码执行情况文件,确定代码分支信息和代码提交记录。In the first step, the above-mentioned execution subject can determine code branch information and code submission records according to the above-mentioned code execution status file.
其中,代码分支信息可以是目标源文件的代码分支。上述代码提交记录可以是针对目标项目的各个版本源文件的提交记录。Wherein, the code branch information may be the code branch of the target source file. The above code submission record may be a submission record for each version of the source file of the target project.
作为示例,上述执行主体可以通过信息匹配的方式,来从数据库中确定出与代码执行情况文件相对应的代码分支信息和代码提交记录。As an example, the execution subject may determine the code branch information and code submission record corresponding to the code execution status file from the database by means of information matching.
第二步,上述执行主体可以根据上述代码分支信息和代码提交记录,生成上述至少一个变更文本名称。In the second step, the above-mentioned execution subject may generate the above-mentioned at least one change text name according to the above-mentioned code branch information and the code submission record.
作为示例,上述执行主体可以使用git diff命令,来根据上述代码分支信息和代码提交记录,生成上述至少一个变更文本名称。As an example, the above execution subject may use the git diff command to generate the above at least one change text name according to the above code branch information and code submission records.
步骤204,根据上述目标文本,生成针对上述目标源文件的增量代码覆盖率报告。Step 204: Generate an incremental code coverage report for the target source file according to the target text.
在一些实施例中,上述执行主体可以根据上述目标文本,生成针对上述目标源文件的增量代码覆盖率报告。其中,增量代码覆盖率报告可以包括:增量代码对应的覆盖率信息,增量代码文件集对应的最大覆盖率落差,增量代码文件集对应的最小覆盖率,增量代码文件集对应的最大覆盖率。其中,增量代码文件集可以是增量代码所属的各个文件。依据增量代码文件集,可以将增量代码划分为多个增量子代码。其中,多个增量子代码中的增量子代码与增量代码文件集中的增量代码文件一一对应。由此,上述执行主体可以确定每个增量子代码对应的覆盖率子信息。最大覆盖率落差可以是覆盖率子信息集中最大覆盖率子信息与最小覆盖率子信息之间的差值。其中,覆盖率子信息集中的覆盖率子信息与多个增量子代码中的增量子代码一一对应。In some embodiments, the execution subject may generate an incremental code coverage report for the target source file according to the target text. Among them, the incremental code coverage report may include: the coverage information corresponding to the incremental code, the maximum coverage gap corresponding to the incremental code file set, the minimum coverage rate corresponding to the incremental code file set, and the corresponding Maximum coverage. Wherein, the incremental code file set may be each file to which the incremental code belongs. According to the incremental code file set, the incremental code can be divided into a plurality of incremental subcodes. Wherein, the incremental subcodes in the plurality of incremental subcodes are in one-to-one correspondence with the incremental code files in the incremental code file set. Thus, the execution subject can determine the coverage sub-information corresponding to each incremental sub-code. The maximum coverage drop may be a difference between the maximum coverage sub-information and the minimum coverage sub-information in the coverage sub-information set. Wherein, the coverage sub-information in the coverage sub-information set is in one-to-one correspondence with the increment sub-codes in the multiple increment sub-codes.
作为示例,上述执行主体可以根据上述目标文本,使用代码覆盖率工具(LOCV),生成针对上述目标源文件的增量代码覆盖率报告。As an example, the execution subject may use a code coverage tool (LOCV) according to the target text to generate an incremental code coverage report for the target source file.
在一些实施例的一些可选的实现方式中,在步骤204之后,步骤还包括:In some optional implementations of some embodiments, after
上述执行主体可以根据上述增量代码覆盖率报告,对上述目标源文件对应的测试用例进行调整。The execution subject may adjust the test case corresponding to the target source file according to the incremental code coverage report.
作为示例,上述执行主体可以接收与增量代码覆盖率报告相关联的用例完善信息,对上述目标源源文件对应的测试用例进行调整。其中,上述用例完善信息可以目标用户根据增量代码覆盖率报告而编写的信息。As an example, the execution subject may receive the use case improvement information associated with the incremental code coverage report, and adjust the test case corresponding to the target source file. Wherein, the above use case improvement information may be information written by the target user according to the incremental code coverage report.
本公开的上述各个实施例具有如下有益效果:通过本公开的一些实施例的报告生成方法可以精准地生成针对目标源文件的增量代码覆盖率报告。具体来说,造成增量代码覆盖率报告不够精准的原因在于:增量代码信息往往错综复杂,且代码量往往较为庞大。在统计过程中,相关测试人员可能存在遗漏或多增代码的情况,导致后续生成的增量代码覆盖率报告不够精准。基于此,本公开的一些实施例的报告生成方法,首先,根据针对目标源文件的代码执行情况文件,生成覆盖率信息文本,以用于后续生成表征变更代码行信息集的覆盖率信息的目标文本。接着,确定变更代码行信息集,以用于后续生成与变更代码行信息集对应的目标文本。进而,根据上述覆盖率信息文本,精准、高效地生成目标文本。其中,上述目标文本表征上述变更代码行信息集的覆盖率信息。最后,根据上述目标文本,可以精准、高效地生成针对上述目标源文件的增量代码覆盖率报告。The above-mentioned various embodiments of the present disclosure have the following beneficial effects: the incremental code coverage report for the target source file can be accurately generated through the report generation method of some embodiments of the present disclosure. Specifically, the reason why the incremental code coverage report is not accurate is that the incremental code information is often intricate and the code volume is often relatively large. During the statistical process, relevant testers may omit or add more codes, resulting in inaccurate incremental code coverage reports generated subsequently. Based on this, in the report generation method of some embodiments of the present disclosure, first, according to the code execution status file for the target source file, the coverage information text is generated for subsequent generation of the target representing the coverage information of the changed code line information set text. Next, the changed code line information set is determined for subsequent generation of target text corresponding to the changed code line information set. Furthermore, according to the above coverage information text, the target text is generated accurately and efficiently. Wherein, the above-mentioned target text represents the coverage information of the above-mentioned changed code line information set. Finally, based on the above target text, an incremental code coverage report for the above target source files can be generated accurately and efficiently.
进一步参考图3,示出了根据本公开的报告生成方法的另一些实施例的流程300。该报告生成方法,包括以下步骤:Further referring to FIG. 3 , a
步骤301,根据针对目标源文件的代码执行情况文件,生成覆盖率信息文本。
步骤302,确定变更代码行信息集。
步骤303,根据上述覆盖率信息文本,生成目标文本。
步骤304,根据上述目标文本,生成针对上述目标源文件的增量代码覆盖率报告。Step 304: Generate an incremental code coverage report for the target source file according to the target text.
在一些实施例中,步骤301-304的具体实现及其所带来的技术效果,可以参考图2对应的实施例中的步骤201-204,在此不再赘述。In some embodiments, for the specific implementation of steps 301-304 and the technical effects brought about by them, reference may be made to steps 201-204 in the embodiment corresponding to FIG. 2 , which will not be repeated here.
步骤305,响应于接收到报告展示请求,将上述增量代码覆盖率报告发送至报告查询展示终端。
在一些实施例中,响应于接收到报告展示请求,上述执行主体(例如图1所示的电子设备101)可以将上述增量代码覆盖率报告发送至报告查询展示终端。其中,报告展示请求可以是用户所触发的请求。报告展示请求为请求展示增量代码覆盖率报告的请求。上述报告查询展示终端可以是支持展示增量代码覆盖率报告,以及查询增量代码覆盖率报告等功能的终端。In some embodiments, in response to receiving the report display request, the execution subject (such as the electronic device 101 shown in FIG. 1 ) may send the above incremental code coverage report to the report query display terminal. Wherein, the report display request may be a request triggered by a user. A report display request is a request to display an incremental code coverage report. The above report query display terminal may be a terminal that supports functions such as displaying incremental code coverage reports and querying incremental code coverage reports.
作为示例,如图4所示,报告查询展示终端的初始界面提供了可选择的“报告查询”和“报告创建”的选择项。当用户点击“报告查询”选择项时,报告查询展示终端会跳转到任务ID(Identity Document)输入页面。其中,任务ID为增量代码覆盖率报告的生成任务的任务标识。通过输入任务ID,报告查询展示终端可以实时展示任务ID对应的增量代码覆盖率报告。同样地,当用户点击“报告创建”选择项时,报告查询展示终端会跳转到源文件上传页面。报告查询展示终端存在用户可点击的“点击上传文件”按钮,支持用户上传对应的源文件。当报告查询展示终端接收到用户上传的源文件时,会在跳转界面来生成用户上传源文件对应的增量代码覆盖率报告,以及生成对应的任务ID。除此之外,通过用户点击报告查询展示终端中的“下载”按钮,可以下载上传源文件对应的增量代码覆盖率报告。As an example, as shown in FIG. 4 , the initial interface of the report query display terminal provides optional options of "report query" and "report creation". When the user clicks the "report query" option, the report query display terminal will jump to the task ID (Identity Document) input page. Wherein, the task ID is the task identifier of the generation task of the incremental code coverage report. By entering the task ID, the report query display terminal can display the incremental code coverage report corresponding to the task ID in real time. Similarly, when the user clicks the "report creation" option, the report query display terminal will jump to the source file upload page. There is a "click to upload file" button that users can click on the report query display terminal to support users to upload the corresponding source files. When the report query display terminal receives the source file uploaded by the user, it will generate the incremental code coverage report corresponding to the source file uploaded by the user in the jump interface, and generate the corresponding task ID. In addition, the incremental code coverage report corresponding to the uploaded source file can be downloaded by the user clicking the "Download" button in the report query display terminal.
从图3中可以看出,与图2对应的一些实施例的描述相比,图3对应的一些实施例中的报告生成方法的流程300依据报告展示请求,将增量代码覆盖率报告发送至报告查询展示终端。由此,这些实施例描述的方案通过报告查询展示终端实现了增量代码覆盖率报告可视化,可以清晰、直观的向用户展示增量代码的覆盖率情况,便于后续用户对目标源文件的测试用例进行调整。It can be seen from FIG. 3 that, compared with the description of some embodiments corresponding to FIG. 2 , the
进一步参考图5,作为对上述各图所示方法的实现,本公开提供了一种报告生成装置的一些实施例,这些装置实施例与图2所示的那些方法实施例相对应,该装置具体可以应用于各种电子设备中。Further referring to FIG. 5 , as an implementation of the methods shown in the above figures, the present disclosure provides some embodiments of a report generating device, and these device embodiments correspond to those method embodiments shown in FIG. 2 , and the device specifically It can be applied to various electronic devices.
如图5所示,一种报告生成装置500包括:第一生成单元501、确定单元502、第二生成单元503和第三生成单元504。其中,第一生成单元501,被配置成根据针对目标源文件的代码执行情况文件,生成覆盖率信息文本,其中,上述目标源文件为目标版本的源文件;确定单元502,被配置成确定变更代码行信息集,其中,上述变更代码行信息集中的变更代码行信息表征上述目标源文件与历史源文件的代码差异的位置信息,其中,上述历史源文件对应的版本早于上述目标版本;第二生成单元503,被配置成根据上述覆盖率信息文本,生成目标文本,其中,上述目标文本表征上述变更代码行信息集的覆盖率信息;第三生成单元504,被配置成根据上述目标文本,生成针对上述目标源文件的增量代码覆盖率报告。As shown in FIG. 5 , a
在一些实施例的一些可选的实现方式中,上述装置500还包括:发送单元(图中未显示)。其中,上述发送单元可以被配置成:响应于接收到报告展示请求,将上述增量代码覆盖率报告发送至报告查询展示终端。In some optional implementation manners of some embodiments, the foregoing
在一些实施例的一些可选的实现方式中,上述变更代码行信息集中的变更代码行信息包括:代码变换的文件的文件名称和变更代码行。In some optional implementation manners of some embodiments, the changed code line information in the above changed code line information set includes: the file name of the code transformed file and the changed code line.
在一些实施例的一些可选的实现方式中,上述装置500还包括:调整单元(图中未显示)。其中,上述调整单元可以被配置成:根据上述增量代码覆盖率报告,对上述目标源文件对应的测试用例进行调整。In some optional implementation manners of some embodiments, the foregoing
在一些实施例的一些可选的实现方式中,上述装置500中的第二生成单元503可以进一步被配置成:确定上述目标源文件中的、针对上述历史源文件的至少一个变更文件名称;根据上述至少一个变更文件名称和上述覆盖率信息文本,生成变更文本,其中,上述变更文本的文本内容为覆盖率信息文本内容中的、与上述至少一个变更文件名称相关联的内容,上述覆盖率信息文本内容为上述覆盖率信息文本的文本内容;根据上述变更文本、上述变更代码行信息集中的变更代码行信息包括的变更代码行和文件名称,生成上述目标文本。In some optional implementations of some embodiments, the
在一些实施例的一些可选的实现方式中,上述装置500中的第二生成单元503可以进一步被配置成:根据上述代码执行情况文件,确定代码分支信息和代码提交记录;根据上述代码分支信息和代码提交记录,生成上述至少一个变更文本名称。In some optional implementations of some embodiments, the
可以理解的是,该装置500中记载的诸单元与参考图2描述的方法中的各个步骤相对应。由此,上文针对方法描述的操作、特征以及产生的有益效果同样适用于装置500及其中包含的单元,在此不再赘述。It can be understood that the units recorded in the
下面参考图6,其示出了适于用来实现本公开的一些实施例的电子设备(例如图1中的电子设备101)600的结构示意图。图6示出的电子设备仅仅是一个示例,不应对本公开的实施例的功能和使用范围带来任何限制。Referring now to FIG. 6 , it shows a schematic structural diagram of an electronic device (such as the electronic device 101 in FIG. 1 ) 600 suitable for implementing some embodiments of the present disclosure. The electronic device shown in FIG. 6 is only an example, and should not limit the functions and scope of use of the embodiments of the present disclosure.
如图6所示,电子设备600可以包括处理装置(例如中央处理器、图形处理器等)601,其可以根据存储在只读存储器(ROM)602中的程序或者从存储装置608加载到随机访问存储器(RAM)603中的程序而执行各种适当的动作和处理。在RAM 603中,还存储有电子设备600操作所需的各种程序和数据。处理装置601、ROM 602以及RAM603通过总线604彼此相连。输入/输出(I/O)接口605也连接至总线604。As shown in FIG. 6, an
通常,以下装置可以连接至I/O接口605:包括例如触摸屏、触摸板、键盘、鼠标、摄像头、麦克风、加速度计、陀螺仪等的输入装置606;包括例如液晶显示器(LCD)、扬声器、振动器等的输出装置607;包括例如磁带、硬盘等的存储装置608;以及通信装置609。通信装置609可以允许电子设备600与其他设备进行无线或有线通信以交换数据。虽然图6示出了具有各种装置的电子设备600,但是应理解的是,并不要求实施或具备所有示出的装置。可以替代地实施或具备更多或更少的装置。图6中示出的每个方框可以代表一个装置,也可以根据需要代表多个装置。Typically, the following devices can be connected to the I/O interface 605:
特别地,根据本公开的一些实施例,上文参考流程图描述的过程可以被实现为计算机软件程序。例如,本公开的一些实施例包括一种计算机程序产品,其包括承载在计算机可读介质上的计算机程序,该计算机程序包含用于执行流程图所示的方法的程序代码。在这样的一些实施例中,该计算机程序可以通过通信装置609从网络上被下载和安装,或者从存储装置608被安装,或者从ROM 602被安装。在该计算机程序被处理装置601执行时,执行本公开的一些实施例的方法中限定的上述功能。In particular, according to some embodiments of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, some embodiments of the present disclosure include a computer program product, which includes a computer program carried on a computer-readable medium, where the computer program includes program codes for executing the methods shown in the flowcharts. In some such embodiments, the computer program may be downloaded and installed from a network via communication means 609 , or from storage means 608 , or from
需要说明的是,本公开的一些实施例上述的计算机可读介质可以是计算机可读信号介质或者计算机可读存储介质或者是上述两者的任意组合。计算机可读存储介质例如可以是——但不限于——电、磁、光、电磁、红外线、或半导体的系统、装置或器件,或者任意以上的组合。计算机可读存储介质的更具体的例子可以包括但不限于:具有一个或多个导线的电连接、便携式计算机磁盘、硬盘、随机访问存储器(RAM)、只读存储器(ROM)、可擦式可编程只读存储器(EPROM或闪存)、光纤、便携式紧凑磁盘只读存储器(CD-ROM)、光存储器件、磁存储器件、或者上述的任意合适的组合。在本公开的一些实施例中,计算机可读存储介质可以是任何包含或存储程序的有形介质,该程序可以被指令执行系统、装置或者器件使用或者与其结合使用。而在本公开的一些实施例中,计算机可读信号介质可以包括在基带中或者作为载波一部分传播的数据信号,其中承载了计算机可读的程序代码。这种传播的数据信号可以采用多种形式,包括但不限于电磁信号、光信号或上述的任意合适的组合。计算机可读信号介质还可以是计算机可读存储介质以外的任何计算机可读介质,该计算机可读信号介质可以发送、传播或者传输用于由指令执行系统、装置或者器件使用或者与其结合使用的程序。计算机可读介质上包含的程序代码可以用任何适当的介质传输,包括但不限于:电线、光缆、RF(射频)等等,或者上述的任意合适的组合。It should be noted that the above-mentioned computer-readable medium in some embodiments of the present disclosure may be a computer-readable signal medium or a computer-readable storage medium, or any combination of the above two. A computer readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to, electrical connections with one or more wires, portable computer diskettes, hard disks, random access memory (RAM), read-only memory (ROM), erasable Programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination of the above. In some embodiments of the present disclosure, a computer-readable storage medium may be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In some embodiments of the present disclosure, however, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code thereon. Such propagated data signals may take many forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the foregoing. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium, which can transmit, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device . Program code embodied on a computer readable medium may be transmitted by any appropriate medium, including but not limited to wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.
在一些实施方式中,客户端、服务器可以利用诸如HTTP(HyperText TransferProtocol,超文本传输协议)之类的任何当前已知或未来研发的网络协议进行通信,并且可以与任意形式或介质的数字数据通信(例如,通信网络)互连。通信网络的示例包括局域网(“LAN”),广域网(“WAN”),网际网(例如,互联网)以及端对端网络(例如,ad hoc端对端网络),以及任何当前已知或未来研发的网络。In some embodiments, the client and the server can communicate using any currently known or future-developed network protocols such as HTTP (HyperText Transfer Protocol, Hypertext Transfer Protocol), and can communicate with digital data in any form or medium (eg, communication network) interconnections. Examples of communication networks include local area networks ("LANs"), wide area networks ("WANs"), internetworks (e.g., the Internet), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future developed network of.
上述计算机可读介质可以是上述电子设备中所包含的;也可以是单独存在,而未装配入该电子设备中。上述计算机可读介质承载有一个或者多个程序,当上述一个或者多个程序被该电子设备执行时,使得该电子设备:根据针对目标源文件的代码执行情况文件,生成覆盖率信息文本,其中,上述目标源文件为目标版本的源文件;确定变更代码行信息集,其中,上述变更代码行信息集中的变更代码行信息表征上述目标源文件与历史源文件的代码差异的位置信息,其中,上述历史源文件对应的版本早于上述目标版本;根据上述覆盖率信息文本,生成目标文本,其中,上述目标文本表征上述变更代码行信息集的覆盖率信息;根据上述目标文本,生成针对上述目标源文件的增量代码覆盖率报告。The above-mentioned computer-readable medium may be included in the above-mentioned electronic device, or may exist independently without being incorporated into the electronic device. The above-mentioned computer-readable medium carries one or more programs, and when the above-mentioned one or more programs are executed by the electronic device, the electronic device: generates the coverage information text according to the code execution status file for the target source file, wherein , the above-mentioned target source file is the source file of the target version; determine the changed code line information set, wherein the changed code line information in the above-mentioned changed code line information set represents the location information of the code difference between the above-mentioned target source file and the historical source file, wherein, The version corresponding to the above historical source file is earlier than the above target version; according to the above coverage information text, generate the target text, wherein the above target text represents the coverage information of the above changed code line information set; according to the above target text, generate the above target text Incremental code coverage report for source files.
可以以一种或多种程序设计语言或其组合来编写用于执行本公开的一些实施例的操作的计算机程序代码,上述程序设计语言包括面向对象的程序设计语言—诸如Java、Smalltalk、C++,还包括常规的过程式程序设计语言—诸如“C”语言或类似的程序设计语言。程序代码可以完全地在用户计算机上执行、部分地在用户计算机上执行、作为一个独立的软件包执行、部分在用户计算机上部分在远程计算机上执行、或者完全在远程计算机或服务器上执行。在涉及远程计算机的情形中,远程计算机可以通过任意种类的网络——包括局域网(LAN)或广域网(WAN)——连接到用户计算机,或者,可以连接到外部计算机(例如利用因特网服务提供商来通过因特网连接)。Computer program code for carrying out operations of some embodiments of the present disclosure may be written in one or more programming languages, or combinations thereof, including object-oriented programming languages—such as Java, Smalltalk, C++, Also included are conventional procedural programming languages - such as the "C" language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user computer through any kind of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (for example, using an Internet service provider to connected via the Internet).
附图中的流程图和框图,图示了按照本公开各种实施例的系统、方法和计算机程序产品的可能实现的体系架构、功能和操作。在这点上,流程图或框图中的每个方框可以代表一个模块、程序段、或代码的一部分,该模块、程序段、或代码的一部分包含一个或多个用于实现规定的逻辑功能的可执行指令。也应当注意,在有些作为替换的实现中,方框中所标注的功能也可以以不同于附图中所标注的顺序发生。例如,两个接连地表示的方框实际上可以基本并行地执行,它们有时也可以按相反的顺序执行,这依所涉及的功能而定。也要注意的是,框图和/或流程图中的每个方框、以及框图和/或流程图中的方框的组合,可以用执行规定的功能或操作的专用的基于硬件的系统来实现,或者可以用专用硬件与计算机指令的组合来实现。The flowchart and block diagrams in the Figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in a flowchart or block diagram may represent a module, program segment, or portion of code that contains one or more logical functions for implementing specified executable instructions. It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or they may sometimes be executed in the reverse order, depending upon the functionality involved. It should also be noted that each block of the block diagrams and/or flowchart illustrations, and combinations of blocks in the block diagrams and/or flowchart illustrations, can be implemented by a dedicated hardware-based system that performs the specified functions or operations , or may be implemented by a combination of dedicated hardware and computer instructions.
描述于本公开的一些实施例中的单元可以通过软件的方式实现,也可以通过硬件的方式来实现。所描述的单元也可以设置在处理器中,例如,可以描述为:一种处理器包括第一生成单元、确定单元、第二生成单元和第三生成单元。其中,这些单元的名称在某种情况下并不构成对该单元本身的限定,例如,第一生成单元还可以被描述为“根据针对目标源文件的代码执行情况文件,生成覆盖率信息文本的单元”。The units described in some embodiments of the present disclosure may be realized by software or by hardware. The described units may also be set in a processor. For example, it may be described as: a processor includes a first generating unit, a determining unit, a second generating unit, and a third generating unit. Wherein, the names of these units do not constitute a limitation on the unit itself under certain circumstances. For example, the first generation unit can also be described as “generate the coverage information text according to the code execution status file for the target source file. unit".
本文中以上描述的功能可以至少部分地由一个或多个硬件逻辑部件来执行。例如,非限制性地,可以使用的示范类型的硬件逻辑部件包括:现场可编程门阵列(FPGA)、专用集成电路(ASIC)、专用标准产品(ASSP)、片上系统(SOC)、复杂可编程逻辑设备(CPLD)等等。The functions described herein above may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: Field Programmable Gate Arrays (FPGAs), Application Specific Integrated Circuits (ASICs), Application Specific Standard Products (ASSPs), System on Chips (SOCs), Complex Programmable Logical device (CPLD) and so on.
本公开的一些实施例还提供一种计算机程序产品,包括计算机程序,计算机程序在被处理器执行时实现上述的任一种报告生成方法。Some embodiments of the present disclosure also provide a computer program product, including a computer program, and when the computer program is executed by a processor, any one of the above report generation methods is implemented.
以上描述仅为本公开的一些较佳实施例以及对所运用技术原理的说明。本领域技术人员应当理解,本公开的实施例中所涉及的发明范围,并不限于上述技术特征的特定组合而成的技术方案,同时也应涵盖在不脱离上述发明构思的情况下,由上述技术特征或其等同特征进行任意组合而形成的其它技术方案。例如上述特征与本公开的实施例中公开的(但不限于)具有类似功能的技术特征进行互相替换而形成的技术方案。The above descriptions are only some preferred embodiments of the present disclosure and illustrations of the applied technical principles. Those skilled in the art should understand that the scope of the invention involved in the embodiments of the present disclosure is not limited to the technical solution formed by the specific combination of the above-mentioned technical features, but also covers the above-mentioned invention without departing from the above-mentioned inventive concept. Other technical solutions formed by any combination of technical features or equivalent features. For example, a technical solution formed by replacing the above-mentioned features with technical features having similar functions disclosed in (but not limited to) the embodiments of the present disclosure.
Claims (10)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202210789942.7A CN115292162A (en) | 2022-07-06 | 2022-07-06 | Report generation method, report generation device, report generation apparatus, report generation medium, and program product |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202210789942.7A CN115292162A (en) | 2022-07-06 | 2022-07-06 | Report generation method, report generation device, report generation apparatus, report generation medium, and program product |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| CN115292162A true CN115292162A (en) | 2022-11-04 |
Family
ID=83822655
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202210789942.7A Pending CN115292162A (en) | 2022-07-06 | 2022-07-06 | Report generation method, report generation device, report generation apparatus, report generation medium, and program product |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN115292162A (en) |
Citations (7)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20160299835A1 (en) * | 2015-04-08 | 2016-10-13 | Opshub, Inc. | Method and system for providing delta code coverage information |
| CN108197036A (en) * | 2018-02-06 | 2018-06-22 | 百度在线网络技术(北京)有限公司 | For determining the method and apparatus of the coverage rate information of incremental code |
| CN110532174A (en) * | 2019-07-24 | 2019-12-03 | 平安科技(深圳)有限公司 | Calculate method, apparatus, computer equipment and the storage medium of incremental code coverage rate |
| CN110928776A (en) * | 2019-11-15 | 2020-03-27 | 武汉极意网络科技有限公司 | Detection method, device and equipment for realizing incremental code coverage rate based on lcov |
| CN114116480A (en) * | 2021-11-26 | 2022-03-01 | 北京字节跳动网络技术有限公司 | Method, device, medium and equipment for determining application program test coverage rate |
| CN114253850A (en) * | 2021-12-20 | 2022-03-29 | 平安证券股份有限公司 | Code incremental coverage rate statistical method, device, equipment and storage medium |
| CN114490414A (en) * | 2022-02-15 | 2022-05-13 | 中信百信银行股份有限公司 | A method and device for acquiring method-level incremental code coverage |
-
2022
- 2022-07-06 CN CN202210789942.7A patent/CN115292162A/en active Pending
Patent Citations (7)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20160299835A1 (en) * | 2015-04-08 | 2016-10-13 | Opshub, Inc. | Method and system for providing delta code coverage information |
| CN108197036A (en) * | 2018-02-06 | 2018-06-22 | 百度在线网络技术(北京)有限公司 | For determining the method and apparatus of the coverage rate information of incremental code |
| CN110532174A (en) * | 2019-07-24 | 2019-12-03 | 平安科技(深圳)有限公司 | Calculate method, apparatus, computer equipment and the storage medium of incremental code coverage rate |
| CN110928776A (en) * | 2019-11-15 | 2020-03-27 | 武汉极意网络科技有限公司 | Detection method, device and equipment for realizing incremental code coverage rate based on lcov |
| CN114116480A (en) * | 2021-11-26 | 2022-03-01 | 北京字节跳动网络技术有限公司 | Method, device, medium and equipment for determining application program test coverage rate |
| CN114253850A (en) * | 2021-12-20 | 2022-03-29 | 平安证券股份有限公司 | Code incremental coverage rate statistical method, device, equipment and storage medium |
| CN114490414A (en) * | 2022-02-15 | 2022-05-13 | 中信百信银行股份有限公司 | A method and device for acquiring method-level incremental code coverage |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US9841969B2 (en) | Software development and distribution platform | |
| CN111291103B (en) | Interface data analysis method, device, electronic equipment and storage medium | |
| EP3465466A1 (en) | Resource allocation for database provisioning | |
| CN115391827B (en) | Log information storage method, device, device, computer readable medium and product | |
| CN113268761B (en) | Information encryption method, apparatus, electronic device and computer readable medium | |
| CN115470754A (en) | Data analysis method and device, computer readable medium and electronic equipment | |
| CN114281697A (en) | Method and device for generating test data | |
| CN115374187B (en) | Index data acquisition method and device, electronic equipment and computer readable medium | |
| WO2021115197A1 (en) | Method for generating device identifier, electronic device, and computer readable medium | |
| CN112035256A (en) | A resource allocation method, device, electronic device and medium | |
| CN116401173A (en) | Test case generation method and device, medium and electronic equipment | |
| CN114356176A (en) | Data acquisition method, data acquisition system, data acquisition equipment and data acquisition medium | |
| CN115996179A (en) | Service node testing method, device, readable medium and electronic equipment | |
| CN115292162A (en) | Report generation method, report generation device, report generation apparatus, report generation medium, and program product | |
| CN110730109A (en) | Method and apparatus for generating information | |
| WO2024160121A1 (en) | Data production method and apparatus, and medium and electronic device | |
| CN119127659A (en) | A test case generation method, device, equipment and storage medium | |
| CN116647545A (en) | Vehicle data joint debugging test method and device, electronic equipment and storage medium | |
| CN115951879A (en) | Template code generation method, device, system, medium and electronic device | |
| WO2022179470A1 (en) | Timer processing method and apparatus, electronic device, and computer readable storage medium | |
| CN112115154A (en) | Data processing and data query method, device, equipment and computer readable medium | |
| CN112100159A (en) | Data processing method and device, electronic equipment and computer readable medium | |
| CN111835846B (en) | Information updating method and device and electronic equipment | |
| KR20250041545A (en) | Software development and platform | |
| CN118916073A (en) | Data configuration method, device, readable medium, electronic equipment and program product |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination |