[go: up one dir, main page]

CN115203004A - Code coverage test method, device, storage medium and electronic device - Google Patents

Code coverage test method, device, storage medium and electronic device Download PDF

Info

Publication number
CN115203004A
CN115203004A CN202110379033.1A CN202110379033A CN115203004A CN 115203004 A CN115203004 A CN 115203004A CN 202110379033 A CN202110379033 A CN 202110379033A CN 115203004 A CN115203004 A CN 115203004A
Authority
CN
China
Prior art keywords
function
coverage
file
information
code
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
Application number
CN202110379033.1A
Other languages
Chinese (zh)
Inventor
史倩月
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing ByteDance Network Technology Co Ltd
Original Assignee
Beijing ByteDance Network Technology Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Beijing ByteDance Network Technology Co Ltd filed Critical Beijing ByteDance Network Technology Co Ltd
Priority to CN202110379033.1A priority Critical patent/CN115203004A/en
Publication of CN115203004A publication Critical patent/CN115203004A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Prevention of errors by analysis, debugging or testing of software
    • G06F11/3668Testing of software
    • G06F11/3672Test management
    • G06F11/3676Test management for coverage analysis

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

本公开涉及一种代码覆盖率测试方法、装置、存储介质及电子设备,以减少代码覆盖率测试过程中的时延和内存消耗。该方法包括:响应于接收到覆盖数据文件,解析覆盖数据文件,得到覆盖数据文件对应的函数覆盖信息,该函数覆盖信息包括函数对应的函数名和覆盖次数;根据函数覆盖信息和第一函数文件映射关系,确定函数覆盖信息对应的文件覆盖信息;从代码项目仓库获取源码文件相较于历史源码文件的修改文件信息,并根据修改文件信息在文件覆盖信息中确定目标文件覆盖信息;确定目标文件覆盖信息对应的函数实体信息,并根据覆盖次数和函数实体信息,确定覆盖数据文件的行覆盖率。

Figure 202110379033

The present disclosure relates to a code coverage test method, device, storage medium and electronic device, so as to reduce the time delay and memory consumption in the code coverage test process. The method includes: in response to receiving the coverage data file, parsing the coverage data file to obtain function coverage information corresponding to the coverage data file, the function coverage information including the function name and coverage times corresponding to the function; mapping according to the function coverage information and the first function file relationship, determine the file coverage information corresponding to the function coverage information; obtain the modified file information of the source code file compared to the historical source code file from the code project repository, and determine the target file coverage information in the file coverage information according to the modified file information; determine the target file coverage The function entity information corresponding to the information, and the line coverage rate of the coverage data file is determined according to the coverage times and the function entity information.

Figure 202110379033

Description

代码覆盖率测试方法、装置、存储介质及电子设备Code coverage test method, device, storage medium and electronic device

技术领域technical field

本公开涉及测试技术领域,具体地,涉及一种代码覆盖率测试方法、装置、存储介质及电子设备。The present disclosure relates to the field of testing technologies, and in particular, to a code coverage testing method, apparatus, storage medium, and electronic device.

背景技术Background technique

代码覆盖率是测试对代码覆盖程度的重要体现,能够在移动设备运行完成后统计代码的执行情况。相关技术中,代码覆盖率的测试主要依赖于开源工具,先聚合多个覆盖数据文件,然后解析聚合的文件,并加载完整源码文件,再结合解析后的聚合文件和完整源码文件生成全量覆盖率,最后进行解析映射得到增量覆盖率。但是,此种方式生成覆盖率报告,强依赖于原生工具的环境和完整源码文件的获取。并且,由于原生工具的限制,上传覆盖数据文件后,必须要先进行聚合数据的步骤,然后解析聚合的文件,实时性很弱。当并发较高时,计算需要加载全部源文件和数据文件,占用内存消耗大。The code coverage rate is an important reflection of the degree of code coverage by the test, and it can count the execution of the code after the mobile device runs. In related technologies, the test of code coverage mainly relies on open source tools. First, multiple coverage data files are aggregated, then the aggregated files are parsed, the complete source code files are loaded, and the full coverage is generated by combining the parsed aggregate files and complete source code files. , and finally parse and map to get incremental coverage. However, generating coverage reports in this way strongly depends on the native tool environment and the acquisition of complete source code files. Moreover, due to the limitation of native tools, after uploading the overlay data file, it is necessary to perform the step of aggregating data first, and then parse the aggregated file, which is very weak in real-time. When the concurrency is high, the calculation needs to load all the source files and data files, which consumes a lot of memory.

发明内容SUMMARY OF THE INVENTION

提供该发明内容部分以便以简要的形式介绍构思,这些构思将在后面的具体实施方式部分被详细描述。该发明内容部分并不旨在标识要求保护的技术方案的关键特征或必要特征,也不旨在用于限制所要求的保护的技术方案的范围。This Summary is provided to introduce concepts in a simplified form that are described in detail in the Detailed Description section that follows. This summary section is not intended to identify 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.

第一方面,本公开提供一种代码覆盖率测试方法,所述方法包括:In a first aspect, the present disclosure provides a code coverage testing method, the method comprising:

响应于接收到覆盖数据文件,解析所述覆盖数据文件,得到所述覆盖数据文件对应的函数覆盖信息,所述函数覆盖信息包括函数对应的函数名和覆盖次数;In response to receiving the coverage data file, parsing the coverage data file to obtain function coverage information corresponding to the coverage data file, where the function coverage information includes a function name and coverage times corresponding to the function;

根据所述函数覆盖信息和第一函数文件映射关系,确定所述函数覆盖信息对应的文件覆盖信息,所述第一函数文件映射关系用于表征源码文件对应的插桩产物中函数与函数文件间的对应关系;Determine the file coverage information corresponding to the function coverage information according to the function coverage information and the first function file mapping relationship, where the first function file mapping relationship is used to represent the function and the function file in the instrumentation product corresponding to the source code file. the corresponding relationship;

从代码项目仓库获取所述源码文件相较于历史源码文件的修改文件信息,并根据所述修改文件信息在所述文件覆盖信息中确定目标文件覆盖信息;Obtain the modified file information of the source code file compared to the historical source code file from the code project warehouse, and determine the target file coverage information in the file coverage information according to the modified file information;

确定所述目标文件覆盖信息对应的函数实体信息,并根据所述覆盖次数和所述函数实体信息,确定所述覆盖数据文件的行覆盖率。Determine the function entity information corresponding to the target file coverage information, and determine the line coverage rate of the coverage data file according to the coverage times and the function entity information.

第二方面,本公开提供一种代码覆盖率测试装置,所述装置包括:In a second aspect, the present disclosure provides a code coverage testing device, the device comprising:

解析模块,用于响应于接收到覆盖数据文件,解析所述覆盖数据文件,得到所述覆盖数据文件对应的函数覆盖信息,所述函数覆盖信息包括函数对应的函数名和覆盖次数;A parsing module, configured to parse the coverage data file in response to receiving the coverage data file, and obtain function coverage information corresponding to the coverage data file, where the function coverage information includes the function name and coverage times corresponding to the function;

第一确定模块,用于根据所述函数覆盖信息和第一函数文件映射关系,确定所述函数覆盖信息对应的文件覆盖信息,所述第一函数文件映射关系用于表征源码文件对应的插桩产物中函数与函数文件间的对应关系;A first determining module, configured to determine the file coverage information corresponding to the function coverage information according to the function coverage information and the first function file mapping relationship, where the first function file mapping relationship is used to represent the instrumentation corresponding to the source code file Correspondence between functions and function files in the product;

第二确定模块,用于从代码项目仓库获取到的所述源码文件相较于历史源码文件的修改文件信息,并根据所述修改文件信息在所述文件覆盖信息中确定目标文件覆盖信息;A second determining module, configured to compare the modified file information of the source code file obtained from the code project repository with the historical source code file, and determine target file coverage information in the file coverage information according to the modified file information;

第三确定模块,用于确定所述目标文件覆盖信息对应的函数实体信息,并根据所述覆盖次数和所述函数实体信息,确定所述覆盖数据文件的行覆盖率。The third determining module is configured to determine the function entity information corresponding to the target file coverage information, and determine the line coverage rate of the coverage data file according to the coverage times and the function entity information.

第三方面,本公开提供一种计算机可读介质,其上存储有计算机程序,该程序被处理装置执行时实现第一方面中所述方法的步骤。In a third aspect, the present disclosure provides a computer-readable medium on which a computer program is stored, and when the program is executed by a processing apparatus, implements the steps of the method described in the first aspect.

第四方面,本公开提供一种电子设备,包括:In a fourth aspect, the present disclosure provides an electronic device, comprising:

存储装置,其上存储有计算机程序;a storage device on which a computer program is stored;

处理装置,用于执行所述存储装置中的所述计算机程序,以实现第一方面中所述方法的步骤。A processing device is configured to execute the computer program in the storage device to implement the steps of the method in the first aspect.

通过上述技术方案,可以不依赖原生工具对覆盖数据文件进行解析,因此可以响应于接收到覆盖数据文件则解析覆盖数据文件,实现上传文件即解析,相较于依赖原生工具的方式,可以省去文件聚合的步骤,从而减少代码覆盖率测试过程中的时延。并且,可以根据文件覆盖信息与从代码项目仓库获取到的修改文件信息,筛选出增量文件覆盖信息,从而根据该增量文件覆盖信息确定行覆盖率,省去了全量覆盖率的生成,无需加载完整源码文件,不仅可以进一步减少时延,而且可以减少内存消耗。Through the above technical solution, the overlay data file can be parsed without relying on native tools, so the overlay data file can be parsed in response to receiving the overlay data file, and the uploaded file can be parsed. Compared with relying on native tools, it is possible to save the The steps of file aggregation, thereby reducing the delay in the code coverage testing process. In addition, the incremental file coverage information can be filtered out according to the file coverage information and the modified file information obtained from the code project repository, so as to determine the line coverage rate according to the incremental file coverage information, eliminating the need to generate the full coverage rate. Loading complete source files can not only further reduce latency, but also reduce memory consumption.

本公开的其他特征和优点将在随后的具体实施方式部分予以详细说明。Other features and advantages of the present disclosure will be described in detail in the detailed description that follows.

附图说明Description of drawings

结合附图并参考以下具体实施方式,本公开各实施例的上述和其他特征、优点及方面将变得更加明显。贯穿附图中,相同或相似的附图标记表示相同或相似的元素。应当理解附图是示意性的,原件和元素不一定按照比例绘制。在附图中:The above and other features, advantages and aspects of various embodiments of the present disclosure will become more apparent when taken in conjunction with the accompanying drawings and with reference to the following detailed description. Throughout the drawings, the same or similar reference numbers refer to the same or similar elements. It should be understood that the drawings are schematic and that the originals and elements are not necessarily drawn to scale. In the attached image:

图1是相关技术中代码覆盖率测试方法的过程示意图;Fig. 1 is the process schematic diagram of the code coverage test method in the related art;

图2是根据本公开一示例性实施例示出的一种代码覆盖率测试方法的流程图;2 is a flowchart of a code coverage testing method according to an exemplary embodiment of the present disclosure;

图3是根据本公开一示例性实施例示出的一种代码覆盖率测试方法中解析插桩产物得到函数文件映射关系的过程示意图;3 is a schematic diagram of a process of parsing an instrumentation product to obtain a function file mapping relationship in a code coverage testing method according to an exemplary embodiment of the present disclosure;

图4是根据本公开一示例性实施例示出的一种代码覆盖率测试方法中得到的函数文件映射关系示意图;4 is a schematic diagram of a function file mapping relationship obtained in a code coverage test method according to an exemplary embodiment of the present disclosure;

图5是根据本公开一示例性实施例示出的一种代码覆盖率测试方法中根据函数文件映射关系确定覆盖数据文件行覆盖率的过程示意图;5 is a schematic diagram of a process of determining the line coverage of a coverage data file according to a function file mapping relationship in a code coverage test method according to an exemplary embodiment of the present disclosure;

图6是根据本公开另一示例性实施例示出的一种代码覆盖率测试方法的过程示意图;6 is a schematic process diagram of a code coverage testing method according to another exemplary embodiment of the present disclosure;

图7是根据本公开一示例性实施例示出的一种代码覆盖率测试装置的框图;7 is a block diagram of a code coverage testing apparatus according to an exemplary embodiment of the present disclosure;

图8是根据本公开一示例性实施例示出的一种电子设备的框图。Fig. 8 is a block diagram of an electronic device according to an exemplary embodiment of the present disclosure.

具体实施方式Detailed ways

下面将参照附图更详细地描述本公开的实施例。虽然附图中显示了本公开的某些实施例,然而应当理解的是,本公开可以通过各种形式来实现,而且不应该被解释为限于这里阐述的实施例,相反提供这些实施例是为了更加透彻和完整地理解本公开。应当理解的是,本公开的附图及实施例仅用于示例性作用,并非用于限制本公开的保护范围。Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While certain embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be construed as limited to the embodiments set forth herein, but rather are provided for the purpose of A more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes, and are not intended to limit the protection scope of the present disclosure.

应当理解,本公开的方法实施方式中记载的各个步骤可以按照不同的顺序执行,和/或并行执行。此外,方法实施方式可以包括附加的步骤和/或省略执行示出的步骤。本公开的范围在此方面不受限制。It should be understood that the various steps described in the method embodiments of the present disclosure may be performed in different orders and/or in parallel. Furthermore, method embodiments may include additional steps and/or omit performing the illustrated steps. The scope of the present disclosure is not limited in this regard.

本文使用的术语“包括”及其变形是开放性包括,即“包括但不限于”。术语“基于”是“至少部分地基于”。术语“一个实施例”表示“至少一个实施例”;术语“另一实施例”表示“至少一个另外的实施例”;术语“一些实施例”表示“至少一些实施例”。其他术语的相关定义将在下文描述中给出。As used herein, the term "including" and variations thereof are open-ended inclusions, ie, "including but not limited to". The term "based on" is "based at least in part on." The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". Relevant definitions of other terms will be given in the description below.

需要注意,本公开中提及的“第一”、“第二”等概念仅用于对不同的装置、模块或单元进行区分,并非用于限定这些装置、模块或单元所执行的功能的顺序或者相互依存关系。另外需要注意,本公开中提及的“一个”、“多个”的修饰是示意性而非限制性的,本领域技术人员应当理解,除非在上下文另有明确指出,否则应该理解为“一个或多个”。It should be noted that concepts such as "first" and "second" mentioned in the present disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order of functions performed by these devices, modules or units or interdependence. In addition, it should be noted that the modifications of "a" and "a plurality" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless the context clearly indicates otherwise, they should be understood as "a" or more".

本公开实施方式中的多个装置之间所交互的消息或者信息的名称仅用于说明性的目的,而并不是用于对这些消息或信息的范围进行限制。The names of messages or information exchanged between multiple devices in the embodiments of the present disclosure are only for illustrative purposes, and are not intended to limit the scope of these messages or information.

代码覆盖率是测试对代码覆盖程度的重要体现,能够在移动设备运行完成后统计代码的执行情况。参照图1,相关技术中代码覆盖率的测试主要依赖于开源工具,先聚合从客户端上传的多个覆盖数据文件,然后解析聚合的文件,并加载完整源码文件,再结合解析后的聚合文件和完整源码文件生成全量覆盖率,最后进行解析映射得到增量覆盖率。但是,此种方式生成覆盖率报告,强依赖于原生工具的环境和完整源码文件的获取。并且,由于原生工具的限制,上传覆盖数据文件后,必须要先进行聚合数据的步骤,然后解析聚合的文件,实时性很弱。当并发较高时,计算需要加载全部源文件和数据文件,占用内存消耗大。The code coverage rate is an important reflection of the degree of code coverage by the test, and it can count the execution of the code after the mobile device runs. Referring to Figure 1, the test of code coverage in related technologies mainly relies on open source tools. First, multiple coverage data files uploaded from the client are aggregated, then the aggregated files are parsed, the complete source code files are loaded, and the parsed aggregated files are combined. Generate full coverage with the complete source code file, and finally parse and map to obtain incremental coverage. However, generating coverage reports in this way strongly depends on the native tool environment and the acquisition of complete source code files. Moreover, due to the limitation of native tools, after uploading the overlay data file, it is necessary to perform the step of aggregating data first, and then parse the aggregated file, which is very weak in real-time. When the concurrency is high, the calculation needs to load all the source files and data files, which consumes a lot of memory.

有鉴于此,本公开提供一种代码覆盖率测试方法、装置、存储介质及电子设备,以减少代码覆盖率测试过程中的时延和内存消耗。In view of this, the present disclosure provides a code coverage testing method, apparatus, storage medium and electronic device to reduce time delay and memory consumption during code coverage testing.

图2是根据本公开实施例提出的一种代码覆盖率测试方法的流程图。参照图2,该代码覆盖率测试方法包括:FIG. 2 is a flowchart of a code coverage testing method proposed according to an embodiment of the present disclosure. Referring to Figure 2, the code coverage testing method includes:

步骤201,响应于接收到覆盖数据文件,解析覆盖数据文件,得到覆盖数据文件对应的函数覆盖信息。该函数覆盖信息包括函数对应的函数名和覆盖次数。Step 201, in response to receiving the coverage data file, parse the coverage data file to obtain function coverage information corresponding to the coverage data file. The function coverage information includes the function name and coverage times corresponding to the function.

示例地,覆盖数据文件是客户端响应于用户操作生成的,可以表征用户操作所覆盖的代码情况。客户端可以将每次用户操作生成的覆盖数据文件上传至代码覆盖率测试设备。其中,客户端可以是安装有IOS移动操作系统的电子设备。代码覆盖率测试设备可以是服务器设备,本公开实施例对此不作限定。代码覆盖率测试设备可以响应于接收到覆盖数据文件,解析该覆盖数据文件,以得到该覆盖数据文件对应的函数覆盖信息。该函数覆盖信息包括覆盖数据文件中函数对应的函数名和覆盖次数。其中,覆盖次数用于表征函数中每一行代码的执行次数。应当理解的是,解析覆盖数据文件得到的函数覆盖信息是粗略表示代码覆盖情况,为了得到更加精细的代码覆盖率数据,还需执行后续步骤。For example, the coverage data file is generated by the client in response to the user operation, and can represent the code situation covered by the user operation. The client can upload the coverage data file generated by each user operation to the code coverage testing device. Wherein, the client may be an electronic device installed with an IOS mobile operating system. The code coverage testing device may be a server device, which is not limited in this embodiment of the present disclosure. The code coverage testing device may, in response to receiving the coverage data file, parse the coverage data file to obtain function coverage information corresponding to the coverage data file. The function coverage information includes the function name and coverage times corresponding to the function in the coverage data file. Among them, the number of coverage is used to represent the number of executions of each line of code in the function. It should be understood that the function coverage information obtained by parsing the coverage data file roughly represents the code coverage situation. In order to obtain more detailed code coverage data, subsequent steps need to be performed.

步骤202,根据函数覆盖信息和第一函数文件映射关系,确定函数覆盖信息对应的文件覆盖信息。该第一函数文件映射关系用于表征源码文件对应的插桩产物中函数与函数文件间的对应关系。Step 202: Determine the file coverage information corresponding to the function coverage information according to the mapping relationship between the function coverage information and the first function file. The first function file mapping relationship is used to represent the corresponding relationship between the function and the function file in the instrumentation product corresponding to the source code file.

示例地,多个函数可以组成一个函数文件,实际应用中函数的数量众多,函数文件的数量相对较少。因此,本公开实施例中根据函数覆盖信息和第一函数文件映射关系,确定函数覆盖信息对应的文件覆盖信息,将处理维度从函数维度转换成文件维度,以提高后续过程的处理效率。For example, multiple functions may form a function file. In practical applications, the number of functions is large, and the number of function files is relatively small. Therefore, in the embodiment of the present disclosure, the file coverage information corresponding to the function coverage information is determined according to the mapping relationship between the function coverage information and the first function file, and the processing dimension is converted from the function dimension to the file dimension, so as to improve the processing efficiency of the subsequent process.

步骤203,从代码项目仓库获取源码文件相较于历史源码文件的修改文件信息,并根据修改文件信息在文件覆盖信息中确定目标文件覆盖信息。In step 203, the modified file information of the source code file compared with the historical source code file is obtained from the code project repository, and the target file coverage information is determined in the file coverage information according to the modified file information.

示例地,代码项目仓库比如可以是gitlab等,本公开实施例对此不作限定。代码项目仓库可以记录开发人员每次提交的代码版本情况。因此,可以从代码项目仓库获取到最新源码文件相较于历史源码文件的修改文件信息,即可以获取到本次版本修改的源码文件信息,从而根据该修改文件信息,可以从文件覆盖信息中过滤出与本次修改的函数信息相关的目标文件覆盖信息,进而加载增量代码对应的函数实体信息实现覆盖率检测。For example, the code project repository may be, for example, gitlab, which is not limited in this embodiment of the present disclosure. The code project repository can record the code version submitted by developers each time. Therefore, the modified file information of the latest source code file compared to the historical source code file can be obtained from the code project repository, that is, the source code file information modified in this version can be obtained, so that according to the modified file information, the file coverage information can be filtered from the file coverage information. The target file coverage information related to the function information modified this time is obtained, and then the function entity information corresponding to the incremental code is loaded to realize coverage detection.

步骤204,确定目标文件覆盖信息对应的函数实体信息,并根据覆盖次数和函数实体信息,确定覆盖数据文件的行覆盖率。Step 204: Determine the function entity information corresponding to the target file coverage information, and determine the line coverage rate of the coverage data file according to the coverage times and the function entity information.

示例地,覆盖次数可以表征函数中每一行代码的执行次数,可以通过覆盖次数数组进行表示。比如,第一函数的覆盖次数数组为[2,5,3],则表示第一函数中第一行代码被执行2次,第二行代码被执行5次,第三行代码被执行3次。函数实体信息用于表征目标文件覆盖信息中每一函数文件对应的函数名、函数代码块的起始位置信息等。通过LLVM(LowLevel Virtual Machine,底层虚拟机)工具可以根据覆盖次数和对应的函数实体信息,确定覆盖数据文件的行覆盖率。For example, the coverage times can represent the execution times of each line of code in the function, which can be represented by an array of coverage times. For example, if the coverage count array of the first function is [2, 5, 3], it means that the first line of code in the first function is executed 2 times, the second line of code is executed 5 times, and the third line of code is executed 3 times . The function entity information is used to represent the function name corresponding to each function file in the target file coverage information, the starting position information of the function code block, and the like. The LLVM (LowLevel Virtual Machine, low-level virtual machine) tool can determine the line coverage rate of the coverage data file according to the coverage times and the corresponding function entity information.

通过上述方式,可以不依赖原生工具对覆盖数据文件进行解析,因此可以响应于接收到覆盖数据文件则解析覆盖数据文件,实现上传文件即解析,相较于依赖原生工具的方式,可以省去文件聚合的步骤,从而减少代码覆盖率测试过程中的时延。并且,可以根据文件覆盖信息与从代码项目仓库获取到的修改文件信息,筛选出增量文件覆盖信息,从而根据该增量文件覆盖信息确定行覆盖率,省去了全量覆盖率的生成,无需加载完整源码文件,不仅可以进一步减少时延,而且可以减少内存消耗。Through the above method, the overlay data file can be parsed without relying on native tools. Therefore, the overlay data file can be parsed in response to receiving the overlay data file, so that the uploaded file can be parsed. Compared with the method of relying on native tools, the file can be omitted. Aggregate steps to reduce latency during code coverage testing. In addition, the incremental file coverage information can be filtered out according to the file coverage information and the modified file information obtained from the code project repository, so as to determine the line coverage rate according to the incremental file coverage information, eliminating the need to generate the full coverage rate. Loading complete source files can not only further reduce latency, but also reduce memory consumption.

为了使得本领域技术人员更加理解本公开提供的代码覆盖率测试方法,下面对上述各步骤进行详细举例说明。In order to make those skilled in the art better understand the code coverage testing method provided by the present disclosure, the above steps are illustrated in detail below.

在可能的方式中,函数文件映射关系可以通过如下方式得到的:解析源码文件对应的插桩产物,得到源码文件中所有函数的函数名和函数属性信息,该函数属性信息包括函数代码块信息,解析函数代码块信息,得到源码文件中每一函数所属的函数文件信息以及每一函数对应的代码块在所属函数文件中的位置信息,根据源码文件中每一函数的函数名称、每一函数所属的函数文件信息以及每一函数对应的代码块在所属函数文件中的位置信息,建立函数文件映射关系。In a possible way, the function file mapping relationship can be obtained by: parsing the instrumentation product corresponding to the source code file, and obtaining the function name and function attribute information of all functions in the source code file, the function attribute information includes function code block information, parsing Function code block information, obtain the function file information of each function in the source code file and the location information of the code block corresponding to each function in the function file to which it belongs. The function file information and the location information of the code block corresponding to each function in the function file to which it belongs are used to establish the function file mapping relationship.

应当理解的是,程序插桩是在保证被测程序原有逻辑完整性的基础上在程序中插入一些探针(又称为“探测仪”,本质上就是进行信息采集的代码段,可以是赋值语句或采集覆盖信息的函数调用),通过探针的执行并抛出程序运行的特征数据,通过对这些数据的分析,可以获得程序的控制流和数据流信息,进而得到逻辑覆盖等动态信息。本公开实施例中,插桩产物可以是对源码文件进行插桩处理后对源码文件进行编译得到的结果。当源码文件发生修改时,该插桩产物对应变更。It should be understood that program instrumentation is to insert some probes (also known as "probes") into the program on the basis of ensuring the original logic integrity of the program under test, which is essentially a code segment for information collection, which can be Assignment statement or function call to collect coverage information), through the execution of the probe and throw out the characteristic data of the program running, through the analysis of these data, the control flow and data flow information of the program can be obtained, and then dynamic information such as logic coverage can be obtained. . In the embodiment of the present disclosure, the instrumentation product may be a result obtained by compiling the source code file after performing the instrumentation process on the source code file. When the source code file is modified, the instrumentation product changes accordingly.

示例地,打包平台打包出二进制插桩产物后,在首次有覆盖数据文件上传时,可以解析该插桩产物,以得到函数文件映射关系。由此,在源码文件未发生修改的情况下,进行一次解析即可在后续过程中随时使用该函数文件映射关系进行代码覆盖率测试,减少了代码覆盖率测试对源码文件的依赖。For example, after the packaging platform has packaged the binary instrumentation product, when the coverage data file is uploaded for the first time, the instrumentation product can be parsed to obtain the function file mapping relationship. Therefore, when the source code file is not modified, the function file mapping relationship can be used at any time in the subsequent process to perform code coverage test after one analysis, which reduces the dependence of the code coverage test on the source code file.

示例地,参照图3,解析源码文件对应的插桩产物,可以得到源码文件中所有函数的函数名和函数属性信息。通过函数名可以计算该函数哈希值进行存储,便于后续可能的计算处理。通过函数属性信息可以解析得到函数代码块信息、函数关联文件信息、函数所属函数文件的文件索引。然后,可以解析函数代码块信息,以得到函数所属的函数文件信息和函数对应的代码块在所属函数文件中的起始位置信息。由此,可以得到每一函数对应的函数文件信息,该函数文件信息包括函数的函数名称、每一函数所属的函数文件信息以及每一函数对应的代码块在所属函数文件中的位置信息。然后,可以根据每一函数的函数文件信息,可以建立函数文件映射关系。For example, referring to FIG. 3 , by analyzing the instrumentation product corresponding to the source code file, function names and function attribute information of all functions in the source code file can be obtained. The hash value of the function can be calculated and stored through the function name, which is convenient for subsequent possible calculation processing. The function code block information, the function associated file information, and the file index of the function file to which the function belongs can be obtained by parsing the function attribute information. Then, the function code block information can be parsed to obtain the function file information to which the function belongs and the starting position information of the code block corresponding to the function in the function file to which the function belongs. Thereby, function file information corresponding to each function can be obtained, and the function file information includes the function name of the function, the function file information to which each function belongs, and the location information of the code block corresponding to each function in the function file to which it belongs. Then, the function file mapping relationship can be established according to the function file information of each function.

例如,参照图4,根据函数文件信息,可以建立第一函数文件映射关系和第二函数文件映射关系。其中,第一函数文件映射关系用于表征函数与函数文件间的对应关系,第二函数文件映射关系用于表征函数文件与函数实体信息间的对应关系。在实际应用中,第一函数文件映射关系可以保存在云端供后续解析使用,第二函数文件映射关系可以保存在数据库,便于后续过程中快速获取文件覆盖信息对应的函数实体信息。For example, referring to FIG. 4 , according to the function file information, a first function file mapping relationship and a second function file mapping relationship can be established. The first function file mapping relationship is used to represent the corresponding relationship between the function and the function file, and the second function file mapping relationship is used to represent the corresponding relationship between the function file and the function entity information. In practical applications, the first function file mapping relationship can be stored in the cloud for subsequent analysis, and the second function file mapping relationship can be stored in the database, so that the function entity information corresponding to the file coverage information can be quickly obtained in the subsequent process.

应当理解的是,解析源码文件对应的插桩产物,可以是解析当前版本下最新源码文件对应的插桩产物。由此得到的函数文件映射关系可以用于全量覆盖率和增量覆盖率的生成,满足不同的应用场景需求。或者,可以先从代码项目仓库获取本次版本修改的文件信息,然后解析与本次版本修改相关的文件信息所对应的插桩产物。由此可以减少函数文件映射关系的存储量。It should be understood that parsing the instrumentation product corresponding to the source code file may be parsing the instrumentation product corresponding to the latest source code file in the current version. The function file mapping relationship thus obtained can be used to generate full coverage and incremental coverage to meet the needs of different application scenarios. Alternatively, you can first obtain the file information modified in this version from the code project repository, and then parse the instrumentation product corresponding to the file information related to the modification in this version. Thereby, the storage amount of the function file mapping relationship can be reduced.

在可能的方式中,解析覆盖数据文件,得到覆盖数据文件对应的函数覆盖信息可以是:解析覆盖数据文件,得到覆盖数据文件中所有函数的函数信息,并从函数信息中过滤未包括在第一函数文件映射关系中的函数信息,以得到覆盖数据文件对应的函数覆盖信息。In a possible manner, parsing the coverage data file to obtain the function coverage information corresponding to the coverage data file may be: parsing the coverage data file, obtaining the function information of all functions in the coverage data file, and filtering the function information not included in the first Function information in the function file mapping relationship to obtain function coverage information corresponding to the coverage data file.

相关技术中解析聚合后的覆盖数据文件,需要先读取每一覆盖数据文件对应的头部信息,然后根据头部信息获取文件版本,再针对不同的文件版本进行不同的解析逻辑。本公开实施例中,也可以先读取覆盖数据文件的头部信息,并根据头部信息获取覆盖数据文件的版本,再处理不同版本的覆盖数据文件。具体地,针对不同版本的覆盖数据文件,均可以先解析该覆盖数据文件中所有函数的函数信息,然后在所有函数信息中过滤未包括在第一函数文件映射关系中的函数信息。然后,针对过滤后的函数信息,可以根据该函数信息对应的函数名读取对应的函数覆盖次数数组,从而得到包括函数名和函数覆盖次数数组的函数覆盖信息。To parse the aggregated overlay data files in the related art, it is necessary to first read the header information corresponding to each overlay data file, then obtain the file version according to the header information, and then perform different parsing logics for different file versions. In the embodiment of the present disclosure, the header information of the overlay data file may also be read first, and the version of the overlay data file may be acquired according to the header information, and then the overlay data files of different versions may be processed. Specifically, for coverage data files of different versions, function information of all functions in the coverage data file may be parsed first, and then function information not included in the mapping relationship of the first function file is filtered from all function information. Then, for the filtered function information, the corresponding function coverage times array can be read according to the function name corresponding to the function information, so as to obtain the function coverage information including the function name and the function coverage times array.

应当理解的是,在测试过程中,用户操作覆盖的代码中可能包括源代码插桩产物中不存在的函数,通过上述方式可以过滤这些无效的函数,提高解析效率,从而提高覆盖率的检测效率。在此之后,用户操作覆盖的代码中可能还包括与本次版本修改不相关的代码,因此为了实现增量代码的覆盖率测试,还可以根据第一函数文件映射关系,从文件维度进行过滤,进一步提高处理效率,减小代码覆盖率测试过程中的时延和内存消耗。It should be understood that, in the testing process, the code covered by user operations may include functions that do not exist in the source code instrumentation products. These invalid functions can be filtered through the above method, the parsing efficiency can be improved, and the coverage detection efficiency can be improved. . After that, the code covered by the user operation may also include code that is not related to the revision of this version. Therefore, in order to implement the coverage test of the incremental code, you can also filter from the file dimension according to the first function file mapping relationship. Further improve processing efficiency and reduce latency and memory consumption during code coverage testing.

示例地,可以先根据函数覆盖信息和第一函数文件映射关系,确定函数覆盖信息对应的文件覆盖信息。然后,根据从代码项目仓库获取到的最新源码文件相较于历史源码文件的修改文件信息,在文件覆盖信息中确定目标文件覆盖信息。由此,可以过滤与本次修改无关的文件覆盖信息。之后,可以确定目标文件覆盖信息对应的函数实体信息,从而根据该函数实体信息实现增量代码的覆盖率测试。For example, the file coverage information corresponding to the function coverage information may be determined according to the mapping relationship between the function coverage information and the first function file. Then, the target file coverage information is determined in the file coverage information according to the modified file information of the latest source code file obtained from the code project repository compared with the historical source code file. In this way, the file coverage information irrelevant to this modification can be filtered. After that, the function entity information corresponding to the target file coverage information can be determined, so as to implement the incremental code coverage test according to the function entity information.

在可能的方式中,确定目标文件覆盖信息对应的函数实体信息可以是:根据第二函数文件映射关系,从数据库中读取目标文件覆盖信息对应的函数实体信息,该第二函数文件映射关系用于表征源码文件对应的插桩产物中函数文件与函数实体信息间的对应关系。In a possible manner, determining the function entity information corresponding to the target file coverage information may be: reading the function entity information corresponding to the target file coverage information from the database according to the second function file mapping relationship, the second function file mapping relationship using It is used to characterize the correspondence between the function file and the function entity information in the instrumentation product corresponding to the source code file.

示例地,第二函数文件映射关系在首次有覆盖数据上传时则通过解析插桩产物生成并保存在数据库。因此,在首次覆盖数据上传后,可以根据第二函数文件映射关系,从数据库中读取目标文件覆盖信息对应的函数实体信息。之后,可以将从数据库中读取到的目标文件覆盖信息对应的函数实体信息保存在本地缓存中,便于加快后续上传数据文件的解析速度。For example, the mapping relationship of the second function file is generated by parsing the instrumentation product and saved in the database when the coverage data is uploaded for the first time. Therefore, after the coverage data is uploaded for the first time, the function entity information corresponding to the target file coverage information can be read from the database according to the second function file mapping relationship. After that, the function entity information corresponding to the target file coverage information read from the database can be saved in the local cache, so as to speed up the parsing speed of the subsequently uploaded data files.

在另一可能的方式中,确定目标文件覆盖信息对应的函数实体信息还可以是:先从本地缓存中读取目标文件覆盖信息对应的函数实体信息,若从本地缓存中读取目标文件覆盖信息对应的函数实体信息失败,则根据第二函数文件映射关系,从数据库中读取目标文件覆盖信息对应的函数实体信息,该第二函数文件映射关系用于表征源码文件对应的插桩产物中函数文件与函数实体信息间的对应关系,数据库中存储有第二函数文件映射关系中各函数文件对应的函数实体信息。In another possible manner, determining the function entity information corresponding to the target file coverage information may also be: first read the function entity information corresponding to the target file coverage information from the local cache, if the target file coverage information is read from the local cache If the corresponding function entity information fails, the function entity information corresponding to the target file coverage information is read from the database according to the second function file mapping relationship, and the second function file mapping relationship is used to represent the function in the instrumentation product corresponding to the source code file. The corresponding relationship between the file and the function entity information, the database stores the function entity information corresponding to each function file in the second function file mapping relationship.

后续每次有覆盖数据上传时,可以先从本地缓存中读取目标文件覆盖信息对应的函数实体信息,若从本地缓存中读取目标文件覆盖信息对应的函数实体信息失败,则根据第二函数文件映射关系,从数据库中读取目标文件覆盖信息对应的函数实体信息。由此,优先从本地缓存中读取函数实体信息,可以提高处理效率。并且通过第二函数文件映射关系,以文件为单位查找函数实体信息,相较于通过函数为单位的查找方式,可以提高效率,减少数据库的访问压力。Each subsequent upload of coverage data, you can first read the function entity information corresponding to the target file coverage information from the local cache. If the function entity information corresponding to the target file coverage information fails to be read from the local cache, the second function File mapping relationship, read the function entity information corresponding to the target file coverage information from the database. Therefore, the function entity information is preferentially read from the local cache, which can improve processing efficiency. And through the second function file mapping relationship, the function entity information is searched in units of files, which can improve the efficiency and reduce the access pressure of the database compared with the search method in units of functions.

例如,参照图5,接收到多个覆盖数据文件,函数覆盖信息包括函数名和覆盖次数数组,比如函数functionName1的覆盖次数数组为[1,1,0])。根据每一覆盖数据文件对应的函数覆盖信息和第一函数文件映射关系可以得到文件覆盖信息。然后根据该文件覆盖信息和从代码项目仓库获取到的修改文件信息,确定目标文件覆盖信息。之后,若从本地缓存中读取目标文件覆盖信息对应的函数实体信息失败,则根据第二函数文件映射关系,从数据库中读取目标文件覆盖信息对应的函数实体信息。最后,可以结合该函数实体信息和函数覆盖信息,得到各覆盖数据文件的行覆盖率。For example, referring to FIG. 5 , multiple coverage data files are received, and the function coverage information includes a function name and an array of coverage times, for example, the coverage times array of function functionName1 is [1, 1, 0]). The file coverage information can be obtained according to the function coverage information corresponding to each coverage data file and the first function file mapping relationship. Then, the target file coverage information is determined according to the file coverage information and the modified file information obtained from the code project repository. Afterwards, if the function entity information corresponding to the target file coverage information fails to be read from the local cache, the function entity information corresponding to the target file coverage information is read from the database according to the second function file mapping relationship. Finally, the line coverage of each coverage data file can be obtained by combining the function entity information and the function coverage information.

在可能的方式中,函数覆盖信息包括多个覆盖次数数组,每一覆盖次数数组具有函数标识信息,且每一覆盖次数数组中的每个元素用于表征对应函数中每行代码的执行次数,则可以先针对函数覆盖信息中的每一函数,执行如下处理:确定函数对应的函数实体信息,并根据函数的函数标识信息,在多个覆盖次数数组中确定对应的覆盖次数数组;根据对应的函数实体信息和覆盖次数数组,确定行覆盖信息。然后,聚合每一函数的行覆盖信息,得到覆盖数据文件的行覆盖率。In a possible manner, the function coverage information includes multiple coverage times arrays, each coverage times array has function identification information, and each element in each coverage times array is used to represent the execution times of each line of code in the corresponding function, Then, for each function in the function coverage information, perform the following processing: determine the function entity information corresponding to the function, and determine the corresponding coverage times array from the multiple coverage times arrays according to the function identification information of the function; Array of function entity information and coverage times to determine line coverage information. Then, the line coverage information of each function is aggregated to obtain the line coverage of the coverage data file.

示例地,覆盖次数可以通过覆盖次数数组进行表示,由于用户操作可能覆盖多个函数,因此解析覆盖数据文件后可能得到多个覆盖次数数组,且每个覆盖次数数组可以具有对应的函数标识。通过该函数标识可以将函数与对应的覆盖次数数组进行关联,从而在后续过程中,可以根据该函数标识确定函数对应的覆盖次数数组。函数实体信息可以用于表征函数代码块的起始位置和终止位置,即可以确定用户操作所覆盖函数的代码块位置,从而结合函数对应的函数实体信息和覆盖次数数组,可以确定函数中代码的行覆盖率。For example, the coverage times may be represented by a coverage times array. Since user operations may cover multiple functions, after parsing the coverage data file, multiple coverage times arrays may be obtained, and each coverage times array may have a corresponding function identifier. The function can be associated with the corresponding coverage times array through the function identifier, so that in the subsequent process, the coverage times array corresponding to the function can be determined according to the function identifier. The function entity information can be used to characterize the starting position and ending position of the function code block, that is, to determine the code block position of the function covered by the user operation, and then combine the function entity information corresponding to the function and the coverage times array to determine the code in the function. line coverage.

之后,可以再通过LLVM工具聚合每一函数的行覆盖率,从而得到覆盖数据文件的行覆盖率。由此,可以同步确定每一函数的行覆盖信息,相较于依次确定覆盖数据文件中每一行代码覆盖率的方式,可以提高处理效率,从而减小代码行覆盖率测试过程中的时延。After that, the line coverage of each function can be aggregated through the LLVM tool to obtain the line coverage of the coverage data file. In this way, the line coverage information of each function can be determined synchronously. Compared with the method of sequentially determining the code coverage rate of each line in the coverage data file, processing efficiency can be improved, thereby reducing the time delay in the code line coverage test process.

在可能的方式中,在得到覆盖数据文件的行覆盖率之后,还可以从数据库获取源码文件的历史行覆盖率,然后将历史行覆盖率与覆盖数据文件的行覆盖率进行累加,以得到源码文件的目标行覆盖率。In a possible way, after the line coverage of the coverage data file is obtained, the historical line coverage of the source code file can also be obtained from the database, and then the historical line coverage and the line coverage of the coverage data file are accumulated to obtain the source code. The target line coverage for the file.

应当理解的是,上述方式可以确定单个覆盖数据文件的增量行覆盖率。在此种情况下,为了得到源码文件的全量行覆盖率,可以从数据库获取源码文件对应的历史行覆盖率,然后将历史行覆盖率与覆盖数据文件的行覆盖率进行累加。之后,还可以将累加后得到的源码文件的行覆盖率进行保存,比如可以保存在redis数据库中,便于后续确定全量行覆盖率。此外,在可能的方式中,还可以获取保存的、源码文件的行覆盖率,比如从redis数据库中获取源码文件的行覆盖率,然后对获取到的源码文件的行覆盖率进行增量映射后展示在前端供QA(Quality Assurance,质量保证)分析。其中,增量映射的方式可以与相关技术中类似,这里不赘述。It should be understood that the above method can determine the incremental line coverage of a single coverage data file. In this case, in order to obtain the full line coverage of the source code file, the historical line coverage corresponding to the source code file can be obtained from the database, and then the historical line coverage and the line coverage of the coverage data file can be accumulated. After that, the line coverage of the source code file obtained after accumulation can also be saved, for example, it can be saved in the redis database, so as to facilitate the subsequent determination of the full line coverage. In addition, in a possible way, it is also possible to obtain the line coverage of the saved source code file, such as obtaining the line coverage of the source code file from the redis database, and then performing incremental mapping on the line coverage of the obtained source code file. Displayed on the front end for QA (Quality Assurance, quality assurance) analysis. The manner of incremental mapping may be similar to that in the related art, and details are not described here.

下面通过另一示例性实施例对本公开提供的代码覆盖率测试方法进行说明。The code coverage testing method provided by the present disclosure will be described below through another exemplary embodiment.

参照图6,首先打包平台打包出二进制插桩产物,在首次有覆盖数据文件上传时,解析该插桩产物,以得到第一函数文件映射关系和第二函数文件映射关系。并且,可以将第一函数文件映射关系和第二函数文件映射关系进行存储在数据库中供后续解析使用。Referring to FIG. 6 , the packaging platform first packs a binary instrumentation product, and when an overlay data file is uploaded for the first time, the instrumentation product is parsed to obtain a first function file mapping relationship and a second function file mapping relationship. In addition, the first function file mapping relationship and the second function file mapping relationship can be stored in the database for subsequent analysis.

在终端设备上传覆盖数据文件后,可以响应于接收到该覆盖数据文件,解析该覆盖数据文件,得到覆盖数据文件对应的函数覆盖信息。之后,可以根据函数覆盖信息和第一函数文件映射关系,确定函数覆盖信息对应的文件覆盖信息。接着,可以从gitlab(代码项目仓库)获取源码文件相较于历史源码文件的修改文件信息,并根据该修改文件信息在文件覆盖信息中确定目标文件覆盖信息。然后,可以从本地缓存中读取目标文件覆盖信息对应的函数实体信息,若从本地缓存中读取目标文件覆盖信息对应的函数实体信息失败,则根据第二函数文件映射关系,从数据库中读取目标文件覆盖信息对应的函数实体信息,从而可以根据函数实体信息确定覆盖数据文件的行覆盖率,即可以得到单个覆盖数据文件的增量行覆盖率。After the terminal device uploads the overlay data file, in response to receiving the overlay data file, it can parse the overlay data file to obtain function overlay information corresponding to the overlay data file. Afterwards, the file coverage information corresponding to the function coverage information may be determined according to the mapping relationship between the function coverage information and the first function file. Next, the modified file information of the source code file compared to the historical source code file can be obtained from gitlab (code project repository), and the target file coverage information can be determined in the file coverage information according to the modified file information. Then, the function entity information corresponding to the target file coverage information can be read from the local cache. If the function entity information corresponding to the target file coverage information is read from the local cache fails, the second function file mapping relationship is read from the database. The function entity information corresponding to the target file coverage information is obtained, so that the line coverage rate of the coverage data file can be determined according to the function entity information, that is, the incremental line coverage rate of a single coverage data file can be obtained.

继续参照图6,得到单个覆盖数据文件的增量行覆盖率后,可以从数据库获取源码文件的历史行覆盖率,然后将历史行覆盖率与该增量行覆盖率行覆盖率进行累加,以得到源码文件的目标行覆盖率,即得到源码文件的全量行覆盖率。之后,在可能的方式中可以将全量行覆盖率进行增量映射后进行前端展示。通过上述方式,可以减少代码覆盖率测试过程中对源码文件的依赖,可以在源码文件未修改的情况下,通过对插桩产物的一次解析得到函数文件映射关系,从而后续过程可以直接通过该函数文件映射关系进行代码覆盖率测试。并且,可以响应于覆盖数据文件的上传则解析该覆盖数据数据文件,可以实现上传文件即解析,相较于相关技术中的方式,可以省去文件聚合的步骤,从而可以减小代码覆盖率测试过程中的时延。Continuing to refer to Figure 6, after obtaining the incremental line coverage of a single coverage data file, the historical line coverage of the source code file can be obtained from the database, and then the historical line coverage and the incremental line coverage can be accumulated. Obtain the target line coverage of the source code file, that is, obtain the full line coverage of the source code file. After that, in a possible way, the full line coverage can be incrementally mapped for front-end display. Through the above method, the dependence on the source code file during the code coverage test can be reduced. When the source code file is not modified, the function file mapping relationship can be obtained through one analysis of the instrumentation product, so that the subsequent process can directly pass this function. File mapping relationship for code coverage testing. In addition, the overlay data file can be parsed in response to the upload of the overlay data file, and the upload file can be parsed. Compared with the method in the related art, the step of file aggregation can be omitted, thereby reducing the code coverage test. delay in the process.

此外,解析覆盖数据文件后可以通过函数文件映射关系进行增量代码的覆盖率测试,无需每次测试都加载完整源码文件对应的插桩产物到内存中。经测试,相较于加载完整源码文件对应的插桩产物到内存的方式,本公开提供的方式内存消耗可以减少三分之二。In addition, after parsing the coverage data file, the incremental code coverage test can be performed through the function file mapping relationship, without the need to load the instrumentation product corresponding to the complete source code file into the memory for each test. After testing, compared with the method of loading the instrumentation product corresponding to the complete source code file into the memory, the method provided by the present disclosure can reduce the memory consumption by two-thirds.

基于同一发明构思,本公开实施例还提供一种代码覆盖率测试装置。参照图,7,该代码覆盖率测试装置700包括:Based on the same inventive concept, an embodiment of the present disclosure also provides a code coverage testing apparatus. 7, the code coverage testing device 700 includes:

解析模块701,用于响应于接收到覆盖数据文件,解析所述覆盖数据文件,得到所述覆盖数据文件对应的函数覆盖信息,所述函数覆盖信息包括函数对应的函数名和覆盖次数;A parsing module 701, configured to parse the coverage data file in response to receiving the coverage data file, and obtain function coverage information corresponding to the coverage data file, where the function coverage information includes the function name and coverage times corresponding to the function;

第一确定模块702,用于根据所述函数覆盖信息和第一函数文件映射关系,确定所述函数覆盖信息对应的文件覆盖信息,所述第一函数文件映射关系用于表征源码文件对应的插桩产物中函数与函数文件间的对应关系;The first determination module 702 is configured to determine the file coverage information corresponding to the function coverage information according to the function coverage information and the first function file mapping relationship, where the first function file mapping relationship is used to represent the insert code corresponding to the source code file. Correspondence between functions and function files in the pile product;

第二确定模块703,用于从代码项目仓库获取到的所述最新源码文件相较于历史源码文件的修改文件信息,并根据修改文件信息在所述文件覆盖信息中确定目标文件覆盖信息;A second determination module 703, configured to compare the latest source code file obtained from the code project repository with the modification file information of the historical source code file, and determine target file coverage information in the file coverage information according to the modification file information;

第三确定模块704,用于确定所述目标文件覆盖信息对应的函数实体信息,并根据所述覆盖次数和所述函数实体信息,确定所述覆盖数据文件的行覆盖率。The third determining module 704 is configured to determine the function entity information corresponding to the target file coverage information, and determine the line coverage rate of the coverage data file according to the coverage times and the function entity information.

可选地,所述解析模块701用于:Optionally, the parsing module 701 is used for:

解析所述覆盖数据文件,得到所述覆盖数据文件中所有函数的函数信息,并从所述函数信息中过滤未包括在所述第一函数文件映射关系中的函数信息,以得到所述覆盖数据文件对应的函数覆盖信息。Parse the coverage data file, obtain function information of all functions in the coverage data file, and filter the function information not included in the mapping relationship of the first function file from the function information to obtain the coverage data The function coverage information corresponding to the file.

可选地,所述第二确定模块703用于:Optionally, the second determining module 703 is used for:

从本地缓存中读取所述目标文件覆盖信息对应的函数实体信息;Read the function entity information corresponding to the target file coverage information from the local cache;

当从本地缓存中读取所述目标文件覆盖信息对应的函数实体信息失败时,根据第二函数文件映射关系,从数据库中读取所述目标文件覆盖信息对应的函数实体信息,所述第二函数文件映射关系用于表征所述源码文件对应的插桩产物中函数文件与函数实体信息间的对应关系,所述数据库中存储有所述第二函数文件映射关系中各函数文件对应的函数实体信息。When reading the function entity information corresponding to the target file coverage information from the local cache fails, read the function entity information corresponding to the target file coverage information from the database according to the second function file mapping relationship, and the second function entity information corresponding to the target file coverage information is read from the database. The function file mapping relationship is used to represent the corresponding relationship between the function file and the function entity information in the instrumentation product corresponding to the source code file, and the database stores the function entity corresponding to each function file in the second function file mapping relationship. information.

可选地,所述函数覆盖信息包括多个覆盖次数数组,每一所述覆盖次数数组具有函数标识信息,且每一所述覆盖次数数组中的每个元素用于表征对应函数中每行代码的执行次数,所述第三确定模块704用于:Optionally, the function coverage information includes a plurality of coverage times arrays, each of the coverage times arrays has function identification information, and each element in each of the coverage times arrays is used to represent each line of code in the corresponding function. The number of times of execution, the third determining module 704 is used for:

针对所述函数覆盖信息中的每一函数,执行如下处理:For each function in the function coverage information, the following processing is performed:

确定所述函数对应的函数实体信息,并根据所述函数的函数标识信息,在所述多个覆盖次数数组中确定对应的覆盖次数数组;Determine the function entity information corresponding to the function, and determine the corresponding coverage times array in the multiple coverage times arrays according to the function identification information of the function;

根据对应的所述函数实体信息和所述覆盖次数数组,确定行覆盖信息;Determine row coverage information according to the corresponding function entity information and the coverage times array;

聚合每一所述函数的行覆盖信息,得到所述覆盖数据文件的行覆盖率。Aggregate the line coverage information of each of the functions to obtain the line coverage of the coverage data file.

可选地,所述装置700还包括用于得到函数文件映射关系的如下模块:Optionally, the apparatus 700 also includes the following modules for obtaining the function file mapping relationship:

第一处理模块,用于解析所述源码文件对应的插桩产物,得到所述源码文件中所有函数的函数名和函数属性信息,所述函数属性信息包括函数代码块信息;a first processing module, configured to parse the instrumentation product corresponding to the source code file, and obtain function names and function attribute information of all functions in the source code file, where the function attribute information includes function code block information;

第二处理模块,用于解析所述函数代码块信息,得到所述源码文件中每一函数所属的函数文件信息以及每一函数对应的代码块在所属函数文件中的位置信息;The second processing module is used to parse the function code block information, and obtain the function file information to which each function in the source code file belongs and the position information of the code block corresponding to each function in the function file to which it belongs;

建立模块,用于根据所述源码文件中每一函数的函数名称、每一函数所属的函数文件信息以及每一函数对应的代码块在所属函数文件中的位置信息,建立函数文件映射关系。The establishment module is configured to establish a function file mapping relationship according to the function name of each function in the source code file, the function file information to which each function belongs, and the position information of the code block corresponding to each function in the function file to which it belongs.

可选地,所述装置700还包括:Optionally, the apparatus 700 further includes:

获取模块,用于从数据库获取源码文件对应的历史行覆盖率;The acquisition module is used to obtain the historical line coverage corresponding to the source code file from the database;

累加模块,用于将所述历史行覆盖率与所述覆盖数据文件的行覆盖率进行累加,以得到源码文件的目标行覆盖率。The accumulation module is configured to accumulate the historical line coverage and the line coverage of the coverage data file to obtain the target line coverage of the source code file.

关于上述实施例中的装置,其中各个模块执行操作的具体方式已经在有关该方法的实施例中进行了详细描述,此处将不做详细阐述说明。Regarding the apparatus in the above-mentioned embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be described in detail here.

基于同一发明构思,本公开实施例还提供一种计算机可读介质,其上存储有计算机程序,该程序被处理装置执行时实现上述任一代码覆盖率测试方法的步骤。Based on the same inventive concept, an embodiment of the present disclosure further provides a computer-readable medium on which a computer program is stored, and when the program is executed by a processing device, implements the steps of any of the foregoing code coverage testing methods.

基于同一发明构思,本公开实施例还提供一种电子设备,包括:Based on the same inventive concept, an embodiment of the present disclosure also provides an electronic device, including:

存储装置,其上存储有计算机程序;a storage device on which a computer program is stored;

处理装置,用于执行所述存储装置中的所述计算机程序,以实现上述任一代码覆盖率测试方法的步骤。A processing device is configured to execute the computer program in the storage device, so as to implement the steps of any of the above code coverage testing methods.

下面参考图8,其示出了适于用来实现本公开实施例的电子设备800的结构示意图。本公开实施例中的终端设备可以包括但不限于诸如移动电话、笔记本电脑、数字广播接收器、PDA(个人数字助理)、PAD(平板电脑)、PMP(便携式多媒体播放器)、车载终端(例如车载导航终端)等等的移动终端以及诸如数字TV、台式计算机等等的固定终端。图8示出的电子设备仅仅是一个示例,不应对本公开实施例的功能和使用范围带来任何限制。Referring next to FIG. 8 , it shows a schematic structural diagram of an electronic device 800 suitable for implementing an embodiment of the present disclosure. Terminal devices in the embodiments of the present disclosure may include, but are not limited to, such as mobile phones, notebook computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablets), PMPs (portable multimedia players), vehicle-mounted terminals (eg, mobile terminals such as in-vehicle navigation terminals), etc., and stationary terminals such as digital TVs, desktop computers, and the like. The electronic device shown in FIG. 8 is only an example, and should not impose any limitation on the function and scope of use of the embodiments of the present disclosure.

如图8所示,电子设备800可以包括处理装置(例如中央处理器、图形处理器等)801,其可以根据存储在只读存储器(ROM)802中的程序或者从存储装置808加载到随机访问存储器(RAM)803中的程序而执行各种适当的动作和处理。在RAM 803中,还存储有电子设备800操作所需的各种程序和数据。处理装置801、ROM 802以及RAM 803通过总线804彼此相连。输入/输出(I/O)接口805也连接至总线804。As shown in FIG. 8 , an electronic device 800 may include a processing device (eg, a central processing unit, a graphics processor, etc.) 801 that may be loaded into random access according to a program stored in a read only memory (ROM) 802 or from a storage device 808 Various appropriate actions and processes are executed by the programs in the memory (RAM) 803 . In the RAM 803, various programs and data necessary for the operation of the electronic device 800 are also stored. The processing device 801 , the ROM 802 , and the RAM 803 are connected to each other through a bus 804 . An input/output (I/O) interface 805 is also connected to bus 804 .

通常,以下装置可以连接至I/O接口805:包括例如触摸屏、触摸板、键盘、鼠标、摄像头、麦克风、加速度计、陀螺仪等的输入装置806;包括例如液晶显示器(LCD)、扬声器、振动器等的输出装置807;包括例如磁带、硬盘等的存储装置808;以及通信装置809。通信装置809可以允许电子设备800与其他设备进行无线或有线通信以交换数据。虽然图8示出了具有各种装置的电子设备800,但是应理解的是,并不要求实施或具备所有示出的装置。可以替代地实施或具备更多或更少的装置。Typically, the following devices may be connected to the I/O interface 805: input devices 806 including, for example, a touch screen, touchpad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; including, for example, a liquid crystal display (LCD), speakers, vibration An output device 807 of a computer, etc.; a storage device 808 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 809. Communication means 809 may allow electronic device 800 to communicate wirelessly or by wire with other devices to exchange data. While FIG. 8 shows an electronic device 800 having various means, it should be understood that not all of the illustrated means are required to be implemented or provided. More or fewer devices may alternatively be implemented or provided.

特别地,根据本公开的实施例,上文参考流程图描述的过程可以被实现为计算机软件程序。例如,本公开的实施例包括一种计算机程序产品,其包括承载在非暂态计算机可读介质上的计算机程序,该计算机程序包含用于执行流程图所示的方法的程序代码。在这样的实施例中,该计算机程序可以通过通信装置809从网络上被下载和安装,或者从存储装置808被安装,或者从ROM 802被安装。在该计算机程序被处理装置801执行时,执行本公开实施例的方法中限定的上述功能。In particular, according to embodiments of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program carried on a non-transitory computer readable medium, the computer program containing program code for performing the method illustrated in the flowchart. In such an embodiment, the computer program may be downloaded and installed from the network via the communication device 809 , or from the storage device 808 , or from the ROM 802 . When the computer program is executed by the processing device 801, the above-mentioned functions defined in the methods of the embodiments of the present disclosure are executed.

需要说明的是,本公开上述的计算机可读介质可以是计算机可读信号介质或者计算机可读存储介质或者是上述两者的任意组合。计算机可读存储介质例如可以是——但不限于——电、磁、光、电磁、红外线、或半导体的系统、装置或器件,或者任意以上的组合。计算机可读存储介质的更具体的例子可以包括但不限于:具有一个或多个导线的电连接、便携式计算机磁盘、硬盘、随机访问存储器(RAM)、只读存储器(ROM)、可擦式可编程只读存储器(EPROM或闪存)、光纤、便携式紧凑磁盘只读存储器(CD-ROM)、光存储器件、磁存储器件、或者上述的任意合适的组合。在本公开中,计算机可读存储介质可以是任何包含或存储程序的有形介质,该程序可以被指令执行系统、装置或者器件使用或者与其结合使用。而在本公开中,计算机可读信号介质可以包括在基带中或者作为载波一部分传播的数据信号,其中承载了计算机可读的程序代码。这种传播的数据信号可以采用多种形式,包括但不限于电磁信号、光信号或上述的任意合适的组合。计算机可读信号介质还可以是计算机可读存储介质以外的任何计算机可读介质,该计算机可读信号介质可以发送、传播或者传输用于由指令执行系统、装置或者器件使用或者与其结合使用的程序。计算机可读介质上包含的程序代码可以用任何适当的介质传输,包括但不限于:电线、光缆、RF(射频)等等,或者上述的任意合适的组合。It should be noted that the computer-readable medium mentioned above in the present disclosure may be a computer-readable signal medium or a computer-readable storage medium, or any combination of the above two. The computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus or device, or a combination of any of the above. More specific examples of computer readable storage media may include, but are not limited to, electrical connections with one or more wires, portable computer disks, hard disks, random access memory (RAM), read only memory (ROM), erasable Programmable read only memory (EPROM or flash memory), fiber optics, portable compact disk read only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing. In this 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 the present disclosure, however, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave with computer-readable program code embodied thereon. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the foregoing. A computer-readable signal medium can also be any computer-readable medium other than a computer-readable storage medium that can transmit, propagate, or transport the program for use by or in connection with the instruction execution system, apparatus, or device . Program code embodied on a computer readable medium may be transmitted using any suitable medium including, but not limited to, electrical wire, optical fiber cable, RF (radio frequency), etc., or any suitable combination of the foregoing.

在一些实施方式中,可以利用诸如HTTP(HyperText Transfer Protocol,超文本传输协议)之类的任何当前已知或未来研发的网络协议进行通信,并且可以与任意形式或介质的数字数据通信(例如,通信网络)互连。通信网络的示例包括局域网(“LAN”),广域网(“WAN”),网际网(例如,互联网)以及端对端网络(例如,ad hoc端对端网络),以及任何当前已知或未来研发的网络。In some embodiments, any currently known or future developed network protocol, such as HTTP (HyperText Transfer Protocol), can be used for communication, and can communicate with digital data in any form or medium (eg, communication network) interconnection. Examples of communication networks include local area networks ("LAN"), wide area networks ("WAN"), the Internet (eg, the Internet), and peer-to-peer networks (eg, ad hoc peer-to-peer networks), as well as any currently known or future development network of.

上述计算机可读介质可以是上述电子设备中所包含的;也可以是单独存在,而未装配入该电子设备中。The above-mentioned computer-readable medium may be included in the above-mentioned electronic device; or may exist alone without being assembled 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: in response to receiving the overlay data file, parse the overlay data file, and obtain the The function coverage information corresponding to the coverage data file, the function coverage information includes the function name and coverage times corresponding to the function; according to the function coverage information and the first function file mapping relationship, determine the file coverage information corresponding to the function coverage information, so The first function file mapping relationship is used to represent the corresponding relationship between the function and the function file in the instrumentation product corresponding to the source code file; the source code file obtained from the code project warehouse is compared with the modification file information of the historical source code file, and Determine target file coverage information in the file coverage information according to the modified file information; determine function entity information corresponding to the target file coverage information, and determine the coverage data according to the coverage times and the function entity information The line coverage of the file.

可以以一种或多种程序设计语言或其组合来编写用于执行本公开的操作的计算机程序代码,上述程序设计语言包括但不限于面向对象的程序设计语言—诸如Java、Smalltalk、C++,还包括常规的过程式程序设计语言——诸如“C”语言或类似的程序设计语言。程序代码可以完全地在用户计算机上执行、部分地在用户计算机上执行、作为一个独立的软件包执行、部分在用户计算机上部分在远程计算机上执行、或者完全在远程计算机或服务器上执行。在涉及远程计算机的情形中,远程计算机可以通过任意种类的网络——包括局域网(LAN)或广域网(WAN)——连接到用户计算机,或者,可以连接到外部计算机(例如利用因特网服务提供商来通过因特网连接)。Computer program code for performing operations of the present disclosure may be written in one or more programming languages, including but not limited to object-oriented programming languages—such as Java, Smalltalk, C++, and This includes 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 the case of a remote computer, the remote computer may be connected to the user's 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 (eg, using an Internet service provider to via Internet connection).

附图中的流程图和框图,图示了按照本公开各种实施例的系统、方法和计算机程序产品的可能实现的体系架构、功能和操作。在这点上,流程图或框图中的每个方框可以代表一个模块、程序段、或代码的一部分,该模块、程序段、或代码的一部分包含一个或多个用于实现规定的逻辑功能的可执行指令。也应当注意,在有些作为替换的实现中,方框中所标注的功能也可以以不同于附图中所标注的顺序发生。例如,两个接连地表示的方框实际上可以基本并行地执行,它们有时也可以按相反的顺序执行,这依所涉及的功能而定。也要注意的是,框图和/或流程图中的每个方框、以及框图和/或流程图中的方框的组合,可以用执行规定的功能或操作的专用的基于硬件的系统来实现,或者可以用专用硬件与计算机指令的组合来实现。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 the flowchart or block diagrams may represent a module, segment, or portion of code that contains one or more logical functions for implementing the specified functions executable instructions. It should also be noted that, in some alternative implementations, the functions noted in the blocks 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 the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It is also 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 in dedicated hardware-based systems that perform the specified functions or operations , or can be implemented in a combination of dedicated hardware and computer instructions.

描述于本公开实施例中所涉及到的模块可以通过软件的方式实现,也可以通过硬件的方式来实现。其中,模块的名称在某种情况下并不构成对该模块本身的限定。The modules involved in the embodiments of the present disclosure may be implemented in software or hardware. Among them, the name of the module does not constitute a limitation of the module itself under certain circumstances.

本文中以上描述的功能可以至少部分地由一个或多个硬件逻辑部件来执行。例如,非限制性地,可以使用的示范类型的硬件逻辑部件包括:现场可编程门阵列(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), Systems on Chips (SOCs), Complex Programmable Logical Devices (CPLDs) and more.

在本公开的上下文中,机器可读介质可以是有形的介质,其可以包含或存储以供指令执行系统、装置或设备使用或与指令执行系统、装置或设备结合地使用的程序。机器可读介质可以是机器可读信号介质或机器可读储存介质。机器可读介质可以包括但不限于电子的、磁性的、光学的、电磁的、红外的、或半导体系统、装置或设备,或者上述内容的任何合适组合。机器可读存储介质的更具体示例会包括基于一个或多个线的电气连接、便携式计算机盘、硬盘、随机存取存储器(RAM)、只读存储器(ROM)、可擦除可编程只读存储器(EPROM或快闪存储器)、光纤、便捷式紧凑盘只读存储器(CD-ROM)、光学储存设备、磁储存设备、或上述内容的任何合适组合。In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in connection with the instruction execution system, apparatus or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. Machine-readable media may include, but are not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media would include one or more wire-based electrical connections, portable computer disks, hard disks, random access memory (RAM), read only memory (ROM), erasable programmable read only memory (EPROM or flash memory), fiber optics, compact disk read only memory (CD-ROM), optical storage, magnetic storage, or any suitable combination of the foregoing.

根据本公开的一个或多个实施例,示例1提供了一种代码覆盖率测试方法,包括:According to one or more embodiments of the present disclosure, Example 1 provides a code coverage testing method, including:

响应于接收到覆盖数据文件,解析所述覆盖数据文件,得到所述覆盖数据文件对应的函数覆盖信息,所述函数覆盖信息包括函数对应的函数名和覆盖次数;In response to receiving the coverage data file, parsing the coverage data file to obtain function coverage information corresponding to the coverage data file, where the function coverage information includes a function name and coverage times corresponding to the function;

根据所述函数覆盖信息和第一函数文件映射关系,确定所述函数覆盖信息对应的文件覆盖信息,所述第一函数文件映射关系用于表征源码文件对应的插桩产物中函数与函数文件间的对应关系;Determine the file coverage information corresponding to the function coverage information according to the function coverage information and the first function file mapping relationship, where the first function file mapping relationship is used to represent the function and the function file in the instrumentation product corresponding to the source code file. the corresponding relationship;

从代码项目仓库获取到的所述源码文件相较于历史源码文件的修改文件信息,并根据所述修改文件信息在所述文件覆盖信息中确定目标文件覆盖信息;The source code file obtained from the code project warehouse is compared with the modification file information of the historical source code file, and the target file coverage information is determined in the file coverage information according to the modification file information;

确定所述目标文件覆盖信息对应的函数实体信息,并根据所述覆盖次数和所述函数实体信息,确定所述覆盖数据文件的行覆盖率。Determine the function entity information corresponding to the target file coverage information, and determine the line coverage rate of the coverage data file according to the coverage times and the function entity information.

根据本公开的一个或多个实施例,示例2提供了示例1的方法,所述解析所述覆盖数据文件,得到所述覆盖数据文件对应的函数覆盖信息,包括:According to one or more embodiments of the present disclosure, Example 2 provides the method of Example 1. The method of parsing the coverage data file to obtain function coverage information corresponding to the coverage data file includes:

解析所述覆盖数据文件,得到所述覆盖数据文件中所有函数的函数信息,并从所述函数信息中过滤未包括在所述第一函数文件映射关系中的函数信息,以得到所述覆盖数据文件对应的函数覆盖信息。Parse the coverage data file, obtain function information of all functions in the coverage data file, and filter the function information not included in the mapping relationship of the first function file from the function information to obtain the coverage data The function coverage information corresponding to the file.

根据本公开的一个或多个实施例,示例3提供了示例1的方法,所述确定所述目标文件覆盖信息对应的函数实体信息,包括:According to one or more embodiments of the present disclosure, Example 3 provides the method of Example 1, and the determining the function entity information corresponding to the target file coverage information includes:

从本地缓存中读取所述目标文件覆盖信息对应的函数实体信息;Read the function entity information corresponding to the target file coverage information from the local cache;

若从本地缓存中读取所述目标文件覆盖信息对应的函数实体信息失败,则根据第二函数文件映射关系,从数据库中读取所述目标文件覆盖信息对应的函数实体信息,所述第二函数文件映射关系用于表征所述源码文件对应的插桩产物中函数文件与函数实体信息间的对应关系,所述数据库中存储有所述第二函数文件映射关系中各函数文件对应的函数实体信息。If it fails to read the function entity information corresponding to the target file coverage information from the local cache, read the function entity information corresponding to the target file coverage information from the database according to the second function file mapping relationship. The function file mapping relationship is used to represent the corresponding relationship between the function file and the function entity information in the instrumentation product corresponding to the source code file, and the database stores the function entity corresponding to each function file in the second function file mapping relationship. information.

根据本公开的一个或多个实施例,示例4提供了示例1-3任一项的方法,所述函数覆盖信息包括多个覆盖次数数组,每一所述覆盖次数数组具有函数标识信息,且每一所述覆盖次数数组中的每个元素用于表征对应函数中每行代码的执行次数,所述根据所述覆盖次数和所述函数实体信息,确定所述覆盖数据文件的行覆盖率,包括:According to one or more embodiments of the present disclosure, Example 4 provides the method of any one of Examples 1-3, the function coverage information includes a plurality of coverage times arrays, each of the coverage times arrays having function identification information, and Each element in each of the coverage times array is used to represent the execution times of each line of code in the corresponding function, and the line coverage rate of the coverage data file is determined according to the coverage times and the function entity information, include:

针对所述函数覆盖信息中的每一函数,执行如下处理:For each function in the function coverage information, the following processing is performed:

确定所述函数对应的函数实体信息,并根据所述函数的函数标识信息,在所述多个覆盖次数数组中确定对应的覆盖次数数组;Determine the function entity information corresponding to the function, and determine the corresponding coverage times array in the multiple coverage times arrays according to the function identification information of the function;

根据对应的所述函数实体信息和所述覆盖次数数组,确定行覆盖信息;Determine row coverage information according to the corresponding function entity information and the coverage times array;

聚合每一所述函数的行覆盖信息,得到所述覆盖数据文件的行覆盖率。Aggregate the line coverage information of each of the functions to obtain the line coverage of the coverage data file.

根据本公开的一个或多个实施例,示例5提供了示例1-3任一项的方法,所述函数文件映射关系是通过如下方式得到的:According to one or more embodiments of the present disclosure, Example 5 provides the method of any one of Examples 1-3, and the function file mapping relationship is obtained in the following manner:

解析所述源码文件对应的插桩产物,得到所述源码文件中所有函数的函数名和函数属性信息,所述函数属性信息包括函数代码块信息;Parse the instrumentation product corresponding to the source code file, and obtain the function names and function attribute information of all functions in the source code file, where the function attribute information includes function code block information;

解析所述函数代码块信息,得到所述源码文件中每一函数所属的函数文件信息以及每一函数对应的代码块在所属函数文件中的位置信息;Parse the function code block information to obtain the function file information to which each function in the source code file belongs and the location information of the code block corresponding to each function in the function file to which it belongs;

根据所述源码文件中每一函数的函数名称、每一函数所属的函数文件信息以及每一函数对应的代码块在所属函数文件中的位置信息,建立函数文件映射关系。The function file mapping relationship is established according to the function name of each function in the source code file, the function file information to which each function belongs, and the location information of the code block corresponding to each function in the function file to which it belongs.

根据本公开的一个或多个实施例,示例6提供了示例1-3任一项的方法,所述方法还包括:According to one or more embodiments of the present disclosure, Example 6 provides the method of any one of Examples 1-3, the method further comprising:

从数据库获取所述源码文件对应的历史行覆盖率;Obtain the historical line coverage corresponding to the source code file from the database;

将所述历史行覆盖率与所述覆盖数据文件的行覆盖率进行累加,以得到所述源码文件的目标行覆盖率。The historical line coverage rate and the line coverage rate of the coverage data file are accumulated to obtain the target line coverage rate of the source code file.

根据本公开的一个或多个实施例,示例7提供了一种代码覆盖率测试装置,所述装置包括:According to one or more embodiments of the present disclosure, Example 7 provides a code coverage testing apparatus, the apparatus comprising:

解析模块,用于响应于接收到覆盖数据文件,解析所述覆盖数据文件,得到所述覆盖数据文件对应的函数覆盖信息,所述函数覆盖信息包括函数对应的函数名和覆盖次数;A parsing module, configured to parse the coverage data file in response to receiving the coverage data file, and obtain function coverage information corresponding to the coverage data file, where the function coverage information includes the function name and coverage times corresponding to the function;

第一确定模块,用于根据所述函数覆盖信息和第一函数文件映射关系,确定所述函数覆盖信息对应的文件覆盖信息,所述第一函数文件映射关系用于表征源码文件对应的插桩产物中函数与函数文件间的对应关系;A first determining module, configured to determine the file coverage information corresponding to the function coverage information according to the function coverage information and the first function file mapping relationship, where the first function file mapping relationship is used to represent the instrumentation corresponding to the source code file Correspondence between functions and function files in the product;

第二确定模块,用于从代码项目仓库获取到的所述最新源码文件相较于历史源码文件的修改文件信息,并根据修改文件信息在所述文件覆盖信息中确定目标文件覆盖信息;A second determination module, configured to compare the modified file information of the latest source code file obtained from the code project warehouse with the historical source code file, and determine target file coverage information in the file coverage information according to the modified file information;

第三确定模块,用于确定所述目标文件覆盖信息对应的函数实体信息,并根据所述覆盖次数和所述函数实体信息,确定所述覆盖数据文件的行覆盖率。The third determining module is configured to determine the function entity information corresponding to the target file coverage information, and determine the line coverage rate of the coverage data file according to the coverage times and the function entity information.

根据本公开的一个或多个实施例,示例8提供了示例7的装置,所述解析模块用于:According to one or more embodiments of the present disclosure, Example 8 provides the apparatus of Example 7, the parsing module for:

解析所述覆盖数据文件,得到所述覆盖数据文件中所有函数的函数信息,并从所述函数信息中过滤未包括在所述第一函数文件映射关系中的函数信息,以得到所述覆盖数据文件对应的函数覆盖信息。Parse the coverage data file, obtain function information of all functions in the coverage data file, and filter the function information not included in the mapping relationship of the first function file from the function information to obtain the coverage data The function coverage information corresponding to the file.

根据本公开的一个或多个实施例,示例9提供了示例7的装置,所述第二确定模块用于:According to one or more embodiments of the present disclosure, Example 9 provides the apparatus of Example 7, the second determining module is configured to:

从本地缓存中读取所述目标文件覆盖信息对应的函数实体信息;Read the function entity information corresponding to the target file coverage information from the local cache;

当从本地缓存中读取所述目标文件覆盖信息对应的函数实体信息失败时,根据第二函数文件映射关系,从数据库中读取所述目标文件覆盖信息对应的函数实体信息,所述第二函数文件映射关系用于表征所述源码文件对应的插桩产物中函数文件与函数实体信息间的对应关系,所述数据库中存储有所述第二函数文件映射关系中各函数文件对应的函数实体信息。When reading the function entity information corresponding to the target file coverage information from the local cache fails, read the function entity information corresponding to the target file coverage information from the database according to the second function file mapping relationship, and the second function entity information corresponding to the target file coverage information is read from the database. The function file mapping relationship is used to represent the corresponding relationship between the function file and the function entity information in the instrumentation product corresponding to the source code file, and the database stores the function entity corresponding to each function file in the second function file mapping relationship. information.

根据本公开的一个或多个实施例,示例10提供了示例7-9任一项的装置,所述函数覆盖信息包括多个覆盖次数数组,每一所述覆盖次数数组具有函数标识信息,且每一所述覆盖次数数组中的每个元素用于表征对应函数中每行代码的执行次数,所述第三确定模块用于:According to one or more embodiments of the present disclosure, Example 10 provides the apparatus of any one of Examples 7-9, the function coverage information includes a plurality of coverage times arrays, each of the coverage times arrays having function identification information, and Each element in each of the coverage times array is used to represent the execution times of each line of code in the corresponding function, and the third determination module is used for:

针对所述函数覆盖信息中的每一函数,执行如下处理:For each function in the function coverage information, the following processing is performed:

确定所述函数对应的函数实体信息,并根据所述函数的函数标识信息,在所述多个覆盖次数数组中确定对应的覆盖次数数组;Determine the function entity information corresponding to the function, and determine the corresponding coverage times array in the multiple coverage times arrays according to the function identification information of the function;

根据对应的所述函数实体信息和所述覆盖次数数组,确定行覆盖信息;Determine row coverage information according to the corresponding function entity information and the coverage times array;

聚合每一所述函数的行覆盖信息,得到所述覆盖数据文件的行覆盖率。Aggregate the line coverage information of each of the functions to obtain the line coverage of the coverage data file.

根据本公开的一个或多个实施例,示例11提供了示例7-9任一项的装置,所述装置还包括用于得到函数文件映射关系的如下模块:According to one or more embodiments of the present disclosure, Example 11 provides the apparatus of any one of Examples 7-9, and the apparatus further includes the following modules for obtaining the function file mapping relationship:

第一处理模块,用于解析所述源码文件对应的插桩产物,得到所述源码文件中所有函数的函数名和函数属性信息,所述函数属性信息包括函数代码块信息;a first processing module, configured to parse the instrumentation product corresponding to the source code file, and obtain function names and function attribute information of all functions in the source code file, where the function attribute information includes function code block information;

第二处理模块,用于解析所述函数代码块信息,得到所述源码文件中每一函数所属的函数文件信息以及每一函数对应的代码块在所属函数文件中的位置信息;The second processing module is used to parse the function code block information, and obtain the function file information to which each function in the source code file belongs and the position information of the code block corresponding to each function in the function file to which it belongs;

建立模块,用于根据所述源码文件中每一函数的函数名称、每一函数所属的函数文件信息以及每一函数对应的代码块在所属函数文件中的位置信息,建立函数文件映射关系。The establishment module is configured to establish a function file mapping relationship according to the function name of each function in the source code file, the function file information to which each function belongs, and the position information of the code block corresponding to each function in the function file to which it belongs.

根据本公开的一个或多个实施例,示例12提供了示例7-9任一项的装置,所述装置还包括:According to one or more embodiments of the present disclosure, Example 12 provides the apparatus of any of Examples 7-9, the apparatus further comprising:

获取模块,用于从数据库获取所述源码文件对应的历史行覆盖率;an acquisition module for acquiring the historical line coverage corresponding to the source code file from the database;

累加模块,用于将所述历史行覆盖率与所述覆盖数据文件的行覆盖率进行累加,以得到所述源码文件的目标行覆盖率。An accumulation module, configured to accumulate the historical line coverage and the line coverage of the coverage data file to obtain the target line coverage of the source code file.

根据本公开的一个或多个实施例,示例13提供了一种计算机可读介质,其上存储有计算机程序,该程序被处理装置执行时实现示例1-6中任一项所述方法的步骤。According to one or more embodiments of the present disclosure, Example 13 provides a computer-readable medium having stored thereon a computer program that, when executed by a processing apparatus, implements the steps of the method in any one of Examples 1-6 .

根据本公开的一个或多个实施例,示例14提供了一种电子设备,包括:According to one or more embodiments of the present disclosure, Example 14 provides an electronic device comprising:

存储装置,其上存储有计算机程序;a storage device on which a computer program is stored;

处理装置,用于执行所述存储装置中的所述计算机程序,以实现示例1-6中任一项所述方法的步骤。A processing device for executing the computer program in the storage device to implement the steps of the method in any one of Examples 1-6.

以上描述仅为本公开的较佳实施例以及对所运用技术原理的说明。本领域技术人员应当理解,本公开中所涉及的公开范围,并不限于上述技术特征的特定组合而成的技术方案,同时也应涵盖在不脱离上述公开构思的情况下,由上述技术特征或其等同特征进行任意组合而形成的其它技术方案。例如上述特征与本公开中公开的(但不限于)具有类似功能的技术特征进行互相替换而形成的技术方案。The above description is merely a preferred embodiment of the present disclosure and an illustration of the technical principles employed. Those skilled in the art should understand that the scope of the disclosure involved in the present disclosure is not limited to the technical solutions formed by the specific combination of the above-mentioned technical features, and should also cover, without departing from the above-mentioned disclosed concept, the technical solutions formed by the above-mentioned technical features or Other technical solutions formed by any combination of its equivalent features. For example, a technical solution is formed by replacing the above-mentioned features with the technical features disclosed in the present disclosure (but not limited to) with similar functions.

此外,虽然采用特定次序描绘了各操作,但是这不应当理解为要求这些操作以所示出的特定次序或以顺序次序执行来执行。在一定环境下,多任务和并行处理可能是有利的。同样地,虽然在上面论述中包含了若干具体实现细节,但是这些不应当被解释为对本公开的范围的限制。在单独的实施例的上下文中描述的某些特征还可以组合地实现在单个实施例中。相反地,在单个实施例的上下文中描述的各种特征也可以单独地或以任何合适的子组合的方式实现在多个实施例中。Additionally, although operations are depicted in a particular order, this should not be construed as requiring that the operations be performed in the particular order shown or in a sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Likewise, although the above discussion contains several implementation-specific details, these should not be construed as limitations on the scope of the present disclosure. Certain features that are described in the context of separate embodiments can also be implemented in combination in a single embodiment. Conversely, various features that are described in the context of a single embodiment can also be implemented in multiple embodiments separately or in any suitable subcombination.

尽管已经采用特定于结构特征和/或方法逻辑动作的语言描述了本主题,但是应当理解所附权利要求书中所限定的主题未必局限于上面描述的特定特征或动作。相反,上面所描述的特定特征和动作仅仅是实现权利要求书的示例形式。关于上述实施例中的装置,其中各个模块执行操作的具体方式已经在有关该方法的实施例中进行了详细描述,此处将不做详细阐述说明。Although the subject matter has been described in language specific to structural features and/or logical acts of method, it is to be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are merely example forms of implementing the claims. Regarding the apparatus in the above-mentioned embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be described in detail here.

Claims (10)

1. A method for code coverage testing, the method comprising:
responding to a received coverage data file, analyzing the coverage data file to obtain function coverage information corresponding to the coverage data file, wherein the function coverage information comprises a function name and coverage times corresponding to a function;
determining file coverage information corresponding to the function coverage information according to the function coverage information and a first function file mapping relation, wherein the first function file mapping relation is used for representing the corresponding relation between a function and a function file in an insertion product corresponding to a source code file;
acquiring modified file information of the source code file compared with a historical source code file from a code project warehouse, and determining target file coverage information in the file coverage information according to the modified file information;
and determining function entity information corresponding to the coverage information of the target file, and determining the row coverage rate of the coverage data file according to the coverage times and the function entity information.
2. The method according to claim 1, wherein the analyzing the overlay data file to obtain function overlay information corresponding to the overlay data file comprises:
analyzing the coverage data file to obtain function information of all functions in the coverage data file, and filtering function information which is not included in the mapping relation of the first function file from the function information to obtain function coverage information corresponding to the coverage data file.
3. The method according to claim 1, wherein the determining function entity information corresponding to the target file coverage information includes:
reading function entity information corresponding to the target file coverage information from a local cache;
if the function entity information corresponding to the target file coverage information is failed to be read from the local cache, reading the function entity information corresponding to the target file coverage information from a database according to a second function file mapping relation, wherein the second function file mapping relation is used for representing the corresponding relation between the function files and the function entity information in the instrumentation product corresponding to the source code file, and the database stores the function entity information corresponding to each function file in the second function file mapping relation.
4. The method according to any one of claims 1 to 3, wherein the function coverage information includes a plurality of coverage times arrays, each of the coverage times arrays has function identification information, and each element in each of the coverage times arrays is used for characterizing the execution times of each line of code in a corresponding function, and the determining the line coverage of the coverage data file according to the coverage times and the function entity information includes:
for each function in the function coverage information, performing the following processing:
determining function entity information corresponding to the function, and determining a corresponding coverage time array in the multiple coverage time arrays according to the function identification information of the function;
determining row coverage information according to the corresponding function entity information and the coverage time array;
and aggregating the row coverage information of each function to obtain the row coverage rate of the coverage data file.
5. The method according to any one of claims 1 to 3, wherein the function file mapping relationship is obtained by:
analyzing the instrumentation product corresponding to the source code file to obtain function names and function attribute information of all functions in the source code file, wherein the function attribute information comprises function code block information;
analyzing the function code block information to obtain function file information to which each function belongs in the source code file and position information of a code block corresponding to each function in the function file to which the function belongs;
and establishing a function file mapping relation according to the function name of each function in the source code file, the function file information of each function and the position information of the code block corresponding to each function in the function file.
6. The method according to any one of claims 1-3, further comprising:
acquiring the historical row coverage rate of the source code file from a database;
and accumulating the historical row coverage rate and the row coverage rate of the coverage data file to obtain the target row coverage rate of the source code file.
7. An apparatus for code coverage testing, the apparatus comprising:
the analysis module is used for responding to the received coverage data file, analyzing the coverage data file and obtaining function coverage information corresponding to the coverage data file, wherein the function coverage information comprises a function name and coverage times corresponding to a function;
the first determining module is used for determining file coverage information corresponding to the function coverage information according to the function coverage information and a first function file mapping relation, wherein the first function file mapping relation is used for representing the corresponding relation between a function and a function file in an instrumentation product corresponding to a source code file;
the second determining module is used for comparing the source code file acquired from the code project warehouse with the modified file information of the historical source code file and determining target file coverage information in the file coverage information according to the modified file information;
and the third determining module is used for determining function entity information corresponding to the coverage information of the target file and determining the row coverage rate of the coverage data file according to the coverage times and the function entity information.
8. The apparatus of claim 7, wherein the parsing module is configured to:
analyzing the coverage data file to obtain function information of all functions in the coverage data file, and filtering the function information which is not included in the mapping relation of the first function file from the function information to obtain function coverage information corresponding to the coverage data file.
9. A computer-readable medium, on which a computer program is stored which, when being executed by a processing means, carries out the steps of the method according to any one of claims 1 to 6.
10. An electronic device, comprising:
a storage device having a computer program stored thereon;
processing means for executing the computer program in the storage means to carry out the steps of the method according to any one of claims 1 to 6.
CN202110379033.1A 2021-04-08 2021-04-08 Code coverage test method, device, storage medium and electronic device Pending CN115203004A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110379033.1A CN115203004A (en) 2021-04-08 2021-04-08 Code coverage test method, device, storage medium and electronic device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110379033.1A CN115203004A (en) 2021-04-08 2021-04-08 Code coverage test method, device, storage medium and electronic device

Publications (1)

Publication Number Publication Date
CN115203004A true CN115203004A (en) 2022-10-18

Family

ID=83571021

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110379033.1A Pending CN115203004A (en) 2021-04-08 2021-04-08 Code coverage test method, device, storage medium and electronic device

Country Status (1)

Country Link
CN (1) CN115203004A (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116610383A (en) * 2023-05-25 2023-08-18 成都融见软件科技有限公司 Method for partially loading target file
CN116820602A (en) * 2023-05-25 2023-09-29 成都融见软件科技有限公司 Database partial loading system
CN117171057A (en) * 2023-11-02 2023-12-05 沐曦集成电路(上海)有限公司 Software code coverage determination system for chip software and hardware co-simulation stage
CN118331887A (en) * 2024-06-12 2024-07-12 天津南大通用数据技术股份有限公司 Code coverage testing method, device, terminal and storage medium
CN120743789A (en) * 2025-08-29 2025-10-03 苏州元脑智能科技有限公司 Firmware code coverage statistical method and electronic device

Citations (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101944040A (en) * 2010-09-15 2011-01-12 复旦大学 Predicate-based automatic parallel optimizing method
CN102722436A (en) * 2012-05-29 2012-10-10 百度在线网络技术(北京)有限公司 Statistical method and device for incremental coverage information
CN104598274A (en) * 2015-01-13 2015-05-06 北京京东尚科信息技术有限公司 Automatic instrumentation, compiling and installing method and system
CN104714882A (en) * 2013-12-17 2015-06-17 腾讯科技(深圳)有限公司 Code information processing method and device
CN105404585A (en) * 2015-12-01 2016-03-16 腾讯科技(深圳)有限公司 Method and apparatus for acquiring code coverage rate
CN105718373A (en) * 2016-01-27 2016-06-29 中电科航空电子有限公司 Code coverage rate generating method meeting DO-178C
CN105988926A (en) * 2015-02-13 2016-10-05 腾讯科技(深圳)有限公司 Method and device for processing multi-version test data
US20160328314A1 (en) * 2015-05-06 2016-11-10 Hcl Technologies Limited System and method for providing code coverage
CN106557413A (en) * 2015-09-25 2017-04-05 伊姆西公司 Based on the method and apparatus that code coverage obtains test case
CN108241543A (en) * 2016-12-30 2018-07-03 深圳壹账通智能科技有限公司 Method, service server and the system that business operation breakpoint performs
CN110727602A (en) * 2019-10-23 2020-01-24 网易(杭州)网络有限公司 Coverage rate data processing method and device and storage medium
CN110928776A (en) * 2019-11-15 2020-03-27 武汉极意网络科技有限公司 Detection method, device and equipment for realizing incremental code coverage rate based on lcov
CN111290943A (en) * 2020-01-13 2020-06-16 北京三快在线科技有限公司 Code coverage rate processing method, device, server and storage medium
CN111897727A (en) * 2020-07-30 2020-11-06 平安科技(深圳)有限公司 Software testing method, device, computer equipment and storage medium

Patent Citations (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101944040A (en) * 2010-09-15 2011-01-12 复旦大学 Predicate-based automatic parallel optimizing method
CN102722436A (en) * 2012-05-29 2012-10-10 百度在线网络技术(北京)有限公司 Statistical method and device for incremental coverage information
CN104714882A (en) * 2013-12-17 2015-06-17 腾讯科技(深圳)有限公司 Code information processing method and device
CN104598274A (en) * 2015-01-13 2015-05-06 北京京东尚科信息技术有限公司 Automatic instrumentation, compiling and installing method and system
CN105988926A (en) * 2015-02-13 2016-10-05 腾讯科技(深圳)有限公司 Method and device for processing multi-version test data
US20160328314A1 (en) * 2015-05-06 2016-11-10 Hcl Technologies Limited System and method for providing code coverage
CN106557413A (en) * 2015-09-25 2017-04-05 伊姆西公司 Based on the method and apparatus that code coverage obtains test case
CN105404585A (en) * 2015-12-01 2016-03-16 腾讯科技(深圳)有限公司 Method and apparatus for acquiring code coverage rate
CN105718373A (en) * 2016-01-27 2016-06-29 中电科航空电子有限公司 Code coverage rate generating method meeting DO-178C
CN108241543A (en) * 2016-12-30 2018-07-03 深圳壹账通智能科技有限公司 Method, service server and the system that business operation breakpoint performs
CN110727602A (en) * 2019-10-23 2020-01-24 网易(杭州)网络有限公司 Coverage rate data processing method and device and storage medium
CN110928776A (en) * 2019-11-15 2020-03-27 武汉极意网络科技有限公司 Detection method, device and equipment for realizing incremental code coverage rate based on lcov
CN111290943A (en) * 2020-01-13 2020-06-16 北京三快在线科技有限公司 Code coverage rate processing method, device, server and storage medium
CN111897727A (en) * 2020-07-30 2020-11-06 平安科技(深圳)有限公司 Software testing method, device, computer equipment and storage medium

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116610383A (en) * 2023-05-25 2023-08-18 成都融见软件科技有限公司 Method for partially loading target file
CN116820602A (en) * 2023-05-25 2023-09-29 成都融见软件科技有限公司 Database partial loading system
CN116610383B (en) * 2023-05-25 2024-02-20 成都融见软件科技有限公司 A way to partially load a target file
CN116820602B (en) * 2023-05-25 2024-04-26 成都融见软件科技有限公司 A database partial loading system
CN117171057A (en) * 2023-11-02 2023-12-05 沐曦集成电路(上海)有限公司 Software code coverage determination system for chip software and hardware co-simulation stage
CN117171057B (en) * 2023-11-02 2024-01-26 沐曦集成电路(上海)有限公司 Software code coverage determination system for chip software and hardware co-simulation stage
CN118331887A (en) * 2024-06-12 2024-07-12 天津南大通用数据技术股份有限公司 Code coverage testing method, device, terminal and storage medium
CN120743789A (en) * 2025-08-29 2025-10-03 苏州元脑智能科技有限公司 Firmware code coverage statistical method and electronic device
CN120743789B (en) * 2025-08-29 2025-11-25 苏州元脑智能科技有限公司 Firmware code coverage rate statistical method and electronic equipment

Similar Documents

Publication Publication Date Title
CN115203004A (en) Code coverage test method, device, storage medium and electronic device
CN111625473A (en) Interface test case generation method and device, storage medium and electronic equipment
CN111666201A (en) Regression testing method, apparatus, medium and electronic equipment
CN112596738B (en) Method and device for determining front-end page to be tested, storage medium and electronic equipment
CN111950857A (en) Index system management method, device and electronic equipment based on business index
CN111506475A (en) Data processing method, apparatus, system, readable medium and electronic device
WO2022247442A1 (en) Symbol parsing method and apparatus, and device and storage medium
CN114116480A (en) Method, device, medium and equipment for determining application program test coverage rate
CN113297277A (en) Test statistic determination method, device, readable medium and electronic equipment
CN110955709B (en) Data processing method and device and electronic equipment
CN118796702A (en) A method, device, equipment and medium for testing an application program
CN111813666A (en) Memory leak positioning method, device, medium and electronic equipment
CN114064431A (en) Stuck detection method and device, readable medium and electronic equipment
CN118733450A (en) A model testing method, device, equipment and medium
CN112099982B (en) Crash information positioning method and device, medium and electronic equipment
CN111797009A (en) Method, apparatus and electronic device for detecting code compatibility
CN112100211B (en) Data storage method, apparatus, electronic device, and computer readable medium
CN114996152A (en) Unit testing method, device, equipment and medium
CN116225886A (en) Test case generation method, device, equipment, storage medium and program product
CN118069491A (en) Incremental coverage determination method, apparatus, device, storage medium, and program product
CN110489341B (en) Test method and device, storage medium and electronic equipment
CN116991818A (en) Log data processing methods, devices, media and electronic equipment
CN115392682A (en) Attribute collection method, device, equipment and medium
CN112084086B (en) Information collection method, device, medium and electronic equipment
CN111898345A (en) Data processing method and device based on detailed design document

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