发明名称 Code coverage rate determination method and system
摘要 Embodiments of the present application relate to a code coverage rate determination method, a code coverage rate determination system, and a computer program product for determining code coverage rate. A code coverage rate determination method is provided. The method includes retrieving source code of a program, determining theoretical number of log file output points included in the source code and location information of the log file output points, retrieving log files actually outputted during the execution of the program, determining an actual number of log file output points of the actual outputted log files based on the location information of the corresponding log file output points recorded in each log file, and determining a code coverage rate of the program based on the theoretical number of log file output points and the actual number of the log file output points of the actual outputted log files.
申请公布号 US9317400(B2) 申请公布日期 2016.04.19
申请号 US201313763497 申请日期 2013.02.08
申请人 Alibaba Group Holding Limited 发明人 Cai Hua;Zhou Qi;Sun Tingtao
分类号 G06F9/44;G06F11/36 主分类号 G06F9/44
代理机构 Van Pelt, Yi & James LLP 代理人 Van Pelt, Yi & James LLP
主权项 1. A code coverage rate determination method, comprising: retrieving source code of a program; prior to executing the program, determining a theoretical number of log file output points included in the source code and location information of the log file output points included in the source code, wherein each log file output point corresponds to at least one line of code, and each log file output point outputs at least one log file when executed; executing the program; retrieving log files actually outputted during the execution of the program, wherein each log file comprises location information of its corresponding log file output point; determining, using one or more processors, an actual number of log file output points of the actually outputted log files based on the location information of the corresponding log file output points recorded in each log file, the determining comprising: a) analyzing content of the actually outputted log files to obtain the location information of the corresponding log file output points, wherein the actually outputted log files were generated during the same execution of the program; merging log files containing the same location information into one merged log file in the event that more than one log file contains the same location information, wherein a merged log file corresponds to a log file output point; and counting a final number of the log file output points of the actually outputted log files based on a total number of merged log files; or b) counting an actual number of log files outputted for each log file output point based on the location information of the corresponding each log file output point contained in each log file, wherein the actually outputted log files were generated during the same execution of the program; for each log file output point where the actual number of log files outputted is greater than 1, subtracting a value 1 from the actual number of log files outputted for each log file output point to obtain a number of repetitions outputted by each log file output point; and subtracting the number of repetitions outputted by each log file output point from a total number of actually outputted log files to obtain a final number of log file output points of the actually outputted log files; and determining, using the one or more processors, a code coverage rate of the program based on the theoretical number of log file output points included in the source code and the final number of the log file output points of the actually outputted log files.
地址 KY