JP5682109B2 - Coverage information generation program, coverage information generation apparatus, and coverage information generation method - Google Patents

Coverage information generation program, coverage information generation apparatus, and coverage information generation method Download PDF

Info

Publication number
JP5682109B2
JP5682109B2 JP2009271669A JP2009271669A JP5682109B2 JP 5682109 B2 JP5682109 B2 JP 5682109B2 JP 2009271669 A JP2009271669 A JP 2009271669A JP 2009271669 A JP2009271669 A JP 2009271669A JP 5682109 B2 JP5682109 B2 JP 5682109B2
Authority
JP
Japan
Prior art keywords
program
subroutine
executed
coverage information
execution
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.)
Expired - Fee Related
Application number
JP2009271669A
Other languages
Japanese (ja)
Other versions
JP2011113474A (en
Inventor
修一郎 藤定
修一郎 藤定
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Fujitsu Ltd
Original Assignee
Fujitsu Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Fujitsu Ltd filed Critical Fujitsu Ltd
Priority to JP2009271669A priority Critical patent/JP5682109B2/en
Publication of JP2011113474A publication Critical patent/JP2011113474A/en
Application granted granted Critical
Publication of JP5682109B2 publication Critical patent/JP5682109B2/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Debugging And Monitoring (AREA)

Description

本発明は、カバレッジ情報算出プログラム、カバレッジ情報算出装置およびカバレッジ情報算出方法に関する。   The present invention relates to a coverage information calculation program, a coverage information calculation device, and a coverage information calculation method.

従来、開発されたプログラムまたは開発段階のプログラムをテストする場合に、プログラムのクラス、メソッド、関数、サブルーチンなど各コードのテスト漏れを防止する技術として、カバレッジ情報を用いた技術が利用されている。このようなカバレッジ情報の算出手法の一例としては、プログラム内に記述される実行されるべき行がどのくらい実際に実行されたかを示す「実行網羅率」を算出するカバレッジ情報算出装置が開示されている。   2. Description of the Related Art Conventionally, when testing a developed program or a development stage program, a technique using coverage information is used as a technique for preventing test omission of each code such as a program class, method, function, and subroutine. As an example of such a coverage information calculation method, there is disclosed a coverage information calculation device that calculates an “execution coverage rate” indicating how many lines to be executed described in a program are actually executed. .

具体的には、カバレッジ情報算出装置は、プログラムの何処が実行されたかを示す「実行位置」をプログラム実行中にログデータとして記録し、記録した実行位置から実行位置の種類数を示す「実行行数」を計数する。そして、カバレッジ情報算出装置は、計数した「実行行数」をプログラム全体の実行可能な行数を示す「有効全体行数」で除算し、さらに100を乗算した結果である「実行網羅率」をカバレッジ情報として算出する。こうして算出された「実行網羅率」が高い程、プログラム内に記述される実行されるべき行の多くが実際に実行されたことが示される。また、「実行網羅率」が低い程、プログラム内に記述される実行されるべき行の多くが実際には実行されていないことが示される。   Specifically, the coverage information calculation device records an “execution position” indicating where the program has been executed as log data during program execution, and displays an “execution line” indicating the number of types of execution positions from the recorded execution position. Count "number". Then, the coverage information calculation device divides the counted “execution line number” by the “effective total line number” indicating the number of executable lines of the entire program, and further multiplies the result by “100”. Calculate as coverage information. The higher the “execution coverage rate” calculated in this way, the more lines that are to be executed described in the program are actually executed. In addition, the lower the “execution coverage rate”, the more lines that are to be executed described in the program are not actually executed.

ここで、図11と図12を用いて、カバレッジ情報として「実行網羅率」を算出するカバレッジ情報算出装置をより具体的に説明する。図11は、プログラム実行時に実行位置を取得する例を示す図であり、図12は、実行位置から実行行数を取得する例を示す図である。   Here, a coverage information calculation apparatus that calculates an “execution coverage rate” as coverage information will be described more specifically with reference to FIGS. 11 and 12. FIG. 11 is a diagram illustrating an example of acquiring the execution position at the time of program execution, and FIG. 12 is a diagram illustrating an example of acquiring the number of execution lines from the execution position.

図11に示すように、Java(登録商標)VM(Java(登録商標) Virtual Machine)上には、classA、classB、classCを有するプログラムが実行されている。そして、カバレッジ情報算出装置は、このプログラムの構成として、「クラス名」と「メソッド名」と「有効行番号」とを対応付けて記憶し、さらに「有効全体行数」を記憶する。ここで、「クラス名」とは、データとその処理方法であるメソッドをまとめたオブジェクトを定義したクラスの名称を示す情報である。また、「メソッド名」とは、クラスで定義されるメソッドの名称を示す情報であり、「有効行番号」とは、実行されるべきクラス内の行番号を示す情報である。また、「有効全体行数」は、各クラスの「有効行番号」の数を計数した情報であり、プログラム全体で実行されるべき行の総数を示す情報である。   As shown in FIG. 11, a program having class A, class B, and class C is executed on a Java (registered trademark) VM (Java (registered trademark) Virtual Machine). Then, the coverage information calculation apparatus stores “class name”, “method name”, and “valid row number” in association with each other as a configuration of the program, and further stores “valid total row number”. Here, the “class name” is information indicating the name of a class that defines an object in which data and a method that is a processing method thereof are collected. The “method name” is information indicating the name of the method defined in the class, and the “effective line number” is information indicating the line number in the class to be executed. The “number of valid total lines” is information obtained by counting the number of “valid line numbers” of each class, and is information indicating the total number of lines to be executed in the entire program.

例えば、カバレッジ情報算出装置は、図11の(a)に示すように、「クラス名、メソッド名、有効行番号」として「classA、methodA1、3,4,5,6」や「classA、methodA2、9,10,13」と記憶する。また、カバレッジ情報算出装置は、「classB、methodB1、1,2,4,5」、「classB、methodB2、8,9,12」、「classB、methodB3、13,14,16,19」と記憶する。そして、カバレッジ情報算出装置は、「classC、methodC1、2,3,4,5,7,9」と、さらに「有効全体行数」として、「24」を記憶する。   For example, as shown in FIG. 11A, the coverage information calculation apparatus has “classA, methodA1, 3, 4, 5, 6” or “classA, methodA2, “9, 10, 13”. Also, the coverage information calculation device stores “classB, methodB1, 1, 2, 4, 5”, “classB, methodB2, 8, 9, 12”, “classB, methodB3, 13, 14, 16, 19”. . Then, the coverage information calculation device stores “classC, methodC1, 2, 3, 4, 5, 7, 9” and “24” as the “number of valid entire lines”.

つまり、この例の場合、classAは、プログラムの3行目〜6行目が実行可能な行であるmethodA1と、プログラムの9行目、10行目、13行目が実行可能な行であるmethodA2とを有している。また、classBは、プログラムの1、2、4、5行目が実行可能な行であるmethodB1と、プログラムの8、9、12行目が実行可能な行であるmethodB2とを有している。さらに、classBは、プログラムの13、14、16、19行目が実行可能な行であるmethodB3を有している。また、classCは、プログラムの2、3、4、5、7、9行目が実行可能な行であるmethodC1を有している。   That is, in this example, classA is methodA1 which is the executable line from the 3rd to 6th lines of the program, and methodA2 which is the executable line from the 9th, 10th and 13th lines of the program. And have. In addition, classB includes methodB1, which is an executable line for the first, second, fourth, and fifth lines of the program, and methodB2, which is an executable line for the eighth, ninth, and twelfth lines of the program. Furthermore, classB has methodB3 which is a line in which the 13th, 14th, 16th, and 19th lines of the program can be executed. In addition, classC has methodC1, which is an executable line of the second, third, fourth, fifth, seventh, and ninth lines of the program.

このような状態において、カバレッジ情報算出装置は、Java(登録商標)VM上でclassA〜Cを有するプログラムを実行すると、実行された「クラス名、メソッド名、行番号」を示す「実行位置」をログデータとしてファイルに出力する。例えば、カバレッジ情報算出装置は、図11の(b)に示すように、「classA、methodA1、3行目」、「classA、methodA1、4行目」、「classB、methodB2、8行目」を出力する。また、カバレッジ情報算出装置は、「classB、methodB2、9行目」、「classB、methodB2、12行目」、「classB、methodB2、8行目」、「classB、methodB2、9行目」を出力する。また、カバレッジ情報算出装置は、「classB、methodB2、12行目」、「classA、methodA1、5行目」を出力する。   In such a state, when the coverage information calculation device executes a program having class A to C on Java (registered trademark) VM, it displays an “execution position” indicating the executed “class name, method name, line number”. Output to a file as log data. For example, the coverage information calculation apparatus outputs “classA, methodA1, line 3”, “classA, methodA1, line 4”, “classB, methodB2, line 8” as shown in FIG. To do. Further, the coverage information calculation device outputs “classB, methodB2, line 9”, “classB, methodB2, line 12”, “classB, methodB2, line 8”, “classB, methodB2, line 9”. . Also, the coverage information calculation apparatus outputs “classB, methodB2, line 12” and “classA, methodA1, line 5”.

その後、カバレッジ情報算出装置は、プログラムの実行を停止した場合やプログラムが終了した場合に、出力された「実行位置」の種類を計数する。例えば、カバレッジ情報算出装置は、図12に示すように、「classA、methodA1、3行目」の登場回数を「1」、「classA、methodA1、4行目」の登場回数を「1」と計数する。同様に、カバレッジ情報算出装置は、「classA、methodA1、5行目」の登場回数を「1」と計数する。さらに、カバレッジ情報算出装置は、「classB、methodB2、8行目」の登場回数を「2」、「classB、methodB2、9行目」の登場回数を「2」、「classB、methodB2、12行目」の登場回数を「2」と計数する。したがって、カバレッジ情報算出装置は、全6種類の「実行位置」、言い換えると、全6種類の「行」が実行されたと計数する。   Thereafter, the coverage information calculation apparatus counts the type of the “execution position” that is output when the execution of the program is stopped or when the program ends. For example, as shown in FIG. 12, the coverage information calculation apparatus counts the number of appearances of “classA, methodA1, third line” as “1” and the number of appearances of “classA, methodA1, fourth line” as “1”. To do. Similarly, the coverage information calculation apparatus counts the number of appearances of “classA, methodA1, line 5” as “1”. Furthermore, the coverage information calculation device sets the number of appearances of “classB, methodB2, line 8” to “2”, the number of appearances of “classB, methodB2, line 9” to “2,” “classB, methodB2, line 12” "2" is counted as "2". Therefore, the coverage information calculation apparatus counts that all six types of “execution positions”, in other words, all six types of “rows” have been executed.

そして、カバレッジ情報算出装置は、算出した「実行位置」の種類数「6」を「有効全体行数=24」で除算した「6/24=0.25」を算出し、さらに「0.25」に100を乗算した「25」を「実行網羅率」として算出する。この結果、例示したプログラム全体のうち「25%」が実際に実行され、「75%」が実際には実行されていないことがわかる。   Then, the coverage information calculation device calculates “6/24 = 0.25” by dividing the calculated “execution position” type number “6” by “valid total number of rows = 24”, and further sets 100 to “0.25”. The multiplied “25” is calculated as the “execution coverage rate”. As a result, it can be seen that “25%” of the entire illustrated program is actually executed and “75%” is not actually executed.

特開平9−251400号公報JP 9-251400 A

しかしながら、従来の技術では、カバレッジ情報の算出対象であるプログラムが複雑な場合など、プログラムの実行によって出力されるデータであって、カバレッジ情報の算出に必要なデータを格納する領域が膨大になる。この結果、カバレッジ情報を効率的に算出することができないという課題があった。   However, in the conventional technique, when the program for which coverage information is to be calculated is complex, the data output by executing the program and storing data necessary for calculating the coverage information become enormous. As a result, there is a problem that coverage information cannot be calculated efficiently.

例えば、プログラム全体の「実行網羅率」を算出する場合には、カバレッジ情報算出装置は、プログラムを最初から最後まで全体的に実行して、上記「実行位置」を取得する。また、カバレッジ情報算出装置は、プログラム内の行が実行されるたびに、「実行位置」を1行ずつログデータとして出力する。これらのため、カバレッジ情報算出装置は、複雑なプログラムや大規模なプログラムのカバレッジを算出する場合には、膨大な数の「実行位置」をログデータとして出力する。そして、カバレッジ情報算出装置は、出力した膨大な数の「実行位置」から「実行位置」の種類を計数するのに多くの時間を必要とし、結果として「実行網羅率」の算出にも多くの時間を必要する。   For example, when calculating the “execution coverage rate” of the entire program, the coverage information calculation apparatus executes the program from the beginning to the end to obtain the “execution position”. Further, every time a line in the program is executed, the coverage information calculation apparatus outputs “execution position” one line at a time as log data. For these reasons, the coverage information calculation apparatus outputs a huge number of “execution positions” as log data when calculating the coverage of a complex program or a large-scale program. The coverage information calculation device requires a lot of time to count the type of “execution position” from the enormous number of “execution positions” that are output, and as a result, it also requires a lot of calculation for the “execution coverage ratio”. I need time.

また、プログラムの所定範囲の「実行網羅率」を算出する場合には、カバレッジ情報算出装置は、所定範囲内のプログラムを実行して、上記「実行位置」を取得する。このような所定範囲の「実行網羅率」を算出する場合とは、対象となる所定範囲のプログラムが非常に複雑であることが多い。このため、所定範囲内のプログラムの実行によって出力される「実行位置」は、膨大な数になることが多い。したがって、この場合であっても、カバレッジ情報算出装置は、出力した膨大な数の「実行位置」から「実行位置」の種類を計数するのに多くの時間を必要とし、結果として「実行網羅率」の算出にも多くの時間を必要とする。   When calculating the “execution coverage rate” of a predetermined range of the program, the coverage information calculation device executes the program within the predetermined range and acquires the “execution position”. When calculating the “execution coverage rate” of such a predetermined range, the target program of the predetermined range is often very complicated. For this reason, the number of “execution positions” output by executing a program within a predetermined range is often enormous. Therefore, even in this case, the coverage information calculation device requires a lot of time to count the types of “execution positions” from the enormous number of “execution positions” that are output. It takes a lot of time to calculate "".

また、繰り返し実行されるプログラムの「実行網羅率」を算出する場合には、カバレッジ情報算出装置は、プログラムを所定時間実行して、上記「実行位置」を取得する。この場合、プログラムを実行する時間が長ければ長いほど、ログデータとして出力される「実行位置」が多くなる。つまり、カバレッジ情報算出装置は、プログラムを実行する時間が長いほど、出力した「実行位置」から「実行位置」の種類を計数するのに時間を必要とし、「実行網羅率」の算出にも多くの時間を必要とする。   When calculating the “execution coverage rate” of a program that is repeatedly executed, the coverage information calculation apparatus executes the program for a predetermined time to obtain the “execution position”. In this case, the longer the program execution time is, the more “execution positions” are output as log data. In other words, the longer the program execution time is, the longer the coverage information calculation device needs time to count the type of “execution position” from the output “execution position”, and the more the “execution coverage rate” is calculated. Need time.

開示の技術は、上記に鑑みてなされたものであって、カバレッジ情報の算出対象となるプログラムに関係なく、カバレッジ情報を効率的に算出することが可能であるカバレッジ情報算出プログラム、カバレッジ情報算出装置およびカバレッジ情報算出方法を提供することを目的とする。   The disclosed technology has been made in view of the above, and a coverage information calculation program and a coverage information calculation apparatus capable of efficiently calculating coverage information regardless of a program for which coverage information is to be calculated It is another object of the present invention to provide a coverage information calculation method.

本願の開示するカバレッジ情報算出プログラムは、カバレッジ情報の算出対象であるプログラムに含まれるコードの枠組み毎に設けられたカウンタを用いて、該プログラムを実行した場合に該枠組みが実行された回数を計数する回数計数手順を有する。そして、前記カウンタが設けられた枠組みの数と、前記回数計数手順によって実行回数が計数された枠組みの数とから、カバレッジ情報を算出するカバレッジ情報算出手順を有する。そして、これらの手順をコンピュータに実行させる。   The coverage information calculation program disclosed in the present application uses a counter provided for each code framework included in the program for which coverage information is to be calculated, and counts the number of times the framework has been executed when the program is executed. A frequency counting procedure. A coverage information calculation procedure for calculating coverage information from the number of frames provided with the counter and the number of frames for which the number of executions is counted by the number counting procedure is provided. Then, the computer is caused to execute these procedures.

本願の開示するカバレッジ情報算出プログラム、カバレッジ情報算出装置およびカバレッジ情報算出方法の一つの態様によれば、カバレッジ情報の算出対象となるプログラムに関係なく、カバレッジ情報を効率的に算出することが可能であるという効果を奏する。   According to one aspect of the coverage information calculation program, the coverage information calculation device, and the coverage information calculation method disclosed in the present application, it is possible to efficiently calculate the coverage information regardless of the program that is the calculation target of the coverage information. There is an effect that there is.

図1は、実施例1に係るカバレッジ情報算出装置の構成を示すブロック図である。FIG. 1 is a block diagram illustrating the configuration of the coverage information calculation apparatus according to the first embodiment. 図2は、実施例2に係るカバレッジ情報算出装置の構成を示すブロック図である。FIG. 2 is a block diagram illustrating the configuration of the coverage information calculation apparatus according to the second embodiment. 図3は、プログラムDBに記憶される情報の例を示す図である。FIG. 3 is a diagram illustrating an example of information stored in the program DB. 図4は、プログラムがC言語で記述されている場合に、枠組みカウンタDBに記憶される情報の例を示す図である。FIG. 4 is a diagram illustrating an example of information stored in the framework counter DB when the program is described in C language. 図5は、プログラムがJava(登録商標)で記述されている場合に、枠組みカウンタDBに記憶される情報の例を示す図である。FIG. 5 is a diagram illustrating an example of information stored in the framework counter DB when a program is described in Java (registered trademark). 図6は、カバレッジ情報DBに記憶される情報の例を示す図である。FIG. 6 is a diagram illustrating an example of information stored in the coverage information DB. 図7は、C言語で記述されたソースコードから枠組みを抽出する例を示す図である。FIG. 7 is a diagram illustrating an example of extracting a framework from source code described in C language. 図8は、Java(登録商標)で記述されたソースファイルから枠組みを抽出する例を示す図である。FIG. 8 is a diagram illustrating an example of extracting a framework from a source file described in Java (registered trademark). 図9は、実施例2に係るカバレッジ情報算出装置における処理の流れを示すフローチャートである。FIG. 9 is a flowchart illustrating a process flow in the coverage information calculation apparatus according to the second embodiment. 図10は、カバレッジ情報算出プログラムを実行するコンピュータシステムの例を示す図である。FIG. 10 is a diagram illustrating an example of a computer system that executes a coverage information calculation program. 図11は、プログラム実行時に実行位置を取得する例を示す図である。FIG. 11 is a diagram illustrating an example in which an execution position is acquired during program execution. 図12は、実行位置から実行行数を取得する例を示す図である。FIG. 12 is a diagram illustrating an example of acquiring the number of execution lines from the execution position.

以下に、本願の開示するカバレッジ情報算出プログラム、カバレッジ情報算出装置およびカバレッジ情報算出方法の実施例を図面に基づいて詳細に説明する。なお、この実施例によりこの発明が限定されるものではない。   Hereinafter, embodiments of a coverage information calculation program, a coverage information calculation device, and a coverage information calculation method disclosed in the present application will be described in detail with reference to the drawings. Note that the present invention is not limited to the embodiments.

図1は、実施例1に係るカバレッジ情報算出装置の構成を示すブロック図である。図1に示すカバレッジ情報算出装置1は、例えば、開発途中のプログラムをテストし、行カバレッジ、クラスカバレッジ、メソッドカバレッジなどの任意の単位で、実行網羅率を算出する装置である。このカバレッジ情報算出装置1は、図1に示すように、回数計数部1aとカバレッジ情報算出部1bとを有する。   FIG. 1 is a block diagram illustrating the configuration of the coverage information calculation apparatus according to the first embodiment. A coverage information calculation apparatus 1 illustrated in FIG. 1 is an apparatus that tests a program under development and calculates an execution coverage rate in arbitrary units such as line coverage, class coverage, and method coverage. As shown in FIG. 1, the coverage information calculation apparatus 1 includes a number counting unit 1a and a coverage information calculation unit 1b.

回数計数部1aは、カバレッジ情報の算出対象であるプログラムに含まれるコードの枠組み毎に設けられたカウンタを用いて、該プログラムを実行した場合に該枠組みが実行された回数を計数する。例えば、カバレッジ情報算出装置1は、カバレッジ情報の算出対象であるプログラムソースコード2に含まれるコードの枠組み毎のカウンタをメモリなどに記憶する。そして、回数計数部1aは、プログラムソースコード2を実行し、メモリなどに記憶される枠組み毎のカウンタを用いて、プログラムソースコード2の枠組み毎に実行された回数を計数する。その後、回数計数部1aは、プログラムソースコード2の実行が終了すると、プログラムの実行が終了したことをカバレッジ情報算出部1bに通知する。   The number counting unit 1a counts the number of times the framework has been executed when the program is executed, using a counter provided for each code framework included in the program for which coverage information is to be calculated. For example, the coverage information calculation apparatus 1 stores, in a memory or the like, a counter for each code framework included in the program source code 2 that is a coverage information calculation target. The number counting unit 1a executes the program source code 2 and counts the number of times executed for each framework of the program source code 2 using a counter for each framework stored in a memory or the like. Thereafter, when the execution of the program source code 2 is completed, the number counting unit 1a notifies the coverage information calculation unit 1b that the execution of the program is completed.

カバレッジ情報算出部1bは、カウンタが設けられた枠組みの数と、回数計数部1aによって実行回数が計数された枠組みの数とから、カバレッジ情報を算出する。例えば、カバレッジ情報算出部1bは、行カバレッジ、メソッドカバレッジ、クラスカバレッジ、関数カバレッジなど任意の単位で、カバレッジ情報3を算出する。一例としては、カバレッジ情報算出部1bは、プログラム中の実行すべき行がどのくらい実際に実行されたか示す実行網羅率やプログラム中の実行すべき関数がどのくらい実際に実行されたかなどを示す実行網羅率などを算出する。   The coverage information calculation unit 1b calculates coverage information from the number of frames provided with a counter and the number of frames for which the number of executions is counted by the number counting unit 1a. For example, the coverage information calculation unit 1b calculates the coverage information 3 in arbitrary units such as line coverage, method coverage, class coverage, and function coverage. As an example, the coverage information calculation unit 1b includes an execution coverage ratio indicating how many lines to be executed in the program are actually executed, and an execution coverage ratio indicating how many functions to be executed in the program are actually executed. Etc. are calculated.

このように、実施例1によれば、カバレッジ情報算出装置1は、カバレッジ情報算出対象のプログラムの枠組みに対応するカウンタをメモリなどに設けておく。そして、カバレッジ情報算出装置1は、実際に実行された枠組みの数をメモリに設けられたカウンタをインクリメントすることで計数し、実行網羅率などを算出する。つまり、カバレッジ情報算出装置1は、プログラムを実行するたびに、実行ログデータをファイルやメモリに出力する必要はなく、プログラムの規模に応じたカウンタを用いて、実行回数のみを計数すればよい。   As described above, according to the first embodiment, the coverage information calculation apparatus 1 provides a counter or the like corresponding to the framework of a program for which coverage information is calculated in a memory or the like. Then, the coverage information calculation apparatus 1 counts the number of frames actually executed by incrementing a counter provided in the memory, and calculates an execution coverage rate and the like. That is, it is not necessary for the coverage information calculation apparatus 1 to output execution log data to a file or a memory each time a program is executed, and it is sufficient to count only the number of executions using a counter corresponding to the scale of the program.

したがって、実施例1に係るカバレッジ情報算出装置1では、プログラムが複雑な場合であっても、プログラムの実行によって出力されるデータであって、カバレッジ情報の算出に必要なデータを格納する領域は必要ない。また、実施例1に係るカバレッジ情報算出装置1では、プログラム実行前に作成した枠組みごとのカウンタで、実行されるたびに実行回数を計数するので、プログラムの実行によって出力されたログデータから枠組みごとの実行回数を解析する必要もない。   Therefore, in the coverage information calculation apparatus 1 according to the first embodiment, even if the program is complicated, an area for storing data that is output by executing the program and necessary for calculating coverage information is necessary. Absent. Further, in the coverage information calculation apparatus 1 according to the first embodiment, the number of executions is counted each time the program is executed by the counter for each framework created before the execution of the program. Therefore, for each framework from the log data output by the execution of the program. There is no need to analyze the number of executions.

この結果、実施例1に係るカバレッジ情報算出装置1では、カバレッジ情報の算出対象となるプログラムに関係なく、カバレッジ情報を効率的に算出することが可能である。また、プログラム開発者などは、開発中のプログラムのクラス、メソッド、関数、サブルーチンなど各コードのテスト漏れを迅速に確認することができる。   As a result, the coverage information calculation apparatus 1 according to the first embodiment can efficiently calculate the coverage information regardless of the program that is the calculation target of the coverage information. In addition, a program developer or the like can quickly confirm a test omission of each code such as a class, a method, a function, and a subroutine of a program under development.

ところで、本願が開示するカバレッジ情報算出装置は、実施例1で説明した制御部以外にも様々な制御部を有していてもよい。そこで、実施例2では、実施例1で説明した制御部以外の様々な制御部を有するカバレッジ情報算出装置について説明する。   By the way, the coverage information calculation apparatus disclosed in the present application may have various control units other than the control unit described in the first embodiment. Thus, in the second embodiment, a coverage information calculation apparatus having various control units other than the control unit described in the first embodiment will be described.

[カバレッジ情報算出装置の構成]
まず、図2を用いて、様々な制御部を有するカバレッジ情報算出装置の構成について説明する。図2は、実施例2に係るカバレッジ情報算出装置の構成を示すブロック図である。図2に示すように、カバレッジ情報算出装置10は、通信制御I/F部11と、入力部12と、表示部13と、記憶部15と、制御部20とを有している。
[Configuration of coverage information calculation device]
First, the configuration of a coverage information calculation apparatus having various control units will be described with reference to FIG. FIG. 2 is a block diagram illustrating the configuration of the coverage information calculation apparatus according to the second embodiment. As illustrated in FIG. 2, the coverage information calculation apparatus 10 includes a communication control I / F unit 11, an input unit 12, a display unit 13, a storage unit 15, and a control unit 20.

通信制御I/F部11は、少なくとも1つの通信ポートを有するインタフェースであり、他の装置との間でやり取りされる情報を制御する。例えば、通信制御I/F部11は、プログラム開発者が利用する管理コンピュータと接続され、カバレッジ情報算出対象のプログラムを管理コンピュータから受信し、また、算出されたカバレッジ情報を管理コンピュータに送信する。   The communication control I / F unit 11 is an interface having at least one communication port, and controls information exchanged with other devices. For example, the communication control I / F unit 11 is connected to a management computer used by a program developer, receives a coverage information calculation target program from the management computer, and transmits the calculated coverage information to the management computer.

入力部12は、例えば、キーボードやマウス、マイクなどであり、カバレッジ情報算出開始指示や終了指示の入力を受付け、後述する制御部20等に入力する。また、入力部12は、CD(Compact Disc)、DVD(Digital Versatile Disc)や磁気ディスクなどの記憶媒体を読み込んで情報を読み出したり、情報を書き込んだりすることができる。例えば、入力部12は、カバレッジ情報算出対象のプログラムを記憶媒体から読み出して記憶部15に格納したり、算出されたカバレッジ情報を記憶媒体に書き込んだりすることができる。   The input unit 12 is, for example, a keyboard, a mouse, a microphone, and the like. The input unit 12 can read information from and write information to a storage medium such as a CD (Compact Disc), a DVD (Digital Versatile Disc), or a magnetic disk. For example, the input unit 12 can read a coverage information calculation target program from the storage medium and store it in the storage unit 15 or write the calculated coverage information to the storage medium.

なお、後述する表示部13も、マウスと協働してポインティングディバイス機能を実現する。表示部13は、例えば、モニタ、ディスプレイ、タッチパネルやスピーカなどであり、後述する制御部20で生成されたカバレッジ情報などを表示出力する。   Note that the display unit 13 described later also realizes a pointing device function in cooperation with the mouse. The display unit 13 is, for example, a monitor, a display, a touch panel, or a speaker, and displays and outputs coverage information generated by the control unit 20 described later.

記憶部15は、制御部20による各種処理に必要なデータおよびプログラムを格納するとともに、プログラムDB(DataBase)16と、枠組みカウンタDB17と、カバレッジ情報DB18とを有する。このプログラムDB16、枠組みカウンタDB17、カバレッジ情報DB18は、例えば、RAM(Random Access Memory)などの半導体メモリ素子やハードディスク、光ディスクなどの記憶装置である。   The storage unit 15 stores data and programs necessary for various processes performed by the control unit 20, and includes a program DB (DataBase) 16, a framework counter DB 17, and a coverage information DB 18. The program DB 16, the frame counter DB 17, and the coverage information DB 18 are, for example, semiconductor memory elements such as RAM (Random Access Memory), and storage devices such as a hard disk and an optical disk.

プログラムDB16は、カバレッジ情報算出対象のプログラムを記憶し、例えば、通信制御I/F部11によって受信されたプログラムや入力部12によって記憶媒体から読み出されたプログラムなどを記憶する。例えば、プログラムDB16は、図3に示すようなC言語で記述されたソースプログラムを記憶する。図3は、プログラムDBに記憶される情報の例を示す図である。   The program DB 16 stores programs for which coverage information is to be calculated, for example, a program received by the communication control I / F unit 11 and a program read from a storage medium by the input unit 12. For example, the program DB 16 stores a source program described in C language as shown in FIG. FIG. 3 is a diagram illustrating an example of information stored in the program DB.

図3に示すソースプログラムであるSampleSource.cは、includeによって、ライブラリであるヘッダーファイル「stdio.h」と「string.h」を読み込み、入出力と文字列操作の宣言を行っている。そして、SampleSource.cは、コマンドライン引数を用いた関数を実行する。具体的には、SampleSource.cには、引数の総個数(int argc)と引数の文字列を示すポインタの配列(char *argc[])を引数とし、戻り値を「0」とするfunctionA1が定義されている。   SampleSource.c which is a source program shown in FIG. 3 reads header files “stdio.h” and “string.h” which are libraries by include, and declares input / output and character string operations. SampleSource.c executes a function using command line arguments. Specifically, SampleSource.c has a functionA1 with the total number of arguments (int argc) and an array of pointers (char * argc []) indicating the argument character strings as arguments and a return value of “0”. Is defined.

枠組みカウンタDB17は、プログラムの枠組みごとに、当該枠組みが実行された回数を計数するカウンタを記憶する。具体的には、枠組みカウンタDB17は、カバレッジ情報算出対象のプログラムが有するソースファイル名、関数名、クラス名、メソッド名、行番号ごとに実行回数を計数するカウンタを記憶する。   For each program framework, the framework counter DB 17 stores a counter that counts the number of times the framework has been executed. Specifically, the framework counter DB 17 stores a counter that counts the number of executions for each source file name, function name, class name, method name, and line number of the program for which coverage information is to be calculated.

例えば、枠組みカウンタDB17は、図4に示すように、ソースファイル「SampleSource.c」の実行回数と、「関数functionA1、B1、C1」各々の実行回数を計数するカウンタを記憶する。また、枠組みカウンタDB17は、「関数functionA1の行番号3、5、11」各々の実行回数と、「関数functionB1の行番号2」の実行回数と、「関数functionC1の行番号5、9」各々の実行回数とを計数するカウンタを記憶する。   For example, as shown in FIG. 4, the framework counter DB 17 stores a counter that counts the number of times of execution of the source file “SampleSource.c” and the number of times of execution of each of the “functions function A 1, B 1, C 1”. In addition, the framework counter DB 17 includes the number of executions of each of “line numbers 3, 5, and 11 of the function functionA1”, the number of executions of “line number 2 of the function functionB1”, and A counter for counting the number of executions is stored.

この例の場合、カバレッジ情報算出対象のプログラムのソースファイル「SampleSource.c」を実行した場合に、実行されるべき関数がA1、B1、C1の3つある。そして、関数A1には、実行されるべき行が3、5、11行目の計3行あり、関数B1には、実行されるべき行が2行目の計1行あり、関数C1には、実行されるべき行が5、9行目の計2行ある。なお、図4は、プログラムがC言語で記述されている場合に、枠組みカウンタDBに記憶される情報の例を示す図である。   In this example, when the source file “SampleSource.c” of the program whose coverage information is to be calculated is executed, there are three functions A1, B1, and C1 that should be executed. And in function A1, there are 3 lines to be executed, 3rd, 5th and 11th lines, in function B1, there are 1 line in 2nd line to be executed, and in function C1 There are 2 lines to be executed, 5th and 9th lines. FIG. 4 is a diagram illustrating an example of information stored in the framework counter DB when the program is described in the C language.

また、枠組みカウンタDB17は、図5に示すように、プログラムのクラス「classA」の実行回数と、「classAのmethodA1、A2」各々の実行回数を計数するカウンタとを計数するカウンタを記憶する。例えば、枠組みカウンタDB17は、「methodA1の行番号2、4」各々の実行回数を計数するカウンタと、「methodA2の行番号2、12」各々の実行回数を計数するカウンタとを計数するカウンタを記憶する。同様に、枠組みカウンタDB17は、プログラムのクラス「classB」の実行回数と、「classBのmethodB1」の実行回数を計数するカウンタとを計数するカウンタと、「methodB1の行番号4、7」各々の実行回数を計数するカウンタとを計数するカウンタを記憶する。   Further, as shown in FIG. 5, the framework counter DB 17 stores a counter that counts the number of executions of the program class “classA” and the counter that counts the number of executions of “method A1 and A2 of class A”. For example, the framework counter DB 17 stores a counter that counts the number of executions of each of “methodA1 line numbers 2 and 4” and a counter that counts the number of executions of “methodA2 line numbers 2 and 12”. To do. Similarly, the framework counter DB 17 counts the number of executions of the class “classB” of the program, the counter that counts the number of executions of “methodB1 of classB”, and the execution of each of “line numbers 4 and 7 of methodB1”. A counter that counts the number of times is stored.

この例の場合、カバレッジ情報算出対象のプログラムを実行した場合に、実行されるべきクラスがA、Bの2つあり、クラスAには、実行されるべきメソッドがA1とA2の2つある。そして、メソッドA1には、実行されるべき行が2、4行目の計2行あり、メソッドA2には、実行されるべき行が2、12行目の計2行ある。また、クラスBには、実行されるべきメソッドがB1の1つあり、メソッドB1には、実行されるべき行が4、7行目の計2行ある。なお、図5は、プログラムがJava(登録商標)で記述されている場合に、枠組みカウンタDBに記憶される情報の例を示す図である。   In this example, when the coverage information calculation target program is executed, there are two classes A and B to be executed, and class A has two methods A1 and A2 to be executed. The method A1 has two lines to be executed, ie, the second and fourth lines, and the method A2 has two lines to be executed, the second and the 12th lines. Class B has one method B1 to be executed, and method B1 has two lines to be executed, a fourth line and a seventh line. FIG. 5 is a diagram illustrating an example of information stored in the framework counter DB when the program is described in Java (registered trademark).

カバレッジ情報DB18は、後述するカバレッジ情報算出部24によって算出されたカバレッジ情報を記憶する。例えば、カバレッジ情報DB18は、図6に示すように、「算出日、算出範囲、カバレッジ値(実行網羅率)」として「2009/9/30、functionA〜functionC、25%」や「2009/9/30、全部、50%」などと記憶する。ここで記憶される「算出日」とは、カバレッジ値を算出した日であり、「算出範囲」とは、カバレッジ値を算出したプログラムの範囲であり、「カバレッジ値」とは、算出された実行網羅率である。なお、図6は、カバレッジ情報DBに記憶される情報の例を示す図である。   The coverage information DB 18 stores coverage information calculated by a coverage information calculation unit 24 described later. For example, as illustrated in FIG. 6, the coverage information DB 18 includes “2009/9/30, function A to function C, 25%” or “2009/9 /” as “calculation date, calculation range, coverage value (execution coverage rate)”. “30, all, 50%”. The “calculation date” stored here is the date when the coverage value was calculated, the “calculation range” is the range of the program that calculated the coverage value, and the “coverage value” is the calculated execution Coverage rate. FIG. 6 is a diagram illustrating an example of information stored in the coverage information DB.

制御部20は、例えば、ASIC(Application Specific Integrated Circuit)などの集積回路やCPU(Central Processing Unit)やMPU(Micro Processing Unit)などの電子回路である。この制御部20は、OS(Operating System)などの制御プログラム、各種の処理手順などを規定したプログラムおよび所要データを格納するための内部メモリを有する。さらに、制御部20は、枠組み抽出部21と、カウンタ生成部22と、回数計数部23と、カバレッジ情報算出部24とを有し、これらによって各種処理を実行する。   The control unit 20 is, for example, an integrated circuit such as an ASIC (Application Specific Integrated Circuit) or an electronic circuit such as a CPU (Central Processing Unit) or an MPU (Micro Processing Unit). The control unit 20 includes a control program such as an OS (Operating System), a program that defines various processing procedures, and an internal memory for storing necessary data. Furthermore, the control unit 20 includes a framework extraction unit 21, a counter generation unit 22, a number counting unit 23, and a coverage information calculation unit 24, and executes various processes.

枠組み抽出部21は、カバレッジ情報算出対象のプログラムに含まれるコードの枠組みを抽出する。具体的には、枠組み抽出部21は、入力部12によってカバレッジ情報算出開始指示が受け付けられると、算出対象のプログラムをプログラムDB16から読み出し、プログラムが有するコードを抽出してカウンタ生成部22に出力する。   The framework extraction unit 21 extracts a framework of codes included in the coverage information calculation target program. Specifically, when the input of the coverage information calculation start instruction is accepted by the input unit 12, the framework extraction unit 21 reads the calculation target program from the program DB 16, extracts the code included in the program, and outputs the code to the counter generation unit 22. .

例えば、枠組み抽出部21は、プログラムDB16から読み出したプログラムがC言語で記述されている場合には、図7に示すように、プログラムのソースコード「SampleSource.c」から関数情報を抽出する。続いて、枠組み抽出部21は、抽出した関数情報内において、演算や出力などの実質的な処理が実施される関数内の行を抽出する。図7は、C言語で記述されたソースコードから枠組みを抽出する例を示す図である。   For example, when the program read from the program DB 16 is described in C language, the framework extraction unit 21 extracts function information from the source code “SampleSource.c” of the program as shown in FIG. Subsequently, the framework extraction unit 21 extracts lines in the function in which substantial processing such as calculation and output is performed in the extracted function information. FIG. 7 is a diagram illustrating an example of extracting a framework from source code described in C language.

また、枠組み抽出部21は、プログラムDB16から読み出したプログラムがJava(登録商標)で記述されている場合には、図8に示すように、Java(登録商標)VM(Java(登録商標) Virtual Machine)上のモジュール構成情報からクラス情報を抽出する。続いて、枠組み抽出部21は、抽出した各クラス情報内で定義されるメソッド情報を抽出する。そして、枠組み抽出部21は、抽出した各メソッド内において、演算や出力などの実質的な処理が実施される関数内の行を抽出する。図8は、Java(登録商標)で記述されたソースファイルから枠組みを抽出する例を示す図である。   In addition, when the program read from the program DB 16 is described in Java (registered trademark), the framework extraction unit 21 performs Java (registered trademark) VM (Java (registered trademark) Virtual Machine) as shown in FIG. ) Class information is extracted from the module configuration information above. Subsequently, the framework extraction unit 21 extracts method information defined in each extracted class information. Then, the framework extraction unit 21 extracts lines in a function in which substantial processing such as calculation and output is performed in each extracted method. FIG. 8 is a diagram illustrating an example of extracting a framework from a source file described in Java (registered trademark).

カウンタ生成部22は、枠組み抽出部21によって抽出された枠組みごとに、当該枠組みが実行された回数を計数するカウンタを生成する。具体的には、カウンタ生成部22は、枠組み抽出部21から枠組みが抽出されると、図4や図5に示すように、抽出された枠組みごとのカウンタを生成して枠組みカウンタDB17に格納し、カウンタを生成したことを回数計数部23に通知する。   The counter generation unit 22 generates a counter that counts the number of times the framework is executed for each framework extracted by the framework extraction unit 21. Specifically, when the framework is extracted from the framework extraction unit 21, the counter generation unit 22 generates a counter for each extracted framework and stores it in the framework counter DB 17 as shown in FIGS. The number counting unit 23 is notified that the counter has been generated.

例えば、カウンタ生成部22は、カバレッジ情報算出対象のプログラムがC言語で記述されている場合には、枠組み抽出部21によって抽出されたソースファイル名、関数、関数内の行ごとに、カウンタを生成する。また、カウンタ生成部22は、カバレッジ情報算出対象のプログラムがjava(登録商標)で記述されている場合には、枠組み抽出部21によって抽出されたクラス、メソッド、メソッド内の行ごとにカウンタを生成する。   For example, when the coverage information calculation target program is described in C language, the counter generation unit 22 generates a counter for each source file name, function, and line in the function extracted by the framework extraction unit 21. To do. The counter generation unit 22 generates a counter for each line in the class, method, and method extracted by the framework extraction unit 21 when the coverage information calculation target program is described in java (registered trademark). To do.

そして、カウンタ生成部22は、枠組み抽出部21によって抽出された枠組みと、生成したカウンタとを対応付ける。例えば、カウンタ生成部22は、枠組みとカウンタとの対応関係を生成する。そして、カウンタ生成部22は、枠組みが実行された場合に、実行された枠組みを特定する情報を示す実行通知を回数計数部23に出力するプログラムを、プログラムDB16に記憶されるプログラムソースコードに追記する。なお、プログラムソースコードに追記されたプログラムは、後述するカバレッジ情報算出部24によって、カバレッジ情報算出後に削除される。また、カウンタ生成部22は、プログラムDB16に記憶されるプログラムソースコードをコピーしたものに上記プログラムを追記し、これをカバレッジ情報算出対象としてもよい。   Then, the counter generation unit 22 associates the framework extracted by the framework extraction unit 21 with the generated counter. For example, the counter generation unit 22 generates a correspondence relationship between the framework and the counter. Then, when the framework is executed, the counter generation unit 22 adds a program that outputs an execution notification indicating information for identifying the executed framework to the number counting unit 23 in the program source code stored in the program DB 16. To do. The program added to the program source code is deleted after coverage information calculation by the coverage information calculation unit 24 described later. Further, the counter generation unit 22 may add the program to a copy of the program source code stored in the program DB 16 and set this as a coverage information calculation target.

また、枠組みを特定する情報の一例としては、プログラム全体での行番号や一意に割り振ったIDなど特定できる情報であれば、カウンタと対応関係を生成できる情報であればよい。また、追記するプログラムの一例としては、コメント文を挿入して実行通知を出力するなど様々な通知手法を用いることができる。   Further, as an example of information for specifying a framework, any information that can generate a correspondence with a counter may be used as long as it is information that can specify a line number or a uniquely assigned ID in the entire program. Further, as an example of a program to be additionally recorded, various notification methods such as inserting a comment sentence and outputting an execution notification can be used.

回数計数部23は、カバレッジ情報算出対象のプログラムを実行し、カウンタ生成部22によって生成された枠組みごとのカウンタを用いて、枠組み抽出部21によって抽出された枠組みが実行された回数を計数する。例えば、回数計数部23は、カウンタ生成部22からカウンタを生成したことが通知されると、プログラムDB16からプログラムを読み出して実行し、実行したプログラムを監視する。そして、回数計数部23は、カウンタ生成部22によって生成されたカウンタと枠組みとの対応関係と、枠組みが実行されるたびに受信する実行通知とを用いて、実行された枠組みを計数する。例えば、回数計数部23は、プログラム内の行が実行されるたびに実行通知を受信し、実行された行、この行を含む関数、この関数を含むソースファイル各々のカウンタをインクリメントする。その後、回数計数部23は、プログラムが終了すると、終了通知をカバレッジ情報算出部24に通知する。   The count counting unit 23 executes a program for calculating coverage information, and counts the number of times the framework extracted by the framework extraction unit 21 is executed using the counter for each framework generated by the counter generation unit 22. For example, when notified that the counter is generated from the counter generation unit 22, the number counting unit 23 reads and executes the program from the program DB 16 and monitors the executed program. The number counting unit 23 counts the executed frame using the correspondence between the counter and the frame generated by the counter generating unit 22 and the execution notification received every time the frame is executed. For example, the number counting unit 23 receives an execution notification every time a line in the program is executed, and increments the counter of each executed line, a function including the line, and a source file including the function. Thereafter, when the program ends, the number counting unit 23 notifies the coverage information calculating unit 24 of an end notification.

図5を例にして説明すると、回数計数部23は、例えば、methodA2の12行目が実行された場合、methodA2の12行目のカウンタをインクリメントし、さらに、methodA2のカウンタをインクリメントし、さらに、classAのカウンタをインクリメントする。その後、回数計数部23は、例えば、methodB1の7行目が実行された場合、methodB1の7行目のカウンタをインクリメントし、さらに、methodB1のカウンタをインクリメントし、さらに、classBのカウンタをインクリメントする。   Referring to FIG. 5 as an example, for example, when the 12th line of methodA2 is executed, the number counting unit 23 increments the counter of the 12th line of methodA2, further increments the counter of methodA2, Increment the classA counter. Thereafter, for example, when the seventh row of methodB1 is executed, the number counting unit 23 increments the counter of the seventh row of methodB1, further increments the counter of methodB1, and further increments the counter of classB.

カバレッジ情報算出部24は、カウンタ生成部22によって抽出された枠組みの数と、回数計数部23によって計数された枠組みごとの実行回数とから、カバレッジ情報としてプログラムの実行網羅率を算出する。カバレッジ情報算出部24は、プログラムの実行終了を回数計数部23から受信すると、カバレッジ情報の算出を実施する。   The coverage information calculation unit 24 calculates the execution coverage rate of the program as coverage information from the number of frames extracted by the counter generation unit 22 and the number of executions for each frame counted by the number counting unit 23. The coverage information calculation unit 24 calculates the coverage information when receiving the end of execution of the program from the number counting unit 23.

例えば、行単位を示す行カバレッジで実行網羅率を算出する場合、カバレッジ情報算出部24は、枠組みカウンタDB17に記憶される行ごとのカウンタの数を計数するとともに、インクリメントされているカウンタの数を計数する。続いて、カバレッジ情報算出部24は、インクリメントされているカウンタの数を行ごとのカウンタの総数で除算し、実行されるべき行のうち、実際に実行された行の割合を算出する。そして、カバレッジ情報算出部24は、算出した割合と算出した時間、さらに、算出対象となったプログラムの範囲とを対応付けてカバレッジ情報DB18に格納する。   For example, when calculating the execution coverage rate with line coverage indicating a line unit, the coverage information calculation unit 24 counts the number of counters for each line stored in the framework counter DB 17 and calculates the number of incremented counters. Count. Subsequently, the coverage information calculation unit 24 divides the number of incremented counters by the total number of counters for each row, and calculates the proportion of the rows actually executed among the rows to be executed. Then, the coverage information calculation unit 24 stores the calculated ratio, the calculated time, and the range of the program to be calculated in the coverage information DB 18 in association with each other.

具体的な例として、プログラム全体を実行し、図4に示した枠ごとのカウンタのうち、functionA1の行番号=3、11とfunctionB1の行番号=2の実行回数が1以上であったとする。この場合、カバレッジ情報算出部24は、枠組みカウンタDB17に記憶される行ごとのカウンタの総数を「6」と計数し、実際に実行された行の数を「3」と計数する。続いて、カバレッジ情報算出部24は、実行したプログラムの実行網羅率(行)を「3/6*100=50%」と算出する。そして、カバレッジ情報算出部24は、実行網羅率を算出した日「2009/10/30」、実行した範囲「全部」、算出した実行網羅率「50%」を対応付けて、カバレッジ情報DB18に格納する。   As a specific example, it is assumed that the entire program is executed, and among the counters for each frame shown in FIG. In this case, the coverage information calculation unit 24 counts the total number of counters for each row stored in the framework counter DB 17 as “6”, and counts the number of actually executed rows as “3”. Subsequently, the coverage information calculation unit 24 calculates the execution coverage rate (row) of the executed program as “3/6 * 100 = 50%”. Then, the coverage information calculation unit 24 associates the date “2009/10/30” when the execution coverage is calculated, the range “all” executed, and the calculated execution coverage “50%”, and stores them in the coverage information DB 18. To do.

また、プログラム全体を実行し、メソッドカバレッジで実行網羅率を算出する場合、図5を用いて説明する。ここでは、図5に示したmethodA1の行番号=2、4と、methodB1の行番号=4、7との実行回数が1以上であったとする。すなわち、methodA1の実行回数とmethodB1の実行回数が1以上である。この場合、カバレッジ情報算出部24は、枠組みカウンタDB17に記憶されるメソッドごとのカウンタの総数を「3」と計数し、実際に実行されたメソッドの数を「2」と計数する。続いて、カバレッジ情報算出部24は、実行したプログラムの実行網羅率(行)を「2/3*100=66.66%」と算出する。そして、カバレッジ情報算出部24は、実行網羅率を算出した日「2009/10/30」、実行した範囲「全部」、算出したメソッドカバレッジの実行網羅率「66%」を対応付けて、カバレッジ情報DB18に格納する。   Further, the case of executing the entire program and calculating the execution coverage rate by method coverage will be described with reference to FIG. Here, it is assumed that the number of executions of the line number = 2, 4 of methodA1 and the line number = 4, 7 of methodB1 shown in FIG. That is, the number of executions of methodA1 and the number of executions of methodB1 are one or more. In this case, the coverage information calculation unit 24 counts the total number of counters for each method stored in the framework counter DB 17 as “3”, and counts the number of actually executed methods as “2”. Subsequently, the coverage information calculation unit 24 calculates the execution coverage rate (row) of the executed program as “2/3 * 100 = 66.66%”. Then, the coverage information calculation unit 24 associates the date “2009/10/30” when the execution coverage is calculated, the execution range “all”, and the calculated method coverage execution coverage “66%” with the coverage information Store in DB18.

なお、カバレッジ情報算出部24は、プログラムを実行した範囲については、枠組み抽出部21によって入力部12を介して受け付けられた範囲を受け付けることで、実行したプログラムの範囲、すなわち、カバレッジ情報算出対象範囲を取得することができる。   The coverage information calculation unit 24 receives the range received by the framework extraction unit 21 via the input unit 12 for the range in which the program is executed, so that the range of the executed program, that is, the coverage information calculation target range Can be obtained.

[処理の流れ]
次に、図9を用いて、実施例2に係るカバレッジ情報算出装置における処理の流れを説明する。図9は、実施例2に係るカバレッジ情報算出装置における処理の流れを示すフローチャートである。
[Process flow]
Next, a processing flow in the coverage information calculation apparatus according to the second embodiment will be described with reference to FIG. FIG. 9 is a flowchart illustrating a process flow in the coverage information calculation apparatus according to the second embodiment.

図9に示すように、入力部12によってカバレッジ情報算出処理開始指示が受け付けられると(ステップS101肯定)、カバレッジ情報算出装置10の枠組み抽出部21は、算出対象のプログラムをプログラムDB16から読み込む(ステップS102)。   As shown in FIG. 9, when a coverage information calculation process start instruction is received by the input unit 12 (Yes in step S101), the framework extraction unit 21 of the coverage information calculation apparatus 10 reads a program to be calculated from the program DB 16 (step S101). S102).

続いて、枠組み抽出部21は、読み込んだプログラムの構造を解析してプログラムが有するコードを抽出し、カウンタ生成部22は、枠組み抽出部21によって抽出された枠組みごとに、枠組みが実行された回数を計数するカウンタを生成する(ステップS103)。   Subsequently, the framework extraction unit 21 analyzes the structure of the read program and extracts codes included in the program, and the counter generation unit 22 performs the number of times the framework is executed for each framework extracted by the framework extraction unit 21. Is generated (step S103).

その後、回数計数部23は、カバレッジ情報算出対象のプログラムを実行する(ステップS104)。そして、回数計数部23は、カウンタ生成部22によって生成された枠組みごとのカウンタを用いて、実際に実行された枠組みのカウンタをインクリメントし、枠組みごとの実行回数を計数する(ステップS105)。なお、回数計数部23は、プログラムの実行が終了するまで、ステップS105を繰り返して実行する(ステップS106否定)。   Thereafter, the number counting unit 23 executes a program for calculating coverage information (step S104). Then, the number counting unit 23 uses the counter for each frame generated by the counter generating unit 22 to increment the counter of the actually executed frame, and counts the number of executions for each frame (step S105). Note that the number counting unit 23 repeatedly executes step S105 until execution of the program ends (No at step S106).

そして、プログラムの実行が終了すると(ステップS106肯定)、カバレッジ情報算出部24は、抽出された枠組みの数と、計数された枠組みごとの実行回数とから、カバレッジ情報としてプログラムの実行網羅率を算出する(ステップS107)。   When the execution of the program ends (Yes at step S106), the coverage information calculation unit 24 calculates the execution coverage of the program as coverage information from the number of extracted frameworks and the number of executions for each counted framework. (Step S107).

[実施例2による効果]
このように、実施例2に係るカバレッジ情報算出装置10は、プログラム実行前の枠組みを用いて、関数などのコードの枠組みごとに実行回数を計数するので、実行ログを生成する必要も無く、実行ログから枠組みごとの実行回数を生成する必要もない。この結果、カバレッジ情報算出装置10は、カバレッジ情報の算出対象となるプログラムに関係なく、カバレッジ情報を効率的に算出することが可能である。また、例えば、メモリなどの記憶領域に、実行ログを出力する領域を設ける必要も無いので、記憶領域を圧迫することもなく、記憶領域の無駄な使用を防止することができる。
[Effects of Example 2]
As described above, the coverage information calculation apparatus 10 according to the second embodiment counts the number of times of execution for each code framework such as a function using the framework before the program execution, so that it is not necessary to generate an execution log. There is no need to generate the number of executions for each framework from the log. As a result, the coverage information calculation apparatus 10 can efficiently calculate the coverage information regardless of the program for which coverage information is to be calculated. Further, for example, there is no need to provide an area for outputting an execution log in a storage area such as a memory, so that useless use of the storage area can be prevented without pressing the storage area.

さて、これまで本発明の実施例について説明したが、本発明は上述した実施例以外にも、種々の異なる形態にて実施されてよいものである。そこで、以下に異なる実施例を説明する。   Although the embodiments of the present invention have been described so far, the present invention may be implemented in various different forms other than the embodiments described above. Therefore, different embodiments will be described below.

(カバレッジ情報算出範囲)
例えば、本願が開示するカバレッジ情報算出装置は、実施例1や2で説明したようなプログラム全体に対してカバレッジ情報を算出する以外にも、プログラムの所定範囲内だけを対象として、カバレッジ情報を算出することができる。例えば、枠組み抽出部21は、カバレッジ情報の算出対象とする場合には、入力部12を介して、対象プログラムの関数Aのみや関数Aから関数Cまでなど範囲の指定を受け付けて、受け付けた範囲についてのみ、枠組みを抽出する。そして、枠組み抽出部21は、抽出した枠組みと指定された範囲とをカウンタ生成部22に出力する。
(Coverage information calculation range)
For example, the coverage information calculation device disclosed in the present application calculates coverage information only within a predetermined range of the program in addition to calculating coverage information for the entire program as described in the first and second embodiments. can do. For example, when the framework extraction unit 21 is to calculate coverage information, the framework extraction unit 21 receives a range specification such as only the function A of the target program or from the function A to the function C via the input unit 12, and the received range. Only the framework is extracted. Then, the framework extraction unit 21 outputs the extracted framework and the specified range to the counter generation unit 22.

続いて、カウンタ生成部22は、枠組み抽出部21によって抽出された枠組みについてのみカウンタを生成し、カウンタ生成が完了したことと指定された範囲とを回数計数部23に通知する。その後、回数計数部23は、指定された範囲についてのみ実行し、生成されたカウンタを用いて枠組みごとの実行回数を計数し、プログラムの実行が完了すると、完了したことと指定された範囲とをカバレッジ情報算出部24に通知する。そして、カバレッジ情報算出部24は、指定された範囲について、カバレッジ情報を算出する。この結果、カバレッジ情報算出装置10は、プログラムの所定範囲内について、カバレッジ情報を効率的に算出することが可能である。   Subsequently, the counter generation unit 22 generates a counter only for the frame extracted by the frame extraction unit 21, and notifies the count counting unit 23 of the completion of the counter generation and the designated range. Thereafter, the number counting unit 23 executes only the designated range, counts the number of times of execution for each framework using the generated counter, and when the execution of the program is completed, the completion and the designated range are determined. The coverage information calculation unit 24 is notified. And the coverage information calculation part 24 calculates coverage information about the designated range. As a result, the coverage information calculation apparatus 10 can efficiently calculate coverage information within a predetermined range of the program.

(カバレッジ情報算出対象プログラム)
また、実施例1や2に係るカバレッジ情報算出装置は、カバレッジ情報算出対象プログラムとして、C言語やJava(登録商標)で記述されたプログラムを例示したが、本願はこれに限定されるものではない。例えば、カバレッジ情報算出装置は、手続き型言語で記述されたプログラムであれば、実施例1や2と同様に処理することができる。また、本願が開示するカバレッジ情報算出装置は、ソースプログラムからだけでなく、例えば、コンパイル後のモジュールから枠組みを抽出することができる。
(Coverage information calculation target program)
Moreover, although the coverage information calculation apparatus which concerns on Example 1 or 2 illustrated the program described in C language or Java (trademark) as a coverage information calculation object program, this application is not limited to this. . For example, the coverage information calculation apparatus can be processed in the same manner as in the first and second embodiments as long as it is a program described in a procedural language. Moreover, the coverage information calculation apparatus disclosed in the present application can extract a framework from not only a source program but also a compiled module, for example.

(実行回数の計数手法)
また、実施例2に係るカバレッジ情報算出装置は、プログラムの枠組みとカウンタとを対応付けて、実行された枠組みの情報をプログラムから受信することで、枠組み毎の実行回数を計数する例について説明したが、本願はこれに限定されるものではない。例えば、カバレッジ情報算出装置は、コンパイラ後のモジュールから枠組み毎のカウンタを作成した場合には、コンパイラ後のモジュールとカウンタとを対応付ける。そして、カバレッジ情報算出装置は、実行したモジュールを監視し、実行された枠組みを計数する。なお、実行された枠組みを検知する手法は、実施例2で説明した手法以外の様々な技術を用いることができる。
(Execution count method)
In addition, the coverage information calculation apparatus according to the second embodiment has described the example in which the number of executions for each framework is counted by associating the framework of the program with the counter and receiving information on the executed framework from the program. However, the present application is not limited to this. For example, when the counter for each framework is created from the post-compiler module, the coverage information calculation apparatus associates the post-compiler module with the counter. Then, the coverage information calculation device monitors the executed modules and counts the executed framework. Various techniques other than the technique described in the second embodiment can be used as a technique for detecting the executed framework.

(カバレッジ情報の単位)
また、実施例1や2に係るカバレッジ情報算出装置は、カバレッジ情報として行カバレッジにおける実行網羅率、つまり、実際にどのくらいの行が実行されたかを示す実行網羅率を算出する例について説明したが、本願はこれに限定されるものではない。例えば、実施例1や2で用いたプログラムの行に注目した行カバレッジ以外にも、クラスに注目したクラスカバレッジ、メソッドに注目したメソッドカバレッジ、関数に注目した関数カバレッジなど、コードにおける任意の単位で実行網羅率を算出することができる。
(Coverage information unit)
Further, the coverage information calculation apparatus according to the first and second embodiments has described the example of calculating the execution coverage ratio in the line coverage as the coverage information, that is, the execution coverage ratio indicating how many lines are actually executed. The present application is not limited to this. For example, in addition to the line coverage focusing on the program lines used in the first and second embodiments, the class coverage focusing on the class, the method coverage focusing on the method, the function coverage focusing on the function, etc. in arbitrary units in the code The execution coverage rate can be calculated.

一例としては、カバレッジ情報算出装置は、実行されるべきメソッドの合計と実際に実行されたメソッドの数とから、メソッドカバレッジでの実行網羅率を算出することができる。また、カバレッジ情報算出装置は、実行されるべきクラスの合計と実際に実行されたクラスの数とから、クラスカバレッジでの実行網羅率を算出することができる。   As an example, the coverage information calculation apparatus can calculate the execution coverage in method coverage from the total number of methods to be executed and the number of methods actually executed. Further, the coverage information calculation apparatus can calculate the execution coverage rate in class coverage from the total number of classes to be executed and the number of classes actually executed.

(システム構成等)
また、本実施例において説明した各処理のうち、自動的におこなわれるものとして説明した処理の全部または一部を手動的におこなうこともできる。あるいは、手動的におこなわれるものとして説明した処理の全部または一部を公知の方法で自動的におこなうこともできる。この他、上記文書中や図面中で示した処理手順、制御手順、具体的名称、例えば図3〜図6等に示した各種のデータやパラメータを含む情報については、特記する場合を除いて任意に変更することができる。
(System configuration etc.)
In addition, among the processes described in the present embodiment, all or a part of the processes described as being automatically performed can be manually performed. Alternatively, all or part of the processing described as being performed manually can be automatically performed by a known method. In addition, the processing procedures, control procedures, and specific names shown in the above-mentioned documents and drawings, for example, information including various data and parameters shown in FIGS. 3 to 6 are optional unless otherwise specified. Can be changed.

また、図示した各装置の各構成要素は機能概念的なものであり、必ずしも物理的に図示の如く構成されていることを要しない。すなわち、例えば枠組み抽出部21とカウンタ生成部22とを統合するなど各装置の分散・統合の具体的形態は図示のものに限られず、その全部または一部を、各種の負荷や使用状況などに応じて、任意の単位で機能的または物理的に分散・統合して構成することができる。さらに、各装置にて行なわれる各処理機能は、その全部または任意の一部が、CPUおよび当該CPUにて解析実行されるプログラムにて実現され、あるいは、ワイヤードロジックによるハードウェアとして実現され得る。   Further, each component of each illustrated apparatus is functionally conceptual, and does not necessarily need to be physically configured as illustrated. That is, for example, the specific form of distribution / integration of each device such as integration of the framework extraction unit 21 and the counter generation unit 22 is not limited to the illustrated one, and all or a part thereof can be used for various loads and usage conditions. Accordingly, it can be configured to be functionally or physically distributed and integrated in arbitrary units. Further, all or any part of each processing function performed in each device may be realized by a CPU and a program analyzed and executed by the CPU, or may be realized as hardware by wired logic.

(プログラム)
ところで、上記の実施例で説明した各種の処理は、あらかじめ用意されたプログラムをパーソナルコンピュータやワークステーションなどのコンピュータシステムで実行することによって実現することができる。そこで、以下では、上記の実施例と同様の機能を有するプログラムを実行するコンピュータシステムの一例を説明する。
(program)
By the way, the various processes described in the above embodiments can be realized by executing a program prepared in advance on a computer system such as a personal computer or a workstation. Therefore, in the following, an example of a computer system that executes a program having the same function as in the above embodiment will be described.

図10は、カバレッジ情報算出プログラムを実行するコンピュータシステムの例を示す図である。図10に示すように、コンピュータシステム100は、RAM101と、HDD102と、ROM103と、CPU104とを有する。ここで、ROM103には、上の実施例と同様の機能を発揮するプログラムがあらかじめ記憶されている。つまり、図10に示すように、ROM103には、枠組み抽出プログラム103a、カウンタ生成プログラム103b、回数計数プログラム103c、カバレッジ情報算出プログラム103dがあらかじめ記憶されている。   FIG. 10 is a diagram illustrating an example of a computer system that executes a coverage information calculation program. As illustrated in FIG. 10, the computer system 100 includes a RAM 101, an HDD 102, a ROM 103, and a CPU 104. Here, the ROM 103 stores in advance a program that exhibits the same function as in the above embodiment. That is, as shown in FIG. 10, the ROM 103 stores in advance a framework extraction program 103a, a counter generation program 103b, a number counting program 103c, and a coverage information calculation program 103d.

そして、CPU104には、これらのプログラム103a〜103dを読み出して実行することで、図10に示すように、各プロセスとなる。つまり、プログラム103a〜103d各々は、枠組み抽出プロセス104a、カウンタ生成プロセス104b、回数計数プロセス104c、カバレッジ情報算出プロセス104dとなる。なお、枠組み抽出プロセス104aは、図2に示した枠組み抽出部21に対応し、同様に、カウンタ生成プロセス104bは、カウンタ生成部22に対応する。また、回数計数プロセス104cは、図2に示した回数計数部23に対応し、カバレッジ情報算出プロセス104dは、カバレッジ情報算出部24に対応する。   Then, the CPU 104 reads out and executes these programs 103a to 103d, thereby forming each process as shown in FIG. That is, each of the programs 103a to 103d is a framework extraction process 104a, a counter generation process 104b, a number counting process 104c, and a coverage information calculation process 104d. Note that the framework extraction process 104a corresponds to the framework extraction unit 21 shown in FIG. 2, and similarly, the counter generation process 104b corresponds to the counter generation unit 22. The number counting process 104c corresponds to the number counting unit 23 shown in FIG. 2, and the coverage information calculation process 104d corresponds to the coverage information calculation unit 24.

また、HDD102には、プログラムテーブル102aと、枠組みカウンタテーブル102bと、カバレッジ情報テーブル102cとが設けられる。プログラムテーブル102aは、図2に示したプログラムDB16に対応し、枠組みカウンタテーブル102bは、枠組みカウンタDB17に対応し、カバレッジ情報テーブル102cは、カバレッジ情報DB18に対応する。   The HDD 102 is provided with a program table 102a, a framework counter table 102b, and a coverage information table 102c. The program table 102a corresponds to the program DB 16 shown in FIG. 2, the framework counter table 102b corresponds to the framework counter DB 17, and the coverage information table 102c corresponds to the coverage information DB 18.

ところで、上記したプログラム103a〜103dは、必ずしもROM103に記憶させておく必要はない。例えば、プログラム103a〜103dは、コンピュータシステム100に挿入されるフレキシブルディスク(FD)、CD−ROM、MOディスク、DVDディスク、光磁気ディスク、ICカードなどの「可搬用の物理媒体」に記憶させておくようにしてもよい。また、コンピュータシステム100の内外に備えられるハードディスクドライブ(HDD)などの「固定用の物理媒体」に記憶させておいてもよい。さらに、公衆回線、インターネット、LAN、WANなどを介してコンピュータシステム100に接続される「他のコンピュータシステム」に記憶させておいてもよい。そして、コンピュータシステム100がこれらからプログラムを読み出して実行するようにしてもよい。   By the way, the above-described programs 103 a to 103 d are not necessarily stored in the ROM 103. For example, the programs 103a to 103d are stored in a “portable physical medium” such as a flexible disk (FD), a CD-ROM, an MO disk, a DVD disk, a magneto-optical disk, or an IC card inserted into the computer system 100. You may make it leave. Further, it may be stored in a “fixed physical medium” such as a hard disk drive (HDD) provided inside or outside the computer system 100. Further, it may be stored in “another computer system” connected to the computer system 100 via a public line, the Internet, a LAN, a WAN, or the like. Then, the computer system 100 may read the program from these and execute it.

すなわち、この他の実施例でいうプログラムは、上記した「可搬用の物理媒体」、「固定用の物理媒体」、「通信媒体」などの記録媒体に、コンピュータ読み取り可能に記録されるものである。そして、コンピュータシステム100は、このような記録媒体からプログラムを読み出して実行することで上記した実施例と同様の機能を実現する。なお、この他の実施例でいうプログラムは、コンピュータシステム100によって実行されることに限定されるものではない。例えば、他のコンピュータシステムまたはサーバがプログラムを実行する場合や、これらが協働してプログラムを実行するような場合にも、本発明を同様に適用することができる。   That is, the program referred to in the other embodiments is recorded in a computer-readable manner on a recording medium such as the above-mentioned “portable physical medium”, “fixed physical medium”, “communication medium”, and the like. . Then, the computer system 100 realizes the same function as the above-described embodiment by reading and executing the program from such a recording medium. The program referred to in the other embodiments is not limited to being executed by the computer system 100. For example, the present invention can be similarly applied to a case where another computer system or server executes a program or a case where these programs cooperate to execute a program.

以上の各実施例を含む実施形態に関し、さらに以下の付記を開示する。   The following supplementary notes are further disclosed with respect to the embodiments including the above examples.

(付記1)カバレッジ情報の算出対象であるプログラムに含まれるコードの枠組み毎に設けられたカウンタを用いて、該プログラムを実行した場合に該枠組みが実行された回数を計数する回数計数手順と、
前記カウンタが設けられた枠組みの数と、前記回数計数手順によって実行回数が計数された枠組みの数とから、カバレッジ情報を算出するカバレッジ情報算出手順と
をコンピュータに実行させることを特徴とするカバレッジ情報算出プログラム。
(Supplementary Note 1) Using a counter provided for each code framework included in a program for which coverage information is to be calculated, a number counting procedure for counting the number of times the framework is executed when the program is executed;
Coverage information for causing a computer to execute a coverage information calculation procedure for calculating coverage information from the number of frames provided with the counter and the number of frames for which the number of executions has been counted by the number counting procedure. Calculation program.

(付記2)前記プログラムを実行する前に、前記プログラムに含まれるコードの枠組みを抽出する枠組み抽出手順と、
前記枠組み抽出手順によって抽出された枠組み毎に、該枠組みが実行された回数を計数するカウンタを生成するカウンタ生成手順とをさらにコンピュータに実行させることを特徴とする付記1に記載のカバレッジ情報算出プログラム。
(Supplementary Note 2) Before executing the program, a framework extraction procedure for extracting a framework of code included in the program;
The coverage information calculation program according to claim 1, further causing a computer to execute a counter generation procedure for generating a counter that counts the number of times the framework has been executed for each framework extracted by the framework extraction procedure. .

(付記3)前記カバレッジ情報算出手順は、前記枠組み抽出手順によって抽出された枠組みの数における前記回数計数手順によって実行回数が計数された枠組みの数の割合を示すプログラムの実行網羅率を、前記カバレッジ情報として算出することを特徴とする付記2に記載のカバレッジ情報算出プログラム。 (Supplementary Note 3) The coverage information calculation procedure includes a program execution coverage ratio indicating a ratio of the number of frames whose number of executions is counted by the number counting procedure to the number of frames extracted by the framework extraction procedure, The coverage information calculation program according to appendix 2, wherein the coverage information calculation program is calculated as information.

(付記4)カバレッジ情報の算出対象であるプログラムに含まれるコードの枠組み毎のカウンタを記憶するカウンタ記憶部と、
前記カウンタ記憶部に記憶される枠組み毎のカウンタを用いて、前記プログラムを実行した場合に該枠組みが実行された回数を計数する回数計数部と、
前記カウンタ記憶部に記憶されるカウンタが設けられた枠組みの数と、前記回数計数部によって実行回数が計数された枠組みの数とから、カバレッジ情報を算出するカバレッジ情報算出部と
を有することを特徴とするカバレッジ情報算出装置。
(Supplementary note 4) a counter storage unit that stores a counter for each framework of a code included in a program for which coverage information is to be calculated;
Using a counter for each frame stored in the counter storage unit, the number counting unit that counts the number of times the frame is executed when the program is executed,
A coverage information calculation unit for calculating coverage information from the number of frames provided with a counter stored in the counter storage unit and the number of frames for which the number of executions is counted by the number counting unit. Coverage information calculation device.

(付記5)前記プログラムを実行する前に、前記プログラムに含まれるコードの枠組みを抽出する枠組み抽出部と、
前記枠組み抽出部によって抽出された枠組み毎に、前記カウンタを生成して前記カウンタ記憶部に格納するカウンタ生成部とをさらにコンピュータに実行させることを特徴とする付記4に記載のカバレッジ情報算出装置。
(Supplementary Note 5) Before executing the program, a framework extraction unit that extracts a framework of code included in the program;
The coverage information calculation apparatus according to appendix 4, wherein the computer further executes a counter generation unit that generates the counter and stores the counter in the counter storage unit for each frame extracted by the framework extraction unit.

(付記6)前記カバレッジ情報算出部は、前記枠組み抽出部によって抽出された枠組みの数における前記回数計数部によって実行回数が計数された枠組みの数の割合を示すプログラムの実行網羅率を、前記カバレッジ情報として算出することを特徴とする付記5に記載のカバレッジ情報算出装置。 (Supplementary note 6) The coverage information calculation unit calculates an execution coverage rate of a program indicating a ratio of the number of frames whose number of executions is counted by the number counting unit to the number of frames extracted by the framework extraction unit, The coverage information calculation apparatus according to appendix 5, wherein the coverage information calculation apparatus calculates the information.

(付記7)カバレッジ情報の算出対象であるプログラムに含まれるコードの枠組み毎に設けられたカウンタを用いて、該プログラムを実行した場合に該枠組みが実行された回数を計数する回数計数工程と、
前記カウンタが設けられた枠組みの数と、前記回数計数工程によって実行回数が計数された枠組みの数とから、カバレッジ情報を算出するカバレッジ情報算出工程と
を含んだことを特徴とするカバレッジ情報算出方法。
(Supplementary note 7) Counting step of counting the number of times the framework is executed when the program is executed by using a counter provided for each code framework included in the program for which coverage information is calculated;
A coverage information calculation method comprising: a coverage information calculation step of calculating coverage information from the number of frames provided with the counter and the number of frames for which the number of executions has been counted by the number counting step. .

(付記8)前記プログラムを実行する前に、前記プログラムに含まれるコードの枠組みを抽出する枠組み抽出工程と、
前記枠組み抽出工程によって抽出された枠組み毎に、前記カウンタを生成するカウンタ生成工程とをさらにコンピュータに実行させることを特徴とする付記7に記載のカバレッジ情報算出方法。
(Supplementary note 8) Before executing the program, a framework extraction step of extracting a framework of code included in the program;
The coverage information calculation method according to appendix 7, further comprising: causing the computer to further execute a counter generation step for generating the counter for each frame extracted by the framework extraction step.

(付記9)前記カバレッジ情報算出工程は、前記枠組み抽出工程によって抽出された枠組みの数における前記回数計数工程によって実行回数が計数された枠組みの数の割合を示すプログラムの実行網羅率を、前記カバレッジ情報として算出することを特徴とする付記8に記載のカバレッジ情報算出方法。 (Supplementary note 9) The coverage information calculation step includes an execution coverage rate of a program indicating a ratio of the number of frames whose number of executions has been counted by the number-of-times counting step to the number of frames extracted by the framework extraction step. The coverage information calculation method according to appendix 8, wherein the coverage information calculation method is calculated as information.

1 カバレッジ情報算出装置
1a 回数計数部
1b カバレッジ情報算出部
2 プログラムソースコード
3 カバレッジ情報
10 カバレッジ情報算出装置
11 通信制御I/F部
12 入力部
13 表示部
15 記憶部
16 プログラムDB
17 枠組みカウンタDB
18 カバレッジ情報DB
20 制御部
21 枠組み抽出部
22 カウンタ生成部
23 回数計数部
24 カバレッジ情報算出部
DESCRIPTION OF SYMBOLS 1 Coverage information calculation apparatus 1a Counting part 1b Coverage information calculation part 2 Program source code 3 Coverage information 10 Coverage information calculation apparatus 11 Communication control I / F part 12 Input part 13 Display part 15 Storage part 16 Program DB
17 Framework counter DB
18 Coverage information DB
20 Control Unit 21 Framework Extraction Unit 22 Counter Generation Unit 23 Number Counting Unit 24 Coverage Information Calculation Unit

Claims (9)

ログラムに含まれるサブルーチンと、該サブルーチンに含まれる行とについて、該プログラムを実行した場合に該サブルーチンおよび該行それぞれが実行されたか否かを検出し、
前記プログラムに含まれる前記サブルーチンのと、実行が検出されたサブルーチンの数とに基づき、前記プログラムに含まれるサブルーチン全体のうちの実行されたサブルーチンの割合を示す情報を表示するとともに、前記サブルーチンに含まれる行の数と、実行が検出された行の数とに基づき、前記サブルーチンに含まれる行全体のうち実行された行の割合を示す情報を表示する、処理をコンピュータに実行させ
前記コンピュータは、
前記実行されたサブルーチンの割合を示す情報を生成する際、前記サブルーチンに含まれる行のうち何れかの行の実行が検出されたサブルーチンの数を、前記実行が検出されたサブルーチンの数とする、
ことを特徴とするカバレッジ情報生成プログラム。
A subroutine contained in the program, for a row included in the subroutine, it is detected whether each said subroutine and the row when running the program is executed,
And total number of pre-Symbol subroutine that is part of the program, based on the number of execution is detected subroutine, and displays information indicating a ratio of the executed subroutine of the overall subroutine contained in said program, run the total number of rows included in the subroutine, on the basis of the number of execution is detected Tagyo displays information indicating a ratio of a line that was executed within the entire row included in the subroutine, the process to the computer then,
The computer
When generating information indicating the ratio of the executed subroutine, the number of subroutines in which execution of any one of the lines included in the subroutine is detected is defined as the number of subroutines in which the execution is detected.
A coverage information generation program characterized by that.
前記プログラムに含まれる前記サブルーチンに対応するカウンタと、前記プログラムに含まれる前記行に対応するカウンタとを用いて、前記サブルーチンが実行された回数および前記行が実行された回数を計数する処理を前記コンピュータにさらに実行させることを特徴とする請求項1に記載のカバレッジ情報生成プログラム。   Using the counter corresponding to the subroutine included in the program and the counter corresponding to the line included in the program, the process of counting the number of times the subroutine is executed and the number of times the line is executed The coverage information generation program according to claim 1, further causing the computer to execute the program. 前記プログラムを実行する前に、前記プログラムに含まれる前記サブルーチンと前記行とを抽出し、
抽出した前記サブルーチン毎と前記行毎とに、前記カウンタを生成する処理を前記コンピュータにさらに実行させることを特徴とする請求項2に記載のカバレッジ情報生成プログラム。
Before executing the program, extract the subroutine and the line included in the program,
3. The coverage information generation program according to claim 2, further causing the computer to further execute a process of generating the counter for each of the extracted subroutines and for each row.
前記抽出た前記サブルーチン全体のうち実行が計数された前記サブルーチンの数の割合を示すプログラムの実行網羅率と、前記抽出した前記行全体のうち実行が計数された前記行の数の割合を示すプログラムの実行網羅率とを、カバレッジ情報として生成することを特徴とする請求項3に記載のカバレッジ情報生成プログラム。 Execution coverage program indicating the ratio of the number of the subroutine execution is counted among whole the subroutine the extracted, the ratio of the number of Kigyo before execution of entire rows the extracted is counted an execution coverage of the program shown, the coverage information generating program according to claim 3, characterized in that to produce a coverage information. 前記検出する処理は、前記サブルーチンとして関数またはメソッドが実行されたか否かを検出することを特徴とする請求項1に記載のカバレッジ情報生成プログラム。   The coverage information generating program according to claim 1, wherein the detecting process detects whether a function or a method is executed as the subroutine. 前記プログラム内の関数またはメソッドにおいて実行対象となる各行までの各階層に対応するカウンタを用いて、いずれかの行が実行された場合に、前記実行された行と、該行を含む関数またはメソッドと、該行を含む関数またはメソッドを含むプログラムとのそれぞれについて、実行された回数を計数する処理を前記コンピュータにさらに実行させ、
前記生成する処理は、前記プログラムに含まれる、前記関数、前記メソッド、前記行それぞれの数と、前記関数、前記メソッド、前記行のそれぞれが実行された回数とを用いて、前記プログラムのカバレッジ情報を生成することを特徴とする請求項5に記載のカバレッジ情報生成プログラム。
When any line is executed using a counter corresponding to each hierarchy up to each line to be executed in the function or method in the program, the executed line and the function or method including the line are executed. And for each of the program including the function or method including the line, causing the computer to further execute a process of counting the number of times executed,
The processing to be generated uses the number of each of the function, the method, and the line included in the program, and the number of times each of the function, the method, and the line is executed, and coverage information of the program The coverage information generation program according to claim 5, wherein:
前記サブルーチンまたは前記サブルーチンに含まれる前記行が実行された場合に、実行された前記サブルーチンまたは前記行を特定する情報である実行通知を出力するソースコードを前記プログラムに追記し、実行されたサブルーチンの割合を示す情報および実行された行の割合を示す情報が生成された後に、追加した前記ソースコードを削除する処理を前記コンピュータにさらに実行させ、
前記検出する処理は、追記された前記ソースコードによって出力される前記実行通知にしたがって、前記サブルーチンおよび前記行が実行されたことを検出することを特徴とする請求項1に記載のカバレッジ情報生成プログラム。
When the subroutine or the line included in the subroutine is executed, source code that outputs an execution notification that is information for specifying the executed subroutine or the line is added to the program, and the subroutine executed After the information indicating the ratio and the information indicating the ratio of the executed lines are generated, the computer is further caused to execute a process of deleting the added source code,
The coverage information generating program according to claim 1, wherein the detecting process detects that the subroutine and the line are executed in accordance with the execution notification output by the added source code. .
ログラムに含まれるサブルーチンと、該サブルーチンに含まれる行とについて、該プログラムを実行した場合に該サブルーチンおよび該行それぞれが実行されたかを検出する検出部と、
前記プログラムに含まれる前記サブルーチンのと、前記検出部によって検出されたサブルーチンの数とに基づき、前記プログラムに含まれるサブルーチン全体のうちの実行されたサブルーチンの割合を示す情報を表示するとともに、前記サブルーチンに含まれる行の数と、前記検出部によって検出された行の数とに基づき、前記サブルーチンに含まれる行全体のうち実行された行の割合を示す情報を表示する生成部とを有し、
前記生成部は、前記実行されたサブルーチンの割合を示す情報を生成する際、前記サブルーチンに含まれる行のうち何れかの行の実行が検出されたサブルーチンの数を、前記実行が検出されたサブルーチンの数とする、
とを特徴とするカバレッジ情報生成装置。
A subroutine contained in the program, for a row included in the subroutine, a detecting unit for detecting whether each said subroutine and the row has been executed when executing the program,
And total number of pre-Symbol subroutine that is part of the program, based on the number of subroutines that have been detected by the detecting unit, and displays information indicating a ratio of the executed subroutine of the overall subroutine contained in said program together, generating unit which displays the total number of rows included in the subroutine, based on the number of Tagyo detected by the detecting unit, information indicating a ratio of a line that was executed within the entire row included in the subroutine It has a door,
When generating the information indicating the ratio of the executed subroutine, the generating unit indicates the number of subroutines in which execution of any one of the lines included in the subroutine is detected, and the subroutine in which the execution is detected. The number of
Coverage information generating apparatus according to claim and this.
ログラムに含まれるサブルーチンと、該サブルーチンに含まれる行とについて、該プログラムを実行した場合に該サブルーチンおよび該行それぞれが実行されたか否かを検出し、
前記プログラムに含まれる前記サブルーチンのと、実行が検出されたサブルーチンの数とに基づき、前記プログラムに含まれるサブルーチン全体のうちの実行されたサブルーチンの割合を示す情報を表示するとともに、前記サブルーチンに含まれる行の数と、実行が検出された行の数とに基づき、前記サブルーチンに含まれる行全体のうち実行された行の割合を示す情報を表示する処理を含み
前記表示する処理は、
前記実行されたサブルーチンの割合を示す情報を生成する際、前記サブルーチンに含まれる行のうち何れかの行の実行が検出されたサブルーチンの数を、前記実行が検出されたサブルーチンの数とする、
とを特徴とするカバレッジ情報生成方法。
A subroutine contained in the program, for a row included in the subroutine, it is detected whether each said subroutine and the row when running the program is executed,
And total number of pre-Symbol subroutine that is part of the program, based on the number of execution is detected subroutine, and displays information indicating a ratio of the executed subroutine of the overall subroutine contained in said program, wherein the total number of rows included in the subroutine, on the basis of the number of execution it is detected Tagyo displays information indicating a ratio of a line that was executed within the entire row included in the subroutine, the process
The processing to display is
When generating information indicating the ratio of the executed subroutine, the number of subroutines in which execution of any one of the lines included in the subroutine is detected is defined as the number of subroutines in which the execution is detected.
Coverage information generated wherein a call.
JP2009271669A 2009-11-30 2009-11-30 Coverage information generation program, coverage information generation apparatus, and coverage information generation method Expired - Fee Related JP5682109B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2009271669A JP5682109B2 (en) 2009-11-30 2009-11-30 Coverage information generation program, coverage information generation apparatus, and coverage information generation method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2009271669A JP5682109B2 (en) 2009-11-30 2009-11-30 Coverage information generation program, coverage information generation apparatus, and coverage information generation method

Publications (2)

Publication Number Publication Date
JP2011113474A JP2011113474A (en) 2011-06-09
JP5682109B2 true JP5682109B2 (en) 2015-03-11

Family

ID=44235731

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2009271669A Expired - Fee Related JP5682109B2 (en) 2009-11-30 2009-11-30 Coverage information generation program, coverage information generation apparatus, and coverage information generation method

Country Status (1)

Country Link
JP (1) JP5682109B2 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2015011396A (en) * 2013-06-26 2015-01-19 株式会社エクサ Regression test support system

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS62200437A (en) * 1986-02-28 1987-09-04 Mitsubishi Electric Corp Inclusion degree measuring instrument
JPH0452835A (en) * 1990-06-15 1992-02-20 Hitachi Ltd Program test evaluation system
JPH04148347A (en) * 1990-10-11 1992-05-21 Nec Corp Unit testing system for fortran source program
JP2002342119A (en) * 2001-03-15 2002-11-29 Ricoh Co Ltd Method for generating program for image forming device, method for measuring coverage for image forming device, program for making computer perform these methods, instrument and program for measuring coverage, and information recording medium
JP4483163B2 (en) * 2002-09-11 2010-06-16 株式会社日立製作所 Program test debugging device

Also Published As

Publication number Publication date
JP2011113474A (en) 2011-06-09

Similar Documents

Publication Publication Date Title
Krogmann et al. Using genetic search for reverse engineering of parametric behavior models for performance prediction
Kwon et al. Mantis: Automatic performance prediction for smartphone applications
US9454467B2 (en) Method and apparatus for mining test coverage data
US8387016B2 (en) Whitebox trace fuzzing
Adamoli et al. Automated GUI performance testing
JP5139486B2 (en) Trace generation device, system, and program thereof
Roehm et al. Monitoring user interactions for supporting failure reproduction
CN111919214A (en) Automatic generation of patches for security violations
US7624381B1 (en) Portable detection of start and completion of object construction
Mendonca et al. Detecting implied scenarios from execution traces
Kwon et al. Mantis: Efficient predictions of execution time, energy usage, memory usage and network usage on smart mobile devices
JP2018156133A (en) Compiler program, information processing apparatus and compilation method
JP5682109B2 (en) Coverage information generation program, coverage information generation apparatus, and coverage information generation method
Izsó et al. MONDO-SAM: A Framework to Systematically Assess MDE Scalability.
Wang et al. Fast reproducing web application errors
Mahmud et al. Acid: an api compatibility issue detector for android apps
Béziers la Fosse et al. Injecting execution traces into a model-driven framework for program analysis
JP2014106770A (en) Type check device, type check method and type check program
JP6081144B2 (en) Source code analyzer
US11055092B1 (en) Correlating contextual information of invoking code in a programming language with contextual information of at least one invoked code in a different programming language
Aparna et al. Building a common notation for enabling comparison of design and execution
KR20120009991A (en) Apparatus and method for generating test suite
Chatterjee et al. Software Regression and Migration Assistance Using Dynamic Instrumentation
WO2015085737A1 (en) Method and apparatus for mining test coverage data priority claim and related application
Barakhshan et al. CaRV--Accelerating Program Optimization through Capture, Replay, Validate

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20120815

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20130827

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20130910

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20131111

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20131217

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20140217

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20140325

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20140526

A02 Decision of refusal

Free format text: JAPANESE INTERMEDIATE CODE: A02

Effective date: 20140624

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20140924

A911 Transfer to examiner for re-examination before appeal (zenchi)

Free format text: JAPANESE INTERMEDIATE CODE: A911

Effective date: 20141001

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20141216

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20141229

R150 Certificate of patent or registration of utility model

Ref document number: 5682109

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

LAPS Cancellation because of no payment of annual fees