CN111124894B - Code coverage rate processing method and device and computer equipment - Google Patents
Code coverage rate processing method and device and computer equipment Download PDFInfo
- Publication number
- CN111124894B CN111124894B CN201911242850.1A CN201911242850A CN111124894B CN 111124894 B CN111124894 B CN 111124894B CN 201911242850 A CN201911242850 A CN 201911242850A CN 111124894 B CN111124894 B CN 111124894B
- Authority
- CN
- China
- Prior art keywords
- code
- difference
- file
- coverage data
- type
- 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.)
- Active
Links
- 238000003672 processing method Methods 0.000 title claims description 13
- 238000012360 testing method Methods 0.000 claims abstract description 177
- 238000000034 method Methods 0.000 claims abstract description 121
- 238000012545 processing Methods 0.000 claims abstract description 15
- 238000004590 computer program Methods 0.000 claims description 32
- 238000013507 mapping Methods 0.000 claims description 3
- 238000011161 development Methods 0.000 description 12
- 238000013522 software testing Methods 0.000 description 8
- 238000010586 diagram Methods 0.000 description 4
- 238000012216 screening Methods 0.000 description 2
- 230000001360 synchronised effect Effects 0.000 description 2
- 238000004364 calculation method Methods 0.000 description 1
- 238000001914 filtration Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000003068 static effect Effects 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Prevention of errors by analysis, debugging or testing of software
- G06F11/3668—Testing of software
- G06F11/3672—Test management
- G06F11/3676—Test management for coverage analysis
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Prevention of errors by analysis, debugging or testing of software
- G06F11/3668—Testing of software
- G06F11/3672—Test management
- G06F11/368—Test management for test version control, e.g. updating test cases to a new software version
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Prevention of errors by analysis, debugging or testing of software
- G06F11/3668—Testing of software
- G06F11/3672—Test management
- G06F11/3692—Test management for test results 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)
- Stored Programmes (AREA)
Abstract
Description
技术领域technical field
本申请涉及软件测试技术领域,特别是涉及一种代码覆盖率的处理方法、装置、计算机设备和存储介质。The present application relates to the technical field of software testing, in particular to a code coverage processing method, device, computer equipment and storage medium.
背景技术Background technique
在软件测试中,通常需要对软件测试过程进行代码覆盖率的统计。代码覆盖率表征了代码在测试中能够被覆盖的程度。一般地,软件测试员通过代码覆盖率的高低决定是否需要重复执行软件测试。In software testing, it is usually necessary to perform code coverage statistics on the software testing process. Code coverage represents the extent to which code can be covered by tests. Generally, software testers decide whether software testing needs to be repeated based on the level of code coverage.
当下的软件测试中,一个应用程序的发布版本由N个可测的小版本组成。也即是,针对每个对外发布的版本,开发人员会向服务器提交多次小版本的软件开发包。但每个提交的小版本,由于其软件测试后编译产物的标识码不同,各小版本间测试过程得到的代码覆盖率数据并不能直接合并。如果各小版本间的覆盖率数据不能合并,直接参考当前小版本的代码覆盖率数据容易造成重复测试。例如,当前小版本和上一小版本均包含某一代码,某一代码在上一版本已测试覆盖而在当前小版本中未测试覆盖,此时参照当前小版本的代码覆盖率数据需要对该代码重新测试,因此造成了该代码的重复测试。In current software testing, the release version of an application program consists of N measurable minor versions. That is, for each version released to the outside world, the developer will submit multiple small versions of the software development kit to the server. However, for each submitted minor version, because the identification codes of the compiled products after software testing are different, the code coverage data obtained during the testing process between minor versions cannot be directly merged. If the coverage data between minor versions cannot be merged, directly referring to the code coverage data of the current minor version will easily lead to repeated testing. For example, the current minor version and the previous minor version both contain a certain code, and a certain code has been tested and covered in the previous version but not in the current minor version. At this time, referring to the code coverage data of the current minor version needs to Code is retested, thus causing repeated testing of that code.
发明内容Contents of the invention
基于此,有必要针对上述技术问题,提供一种能够对多个版本的应用程序的代码覆盖率数据进行适量合并减少代码重复测试的代码覆盖率的处理方法、装置、计算机设备和存储介质。Based on this, it is necessary to address the above technical problems and provide a processing method, device, computer equipment and storage medium capable of appropriately merging the code coverage data of multiple versions of application programs to reduce the code coverage of repeated code testing.
一种代码覆盖率的处理方法,该方法包括:获取应用程序的第二版本的第二源代码相对于应用程序的第一版本的第一源代码的代码差异信息;获取测试第二源代码时编译得到的第二类文件以及获取测试第一源代码时编译得到的第一类文件;根据第二类文件获取测试第二源代码时生成的第二代码覆盖率数据文件,并获取第二子代码覆盖率数据和第三子代码覆盖率数据,第二子代码覆盖率数据为第二代码覆盖率数据文件中代码差异信息对应的代码覆盖率数据,第三子代码覆盖率数据为第二代码覆盖率数据文件中除第二子代码覆盖率数据之外的代码覆盖率数据;根据第一类文件获取测试第一源代码时生成的第一代码覆盖率数据文件,从第一代码覆盖率数据文件中筛选出除代码差异信息映射在第一代码覆盖率数据文件中的代码覆盖率数据之外的第一子代码覆盖率数据;将第一子代码覆盖率数据与第三子代码覆盖率数据进行合并处理,得到合并后的第四子代码覆盖率数据,根据第二子代码覆盖率数据和第四子代码覆盖率数据生成应用程序的第二版本的第三代码覆盖率数据文件。A method for processing code coverage, the method comprising: acquiring code difference information of a second source code of a second version of an application program relative to the first source code of a first version of an application program; acquiring when testing the second source code Compile the second type of file and obtain the first type of file compiled when testing the first source code; obtain the second code coverage data file generated when testing the second source code according to the second type of file, and obtain the second subclass Code coverage data and the third sub-code coverage data, the second sub-code coverage data is the code coverage data corresponding to the code difference information in the second code coverage data file, and the third sub-code coverage data is the second code coverage data Code coverage data other than the second sub-code coverage data in the coverage data file; obtain the first code coverage data file generated when testing the first source code according to the first type of file, from the first code coverage data Filter out the first subcode coverage data except the code coverage data in the first code coverage data file that the code difference information is mapped in the file; combine the first subcode coverage data with the third subcode coverage data Perform merging processing to obtain the combined fourth sub-code coverage data, and generate the third code coverage data file of the second version of the application program according to the second sub-code coverage data and the fourth sub-code coverage data.
在其中一个实施例中,代码覆盖率的处理方法还包括:根据代码差异信息确定第二类文件中相对于第一类文件存在区别的差异行代码;第二子代码覆盖率数据为第二代码覆盖率数据文件中差异行代码对应的代码覆盖率数据;从第一代码覆盖率数据文件中筛选出除代码差异信息映射在第一代码覆盖率数据文件中的代码覆盖率数据之外的第一子代码覆盖率数据,包括:从第一代码覆盖率数据文件中筛选出除差异行代码映射在第一代码覆盖率数据文件中的代码覆盖率数据之外的第一子代码覆盖率数据。In one of the embodiments, the code coverage processing method further includes: according to the code difference information, determining the difference line code in the second type of file relative to the first type of file; the second sub-code coverage data is the second code The code coverage data corresponding to the difference line code in the coverage data file; the first code coverage data other than the code coverage data that the code difference information is mapped in the first code coverage data file is filtered out from the first code coverage data file The sub-code coverage data includes: filtering out the first sub-code coverage data from the first code coverage data file except the code coverage data in which the difference line codes are mapped in the first code coverage data file.
在其中一个实施例中,根据代码差异信息确定第二类文件中相对于第一类文件存在区别的差异行代码,包括:根据代码差异信息获取第二类文件中相对于第一类文件存在区别的差异方法名、差异代码分支名和/或差异代码的标号;若存在差异方法名,获取差异方法名的差异方法,获取差异方法中存在的差异行代码;若存在差异代码分支名,获取差异代码分支名的差异代码分支,获取差异代码分支中存在的差异行代码;若存在差异代码的标号,获取差异代码的标号对应的差异代码,根据差异代码获取差异行代码。In one of the embodiments, determining the difference line codes in the second type of files that are different from the first type of files according to the code difference information includes: obtaining the difference between the second type of files and the first type of files according to the code difference information The difference method name, difference code branch name and/or difference code label; if there is a difference method name, get the difference method of the difference method name, and get the difference line code in the difference method; if there is a difference code branch name, get the difference code For the difference code branch of the branch name, obtain the difference line code existing in the difference code branch; if there is a label of the difference code, obtain the difference code corresponding to the label of the difference code, and obtain the difference line code according to the difference code.
在其中一个实施例中,代码覆盖率的处理方法还包括:若同时存在差异方法名和差异代码分支名,获取差异方法名的差异方法以及获取差异代码分支名的差异代码分支,根据差异方法获取第二类文件中相对于第一类文件存在区别的第一目标行代码,根据差异代码分支获取第二类文件中相对于第一类文件存在区别的第二目标行代码,当第一目标行代码和第二目标行代码匹配时将第一目标行代码或第二目标行代码作为差异行代码,当第一目标行代码和第二目标行代码不匹配时将第一目标行代码和第二目标行代码均作为差异行代码;若同时存在差异方法名和差异代码的标号,获取差异方法名的差异方法以及获取差异代码的标号对应的差异代码,根据差异方法获取第二类文件中相对于第一类文件存在区别的第三目标行代码,根据差异代码获取第二类文件中相对于第一类文件存在区别的第四目标行代码,当第三目标行代码和第四目标行代码匹配时将第三目标行代码或第四目标行代码作为差异行代码,当第三目标行代码和第四目标行代码不匹配时将第三目标行代码和第四目标行代码均作为差异行代码;若同时存在差异代码分支名和差异代码的标号,获取差异代码的标号的差异代码以及获取差异代码分支名的差异代码分支,根据差异代码获取第二类文件中相对于第一类文件存在区别的第五目标行代码,根据差异代码分支获取第二类文件中相对于第一类文件存在区别的第六目标行代码,当第五目标行代码和第六目标行代码匹配时将第五目标行代码或第六目标行代码作为差异行代码,当第五目标行代码和第六目标行代码不匹配时将第五目标行代码和第六目标行代码均作为差异行代码。In one of the embodiments, the method for processing code coverage further includes: if there are difference method names and difference code branch names at the same time, obtain the difference method for the difference method name and the difference code branch for obtaining the difference code branch name, and obtain the first difference method according to the difference method For the first target line code that is different from the first type file in the second type file, obtain the second target line code that is different from the first type file in the second type file according to the difference code branch, when the first target line code When it matches the second target line code, the first target line code or the second target line code is used as the difference line code; when the first target line code and the second target line code do not match, the first target line code and the second target line code are Line codes are all used as difference line codes; if there are difference method names and difference code labels at the same time, obtain the difference method of the difference method name and the difference code corresponding to the label of the difference code, and obtain the difference in the second type of file relative to the first There is a third target line code that differs from the class file, and the fourth target line code that is different from the first class file in the second class file is obtained according to the difference code, and when the third target line code matches the fourth target line code, the The third target line code or the fourth target line code is used as the difference line code, and when the third target line code and the fourth target line code do not match, both the third target line code and the fourth target line code are used as the difference line code; if At the same time, there is a difference code branch name and a label of the difference code, and the difference code of the label of the difference code and the difference code branch of the name of the difference code branch are obtained, and the second type of file that is different from the first type of file is obtained according to the difference code. The target line code, according to the difference code branch, obtains the sixth target line code that is different from the first type file in the second type of file, and when the fifth target line code matches the sixth target line code, the fifth target line code or The sixth target line code is used as the difference line code, and when the fifth target line code and the sixth target line code do not match, both the fifth target line code and the sixth target line code are used as the difference line code.
在其中一个实施例中,根据第二子代码覆盖率数据和第四子代码覆盖率数据生成应用程序的第二版本的第三代码覆盖率数据文件,包括:根据第四子代码覆盖率数据确定第二类文件中已被测试覆盖的第一行代码和未被测试覆盖的第二行代码;若根据第二子代码覆盖率数据确定差异行代码已被测试覆盖时,根据第二子代码覆盖率数据的确定结果以及第四子代码覆盖率数据的确定结果获取第二版本中已被测试覆盖的行代码和未被测试覆盖的行代码,根据已被测试覆盖的行代码和未被测试覆盖的行代码统计应用程序的第二版本对应的行代码的代码覆盖率,根据行代码的代码覆盖率生成应用程序的第二版本的第三代码覆盖率数据文件;若根据第二子代码覆盖率数据确定差异行代码被测试覆盖时,根据第二子代码覆盖率数据的确定结果以及第四子代码覆盖率数据的确定结果获取第二版本中已被测试覆盖的行代码和未被测试覆盖的行代码,根据已被测试覆盖的行代码和未被测试覆盖的行代码统计应用程序的第二版本对应的行代码的代码覆盖率,根据行代码的代码覆盖率生成应用程序的第二版本的第三代码覆盖率数据文件。In one of the embodiments, generating the third code coverage data file of the second version of the application program according to the second sub-code coverage data and the fourth sub-code coverage data includes: determining according to the fourth sub-code coverage data The first line of code that has been covered by the test and the second line of code that has not been covered by the test in the second type of file; The determination result of the rate data and the determination result of the fourth sub-code coverage data obtain the lines of codes covered by the test and the lines of codes not covered by the test in the second version, according to the lines of codes covered by the test and the lines of codes not covered by the test The code coverage rate of the line code corresponding to the second version of the application program is counted, and the third code coverage data file of the second version of the application program is generated according to the code coverage rate of the line code; if according to the second sub-code coverage rate When the data determines that the different lines of code are covered by the test, according to the determination results of the second sub-code coverage data and the determination results of the fourth sub-code coverage data, obtain the lines of code that have been covered by the test and the lines of code that have not been covered by the test in the second version. Lines of code, according to the code coverage of the line of code that has been covered by the test and the line of code that has not been covered by the test, the code coverage of the line of code corresponding to the second version of the application is calculated, and the code coverage of the second version of the application is generated according to the code coverage of the line of code The third code coverage data file.
在其中一个实施例中,代码覆盖率的处理方法还包括:根据第二类文件获取应用程序的第二版本的代码源文件;根据第三代码覆盖率数据文件以及代码源文件生成应用程序的第二版本的代码覆盖率报告。In one of the embodiments, the code coverage processing method further includes: obtaining the code source file of the second version of the application program according to the second type of file; generating the first version of the application program according to the third code coverage data file and the code source file Version 2 of the code coverage report.
在其中一个实施例中,根据第三代码覆盖率数据文件以及代码源文件生成应用程序的第二版本的代码覆盖率报告,包括:根据第二子代码覆盖率数据和第四子代码覆盖率数据标记出代码源文件中已测试覆盖的代码和未测试覆盖的代码,根据标记后的代码源文件以及第三代码覆盖率数据文件生成应用程序的第二版本的代码覆盖率报告;和/或,根据代码差异信息标记出代码源文件中的差异代码,根据标记后的代码源文件以及第三代码覆盖率数据文件生成应用程序的第二版本的代码覆盖率报告。In one of the embodiments, generating the code coverage report of the second version of the application program according to the third code coverage data file and the code source file includes: according to the second sub-code coverage data and the fourth sub-code coverage data Marking the code covered by the test and the code not covered by the test in the code source file, generating a code coverage report of the second version of the application according to the marked code source file and the third code coverage data file; and/or, The difference code in the code source file is marked according to the code difference information, and a code coverage report of the second version of the application program is generated according to the marked code source file and the third code coverage data file.
一种代码覆盖率的处理装置,其特征在于,该装置包括:第一获取模块,用于获取应用程序的第二版本的第二源代码相对于应用程序的第一版本的第一源代码的代码差异信息;第二获取模块,用于获取测试第二源代码时编译得到的第二类文件以及获取测试第一源代码时编译得到的第一类文件;第三获取模块,用于根据第二类文件获取测试第二源代码时生成的第二代码覆盖率数据文件,并获取第二子代码覆盖率数据和第三子代码覆盖率数据,第二子代码覆盖率数据为第二代码覆盖率数据文件中代码差异信息对应的代码覆盖率数据,第三子代码覆盖率数据为第二代码覆盖率数据文件中除第二子代码覆盖率数据之外的代码覆盖率数据;第四获取模块,用于根据第一类文件获取测试第一源代码时生成的第一代码覆盖率数据文件,从第一代码覆盖率数据文件中筛选出除代码差异信息映射在第一代码覆盖率数据文件中的代码覆盖率数据之外的第一子代码覆盖率数据;生成模块,用于将第一子代码覆盖率数据与第三子代码覆盖率数据进行合并处理,得到合并后的第四子代码覆盖率数据,根据第二子代码覆盖率数据和第四子代码覆盖率数据生成应用程序的第二版本的第三代码覆盖率数据文件。A code coverage processing device, characterized in that the device includes: a first acquisition module, configured to acquire the difference between the second source code of the second version of the application program and the first source code of the first version of the application program Code difference information; the second obtaining module is used to obtain the second type of file compiled when testing the second source code and the first type of file compiled when testing the first source code; the third obtaining module is used to obtain the first type of file compiled according to the first source code The second type of file obtains the second code coverage data file generated when testing the second source code, and obtains the second subcode coverage data and the third subcode coverage data, and the second subcode coverage data is the second code coverage Code coverage data corresponding to the code difference information in the rate data file, the third sub-code coverage data is code coverage data other than the second sub-code coverage data in the second code coverage data file; the fourth acquisition module , used to obtain the first code coverage data file generated when testing the first source code according to the first type of file, filter out the code difference information from the first code coverage data file and map it in the first code coverage data file The first sub-code coverage data other than the code coverage data; the generation module is used to merge the first sub-code coverage data and the third sub-code coverage data to obtain the merged fourth sub-code coverage rate data, generating a third code coverage data file of the second version of the application program according to the second sub-code coverage data and the fourth sub-code coverage data.
一种计算机设备,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,处理器执行计算机程序时实现上述任一实施例方法的步骤。A computer device includes a memory, a processor, and a computer program stored in the memory and operable on the processor. When the processor executes the computer program, the steps of the method in any of the above embodiments are implemented.
一种计算机可读存储介质,其上存储有计算机程序,计算机程序被处理器执行时实现上述任一实施例方法的步骤。A computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the method in any one of the above embodiments are implemented.
上述代码覆盖率的处理方法、装置、计算机设备和存储介质,服务器获取应用程序的第二版本的第二源代码相对于应用程序的第一版本的第一源代码的代码差异信息,获取测试第二源代码时编译得到的第二类文件以及获取测试第一源代码时编译得到的第一类文件,进而根据第二类文件获取测试第二源代码时生成的第二代码覆盖率数据文件,并从第二代码覆盖率数据文件中获取代码差异信息对应的第二子代码覆盖率数据,从而可以确定出应用程序第二版本相对于第一版本改动的差异代码的代码覆盖率数据情况。同时,服务器根据第一类文件获取测试第一源代码时生成的第一代码覆盖率数据文件,从第一代码覆盖率数据文件中筛选出除代码差异信息映射在第一代码覆盖率数据文件中的代码覆盖率数据之外的第一子代码覆盖率数据,将第一子代码覆盖率数据与第三子代码覆盖率数据进行合并处理,从而实现了非差异代码之外的代码覆盖率数据的合并。最终,根据合并处理后得到的第四子代码覆盖率数据和差异代码对应的第二子代码覆盖率数据生成应用程序的第二版本的第三代码覆盖率数据文件。因此,服务器能够根据应用程序两个版本编译产物中的类文件分别获取两个版本的代码覆盖率数据进行相应数据合并,同时根据合并后得到的数据与不同版本差异代码对应的代码覆盖率数据生成第二版本的第三代码覆盖率数据文件,与直接测试应用程序的第二版本的源代码得到的第二代码覆盖率数据文件相比,第三代码覆盖率数据文件的准确性更高,根据第三代码覆盖率数据文件进行应用程序的测试,可以减少代码重复测试。In the above code coverage processing method, device, computer equipment and storage medium, the server obtains the code difference information of the second source code of the second version of the application relative to the first source code of the first version of the application, and obtains the code difference information of the first source code of the first version of the application. The second type of file compiled when the second source code is obtained and the first type of file compiled when the first source code is obtained for testing, and then the second code coverage data file generated when the second source code is tested is obtained according to the second type of file, And obtain the second sub-code coverage data corresponding to the code difference information from the second code coverage data file, so as to determine the code coverage data of the difference codes changed by the second version of the application compared to the first version. At the same time, the server obtains the first code coverage data file generated when testing the first source code according to the first type of file, and filters out code difference information from the first code coverage data file and maps it in the first code coverage data file The first sub-code coverage data other than the code coverage data of the code, the first sub-code coverage data and the third sub-code coverage data are merged, so as to realize the code coverage data other than the non-difference code merge. Finally, a third code coverage data file of the second version of the application program is generated according to the fourth subcode coverage data obtained after the merging process and the second subcode coverage data corresponding to the difference code. Therefore, the server can obtain the code coverage data of the two versions according to the class files in the compiled product of the two versions of the application, and merge the corresponding data, and at the same time generate The third code coverage data file of the second version, compared with the second code coverage data file obtained by directly testing the source code of the second version of the application program, the accuracy of the third code coverage data file is higher, according to The third code coverage data file is used to test the application program, which can reduce repeated code testing.
附图说明Description of drawings
图1为一个实施例中一种代码覆盖率的处理方法的应用环境图;Fig. 1 is an application environment diagram of a processing method of code coverage in an embodiment;
图2为一个实施例中一种代码覆盖率的处理方法的流程示意图;Fig. 2 is a schematic flow chart of a method for processing code coverage in an embodiment;
图3为一个实施例中一种代码覆盖率的处理装置的结构框图;Fig. 3 is a structural block diagram of a processing device for code coverage in an embodiment;
图4为一个实施例中计算机设备的内部结构图。Figure 4 is an internal block diagram of a computer device in one embodiment.
具体实施方式Detailed ways
为了使本申请的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本申请进行进一步详细说明。应当理解,此处描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。In order to make the purpose, technical solution and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described here are only used to explain the present application, and are not intended to limit the present application.
本申请提供的一种代码覆盖率的处理方法,应用于如图1所示的应用环境中。其中,终端16通过网络连接向服务器12上传应用程序的各个版本的开发包,开发包中包含有应用程序的源代码。其中,终端16上传的各个版本的开发包中包含有同一版本的多个小版本的开发包。服务器12接收到终端16上传的应用程序的开发包之后,将开发包存储到数据库14中。终端18通过网络连接向服务器12请求获取应用程序的开发包,以对开发包进行软件测试。同时,终端18执行完软件测试后,将测试应用程序得到的测试产物发送回服务器12。测试产物包括每次测试得到的编译产物,如class文件等。服务器12将终端18提交的测试产物存储到数据库14中。服务器12在执行本申请的一种代码覆盖率的处理方法时,从数据库14中获取应用程序的第二版本的第二源代码相对于应用程序的第一版本的第一源代码的代码差异信息,获取测试第二源代码时编译得到的第二类文件以及获取测试第一源代码时编译得到的第一类文件。服务器12根据第二类文件获取测试第二源代码时生成的第二代码覆盖率数据文件,并获取第二子代码覆盖率数据和第三子代码覆盖率数据,第二子代码覆盖率数据为第二代码覆盖率数据文件中代码差异信息对应的代码覆盖率数据,第三子代码覆盖率数据为第二代码覆盖率数据文件中除第二子代码覆盖率数据之外的代码覆盖率数据;根据第一类文件获取测试第一源代码时生成的第一代码覆盖率数据文件,从第一代码覆盖率数据文件中筛选出除代码差异信息映射在第一代码覆盖率数据文件中的代码覆盖率数据之外的第一子代码覆盖率数据;将第一子代码覆盖率数据与第三子代码覆盖率数据进行合并处理,得到合并后的第四子代码覆盖率数据,根据第二子代码覆盖率数据和第四子代码覆盖率数据生成应用程序的第二版本的第三代码覆盖率数据文件。其中,终端16和终端18均可以是笔记本电脑、台式电脑等计算机设备。服务器12还可以是由多个服务器构成的服务器集群实现。A code coverage processing method provided in this application is applied to the application environment shown in FIG. 1 . Wherein, the
本申请提供一种代码覆盖率的处理方法,以该方法应用于图1所示的服务器12为例。如图2所示,该代码覆盖率的处理方法包括以下步骤:This application provides a method for processing code coverage, taking the method applied to the
S102,获取应用程序的第二版本的第二源代码相对于应用程序的第一版本的第一源代码的代码差异信息。S102. Acquire code difference information of the second source code of the second version of the application program relative to the first source code of the first version of the application program.
用于执行软件测试的测试终端每次向服务器提交测试产物时,均包含用于标识当次提交的测试产物的标识信息。用于开发应用程序的开发终端每次向服务器提交开发包时,均包含用于标识当次提交的开发包的标识信息。服务器根据测试终端以及开发终端提交的标识信息生成标识列表,用于记录各个终端的提交记录。在本实施例中,服务器根据标识列表中的标识信息获取应用程序的第二版本的第二源代码以及应用程序的第一版本的第一源代码。进一步地,服务器将获取第二版本的第二源代码相对于应用程序的第一版本的第一源代码的代码差异信息。其中,代码差异信息中可以包括第二源代码相对于第一源代码存在区别的代码。区别的代码可以是新增代码,在第一源代码的基础上修改的代码。根据区别的代码可以确定出第二类文件中相对于第一类文件存在区别的差异行代码、差异方法以及差异分支等。Each time the test terminal for performing software testing submits the test product to the server, it includes identification information for identifying the test product submitted this time. Each time the development terminal used to develop the application program submits the development package to the server, it includes identification information for identifying the development package submitted at that time. The server generates an identification list according to the identification information submitted by the test terminal and the development terminal, and is used to record the submission record of each terminal. In this embodiment, the server obtains the second source code of the second version of the application program and the first source code of the first version of the application program according to the identification information in the identification list. Further, the server will acquire code difference information of the second source code of the second version relative to the first source code of the first version of the application program. Wherein, the code difference information may include codes in which the second source code is different from the first source code. The different codes may be newly added codes or codes modified on the basis of the first source code. According to the different codes, it is possible to determine the different line codes, different methods, and different branches in the second type of files compared to the first type of files.
在一具体实现过程中,可以采用git diff命令获取第二源代码和第一源代码的diff日志(差异日志),从diff日志中确定出代码差异信息。具体地,服务器获取当前版本A相对于上个版本B的所有提交记录的标识号,生成标识列表。例如,测试终端向服务器提交当前版本A的多个小版本,每个小版本对应一个标识号。当前版本A的标识号包括a1、a2、a3、……、an等多个标识号,服务器获取上个版本B的最后一次提交的版本的标识号b以及当前版本A的多个标识号a1、a2、a3、……、an,生成标识列表。标识列表可以表示为commitids[b1、a1、a2、a3……an]。commitids标识列表名称。此时,服务器根据commitids中第二版本的标识号和第一版本的标识号,分别通过两者的标识号获取第二源代码和第一源代码。其中,每个提交的小版本对应的标识号可以用哈希值标识,以唯一标识出对应的版本。进一步地,采用git diff命令获取第二源代码和第一源代码的diff日志(差异日志),进而分析diff日志,生成可供脚本识别的diff(差异)标记文件,采用diff标记文件记录第一源代码和第二源代码之间的代码差异信息。此外,第一源代码和第二源代码可以是任意两个版本对应的源代码。在具体实现方式中,第一源代码和第二源代码为前后两个版本之间的源代码。diff标记文件可以记录前后两个版本之间的代码差异信息。In a specific implementation process, the diff log (difference log) of the second source code and the first source code can be obtained by using the git diff command, and the code difference information can be determined from the diff log. Specifically, the server obtains the identification numbers of all submitted records of the current version A relative to the previous version B, and generates an identification list. For example, the test terminal submits multiple minor versions of the current version A to the server, and each minor version corresponds to an identification number. The identification number of the current version A includes multiple identification numbers such as a1, a2, a3, ..., an, etc. The server obtains the identification number b of the last submitted version of the previous version B and multiple identification numbers a1, a2, a3, ..., an, generate a list of identifiers. A list of identities can be represented as commitids[b1, a1, a2, a3...an]. commitids identifies the list name. At this time, the server acquires the second source code and the first source code through the identification numbers of the second version and the first version respectively according to the identification numbers of the second version and the first version in the commitids. Wherein, the identification number corresponding to each submitted minor version can be identified by a hash value to uniquely identify the corresponding version. Further, use the git diff command to obtain the diff log (difference log) of the second source code and the first source code, and then analyze the diff log to generate a diff (difference) mark file that can be recognized by the script, and use the diff mark file to record the first Code diff information between the source code and the second source code. In addition, the first source code and the second source code may be source codes corresponding to any two versions. In a specific implementation manner, the first source code and the second source code are source codes between two previous versions. The diff tag file can record the code difference information between the previous and previous versions.
S104,获取测试第二源代码时编译得到的第二类文件以及获取测试第一源代码时编译得到的第一类文件。S104. Obtain a second type of file compiled when testing the second source code and obtain a first type of file compiled when testing the first source code.
在本实施例中,测试终端对应用程序的第二版本的第二源代码进行测试时,将测试过程中编译后得到的第二类文件,即class文件,上传到服务器。同样地,测试终端对应用程序的第一版本的第一源代码进行测试时,将测试过程中编译后得到的第一类文件,即class文件,上传到服务器。两个测试终端可以是同一终端或不同终端。其中,应用程序的第二版本可以是作为提交的当前版本。应用程序的第一版本可以是之前提交的任一版本,如相对于当前版本而言的上一版本。In this embodiment, when testing the second source code of the second version of the application program, the test terminal uploads the second type of file compiled during the test, that is, the class file, to the server. Similarly, when testing the first source code of the first version of the application program, the test terminal uploads the first type of file obtained after compiling during the test, that is, the class file, to the server. The two test terminals can be the same terminal or different terminals. Wherein, the second version of the application program may be the current version as submitted. The first version of the application may be any previously submitted version, such as a previous version relative to the current version.
S106,根据第二类文件获取测试第二源代码时生成的第二代码覆盖率数据文件,并获取第二子代码覆盖率数据和第三子代码覆盖率数据,第二子代码覆盖率数据为第二代码覆盖率数据文件中代码差异信息对应的代码覆盖率数据,第三子代码覆盖率数据为第二代码覆盖率数据文件中除第二子代码覆盖率数据之外的代码覆盖率数据。S106, obtain the second code coverage data file generated when testing the second source code according to the second type of file, and obtain the second subcode coverage data and the third subcode coverage data, the second subcode coverage data is The code coverage data corresponding to the code difference information in the second code coverage data file, the third sub-code coverage data is the code coverage data in the second code coverage data file except the second sub-code coverage data.
在本实施例中,测试终端对第二源代码进行测试时,将测试过程中生成的第二代码覆盖率数据文件,即ec文件,上传到服务器。此时,在服务器中,第二源代码对应的ec文件与第二源代码对应的第二类文件,即class文件关联。通过class文件可以读取出对应的ec文件。服务器从第二代码覆盖率数据文件中获取代码差异信息对应的第二子代码覆盖率数据,以及获取第二代码覆盖率数据文件中除第二子代码覆盖率数据之外的数据,将该除第二子代码覆盖率数据之外的数据作为第三子代码覆盖率数据。也即是,服务器将第二源代码对应的第二代码覆盖率数据文件划分为两部分数据,一部分数据是代码差异信息对应的第二子代码覆盖率数据,另外一部分数据是除了第二子代码覆盖率数据之外的数据。In this embodiment, when testing the second source code, the test terminal uploads the second code coverage data file generated during the test, that is, the ec file, to the server. At this time, in the server, the ec file corresponding to the second source code is associated with the second type of file corresponding to the second source code, that is, the class file. The corresponding ec file can be read through the class file. The server obtains the second subcode coverage data corresponding to the code difference information from the second code coverage data file, and obtains data other than the second subcode coverage data in the second code coverage data file, and the Data other than the second subcode coverage data is used as the third subcode coverage data. That is, the server divides the second code coverage data file corresponding to the second source code into two parts of data, one part of the data is the second subcode coverage data corresponding to the code difference information, and the other part of the data is Data other than coverage data.
S108,根据第一类文件获取测试第一源代码时生成的第一代码覆盖率数据文件,从第一代码覆盖率数据文件中筛选出除代码差异信息映射在第一代码覆盖率数据文件中的代码覆盖率数据之外的第一子代码覆盖率数据。S108. Obtain the first code coverage data file generated when testing the first source code according to the first type of file, and select from the first code coverage data file except the code difference information mapped in the first code coverage data file. The first subcode coverage data other than the code coverage data.
在本实施例中,测试终端对第一源代码进行测试时,将测试过程中生成的第一代码覆盖率数据文件,即ec文件,上传到服务器。此时,在服务器中,第一源代码对应的ec文件与第一源代码对应的第一类文件,即class文件关联。通过class文件可以读取出对应的ec文件。服务器从第一代码覆盖率数据文件中筛选除代码差异信息映射在第一代码覆盖率数据文件中的代码覆盖率数据之外的第一子代码覆盖率数据。也即是,服务器将第一源代码对应的第一代码覆盖率数据文件划分为两部分数据。一部分数据是第一源代码对应的代码差异信息映射到第一代码覆盖率数据文件中的代码覆盖率数据。例如,代码差异信息是包含第二版本相对于第一版本增加的代码的信息,那此处映射到第一代码覆盖率数据文件中的代码覆盖率数据为零。若代码差异信息是包含第二版本相对于第一版本修改的代码的信息,那此处映射到第一代码覆盖率数据文件中的代码覆盖率数据为第一版本修改前的代码对应的代码覆盖率数据。另外一部分数据是除了映射在第一代码覆盖率数据文件中的代码覆盖率数据之外的数据。In this embodiment, when testing the first source code, the test terminal uploads the first code coverage data file generated during the test, that is, the ec file, to the server. At this time, in the server, the ec file corresponding to the first source code is associated with the first type of file corresponding to the first source code, that is, the class file. The corresponding ec file can be read through the class file. The server screens the first sub-code coverage data from the first code coverage data file except the code coverage data whose code difference information is mapped in the first code coverage data file. That is, the server divides the first code coverage data file corresponding to the first source code into two parts of data. Part of the data is the code coverage data in the first code coverage data file mapped from the code difference information corresponding to the first source code. For example, the code difference information is the information including the code added in the second version relative to the first version, and the code coverage data mapped to the first code coverage data file here is zero. If the code difference information includes the code modified by the second version relative to the first version, then the code coverage data mapped to the first code coverage data file here is the code coverage corresponding to the code before the first version is modified rate data. Another part of data is data other than the code coverage data mapped in the first code coverage data file.
S110,将第一子代码覆盖率数据与第三子代码覆盖率数据进行合并处理,得到合并后的第四子代码覆盖率数据,根据第二子代码覆盖率数据和第四子代码覆盖率数据生成应用程序的第二版本的第三代码覆盖率数据文件。S110, merge the first subcode coverage data and the third subcode coverage data to obtain the combined fourth subcode coverage data, according to the second subcode coverage data and the fourth subcode coverage data A third code coverage data file for the second version of the application is generated.
在本实施例中,服务器将第一子代码覆盖率数据与第三子代码覆盖率数据进行合并处理,得到合并后的第四子代码覆盖率数据。也即是,服务器将第二版本和第一版本之间除了代码差异信息对应的代码覆盖率数据之外的其他数据进行合并处理。合并的方式可以是,同一代码在第一子代码覆盖率数据和第三子代码覆盖率数据对应的任一数据中显示为测试覆盖时,该代码在合并后的第四子代码覆盖率数据中显示为测试覆盖。同一代码在第一子代码覆盖率数据和第三子代码覆盖率数据对应的数据中两者数据均显示为未测试覆盖时,该代码在合并后的第四子代码覆盖率数据中显示为未测试覆盖。例如,除了代码差异信息对应的差异代码之外,第一版本和第二版本中均包含代码a。代码a在第一子代码覆盖率数据和第三子代码覆盖率数据对应的数据中均显示为未测试覆盖,则代码a在合并后的第四子代码覆盖率数据中显示为未测试覆盖。代码a在第一子代码覆盖率数据和第三子代码覆盖率数据对应的数据中任一数据显示为已测试覆盖,可以是在第一子代码覆盖率数据的数据中显示为已测试覆盖或在第三子代码覆盖率数据的数据中显示为已测试覆盖,则代码a在合并后的第四子代码覆盖率数据中显示为已测试覆盖。因此,合并后得到的第四子代码覆盖率数据可以准确反映除代码差异信息对应的源代码的测试情况之外的其他源代码的测试情况,避免其他源代码的重复测试。In this embodiment, the server merges the first subcode coverage data and the third subcode coverage data to obtain the combined fourth subcode coverage data. That is, the server merges other data between the second version and the first version except the code coverage data corresponding to the code difference information. The way of merging may be that when the same code is displayed as test coverage in any data corresponding to the first sub-code coverage data and the third sub-code coverage data, the code will be included in the combined fourth sub-code coverage data Shown as test coverage. When the data corresponding to the first sub-code coverage data and the third sub-code coverage data of the same code are both displayed as untested coverage, the code is displayed as untested coverage in the combined fourth sub-code coverage data. Test coverage. For example, except for the difference code corresponding to the code difference information, both the first version and the second version contain code a. Code a is displayed as untested coverage in the data corresponding to the first sub-code coverage data and the third sub-code coverage data, then code a is displayed as untested coverage in the combined fourth sub-code coverage data. Code a is displayed as tested coverage in any data corresponding to the first sub-code coverage data and the third sub-code coverage data, which can be displayed as tested coverage in the data of the first sub-code coverage data or In the data of the third sub-code coverage data, code a is displayed as tested coverage in the merged fourth sub-code coverage data. Therefore, the fourth sub-code coverage data obtained after merging can accurately reflect the test situation of other source codes except the test situation of the source code corresponding to the code difference information, and avoid repeated testing of other source codes.
进一步地,服务器根据第二子代码覆盖率数据和第四子代码覆盖率数据生成应用程序的第二版本的第三代码覆盖率数据文件。也即是,服务器根据代码差异信息对应的第二子代码覆盖率数据以及将第二版本和第一版本之间除了代码差异信息对应的代码覆盖率数据之外的其他数据进行合并处理后的第四子代码覆盖率数据生成应用程序的第二版本的第三代码覆盖率数据文件。因此,最终生成的第三代码覆盖率数据文件能够更加准确反映应用程序的第二版本中源代码的代码测试过程的覆盖率情况。Further, the server generates a third code coverage data file of the second version of the application program according to the second sub-code coverage data and the fourth sub-code coverage data. That is to say, the server merges the second sub-code coverage data corresponding to the code difference information and the second sub-code coverage data between the second version and the first version except the code coverage data corresponding to the code difference information. The fourth subcode coverage data generates a third code coverage data file for the second version of the application. Therefore, the finally generated third code coverage data file can more accurately reflect the coverage situation of the code testing process of the source code in the second version of the application program.
上述代码覆盖率的处理方法,服务器获取应用程序的第二版本的第二源代码相对于应用程序的第一版本的第一源代码的代码差异信息,获取测试第二源代码时编译得到的第二类文件以及获取测试第一源代码时编译得到的第一类文件,进而根据第二类文件获取测试第二源代码时生成的第二代码覆盖率数据文件,并从第二代码覆盖率数据文件中获取代码差异信息对应的第二子代码覆盖率数据,从而可以确定出应用程序第二版本相对于第一版本改动的差异代码的代码覆盖率数据情况。同时,服务器根据第一类文件获取测试第一源代码时生成的第一代码覆盖率数据文件,从第一代码覆盖率数据文件中筛选出除代码差异信息映射在第一代码覆盖率数据文件中的代码覆盖率数据之外的第一子代码覆盖率数据,将第一子代码覆盖率数据与第三子代码覆盖率数据进行合并处理,从而实现了非差异代码之外的代码覆盖率数据的合并。最终,根据合并处理后得到的第四子代码覆盖率数据和差异代码对应的第二子代码覆盖率数据生成应用程序的第二版本的第三代码覆盖率数据文件。因此,服务器能够根据应用程序两个版本编译产物中的类文件分别获取两个版本的代码覆盖率数据进行相应数据合并,同时根据合并后得到的数据与不同版本差异代码对应的代码覆盖率数据生成第二版本的第三代码覆盖率数据文件,与直接测试应用程序的第二版本的源代码得到的第二代码覆盖率数据文件相比,第三代码覆盖率数据文件的准确性更高,根据第三代码覆盖率数据文件进行应用程序的测试,可以减少代码重复测试。In the above code coverage processing method, the server obtains the code difference information of the second source code of the second version of the application program relative to the first source code of the first version of the application program, and obtains the first source code compiled when testing the second source code. The second type of file and the first type of file compiled when obtaining the first source code for testing, and then according to the second type of file to obtain the second code coverage data file generated when testing the second source code, and from the second code coverage data The second sub-code coverage data corresponding to the code difference information is obtained from the file, so that the code coverage data of the difference codes changed by the second version of the application program relative to the first version can be determined. At the same time, the server obtains the first code coverage data file generated when testing the first source code according to the first type of file, and filters out code difference information from the first code coverage data file and maps it in the first code coverage data file The first sub-code coverage data other than the code coverage data of the code, the first sub-code coverage data and the third sub-code coverage data are merged, so as to realize the code coverage data other than the non-difference code merge. Finally, a third code coverage data file of the second version of the application program is generated according to the fourth subcode coverage data obtained after the merging process and the second subcode coverage data corresponding to the difference code. Therefore, the server can obtain the code coverage data of the two versions according to the class files in the compiled product of the two versions of the application, and merge the corresponding data, and at the same time generate The third code coverage data file of the second version, compared with the second code coverage data file obtained by directly testing the source code of the second version of the application program, the accuracy of the third code coverage data file is higher, according to The third code coverage data file is used to test the application program, which can reduce repeated code testing.
在一个实施例中,步骤S102之后,还包括:根据代码差异信息确定第二类文件中相对于第一类文件存在区别的差异行代码。此时,第二子代码覆盖率数据为第二代码覆盖率数据文件中差异行代码对应的代码覆盖率数据。步骤S106中,从第一代码覆盖率数据文件中筛选出除代码差异信息映射在第一代码覆盖率数据文件中的代码覆盖率数据之外的第一子代码覆盖率数据,包括:从第一代码覆盖率数据文件中筛选出除差异行代码映射在第一代码覆盖率数据文件中的代码覆盖率数据之外的第一子代码覆盖率数据。In one embodiment, after step S102, the method further includes: determining, according to the code difference information, the difference line codes in the files of the second type that are different from those of the files of the first type. At this time, the second sub-code coverage data is the code coverage data corresponding to the codes of the different lines in the second code coverage data file. In step S106, the first sub-code coverage data other than the code coverage data mapped in the first code coverage data file by the code difference information is screened out from the first code coverage data file, including: The code coverage data file filters out the first sub-code coverage data except the code coverage data in which the difference line codes are mapped in the first code coverage data file.
在该实施例中,代码差异信息中包括差异行代码信息。服务器根据代码差异信息确定第二类文件中相对于第一类文件存在区别的差异行代码。在具体实现过程中,服务器根据代码差异信息读取第二类文件中相对于第一类文件中存在的区别代码,根据两者间存在的区别代码获取第二类文件中相对于第一类文件存在区别的差异行代码。例如,假设第二类文件中所有代码包括代码m、代码n和代码s,第一类文件中所有代码包括代码m、代码n、代码s和代码l。此时,第二类文件中相对于第一类文件存在的区别代码为代码l。代码l所在的代码行即为差异行代码。In this embodiment, the code difference information includes difference line code information. The server determines, according to the code difference information, the difference line codes in the second type of files that are different from those of the first type of files. In the specific implementation process, the server reads the difference codes in the second type of files relative to the first type files according to the code difference information, and obtains the difference codes in the second type files relative to the first type files according to the difference codes between the two. There are different lines of code that make a difference. For example, it is assumed that all codes in the second type of files include code m, code n and code s, and all codes in the first type of files include code m, code n, code s and code l. At this time, the difference code existing in the second type of file relative to the first type of file is code 1. The code line where the code l is located is the difference line code.
在一个实施例中,根据代码差异信息确定第二类文件中相对于第一类文件存在区别的差异行代码,包括:根据代码差异信息获取第二类文件中相对于第一类文件存在区别的差异方法名、差异代码分支名和/或差异代码的标号;若存在差异方法名,获取差异方法名的差异方法,获取差异方法中存在的差异行代码;若存在差异代码分支名,获取差异代码分支名的差异代码分支,获取差异代码分支中存在的差异行代码;若存在差异代码的标号,获取差异代码的标号对应的差异代码,根据差异代码获取差异行代码。In one embodiment, determining the difference line codes in the second type of files that are different from the first type of files according to the code difference information includes: obtaining the difference between the second type of files and the first type of files according to the code difference information Difference method name, difference code branch name and/or difference code label; if there is a difference method name, get the difference method of the difference method name, and get the difference line code in the difference method; if there is a difference code branch name, get the difference code branch If there is a difference code branch with the name of the difference code branch, obtain the difference line code existing in the difference code branch; if there is a difference code label, obtain the difference code corresponding to the difference code label, and obtain the difference line code according to the difference code.
在该实施例中,服务器根据代码差异信息能够获取到第二类文件中相对于第一类文件存在区别的差异方法名、差异代码分支名以及差异代码的标号。差异方法名对应的差异方法中可以包含差异行代码,差异代码分支名的差异代码分支中也可以包含差异行代码。根据差异代码的标号确定的差异代码之后也可以得到差异行代码。因此,服务器根据差异方法名、差异代码分支名以及差异代码的标号三者中任一均可获得差异行代码,从而提高了获取差异行代码的效率。In this embodiment, according to the code difference information, the server can obtain the difference method name, the branch name of the difference code, and the label of the difference code that are different from those of the first type of file in the second type of file. The difference method corresponding to the difference method name may contain the difference line of code, and the difference code branch of the difference code branch name may also contain the difference line of code. The difference line code can also be obtained after the difference code determined according to the label of the difference code. Therefore, the server can obtain the difference line code according to any one of the difference method name, the difference code branch name, and the label of the difference code, thereby improving the efficiency of obtaining the difference line code.
在一实施例中,根据代码差异信息确定第二类文件中相对于第一类文件存在区别的差异行代码,还包括:若同时存在差异方法名和差异代码分支名,获取差异方法名的差异方法以及获取差异代码分支名的差异代码分支,根据差异方法获取第二类文件中相对于第一类文件存在区别的第一目标行代码,根据差异代码分支获取第二类文件中相对于第一类文件存在区别的第二目标行代码,当第一目标行代码和第二目标行代码匹配时将第一目标行代码或第二目标行代码作为差异行代码,当第一目标行代码和第二目标行代码不匹配时将第一目标行代码和第二目标行代码均作为差异行代码;若同时存在差异方法名和差异代码的标号,获取差异方法名的差异方法以及获取差异代码的标号对应的差异代码,根据差异方法获取第二类文件中相对于第一类文件存在区别的第三目标行代码,根据差异代码获取第二类文件中相对于第一类文件存在区别的第四目标行代码,当第三目标行代码和第四目标行代码匹配时将第三目标行代码或第四目标行代码作为差异行代码,当第三目标行代码和第四目标行代码不匹配时将第三目标行代码和第四目标行代码均作为差异行代码;若同时存在差异代码分支名和差异代码的标号,获取差异代码的标号的差异代码以及获取差异代码分支名的差异代码分支,根据差异代码获取第二类文件中相对于第一类文件存在区别的第五目标行代码,根据差异代码分支获取第二类文件中相对于第一类文件存在区别的第六目标行代码,当第五目标行代码和第六目标行代码匹配时将第五目标行代码或第六目标行代码作为差异行代码,当第五目标行代码和第六目标行代码不匹配时将第五目标行代码和第六目标行代码均作为差异行代码。In one embodiment, determining the difference line codes in the second type of files relative to the first type of files according to the code difference information, also includes: if there are difference method names and difference code branch names at the same time, obtaining the difference methods of the difference method names And obtain the difference code branch of the difference code branch name, obtain the first target line code in the second type of file that is different from the first type of file according to the difference method, and obtain the difference in the second type of file relative to the first type of code according to the difference code branch There is a second target line code that is different in the file. When the first target line code and the second target line code match, the first target line code or the second target line code is used as the difference line code. When the first target line code and the second target line code When the target line codes do not match, both the first target line code and the second target line code are regarded as difference line codes; if there is a difference method name and a difference code label at the same time, the corresponding difference method for obtaining the difference method name and the label for obtaining the difference code Difference code, according to the difference method, obtain the third target line code that is different from the first type of file in the second type of file, and obtain the fourth target line code that is different from the first type of file in the second type of file according to the difference code , when the third target line code and the fourth target line code match, the third target line code or the fourth target line code is used as the difference line code, and when the third target line code and the fourth target line code do not match, the third target line code is Both the target line code and the fourth target line code are used as difference line codes; if there are difference code branch names and difference code labels at the same time, obtain the difference code of the label of the difference code and the difference code branch of the difference code branch name, and obtain it according to the difference code For the fifth target line code that is different from the first type file in the second type file, obtain the sixth target line code that is different from the first type file in the second type file according to the difference code branch, when the fifth target line When the code matches the sixth target line code, the fifth target line code or the sixth target line code is used as the difference line code; when the fifth target line code and the sixth target line code do not match, the fifth target line code and the sixth target line code are The target row codes are regarded as difference row codes.
在一个实施例中,步骤S110中,根据第二子代码覆盖率数据和第四子代码覆盖率数据生成应用程序的第二版本的第三代码覆盖率数据文件,包括:根据第四子代码覆盖率数据确定第二类文件中已被测试覆盖的第一行代码和未被测试覆盖的第二行代码;若根据第二子代码覆盖率数据确定差异行代码已被测试覆盖时,根据第二子代码覆盖率数据的确定结果以及第四子代码覆盖率数据的确定结果获取第二版本中已被测试覆盖的行代码和未被测试覆盖的行代码,根据已被测试覆盖的行代码和未被测试覆盖的行代码统计应用程序的第二版本对应的行代码的代码覆盖率,根据行代码的代码覆盖率生成应用程序的第二版本的第三代码覆盖率数据文件;若根据第二子代码覆盖率数据确定差异行代码被测试覆盖时,根据第二子代码覆盖率数据的确定结果以及第四子代码覆盖率数据的确定结果获取第二版本中已被测试覆盖的行代码和未被测试覆盖的行代码,根据已被测试覆盖的行代码和未被测试覆盖的行代码统计应用程序的第二版本对应的行代码的代码覆盖率,根据行代码的代码覆盖率生成应用程序的第二版本的第三代码覆盖率数据文件。In one embodiment, in step S110, generating the third code coverage data file of the second version of the application program according to the second subcode coverage data and the fourth subcode coverage data includes: rate data to determine the first line of code that has been covered by the test and the second line of code that has not been covered by the test in the second type of file; if it is determined based on the second sub-code coverage data The determination result of the sub-code coverage data and the determination result of the fourth sub-code coverage data obtain the lines of codes covered by the test and the lines of codes not covered by the test in the second version. The code coverage rate of the corresponding line code of the second version of the test-covered line code statistics application program, generates the third code coverage rate data file of the second version of the application program according to the code coverage rate of the line code program; When the code coverage data determines that the different lines of code are covered by the test, according to the determination results of the second sub-code coverage data and the determination results of the fourth sub-code coverage data, the lines of code that have been covered by the test and the lines of code that have not been covered by the test in the second version are obtained. The lines of code covered by the test, the code coverage of the line of code corresponding to the second version of the application is counted according to the line of code covered by the test and the line of code not covered by the test, and the code coverage of the line of code is generated according to the code coverage of the line of code Second version of the third code coverage data file.
在该实施例中,第二类文件中的差异行代码对应的第二子代码覆盖率数据可以判断出差异行代码已被测试覆盖,或第二类文件中的差异行代码对应的第二子代码覆盖率数据可以判断出差异行代码未被测试覆盖。第四子代码覆盖率数据可以判断出第二类文件中已被测试覆盖的第一行代码和未被测试覆盖的第二行代码。也即是说,不管根据第二类文件中的差异行代码对应的第二子代码覆盖率数据判断出差异行代码已被测试覆盖的情况或者是未被测试覆盖的情况,均可根据第二子代码覆盖率数据和根据第四子代码覆盖率数据可以确定出应用程序的第二版本中被测试过的行代码和未被测试过的行代码,从而根据应用程序的第二版本中已被测试覆盖的行代码和未被测试覆盖的行代码统计应用程序的第二版本对应的行代码的代码覆盖率,进而根据该第二版本对应的行代码的代码覆盖率生成应用程序的第二版本的第三代码覆盖率数据文件。因此,第三代码覆盖率数据文件能够真实反映出应用程序的第二版本在执行代码测试过程方法的代码覆盖率情况。In this embodiment, the second subcode coverage data corresponding to the difference line code in the second type of file can determine that the difference line code has been covered by the test, or the second subcode corresponding to the difference line code in the second type file The code coverage data can determine that the difference lines of code are not covered by the test. The fourth sub-code coverage data can determine the first line of code that has been covered by the test and the second line of code that has not been covered by the test in the second type of file. That is to say, no matter according to the second sub-code coverage data corresponding to the difference line code in the second type file, it is judged that the difference line code has been covered by the test or has not been covered by the test, it can be determined according to the second sub-code coverage data. The sub-code coverage data and the fourth sub-code coverage data can determine the tested lines of code and untested lines of code in the second version of the application program, so that according to the second version of the application program that has been tested The code coverage of the lines of codes covered by the test and the lines of codes not covered by the test are counted, and then the second version of the application is generated according to the code coverage of the lines of codes corresponding to the second version The third code coverage data file. Therefore, the third code coverage data file can truly reflect the code coverage of the second version of the application program when executing the code testing process method.
在一个实施例中,步骤S110之后,还包括:根据第二类文件获取应用程序的第二版本的代码源文件;根据第三代码覆盖率数据文件以及代码源文件生成应用程序的第二版本的代码覆盖率报告。In one embodiment, after step S110, further include: obtaining the code source file of the second version of the application program according to the second type of file; generating the code source file of the second version of the application program according to the third code coverage data file and the code source file Code coverage report.
在该实施例中,应用程序的代码覆盖率数据文件依赖于类文件(class文件)。同时,应用程序的代码源文件也依赖于类文件。通过类文件可以关联对应的代码源文件。因此,服务器根据第二类文件获取应用程序的第二版本的代码源文件,并根据第三代码覆盖率数据文件以及代码源文件生成应用程序的第二版本的代码覆盖率报告。因此,可以通过代码覆盖率报告展示应用程序的第二版本对应的源代码的测试情况之外,还可以通过代码源文件对应展示其对应的研发人员编写的代码,提高代码覆盖率报告的可视性。In this embodiment, the code coverage data file of the application depends on the class file (class file). At the same time, the code source files of the application also depend on the class files. The corresponding code source file can be associated with the class file. Therefore, the server obtains the code source file of the second version of the application program according to the second type of file, and generates a code coverage report of the second version of the application program according to the third code coverage data file and the code source file. Therefore, in addition to displaying the test status of the source code corresponding to the second version of the application through the code coverage report, the code written by the corresponding R&D personnel can also be displayed through the code source file to improve the visibility of the code coverage report sex.
在一个实施例中,根据第三代码覆盖率数据文件以及代码源文件生成应用程序的第二版本的代码覆盖率报告,包括:根据第二子代码覆盖率数据和第四子代码覆盖率数据标记出代码源文件中已测试覆盖的代码和未测试覆盖的代码;根据标记后的代码源文件以及第三代码覆盖率数据文件生成应用程序的第二版本的代码覆盖率报告。In one embodiment, generating the code coverage report of the second version of the application program according to the third code coverage data file and the code source file includes: marking according to the second sub-code coverage data and the fourth sub-code coverage data Output the code covered by the test and the code not covered by the test in the code source file; generate a code coverage report of the second version of the application program according to the marked code source file and the third code coverage data file.
在该实施例中,服务器根据差异行代码对应的第二子代码覆盖率数据标注出代码源文件中已测试覆盖的代码和/或未测试覆盖的代码,第四子代码覆盖率数据标记出代码源文件中已测试覆盖的代码和/或未测试覆盖的代码,最终生成的代码覆盖率报告中包含有标记后的代码信息,因此进一步提高代码覆盖率报告的可视性。In this embodiment, the server marks the code covered by the test and/or the code not covered by the test in the code source file according to the second sub-code coverage data corresponding to the difference line of code, and the fourth sub-code coverage data marks the code The code covered by the test and/or the code not covered by the test in the source file, the code coverage report generated finally contains the marked code information, so the visibility of the code coverage report is further improved.
在一个实施例中,根据第三代码覆盖率数据文件以及代码源文件生成应用程序的第二版本的代码覆盖率报告,包括:根据代码差异信息标记出代码源文件中的差异代码;根据标记后的代码源文件以及第三代码覆盖率数据文件生成应用程序的第二版本的代码覆盖率报告。In one embodiment, generating the code coverage report of the second version of the application program according to the third code coverage data file and the code source file includes: marking the difference code in the code source file according to the code difference information; The code source file and the third code coverage data file generate a code coverage report for the second version of the application.
在该实施例中,服务器根据差异信息标记出应用程序的第二版本的代码原文件中的差异代码,最终生成的代码覆盖率报告中包含有标记后的代码信息,因此进一步提高代码覆盖率报告的可视性。In this embodiment, the server marks the difference code in the original code file of the second version of the application program according to the difference information, and the finally generated code coverage report includes the marked code information, thus further improving the code coverage report. visibility.
应该理解的是,虽然流程图中的各个步骤按照箭头的指示依次显示,但是这些步骤并不是必然按照箭头指示的顺序依次执行。除非本文中有明确的说明,这些步骤的执行并没有严格的顺序限制,这些步骤可以以其它的顺序执行。而且,附图中的至少一部分步骤可以包括多个子步骤或者多个阶段,这些子步骤或者阶段并不必然是在同一时刻执行完成,而是可以在不同的时刻执行,这些子步骤或者阶段的执行顺序也不必然是依次进行,而是可以与其它步骤或者其它步骤的子步骤或者阶段的至少一部分轮流或者交替地执行。It should be understood that although the various steps in the flow chart are shown sequentially according to the arrows, these steps are not necessarily executed sequentially in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and these steps can be executed in other orders. Moreover, at least some of the steps in the drawings may include a plurality of sub-steps or stages, and these sub-steps or stages are not necessarily executed at the same time, but may be executed at different times. The execution of these sub-steps or stages The order is not necessarily performed sequentially, but may be performed alternately or alternately with at least a part of other steps or sub-steps or stages of other steps.
本申请还提供一种代码覆盖率的处理装置,如图3所示,该装置包括:The present application also provides a code coverage processing device, as shown in Figure 3, the device includes:
第一获取模块10,用于获取应用程序的第二版本的第二源代码相对于应用程序的第一版本的第一源代码的代码差异信息;The first acquiring
第二获取模块20,用于获取测试第二源代码时编译得到的第二类文件以及获取测试第一源代码时编译得到的第一类文件;The second acquiring
第三获取模块30,用于根据第二类文件获取测试第二源代码时生成的第二代码覆盖率数据文件,并获取第二子代码覆盖率数据和第三子代码覆盖率数据,第二子代码覆盖率数据为第二代码覆盖率数据文件中代码差异信息对应的代码覆盖率数据,第三子代码覆盖率数据为第二代码覆盖率数据文件中除第二子代码覆盖率数据之外的代码覆盖率数据;The third obtaining
第四获取模块40,用于根据第一类文件获取测试第一源代码时生成的第一代码覆盖率数据文件,从第一代码覆盖率数据文件中筛选出除代码差异信息映射在第一代码覆盖率数据文件中的代码覆盖率数据之外的第一子代码覆盖率数据;The fourth obtaining
生成模块50,用于将第一子代码覆盖率数据与第三子代码覆盖率数据进行合并处理,得到合并后的第四子代码覆盖率数据,根据第二子代码覆盖率数据和第四子代码覆盖率数据生成应用程序的第二版本的第三代码覆盖率数据文件。
在其中一个实施例中,该代码覆盖率的处理装置还包括(图3未示):In one of the embodiments, the code coverage processing device further includes (not shown in FIG. 3 ):
确定模块,用于根据代码差异信息确定第二类文件中相对于第一类文件存在区别的差异行代码;第二子代码覆盖率数据为第二代码覆盖率数据文件中差异行代码对应的代码覆盖率数据;A determining module, configured to determine, according to the code difference information, the difference line codes in the second type of files that are different from the first type of files; the second sub-code coverage data is the code corresponding to the difference line codes in the second code coverage data file coverage data;
第四获取模块40包括第一获取单元,第一获取单元用于从第一代码覆盖率数据文件中筛选出除差异行代码映射在第一代码覆盖率数据文件中的代码覆盖率数据之外的第一子代码覆盖率数据。The
在其中一个实施例中,确定模块包括(图3未示)::In one of the embodiments, the determination module includes (not shown in Figure 3):
第二获取单元,用于根据代码差异信息获取第二类文件中相对于第一类文件存在区别的差异方法名、差异代码分支名和/或差异代码的标号;The second obtaining unit is used to obtain, according to the code difference information, the name of the difference method, the name of the branch of the difference code and/or the label of the difference code that are different from the files of the first type in the second type of file;
第三获取单元,用于若存在差异方法名,获取差异方法名的差异方法,获取差异方法中存在的差异行代码;The third obtaining unit is used to obtain the difference method of the difference method name if there is a difference method name, and obtain the difference line code existing in the difference method;
第四获取单元,用于若存在差异代码分支名,获取差异代码分支名的差异代码分支,获取差异代码分支中存在的差异行代码;The fourth obtaining unit is used to obtain the difference code branch of the difference code branch name if there is a difference code branch name, and obtain the difference line code existing in the difference code branch;
第五获取单元,用于若存在差异代码的标号,获取差异代码的标号对应的差异代码,根据差异代码获取差异行代码。The fifth acquisition unit is used to acquire the difference code corresponding to the label of the difference code if there is a label of the difference code, and obtain the difference line code according to the difference code.
在其中一个实施例中,确定模块还包括(图3未示)::In one of the embodiments, the determination module also includes (not shown in Figure 3):
第六获取单元,用于若同时存在差异方法名和差异代码分支名,获取差异方法名的差异方法以及获取差异代码分支名的差异代码分支,根据差异方法获取第二类文件中相对于第一类文件存在区别的第一目标行代码,根据差异代码分支获取第二类文件中相对于第一类文件存在区别的第二目标行代码,当第一目标行代码和第二目标行代码匹配时将第一目标行代码或第二目标行代码作为差异行代码,当第一目标行代码和第二目标行代码不匹配时将第一目标行代码和第二目标行代码均作为差异行代码;The sixth acquisition unit is used to obtain the difference method of the difference method name and the difference code branch of the difference code branch name if there are difference method names and difference code branch names at the same time, and obtain the files of the second type relative to the first type according to the difference method The first target line code that differs from the file, obtains the second target line code that is different from the first type file in the second type of file according to the difference code branch, and when the first target line code matches the second target line code, the The first target line code or the second target line code is used as the difference line code, and when the first target line code and the second target line code do not match, both the first target line code and the second target line code are used as the difference line code;
第七获取单元,用于若同时存在差异方法名和差异代码的标号,获取差异方法名的差异方法以及获取差异代码的标号对应的差异代码,根据差异方法获取第二类文件中相对于第一类文件存在区别的第三目标行代码,根据差异代码获取第二类文件中相对于第一类文件存在区别的第四目标行代码,当第三目标行代码和第四目标行代码匹配时将第三目标行代码或第四目标行代码作为差异行代码,当第三目标行代码和第四目标行代码不匹配时将第三目标行代码和第四目标行代码均作为差异行代码;The seventh acquisition unit is used to obtain the difference method of the difference method name and the difference code corresponding to the label of the difference code if there is a difference method name and a difference code label at the same time, and obtain the second type of file relative to the first type according to the difference method There is a third target line code with a difference in the file, and the fourth target line code that is different from the first type of file in the second type of file is obtained according to the difference code, and when the third target line code and the fourth target line code match, the first The third target line code or the fourth target line code is used as the difference line code, and when the third target line code and the fourth target line code do not match, both the third target line code and the fourth target line code are used as the difference line code;
第八获取单元,用于若同时存在差异代码分支名和差异代码的标号,获取差异代码的标号的差异代码以及获取差异代码分支名的差异代码分支,根据差异代码获取第二类文件中相对于第一类文件存在区别的第五目标行代码,根据差异代码分支获取第二类文件中相对于第一类文件存在区别的第六目标行代码,当第五目标行代码和第六目标行代码匹配时将第五目标行代码或第六目标行代码作为差异行代码,当第五目标行代码和第六目标行代码不匹配时将第五目标行代码和第六目标行代码均作为差异行代码。The eighth acquisition unit is used to obtain the difference code of the label of the difference code and the difference code branch of the difference code branch name if there is a difference code branch name and a difference code label at the same time, and obtain the second type of file according to the difference code. The code of the fifth target line that is different from the first type of file is obtained according to the difference code branch, and the code of the sixth target line that is different from the first type of file in the second type of file is obtained. When the fifth target line code and the sixth target line code match When the fifth target line code or the sixth target line code is used as the difference line code, when the fifth target line code and the sixth target line code do not match, both the fifth target line code and the sixth target line code are used as the difference line code .
在其中一个实施例中,生成模块包括(图3未示):In one of the embodiments, the generation module includes (not shown in Fig. 3):
第一确定单元,用于根据第四子代码覆盖率数据确定第二类文件中已被测试覆盖的第一行代码和未被测试覆盖的第二行代码;The first determining unit is used to determine the first line of code that has been covered by the test and the second line of code that has not been covered by the test in the second type of file according to the fourth sub-code coverage data;
第一生成单元,用于若根据第二子代码覆盖率数据确定差异行代码已被测试覆盖时,根据第二子代码覆盖率数据的确定结果以及第四子代码覆盖率数据的确定结果获取第二版本中已被测试覆盖的行代码和未被测试覆盖的行代码,根据已被测试覆盖的行代码和未被测试覆盖的行代码统计应用程序的第二版本对应的行代码的代码覆盖率,根据行代码的代码覆盖率生成应用程序的第二版本的第三代码覆盖率数据文件;The first generation unit is used to obtain the second sub-code coverage data according to the determination result of the second sub-code coverage data and the determination result of the fourth sub-code coverage data if it is determined that the difference line of code has been covered by the test according to the second sub-code coverage data. Lines of code that have been covered by the test and lines of code that have not been covered by the test in the second version, according to the line of code that has been covered by the test and the line of code that has not been covered by the test, the code coverage rate of the line of code corresponding to the second version of the application is counted , generating a third code coverage data file of the second version of the application program according to the code coverage of the line of code;
第二生成单元,用于若根据第二子代码覆盖率数据确定差异行代码被测试覆盖时,根据第二子代码覆盖率数据的确定结果以及第四子代码覆盖率数据的确定结果获取第二版本中已被测试覆盖的行代码和未被测试覆盖的行代码,根据已被测试覆盖的行代码和未被测试覆盖的行代码统计应用程序的第二版本对应的行代码的代码覆盖率,根据行代码的代码覆盖率生成应用程序的第二版本的第三代码覆盖率数据文件。The second generation unit is used to obtain the second subcode according to the determination result of the second subcode coverage data and the determination result of the fourth subcode coverage data if it is determined that the difference line code is covered by the test according to the second subcode coverage data. The lines of code that have been covered by the test and the lines of code that have not been covered by the test in the version, according to the code coverage of the line of code that has been covered by the test and the line of code that has not been covered by the test, the code coverage of the line of code corresponding to the second version of the application, A third code coverage data file of the second version of the application is generated based on the code coverage of the line of code.
在其中一个实施例中,该代码覆盖率的处理装置还包括(图3未示):In one of the embodiments, the code coverage processing device further includes (not shown in FIG. 3 ):
第五获取模块,用于根据第二类文件获取应用程序的第二版本的代码源文件;The fifth obtaining module is used to obtain the code source file of the second version of the application program according to the second type of file;
第一报告生成模块,用于根据第三代码覆盖率数据文件以及代码源文件生成应用程序的第二版本的代码覆盖率报告。The first report generating module is configured to generate a code coverage report of the second version of the application program according to the third code coverage data file and the code source file.
在其中一个实施例中,第一报告生成模块(图3未示)包括:In one of the embodiments, the first report generation module (not shown in Figure 3) includes:
第一报告生成单元,用于根据第二子代码覆盖率数据和第四子代码覆盖率数据标记出代码源文件中已测试覆盖的代码和未测试覆盖的代码,根据标记后的代码源文件以及第三代码覆盖率数据文件生成应用程序的第二版本的代码覆盖率报告;和/或,The first report generation unit is used to mark out the code covered by the test and the code not covered by the test in the code source file according to the second sub-code coverage data and the fourth sub-code coverage data, according to the marked code source file and The third code coverage data file generates a code coverage report for the second version of the application; and/or,
根据代码差异信息标记出代码源文件中的差异代码,根据标记后的代码源文件以及第三代码覆盖率数据文件生成应用程序的第二版本的代码覆盖率报告。The difference code in the code source file is marked according to the code difference information, and a code coverage report of the second version of the application program is generated according to the marked code source file and the third code coverage data file.
关于代码覆盖率的处理装置的具体限定可以参见上文中对于代码覆盖率的处理方法的限定,在此不再赘述。上述代码覆盖率的处理装置中的各个模块可全部或部分通过软件、硬件及其组合来实现。上述各模块可以硬件形式内嵌于或独立于计算机设备中的处理器中,也可以以软件形式存储于计算机设备中的存储器中,以便于处理器调用执行以上各个模块对应的操作。For the specific limitations of the code coverage processing device, refer to the above definition of the code coverage processing method, which will not be repeated here. Each module in the above code coverage processing device may be fully or partially realized by software, hardware or a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, and can also be stored in the memory of the computer device in the form of software, so that the processor can invoke and execute the corresponding operations of the above-mentioned modules.
在一个实施例中,提供了一种计算机设备,该计算机设备可以为服务器,其内部结构图可以如图4所示。该计算机设备包括通过系统总线连接的处理器、存储器、网络接口和数据库。其中,该计算机设备的处理器用于提供计算和控制能力。该计算机设备的存储器包括非易失性存储介质、内存储器。该非易失性存储介质存储有操作系统、计算机程序和数据库。该内存储器为非易失性存储介质中的操作系统和计算机程序的运行提供环境。该计算机设备的网络接口用于与外部的终端连接,以与外部终端进行数据交互。该计算机程序被处理器执行时以实现上述任一实施例中一种代码覆盖率的处理方法。In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure may be as shown in FIG. 4 . The computer device includes a processor, memory, network interface and database connected by a system bus. Wherein, the processor of the computer device is used to provide calculation and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, computer programs and databases. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The network interface of the computer device is used to connect with an external terminal, so as to exchange data with the external terminal. When the computer program is executed by the processor, a method for processing code coverage in any of the above-mentioned embodiments can be implemented.
本领域技术人员可以理解,图4中示出的结构,仅仅是与本申请方案相关的部分结构的框图,并不构成对本申请方案所应用于其上的计算机设备的限定,具体的计算机设备可以包括比图中所示更多或更少的部件,或者组合某些部件,或者具有不同的部件布置。Those skilled in the art can understand that the structure shown in Figure 4 is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation to the computer equipment on which the solution of the application is applied. The specific computer equipment can be More or fewer components than shown in the figures may be included, or some components may be combined, or have a different arrangement of components.
在一个实施例中,提供了一种计算机设备,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,处理器执行计算机程序时实现以下步骤:In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored on the memory and operable on the processor. When the processor executes the computer program, the following steps are implemented:
获取应用程序的第二版本的第二源代码相对于应用程序的第一版本的第一源代码的代码差异信息;获取测试第二源代码时编译得到的第二类文件以及获取测试第一源代码时编译得到的第一类文件;根据第二类文件获取测试第二源代码时生成的第二代码覆盖率数据文件,并获取第二子代码覆盖率数据和第三子代码覆盖率数据,第二子代码覆盖率数据为第二代码覆盖率数据文件中代码差异信息对应的代码覆盖率数据,第三子代码覆盖率数据为第二代码覆盖率数据文件中除第二子代码覆盖率数据之外的代码覆盖率数据;根据第一类文件获取测试第一源代码时生成的第一代码覆盖率数据文件,从第一代码覆盖率数据文件中筛选出除代码差异信息映射在第一代码覆盖率数据文件中的代码覆盖率数据之外的第一子代码覆盖率数据;将第一子代码覆盖率数据与第三子代码覆盖率数据进行合并处理,得到合并后的第四子代码覆盖率数据,根据第二子代码覆盖率数据和第四子代码覆盖率数据生成应用程序的第二版本的第三代码覆盖率数据文件。Obtain code difference information of the second source code of the second version of the application program relative to the first source code of the first version of the application program; obtain the second type of file compiled when testing the second source code and obtain the test first source code The first type of file obtained when compiling the code; according to the second type of file, the second code coverage data file generated when testing the second source code is obtained, and the second sub-code coverage data and the third sub-code coverage data are obtained, The second subcode coverage data is the code coverage data corresponding to the code difference information in the second code coverage data file, and the third subcode coverage data is the second code coverage data file except the second subcode coverage data Code coverage data other than the code coverage data; according to the first type of file, the first code coverage data file generated when testing the first source code is obtained, and the first code coverage data file is selected from the first code coverage data file except that the code difference information is mapped in the first code The first subcode coverage data other than the code coverage data in the coverage data file; the first subcode coverage data and the third subcode coverage data are merged to obtain the merged fourth subcode coverage rate data, generating a third code coverage data file of the second version of the application program according to the second sub-code coverage data and the fourth sub-code coverage data.
在其中一个实施例中,处理器执行计算机程序时实现以下步骤:根据代码差异信息确定第二类文件中相对于第一类文件存在区别的差异行代码;第二子代码覆盖率数据为第二代码覆盖率数据文件中差异行代码对应的代码覆盖率数据;处理器执行计算机程序实现上述的从第一代码覆盖率数据文件中筛选出除代码差异信息映射在第一代码覆盖率数据文件中的代码覆盖率数据之外的第一子代码覆盖率数据步骤时,具体实现以下步骤:从第一代码覆盖率数据文件中筛选出除差异行代码映射在第一代码覆盖率数据文件中的代码覆盖率数据之外的第一子代码覆盖率数据。In one of the embodiments, when the processor executes the computer program, the following steps are implemented: according to the code difference information, the difference line codes in the second type of file are determined relative to the first type of file; the second sub-code coverage data is the second The code coverage data corresponding to the difference line code in the code coverage data file; the processor executes the computer program to realize the above-mentioned screening from the first code coverage data file except that the code difference information is mapped in the first code coverage data file When the first sub-code coverage data step other than the code coverage data is carried out, the following steps are specifically implemented: from the first code coverage data file, filter out the code coverage except for the difference line code mapping in the first code coverage data file First subcode coverage data other than coverage data.
在其中一个实施例中,处理器执行计算机程序实现上述的根据代码差异信息确定第二类文件中相对于第一类文件存在区别的差异行代码步骤时,具体实现以下步骤:根据代码差异信息获取第二类文件中相对于第一类文件存在区别的差异方法名、差异代码分支名和/或差异代码的标号;若存在差异方法名,获取差异方法名的差异方法,获取差异方法中存在的差异行代码;若存在差异代码分支名,获取差异代码分支名的差异代码分支,获取差异代码分支中存在的差异行代码;若存在差异代码的标号,获取差异代码的标号对应的差异代码,根据差异代码获取差异行代码。In one of the embodiments, when the processor executes the computer program to realize the above-mentioned step of determining the difference line codes in the second type of file with respect to the first type of file according to the code difference information, the following steps are specifically implemented: according to the code difference information to obtain The difference method name, difference code branch name, and/or difference code label that is different from the first type of file in the second type of file; if there is a difference method name, obtain the difference method of the difference method name, and obtain the difference in the difference method If there is a difference code branch name, get the difference code branch of the difference code branch name, and get the difference line code in the difference code branch; if there is a difference code label, get the difference code corresponding to the difference code label, according to the difference The code gets the difference line of code.
在其中一个实施例中,处理器执行计算机程序时实现以下步骤:若同时存在差异方法名和差异代码分支名,获取差异方法名的差异方法以及获取差异代码分支名的差异代码分支,根据差异方法获取第二类文件中相对于第一类文件存在区别的第一目标行代码,根据差异代码分支获取第二类文件中相对于第一类文件存在区别的第二目标行代码,当第一目标行代码和第二目标行代码匹配时将第一目标行代码或第二目标行代码作为差异行代码,当第一目标行代码和第二目标行代码不匹配时将第一目标行代码和第二目标行代码均作为差异行代码;若同时存在差异方法名和差异代码的标号,获取差异方法名的差异方法以及获取差异代码的标号对应的差异代码,根据差异方法获取第二类文件中相对于第一类文件存在区别的第三目标行代码,根据差异代码获取第二类文件中相对于第一类文件存在区别的第四目标行代码,当第三目标行代码和第四目标行代码匹配时将第三目标行代码或第四目标行代码作为差异行代码,当第三目标行代码和第四目标行代码不匹配时将第三目标行代码和第四目标行代码均作为差异行代码;若同时存在差异代码分支名和差异代码的标号,获取差异代码的标号的差异代码以及获取差异代码分支名的差异代码分支,根据差异代码获取第二类文件中相对于第一类文件存在区别的第五目标行代码,根据差异代码分支获取第二类文件中相对于第一类文件存在区别的第六目标行代码,当第五目标行代码和第六目标行代码匹配时将第五目标行代码或第六目标行代码作为差异行代码,当第五目标行代码和第六目标行代码不匹配时将第五目标行代码和第六目标行代码均作为差异行代码。In one of the embodiments, when the processor executes the computer program, the following steps are implemented: if there are difference method names and difference code branch names at the same time, obtain the difference methods for the difference method names and the difference code branches for obtaining the difference code branch names, and obtain according to the difference methods For the first target line code that is different from the first type file in the second type file, obtain the second target line code that is different from the first type file in the second type file according to the difference code branch, when the first target line When the code and the second target line code match, the first target line code or the second target line code is used as the difference line code; when the first target line code and the second target line code do not match, the first target line code and the second target line code are The target line codes are all used as difference line codes; if there is a difference method name and a difference code label at the same time, obtain the difference method of the difference method name and the difference code corresponding to the label of the difference code, and obtain the relative difference in the second type of file according to the difference method The third target line code that is different from one type of file is obtained according to the difference code to obtain the fourth target line code that is different from the first type of file in the second type of file, when the third target line code and the fourth target line code match The third target line code or the fourth target line code is used as the difference line code, and when the third target line code and the fourth target line code do not match, both the third target line code and the fourth target line code are used as the difference line code; If the difference code branch name and the label of the difference code exist at the same time, the difference code of the label of the difference code and the difference code branch of the difference code branch name are obtained, and the second type of file that is different from the first type of file is obtained according to the difference code. Five target line codes, according to the difference code branch to obtain the sixth target line code in the second type of file that is different from the first type of file, when the fifth target line code and the sixth target line code match, the fifth target line code Or the sixth target line code is used as the difference line code, and when the fifth target line code and the sixth target line code do not match, both the fifth target line code and the sixth target line code are used as the difference line code.
在其中一个实施例中,处理器执行计算机程序实现上述的根据第二子代码覆盖率数据和第四子代码覆盖率数据生成应用程序的第二版本的第三代码覆盖率数据文件步骤时,具体实现以下步骤:根据第四子代码覆盖率数据确定第二类文件中已被测试覆盖的第一行代码和未被测试覆盖的第二行代码;若根据第二子代码覆盖率数据确定差异行代码已被测试覆盖时,根据第二子代码覆盖率数据的确定结果以及第四子代码覆盖率数据的确定结果获取第二版本中已被测试覆盖的行代码和未被测试覆盖的行代码,根据已被测试覆盖的行代码和未被测试覆盖的行代码统计应用程序的第二版本对应的行代码的代码覆盖率,根据行代码的代码覆盖率生成应用程序的第二版本的第三代码覆盖率数据文件;若根据第二子代码覆盖率数据确定差异行代码被测试覆盖时,根据第二子代码覆盖率数据的确定结果以及第四子代码覆盖率数据的确定结果获取第二版本中已被测试覆盖的行代码和未被测试覆盖的行代码,根据已被测试覆盖的行代码和未被测试覆盖的行代码统计应用程序的第二版本对应的行代码的代码覆盖率,根据行代码的代码覆盖率生成应用程序的第二版本的第三代码覆盖率数据文件。In one of the embodiments, when the processor executes the computer program to implement the above step of generating the third code coverage data file of the second version of the application program according to the second sub-code coverage data and the fourth sub-code coverage data, specifically Implement the following steps: determine the first line of code that has been covered by the test and the second line of code that has not been covered by the test in the second type of file according to the fourth sub-code coverage data; if determine the difference line according to the second sub-code coverage data When the code has been covered by the test, according to the determination result of the second sub-code coverage data and the determination result of the fourth sub-code coverage data, obtain the lines of code that have been covered by the test and the lines of code that have not been covered by the test in the second version, Count the code coverage of the line of code corresponding to the second version of the application program according to the line of code covered by the test and the line of code not covered by the test, and generate the third code of the second version of the application program according to the code coverage rate of the line of code Coverage data file; if it is determined according to the second sub-code coverage data that the difference row code is covered by the test, according to the determination result of the second sub-code coverage data and the determination result of the fourth sub-code coverage data, obtain the second version Lines of code that have been covered by the test and lines of code that have not been covered by the test, according to the line of code that has been covered by the test and the line of code that has not been covered by the test, the code coverage of the line of code corresponding to the second version of the application is counted. The code coverage of the code generates a third code coverage data file for the second version of the application.
在其中一个实施例中,处理器执行计算机程序时实现以下步骤:根据第二类文件获取应用程序的第二版本的代码源文件;根据第三代码覆盖率数据文件以及代码源文件生成应用程序的第二版本的代码覆盖率报告。In one of the embodiments, the following steps are implemented when the processor executes the computer program: obtain the code source file of the second version of the application program according to the second type of file; generate the code source file of the application program according to the third code coverage data file and the code source file The second version of the code coverage report.
在其中一个实施例中,处理器执行计算机程序实现上述的根据第三代码覆盖率数据文件以及代码源文件生成应用程序的第二版本的代码覆盖率报告步骤时,具体实现以下步骤:根据第二子代码覆盖率数据和第四子代码覆盖率数据标记出代码源文件中已测试覆盖的代码和未测试覆盖的代码,根据标记后的代码源文件以及第三代码覆盖率数据文件生成应用程序的第二版本的代码覆盖率报告;和/或,根据代码差异信息标记出代码源文件中的差异代码,根据标记后的代码源文件以及第三代码覆盖率数据文件生成应用程序的第二版本的代码覆盖率报告。In one of the embodiments, when the processor executes the computer program to implement the above-mentioned steps of generating the code coverage report of the second version of the application program according to the third code coverage data file and the code source file, the following steps are specifically implemented: according to the second The sub-code coverage data and the fourth sub-code coverage data mark the code covered by the test and the code not covered by the test in the code source file, and generate the application program according to the code source file after marking and the third code coverage data file The second version of the code coverage report; and/or, mark the difference code in the code source file according to the code difference information, and generate the second version of the application program according to the marked code source file and the third code coverage data file Code coverage report.
在一个实施例中,提供了一种计算机可读存储介质,其上存储有计算机程序,计算机程序被处理器执行时实现以下步骤:In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:
获取应用程序的第二版本的第二源代码相对于应用程序的第一版本的第一源代码的代码差异信息;获取测试第二源代码时编译得到的第二类文件以及获取测试第一源代码时编译得到的第一类文件;根据第二类文件获取测试第二源代码时生成的第二代码覆盖率数据文件,并获取第二子代码覆盖率数据和第三子代码覆盖率数据,第二子代码覆盖率数据为第二代码覆盖率数据文件中代码差异信息对应的代码覆盖率数据,第三子代码覆盖率数据为第二代码覆盖率数据文件中除第二子代码覆盖率数据之外的代码覆盖率数据;根据第一类文件获取测试第一源代码时生成的第一代码覆盖率数据文件,从第一代码覆盖率数据文件中筛选出除代码差异信息映射在第一代码覆盖率数据文件中的代码覆盖率数据之外的第一子代码覆盖率数据;将第一子代码覆盖率数据与第三子代码覆盖率数据进行合并处理,得到合并后的第四子代码覆盖率数据,根据第二子代码覆盖率数据和第四子代码覆盖率数据生成应用程序的第二版本的第三代码覆盖率数据文件。Obtain code difference information of the second source code of the second version of the application program relative to the first source code of the first version of the application program; obtain the second type of file compiled when testing the second source code and obtain the test first source code The first type of file obtained when compiling the code; according to the second type of file, the second code coverage data file generated when testing the second source code is obtained, and the second sub-code coverage data and the third sub-code coverage data are obtained, The second subcode coverage data is the code coverage data corresponding to the code difference information in the second code coverage data file, and the third subcode coverage data is the second code coverage data file except the second subcode coverage data Code coverage data other than the code coverage data; according to the first type of file, the first code coverage data file generated when testing the first source code is obtained, and the first code coverage data file is selected from the first code coverage data file except that the code difference information is mapped in the first code The first subcode coverage data other than the code coverage data in the coverage data file; the first subcode coverage data and the third subcode coverage data are merged to obtain the merged fourth subcode coverage rate data, generating a third code coverage data file of the second version of the application program according to the second sub-code coverage data and the fourth sub-code coverage data.
在其中一个实施例中,计算机程序被处理器执行时实现以下步骤:根据代码差异信息确定第二类文件中相对于第一类文件存在区别的差异行代码;第二子代码覆盖率数据为第二代码覆盖率数据文件中差异行代码对应的代码覆盖率数据;计算机程序被处理器执行实现上述的从第一代码覆盖率数据文件中筛选出除代码差异信息映射在第一代码覆盖率数据文件中的代码覆盖率数据之外的第一子代码覆盖率数据步骤时,具体实现以下步骤:从第一代码覆盖率数据文件中筛选出除差异行代码映射在第一代码覆盖率数据文件中的代码覆盖率数据之外的第一子代码覆盖率数据。In one of the embodiments, when the computer program is executed by the processor, the following steps are implemented: according to the code difference information, it is determined that there are different line codes in the second type of file that are different from the first type of file; the second sub-code coverage data is the second sub-code coverage data The code coverage data corresponding to the difference line code in the second code coverage data file; the computer program is executed by the processor to realize the above-mentioned screening from the first code coverage data file except that the code difference information is mapped on the first code coverage data file When performing the first sub-code coverage data step other than the code coverage data in the code coverage data, the following steps are specifically implemented: from the first code coverage data file, filter out the difference row code mapping in the first code coverage data file The first subcode coverage data other than the code coverage data.
在其中一个实施例中,计算机程序被处理器执行实现上述的根据代码差异信息确定第二类文件中相对于第一类文件存在区别的差异行代码步骤时,具体实现以下步骤:根据代码差异信息获取第二类文件中相对于第一类文件存在区别的差异方法名、差异代码分支名和/或差异代码的标号;若存在差异方法名,获取差异方法名的差异方法,获取差异方法中存在的差异行代码;若存在差异代码分支名,获取差异代码分支名的差异代码分支,获取差异代码分支中存在的差异行代码;若存在差异代码的标号,获取差异代码的标号对应的差异代码,根据差异代码获取差异行代码。In one of the embodiments, when the computer program is executed by the processor to implement the above-mentioned step of determining the difference line codes in the second type of file relative to the first type of file according to the code difference information, the following steps are specifically implemented: according to the code difference information Obtain the difference method name, difference code branch name and/or difference code label that is different from the first type of file in the second type of file; if there is a difference method name, obtain the difference method of the difference method name, and obtain the difference method that exists in the difference method Difference line code; if there is a difference code branch name, obtain the difference code branch of the difference code branch name, and obtain the difference line code existing in the difference code branch; if there is a difference code label, obtain the difference code corresponding to the difference code label, according to diff_code Gets the diff line code.
在其中一个实施例中,计算机程序被处理器执行时实现以下步骤:若同时存在差异方法名和差异代码分支名,获取差异方法名的差异方法以及获取差异代码分支名的差异代码分支,根据差异方法获取第二类文件中相对于第一类文件存在区别的第一目标行代码,根据差异代码分支获取第二类文件中相对于第一类文件存在区别的第二目标行代码,当第一目标行代码和第二目标行代码匹配时将第一目标行代码或第二目标行代码作为差异行代码,当第一目标行代码和第二目标行代码不匹配时将第一目标行代码和第二目标行代码均作为差异行代码;若同时存在差异方法名和差异代码的标号,获取差异方法名的差异方法以及获取差异代码的标号对应的差异代码,根据差异方法获取第二类文件中相对于第一类文件存在区别的第三目标行代码,根据差异代码获取第二类文件中相对于第一类文件存在区别的第四目标行代码,当第三目标行代码和第四目标行代码匹配时将第三目标行代码或第四目标行代码作为差异行代码,当第三目标行代码和第四目标行代码不匹配时将第三目标行代码和第四目标行代码均作为差异行代码;若同时存在差异代码分支名和差异代码的标号,获取差异代码的标号的差异代码以及获取差异代码分支名的差异代码分支,根据差异代码获取第二类文件中相对于第一类文件存在区别的第五目标行代码,根据差异代码分支获取第二类文件中相对于第一类文件存在区别的第六目标行代码,当第五目标行代码和第六目标行代码匹配时将第五目标行代码或第六目标行代码作为差异行代码,当第五目标行代码和第六目标行代码不匹配时将第五目标行代码和第六目标行代码均作为差异行代码。In one of the embodiments, when the computer program is executed by the processor, the following steps are implemented: if there is a difference method name and a difference code branch name at the same time, obtain the difference method for the difference method name and the difference code branch for obtaining the difference code branch name, according to the difference method Obtain the first target line code that is different from the first type of file in the second type of file, and obtain the second target line code that is different from the first type of file in the second type of file according to the difference code branch, when the first target When the line code and the second target line code match, the first target line code or the second target line code is used as the difference line code; when the first target line code and the second target line code do not match, the first target line code and the second target line code are Both target line codes are regarded as difference line codes; if there is a difference method name and a difference code label at the same time, obtain the difference method corresponding to the difference method name and the difference code corresponding to the label of the difference code, and obtain the relative difference in the second type of file according to the difference method The third target line code that is different from the first type of file, according to the difference code, obtain the fourth target line code that is different from the first type of file in the second type of file, when the third target line code and the fourth target line code match When the third target line code or the fourth target line code is used as the difference line code, when the third target line code and the fourth target line code do not match, both the third target line code and the fourth target line code are used as the difference line code ; If there is a difference code branch name and a difference code label at the same time, obtain the difference code of the label of the difference code and the difference code branch that obtains the difference code branch name, and obtain the difference between the second type of file and the first type of file according to the difference code The fifth target line code, according to the difference code branch, obtains the sixth target line code that is different from the first type file in the second type of file, and when the fifth target line code matches the sixth target line code, the fifth target line code is The code or the sixth target line code is used as the difference line code, and when the fifth target line code and the sixth target line code do not match, both the fifth target line code and the sixth target line code are used as the difference line code.
在其中一个实施例中,计算机程序被处理器执行实现上述的根据第二子代码覆盖率数据和第四子代码覆盖率数据生成应用程序的第二版本的第三代码覆盖率数据文件步骤时,具体实现以下步骤:根据第四子代码覆盖率数据确定第二类文件中已被测试覆盖的第一行代码和未被测试覆盖的第二行代码;若根据第二子代码覆盖率数据确定差异行代码已被测试覆盖时,根据第二子代码覆盖率数据的确定结果以及第四子代码覆盖率数据的确定结果获取第二版本中已被测试覆盖的行代码和未被测试覆盖的行代码,根据已被测试覆盖的行代码和未被测试覆盖的行代码统计应用程序的第二版本对应的行代码的代码覆盖率,根据行代码的代码覆盖率生成应用程序的第二版本的第三代码覆盖率数据文件;若根据第二子代码覆盖率数据确定差异行代码被测试覆盖时,根据第二子代码覆盖率数据的确定结果以及第四子代码覆盖率数据的确定结果获取第二版本中已被测试覆盖的行代码和未被测试覆盖的行代码,根据已被测试覆盖的行代码和未被测试覆盖的行代码统计应用程序的第二版本对应的行代码的代码覆盖率,根据行代码的代码覆盖率生成应用程序的第二版本的第三代码覆盖率数据文件。In one of the embodiments, when the computer program is executed by the processor to realize the above step of generating the third code coverage data file of the second version of the application program according to the second sub-code coverage data and the fourth sub-code coverage data, Specifically realize the following steps: determine the first line of code that has been covered by the test and the second line of code that has not been covered by the test in the second type of file according to the fourth sub-code coverage data; if the difference is determined according to the second sub-code coverage data When the line of code has been covered by the test, obtain the line of code covered by the test and the line of code not covered by the test in the second version according to the determination result of the second sub-code coverage data and the determination result of the fourth sub-code coverage data According to the code coverage of the line of code that has been covered by the test and the line of code not covered by the test, the code coverage of the line of code corresponding to the second version of the application is calculated, and the third version of the second version of the application is generated according to the code coverage of the line of code Code coverage data file; if it is determined according to the second sub-code coverage data that the difference line code is covered by the test, the second version is obtained according to the determination result of the second sub-code coverage data and the determination result of the fourth sub-code coverage data Lines of code that have been covered by the test and lines of code that have not been covered by the test, and the code coverage of the line of code corresponding to the second version of the application is counted according to the line of code that has been covered by the test and the line of code that has not been covered by the test. According to The code coverage for the line of code generates a third code coverage data file for the second version of the application.
在其中一个实施例中,计算机程序被处理器执行时实现以下步骤:根据第二类文件获取应用程序的第二版本的代码源文件;根据第三代码覆盖率数据文件以及代码源文件生成应用程序的第二版本的代码覆盖率报告。In one of the embodiments, when the computer program is executed by the processor, the following steps are implemented: obtain the code source file of the second version of the application program according to the second type of file; generate the application program according to the third code coverage data file and the code source file The second version of the code coverage report.
在其中一个实施例中,计算机程序被处理器执行实现上述的根据第三代码覆盖率数据文件以及代码源文件生成应用程序的第二版本的代码覆盖率报告步骤时,具体实现以下步骤:根据第二子代码覆盖率数据和第四子代码覆盖率数据标记出代码源文件中已测试覆盖的代码和未测试覆盖的代码,根据标记后的代码源文件以及第三代码覆盖率数据文件生成应用程序的第二版本的代码覆盖率报告;和/或,根据代码差异信息标记出代码源文件中的差异代码,根据标记后的代码源文件以及第三代码覆盖率数据文件生成应用程序的第二版本的代码覆盖率报告。In one of the embodiments, when the computer program is executed by the processor to implement the above-mentioned steps of generating the code coverage report of the second version of the application program according to the third code coverage data file and the code source file, the following steps are specifically implemented: according to the first The second sub-code coverage data and the fourth sub-code coverage data mark out the code covered by the test and the code not covered by the test in the code source file, and generate the application program according to the marked code source file and the third code coverage data file The second version of the code coverage report; and/or, mark the difference code in the code source file according to the code difference information, and generate the second version of the application program according to the marked code source file and the third code coverage data file code coverage report.
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成,所述的计算机程序可存储于一非易失性计算机可读取存储介质中,该计算机程序在执行时,可包括如上述各方法的实施例的流程。其中,本申请所提供的各实施例中所使用的对存储器、存储、数据库或其它介质的任何引用,均可包括非易失性和/或易失性存储器。非易失性存储器可包括只读存储器(ROM)、可编程ROM(PROM)、电可编程ROM(EPROM)、电可擦除可编程ROM(EEPROM)或闪存。易失性存储器可包括随机存取存储器(RAM)或者外部高速缓冲存储器。作为说明而非局限,RAM以多种形式可得,诸如静态RAM(SRAM)、动态RAM(DRAM)、同步DRAM(SDRAM)、双数据率SDRAM(DDRSDRAM)、增强型SDRAM(ESDRAM)、同步链路(Synchlink)DRAM(SLDRAM)、存储器总线(Rambus)直接RAM(RDRAM)、直接存储器总线动态RAM(DRDRAM)、以及存储器总线动态RAM(RDRAM)等。Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be implemented through computer programs to instruct related hardware, and the computer programs can be stored in a non-volatile computer-readable memory In the medium, when the computer program is executed, it may include the processes of the embodiments of the above-mentioned methods. Wherein, any references to memory, storage, database or other media used in the various embodiments provided in the present application may include non-volatile and/or volatile memory. Nonvolatile memory can include read only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in many forms such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDRSDRAM), Enhanced SDRAM (ESDRAM), Synchronous Chain Synchlink DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
以上实施例的各技术特征可以进行任意的组合,为使描述简洁,未对上述实施例中的各个技术特征所有可能的组合都进行描述,然而,只要这些技术特征的组合不存在矛盾,都应当认为是本说明书记载的范围。The technical features of the above embodiments can be combined arbitrarily. To make the description concise, all possible combinations of the technical features in the above embodiments are not described. However, as long as there is no contradiction in the combination of these technical features, they should be It is considered to be within the range described in this specification.
以上所述实施例仅表达了本申请的几种实施方式,其描述较为具体和详细,但并不能因此而理解为对发明专利范围的限制。应当指出的是,对于本领域的普通技术人员来说,在不脱离本申请构思的前提下,还可以做出若干变形和改进,这些都属于本申请的保护范围。因此,本申请专利的保护范围应以所附权利要求为准。The above-mentioned embodiments only represent several implementation modes of the present application, and the description thereof is relatively specific and detailed, but it should not be construed as limiting the scope of the patent for the invention. It should be noted that those skilled in the art can make several modifications and improvements without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the scope of protection of the patent application should be based on the appended claims.
Claims (9)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201911242850.1A CN111124894B (en) | 2019-12-06 | 2019-12-06 | Code coverage rate processing method and device and computer equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201911242850.1A CN111124894B (en) | 2019-12-06 | 2019-12-06 | Code coverage rate processing method and device and computer equipment |
Publications (2)
Publication Number | Publication Date |
---|---|
CN111124894A CN111124894A (en) | 2020-05-08 |
CN111124894B true CN111124894B (en) | 2023-04-28 |
Family
ID=70497789
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201911242850.1A Active CN111124894B (en) | 2019-12-06 | 2019-12-06 | Code coverage rate processing method and device and computer equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111124894B (en) |
Families Citing this family (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112148590B (en) * | 2020-08-27 | 2022-11-04 | 浙江大搜车融资租赁有限公司 | Method, device and equipment for determining code coverage rate |
CN112463620B (en) * | 2020-12-03 | 2024-09-17 | 广州品唯软件有限公司 | Coverage rate test method and device in android software integration test |
CN117349150B (en) * | 2023-09-22 | 2024-08-13 | 乾升利信息技术(上海)有限公司 | Coverage rate data processing method and device, electronic equipment and storage medium |
CN119127712A (en) * | 2024-09-18 | 2024-12-13 | 绵阳市商业银行股份有限公司 | Enhanced coverage detection system and method for account-related code based on JaCoCo |
Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108829580A (en) * | 2018-05-07 | 2018-11-16 | 百度在线网络技术(北京)有限公司 | Multi version test data processing method, device, equipment and storage medium |
Family Cites Families (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US10289532B2 (en) * | 2015-04-08 | 2019-05-14 | Opshub, Inc. | Method and system for providing delta code coverage information |
CN105404585B (en) * | 2015-12-01 | 2018-09-04 | 腾讯科技(深圳)有限公司 | Obtain the method and device of code coverage |
CN108519945A (en) * | 2018-03-21 | 2018-09-11 | 腾讯科技(深圳)有限公司 | Coverage rate test method, apparatus and storage device |
CN110209568B (en) * | 2018-04-24 | 2022-07-01 | 腾讯科技(深圳)有限公司 | Coverage rate test method and device and storage equipment |
CN109388566B (en) * | 2018-09-27 | 2022-07-29 | 北京城市网邻信息技术有限公司 | Code coverage rate analysis method, device, equipment and storage medium |
-
2019
- 2019-12-06 CN CN201911242850.1A patent/CN111124894B/en active Active
Patent Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108829580A (en) * | 2018-05-07 | 2018-11-16 | 百度在线网络技术(北京)有限公司 | Multi version test data processing method, device, equipment and storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN111124894A (en) | 2020-05-08 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN111124894B (en) | Code coverage rate processing method and device and computer equipment | |
CN108459962B (en) | Code normalization detection method and device, terminal equipment and storage medium | |
US9317400B2 (en) | Code coverage rate determination method and system | |
CN108549606A (en) | interface test method and device | |
CN111290941A (en) | Method and device for testing multiple interfaces, computing equipment and medium | |
CN111026647B (en) | Method and device for acquiring code coverage rate, computer equipment and storage medium | |
JPH0855045A (en) | Method and apparatus for coding of data in self-descriptive system | |
CN117215932A (en) | Display method and device for code increment coverage information and electronic equipment | |
CN113791980A (en) | Test case conversion analysis method, device, equipment and storage medium | |
CN115658452B (en) | Buried point verification method, buried point verification device, readable storage medium, and electronic device | |
CN111597069B (en) | Program processing method, device, electronic equipment and storage medium | |
CN114416545B (en) | Method, device and electronic device for determining test code coverage | |
CN113094252B (en) | Test case generation method and device, computer equipment and storage medium | |
CN111078549B (en) | Code coverage rate processing method and device and computer equipment | |
CN111090583B (en) | Method and device for generating code coverage rate report and computer equipment | |
CN109558315A (en) | The determination method, device and equipment of test scope | |
CN111008147B (en) | Application program testing method, terminal and computer readable storage medium | |
CN111008138B (en) | Method and device for processing code coverage rate and computer equipment | |
CN118733389A (en) | Application program function monitoring method, device, equipment, storage medium and product | |
CN110147313B (en) | Log output method and device | |
CN107977315B (en) | Embedded software object code unit testing method based on Bootloader mode | |
CN112416781B (en) | Cross-system interface determination method, device, computer equipment and storage medium | |
CN114448851B (en) | Automatic data testing method and system | |
TW201721434A (en) | Computer program product applicable to automatic generation of software testing data and method thereof capable of making sure each functional module can access accurate testing data for testing | |
CN115964274A (en) | Test data acquisition method and device, computer equipment and storage medium |
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 | ||
GR01 | Patent grant | ||
GR01 | Patent grant |