JP2009104489A - Apparatus and method for testing code clone - Google Patents

Apparatus and method for testing code clone Download PDF

Info

Publication number
JP2009104489A
JP2009104489A JP2007277023A JP2007277023A JP2009104489A JP 2009104489 A JP2009104489 A JP 2009104489A JP 2007277023 A JP2007277023 A JP 2007277023A JP 2007277023 A JP2007277023 A JP 2007277023A JP 2009104489 A JP2009104489 A JP 2009104489A
Authority
JP
Japan
Prior art keywords
code
code clone
test
clone
file
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Withdrawn
Application number
JP2007277023A
Other languages
Japanese (ja)
Inventor
Koji Nishida
廣治 西田
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.)
Fuji Electric Co Ltd
Original Assignee
Fuji Electric Holdings 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 Fuji Electric Holdings Ltd filed Critical Fuji Electric Holdings Ltd
Priority to JP2007277023A priority Critical patent/JP2009104489A/en
Publication of JP2009104489A publication Critical patent/JP2009104489A/en
Withdrawn legal-status Critical Current

Links

Abstract

<P>PROBLEM TO BE SOLVED: To provide an apparatus and method for testing code clones that efficiently tests code-cloned source codes. <P>SOLUTION: A server 100 has a source code file 2, a code clone output file 3, a test result file 4 and a code clone merging file 7, and includes a data setting part 8, a code clone detection/merge processing part 9 and a test result setting part 10 as function blocks implemented by hardware resources in the server 100. The code clone detection/merge processing part 9 detects and merges code clone sets in software source programs stored in the source code file 2. The test result setting part 10 tests one code clone in the detected code clone set, and sets test case numbers to the tested source code lines to indicate that the entire code clone set has been tested. <P>COPYRIGHT: (C)2009,JPO&INPIT

Description

本発明は、組み込みソフトウェアを含むソフトウェアソースコードプログラムのテストに関し、特にコードクローンされたソースコードのテストの効率化を図るコードクローンのテスト装置および方法に関する。   The present invention relates to testing of software source code programs including embedded software, and more particularly to a code clone testing apparatus and method for improving the efficiency of code cloned source code testing.

ソフトウェア開発においてはコードクローンがよく使われる。コードクローンは、ソースコード中の重複したコード列を指し、ソースコードの全部または一部をコピーアンドペーストして多数のコードクローンを含むソフトウェアを生成している。しかし一つのコードクローンに変更を加えると他のコードクローンにも同様の変更を行わなければならないことが多く、ソフトウェアの修正に掛かるコストが増大する原因になっている。   Code clones are often used in software development. The code clone indicates a duplicate code string in the source code, and a software including a large number of code clones is generated by copying and pasting all or part of the source code. However, if one code clone is changed, it is often necessary to make the same change to the other code clones, which causes an increase in the cost of correcting the software.

特許文献1は、コードクローン検出ツールの出力結果から、ソースコードの類似度を計測する技術を開示している。
特許文献2は、コードクローンの検出方法についての技術を開示している。
Patent Document 1 discloses a technique for measuring the similarity of source code from the output result of the code clone detection tool.
Patent Document 2 discloses a technique regarding a code clone detection method.

特許文献3は、プログラムを流用する場合、流用元で行っていたチェック項目を流用先に流用可能にする技術を開示している。
非特許文献1は、コードクローンセット間の依存関係をチェーンドクローンとして定義し、チェーンドクローンのリファクタリング方法について開示している。
Japanese Patent Application Laid-Open No. 2004-228561 discloses a technique that enables a check item that has been performed at a diversion source to be diverted to a diversion destination when the program is diverted.
Non-Patent Document 1 defines a dependency relationship between code clone sets as a chained clone, and discloses a chained clone refactoring method.

非特許文献2は、コードクローン検出ツールについて紹介している。
特開2003−216425号公報 特開2003−29978号公報 特開平5−250213号公報 吉田則裕 他4名「コードクローン間の依存関係に基づくリファタリング支援」情報処理学会論文誌 Vol.48,No.3,Mar. 2007,pp.1431-1442 小堀一雄 「コードクローン検出ツールを使って「コピペ」したコードを見つけよう」ソフトウェア・テストPRESS Vol.4,pp.124,技術評論社(2007)
Non-Patent Document 2 introduces a code clone detection tool.
JP 2003-216425 A Japanese Patent Laid-Open No. 2003-29978 JP-A-5-250213 Norihiro Yoshida and four others "Supporting Referering Based on Dependencies Between Code Clones" IPSJ Journal Vol.48, No.3, Mar. 2007, pp.1431-1442 Kazuo Kobori “Let's find“ copied ”code using the code clone detection tool” Software Test PRESS Vol.4, pp.124, Technical Review (2007)

ソフトウェアのソースコードのテストでは、一般に、ソースコードの一通りの命令を網羅するC0カバレッジテスト、分岐のtrueやfalseを網羅するC1カバレッジテスト、条件の組み合わせを網羅するC2カバレッジテストなどが行われる。   Software source code tests generally include a C0 coverage test that covers a single instruction of the source code, a C1 coverage test that covers true and false branches, and a C2 coverage test that covers combinations of conditions.

またソースコードのテスト方法としては、上記カバレッジを網羅するテスト仕様を作成してステップごとに確認する方法、テストプログラムを作成して自動実施する方法等がある。さらにテストプログラムを生成・実行・検証するXUNITなどのツールを用いる場合もある。   As a source code test method, there are a method of creating a test specification covering the above-mentioned coverage and confirming it for each step, a method of creating a test program and automatically executing it. In addition, tools such as XUNIT that generate, execute, and verify test programs may be used.

ソースコードには、あるコードの全部または一部を再利用するため、コピーアンドペーストで複製したコードクローンが存在する。再利用するには再利用部分を関数とするのが原則であるが、一部異なる部分があるなど関数化できずにコードクローンをする場合がある。従来ではコードクローンされた部分がどこにあるのかを区別できないため、コードクローンの有無に関わらずソースコードのテストを行っており、不必要なテストに労力やテスト機材の使用を許してきた。   In the source code, there is a code clone duplicated by copy and paste in order to reuse all or part of a certain code. In principle, the reuse part is used as a function for reuse, but there are cases where the code is cloned without being functionalized because there are some parts that are different. Conventionally, since it is not possible to distinguish where the code-clone portion is, the source code is tested regardless of the presence or absence of the code clone, thus allowing labor and use of test equipment for unnecessary tests.

一方、上記特許文献1では、ソースコードの類似度を計測できるが、テストには利用できない。また上記特許文献2では、コードクローンの検出には利用できるが、テストには利用できない。また、上記特許文献3では、プログラムを流用する場合、流用元で行っていたチェック項目を流用先に流用できるが、テストに適用できるかは言及されていない。さらに、上記非特許文献1は、チェーンドクローンを定義しているが、変数の参照関係によるコードクローン関数間のチェーンであり、テストは関数で閉じているため、テストには利用できない。また上記非特許文献2は、コードクローン検出ツールの紹介であり、テストには触れていない。   On the other hand, in Patent Document 1, the similarity of source code can be measured, but it cannot be used for testing. Moreover, in the said patent document 2, although it can utilize for the detection of a code clone, it cannot utilize for a test. Moreover, in the said patent document 3, when diverting a program, although the check item performed by the diversion source can be diverted to diversion destination, it is not mentioned whether it can apply to a test. Furthermore, although the said nonpatent literature 1 has defined the chained clone, since it is the chain between the code clone functions by the reference relation of a variable, and the test is closed with a function, it cannot be used for a test. Non-Patent Document 2 is an introduction of a code clone detection tool, and does not touch the test.

したがって本発明は、上記のコードクローンされたソースコードのテストを効率的に行うコードクローンのテスト装置および方法を提供することを目的とする。   Accordingly, an object of the present invention is to provide a code clone testing apparatus and method for efficiently testing the code cloned source code.

本発明のコードクローンのテスト装置は、コードクローンセットを含むソフトウェアソースプログラムをソースコードファイルに格納するデータ設定手段と、前記ソースコードファイルに格納された前記ソフトウェアソースプログラムから前記コードクローンセットを検出するコードクローン検出手段と、検出した前記コードクローンセットの内1つのコードクローンをテストし、テストされたソースコード行にテストケース番号を設定して前記コードクローンセット全体がテストされたことを表示するテスト結果設定処理手段、を有することを特徴とする。   A code clone test apparatus according to the present invention detects a code clone set from data setting means for storing a software source program including a code clone set in a source code file, and the software source program stored in the source code file. A code clone detection means and a test that tests one code clone of the detected code clone set, sets a test case number in the tested source code line, and displays that the entire code clone set has been tested Result setting processing means.

また本発明のコードクローンのテスト方法は、コードクローンセットを含むソフトウェアソースプログラムを格納する過程と、格納された前記ソフトウェアソースプログラムから前記コードクローンセットを検出する過程と、前記コードクローンセットの内1つのコードクローンをテストする過程と、前記コードクローンについてテストされたソースコード行にテストケース番号を設定し前記コードクローンセット全体がテストされたことを表示する過程と、を含むことを特徴とする。   The code clone test method of the present invention includes a step of storing a software source program including a code clone set, a step of detecting the code clone set from the stored software source program, and one of the code clone sets. And testing a single code clone, and setting a test case number to a source code line tested for the code clone to display that the entire code clone set has been tested.

本発明によれば、従来、コピーアンドペーストで複製した部分について行っていたテストを省略することができ、また複製して一部変更したソースコードのテストも効率的に行うことができる。また本発明によれば、あるコードの全部または一部を再利用するためにコピーアンドペーストで複製したコードクローンについてテストされたソースコード行が明確になり、重複したソースコードのテストを防止できる。また、コピーアンドペーストで複製しさらに一部変更したソースコードについて、変更部分の未テストの部分が明確になり、また変更を必要とするテスト仕様およびテストケースも特定できることから、変更部分のテスト仕様の作成と実行を半自動で行えるようになる。   According to the present invention, it is possible to omit a test that has conventionally been performed on a portion copied by copy and paste, and it is also possible to efficiently test a source code that has been copied and partially changed. Further, according to the present invention, a source code line tested for a code clone duplicated by copy and paste in order to reuse all or a part of a certain code is clarified, and a test of a duplicate source code can be prevented. In addition, for the source code copied and pasted by copy and paste, the untested part of the changed part becomes clear, and the test specifications and test cases that need to be changed can be identified. Can be created and executed semi-automatically.

以下、本発明の実施の形態を、図面を参照しながら説明する。
図1は、本発明の実施形態に係るコードクローンのテスト装置を具現するシステムの構成概要を示す図である。図1のシステム構成において、コードクローンテスト装置1は、サーバ100内において構成され、コードクローンテスト装置1はネットワーク200を介してクライアント300に結合される。そしてコードクローンテスト装置1は、サーバ100内のハードウェア資源である記憶装置中に、ソースコードファイル2、コードクローン出力ファイル3、テスト結果ファイル4、テスト仕様ファイル5、変更テスト仕様ファイル6、コードクローンマージファイル7を備え、またサーバ100内のハードウェア資源である中央処理装置(CPU),入出力装置,記憶装置等により実現される、機能ブロックとしての、データ設定処理部8、コードクローン検出・マージ処理部9、テスト結果設定処理部10、
変更テストケース抽出処理部11、変更テスト仕様作成処理部12を備えて構成される。ここでサーバ100は当業者に周知のコンピュータハードウェア資源によって実現されているもので、例えばコンピュータハードウェア資源としてCPU、記憶装置(ROM,RAM,HDDを含む)、入出力装置(通信I/F,ディスプレイ,プリンタ,マウス,キーボードなどを含む)などを備えている。
Hereinafter, embodiments of the present invention will be described with reference to the drawings.
FIG. 1 is a diagram showing a schematic configuration of a system that embodies a code clone test apparatus according to an embodiment of the present invention. In the system configuration of FIG. 1, the code clone test apparatus 1 is configured in the server 100, and the code clone test apparatus 1 is coupled to the client 300 via the network 200. The code clone test apparatus 1 stores the source code file 2, the code clone output file 3, the test result file 4, the test specification file 5, the change test specification file 6, the code in the storage device which is a hardware resource in the server 100. Data setting processing unit 8, code clone detection as a functional block realized by a central processing unit (CPU), an input / output device, a storage device, etc., which are provided with a clone merge file 7 and are hardware resources in the server 100・ Merge processing unit 9, test result setting processing unit 10,
A change test case extraction processing unit 11 and a change test specification creation processing unit 12 are provided. Here, the server 100 is realized by computer hardware resources known to those skilled in the art. For example, a CPU, a storage device (including ROM, RAM, HDD), an input / output device (communication I / F) as computer hardware resources. , Display, printer, mouse, keyboard, etc.).

ネットワーク200は、クライアント300とサーバ100(コードクローンテスト装置1)とを連携するもので、LAN、公衆網(インターネットを含む)など、周知のネットワーク技術を用いることができる。   The network 200 links the client 300 and the server 100 (code clone test apparatus 1), and a well-known network technology such as a LAN or a public network (including the Internet) can be used.

クライアント300は、ネットワーク200経由でサーバ100(コードクローンテスト装置1)に繋がれ、周知のクライアントが有するコンピュータハードウェア資源を用いてサーバ100(コードクローンテスト装置1)に対する処理の起動やデータの表示、データの設定を行う。   The client 300 is connected to the server 100 (code clone test apparatus 1) via the network 200, and starts processing and displays data for the server 100 (code clone test apparatus 1) using computer hardware resources of a known client. Set the data.

ソースコードファイル2は、本発明の適用対象となるソースコードを格納するファイルであり、図2にソースコードファイル2の構成例を示す。これについては後述する。
コードクローン出力ファイル3は、コードクローン検出ツール、例えば、非特許文献2で紹介されているCCFinderXなどを用いて検出したデータを格納するファイルであり、図3にコードクローン出力ファイル3の構成例を示す。これについては後述する。
The source code file 2 is a file for storing source code to which the present invention is applied, and FIG. 2 shows a configuration example of the source code file 2. This will be described later.
The code clone output file 3 is a file for storing data detected using a code clone detection tool such as CCFinderX introduced in Non-Patent Document 2, and a configuration example of the code clone output file 3 is shown in FIG. Show. This will be described later.

テスト結果ファイル4は、ソースコードに対応して実施されたテスト結果をテストケース番号として格納するファイルであり、図4にテスト結果ファイル4の構成例を示す。これについては後述する。   The test result file 4 is a file for storing the test result executed in correspondence with the source code as a test case number. FIG. 4 shows a configuration example of the test result file 4. This will be described later.

テスト仕様ファイル5は、コードクローン部分に関係するテスト仕様を格納するファイルであり、図5にテスト仕様ファイル5の構成例を示す。これについては後述する。
変更テスト仕様ファイル6は、コードクローンから変更した部分のテスト仕様を格納するファイルであり、図6に変更テスト仕様ファイル6の構成例を示す。これについては後述する。
The test specification file 5 is a file for storing test specifications related to the code clone portion. FIG. 5 shows a configuration example of the test specification file 5. This will be described later.
The change test specification file 6 is a file for storing the test specification of the part changed from the code clone, and FIG. 6 shows a configuration example of the change test specification file 6. This will be described later.

コードクローンマージファイル7は、コードクローンセット間でマージできると判断されたコードクローンセットの組のデータを格納するファイルであり、図11にコードクローンマージファイル7の構成例を示す。これについては後述する。   The code clone merge file 7 is a file for storing data of a set of code clone sets determined to be mergeable between code clone sets. FIG. 11 shows a configuration example of the code clone merge file 7. This will be described later.

データ設定処理部8は、ソースコードファイル2に該当するソースコードデータを設定する処理を実行する。図12にデータ設定処理部8の動作を説明するフローチャートを示す。これについては後述する。   The data setting processing unit 8 executes processing for setting source code data corresponding to the source code file 2. FIG. 12 is a flowchart for explaining the operation of the data setting processing unit 8. This will be described later.

コードクローン検出・マージ処理部9は、コードクローン検出ツール、例えば上述したCCFinderXなどによりコードクローンセットを検出し、また、コードクローンセット間でマージ可否を判断する処理を実行する。図13にコードクローン検出・マージ処理部9の動作を説明するフローチャートを示す。これについては後述する。   The code clone detection / merge processing unit 9 detects a code clone set by a code clone detection tool such as the CCFinderX described above, and executes a process of determining whether or not to merge between code clone sets. FIG. 13 shows a flowchart for explaining the operation of the code clone detection / merge processing unit 9. This will be described later.

テスト結果設定処理部10は、コードクローン部分を含むソースコードのテスト仕様またはテストプログラムをテスト仕様ファイル5に登録し、テストを実行し、テストしたソースコードに対応したテストケース番号をテスト結果ファイル4に格納する処理を実行する。図14にテスト結果設定処理部10の動作を説明するフローチャートを示す。これについては後述する。   The test result setting processing unit 10 registers the test specification or test program of the source code including the code clone part in the test specification file 5, executes the test, and sets the test case number corresponding to the tested source code to the test result file 4 Execute the process stored in. FIG. 14 is a flowchart for explaining the operation of the test result setting processing unit 10. This will be described later.

変更テストケース抽出処理部11は、マージされたコードクローンセットの変更部分のソースコードに対応したテストケースを抽出し変更テスト仕様ファイル6に格納する処理を実行する。図15に変更テストケース抽出処理部11の動作を説明するフローチャートを示す。これについては後述する。   The changed test case extraction processing unit 11 executes a process of extracting a test case corresponding to the source code of the changed portion of the merged code clone set and storing it in the changed test specification file 6. FIG. 15 is a flowchart for explaining the operation of the changed test case extraction processing unit 11. This will be described later.

変更テスト仕様作成処理部12は、マージされたコードクローンセットの変更部分のソースコードに対応したテスト仕様を半自動で作成し変更テスト仕様ファイル6に格納する処理を実行する。図16に変更テスト仕様作成処理部12の動作を説明するフローチャートを示す。これについては後述する。   The change test specification creation processing unit 12 executes a process of semi-automatically creating a test specification corresponding to the source code of the changed part of the merged code clone set and storing it in the change test specification file 6. FIG. 16 is a flowchart for explaining the operation of the change test specification creation processing unit 12. This will be described later.

以上において図1におけるシステム構成の概要を説明したので、以下ではその詳細を説明することにする。なお図1のコードクローンテスト装置1内の構成要素間の処理の流れを太線の矢印で、またデータの流れを細線の矢印で示す。   The overview of the system configuration in FIG. 1 has been described above, and the details will be described below. The flow of processing between the components in the code clone test apparatus 1 of FIG. 1 is indicated by a bold arrow, and the flow of data is indicated by a thin arrow.

図2は、本発明の実施形態に係るソースコードファイルの構成例を示す図である。図2に示すようにソースコードファイル2は、ソースコードファイル名21とソースコード22から構成される。ソースコード22の部分には、図に示していないがソースコードファイル名21に対応した一連のソースコードを格納する。   FIG. 2 is a diagram showing a configuration example of a source code file according to the embodiment of the present invention. As shown in FIG. 2, the source code file 2 includes a source code file name 21 and a source code 22. Although not shown in the drawing, a series of source codes corresponding to the source code file name 21 is stored in the source code 22 portion.

図3は、本発明の実施形態に係るコードクローン出力ファイルの構成例を示す図である。図3に示すようにコードクローン出力ファイル3は、コードクローンセット名31、ソースコードファイル名32、開始行番号(図示番号33)、終了行番号(図示番号34)から構成される。そしてコードクローンセット名31には同一コードの組について同一名称(例えば、cloneset1)を付している。ソースコードファイル名32には、当該同一コードのソースコードファイル名を格納する。また開始行番号(図示番号33)には当該同一コードが始まるコードの行番号を格納し、さらに終了行番号(図示番号34)には、当該同一コードが終了するコードの行番号を格納する。   FIG. 3 is a diagram showing a configuration example of the code clone output file according to the embodiment of the present invention. As shown in FIG. 3, the code clone output file 3 includes a code clone set name 31, a source code file name 32, a start line number (illustrated number 33), and an end line number (illustrated number 34). The code clone set name 31 is assigned the same name (for example, cloneset1) for the same code set. The source code file name 32 stores the source code file name of the same code. The line number of the code where the same code starts is stored in the start line number (illustrated number 33), and the line number of the code where the same code ends is stored in the end line number (illustrated number 34).

図4は、本発明の実施形態に係るテスト結果ファイルの構成例を示す図である。図4に示すようにテスト結果ファイル4には、ソースコードファイル名41、行番号(図示番号42)、テスト対象関数・テストケース番号(図示番号43)から構成される。そしてソースコードファイル名41には、コードクローンが存在するソースコードファイル名を格納する。行番号(図示番号42)には、コードクローン出力ファイル3の開始行番号から終了行番号までの一連の行番号またはコードクローンマージファイル7にコードクローンセット名が存在する場合はコードクローンマージファイル7の開始行番号から終了行番号までの一連の行番号を格納する。テスト対象関数・テストケース番号(図示番号43)には、行番号(図示番号42)に対応したテスト仕様の単位に相当するテスト対象関数名とテストケース番号を格納する。テストケース番号は複数のテストケースが当該ソースコード行に該当する場合は複数となる。   FIG. 4 is a diagram showing a configuration example of a test result file according to the embodiment of the present invention. As shown in FIG. 4, the test result file 4 includes a source code file name 41, a line number (illustrated number 42), and a test target function / test case number (illustrated number 43). The source code file name 41 stores the source code file name where the code clone exists. In the line number (number 42 in the figure), a series of line numbers from the start line number to the end line number of the code clone output file 3 or the code clone merge file 7 if the code clone set name exists in the code clone merge file 7 Stores a series of line numbers from the start line number to the end line number. The test target function / test case number (illustrated number 43) stores the test target function name and test case number corresponding to the unit of the test specification corresponding to the row number (illustrated number 42). The test case number is plural when a plurality of test cases correspond to the source code line.

図5は、本発明の実施形態に係るテスト仕様ファイルの構成例を示す図である。図5に示すようにテスト仕様ファイル5は、テスト対象関数・ソースコードファイル名51、テストケース番号またはテストプログラム番号(図示番号52)、入力値(図示番号53)、検証値(図示番号54)から構成される。そしてテスト対象関数・ソースコードファイル名51には、テスト仕様の識別をするためにテスト対象関数名およびソースコードファイル名を格納する。テストケース番号またはテストプログラム番号(図示番号52)には、テストケースを識別する番号または当該テストケースを実行するテストプログラムがある場合は当該テストプログラムを識別する番号を格納する。入力値(図示番号53)には、当該テストケースのルートを通すために必要な入力値を格納する。検証値(図示番号54)には、ソースコードが妥当かを検証するための検証値を格納する。   FIG. 5 is a diagram showing a configuration example of a test specification file according to the embodiment of the present invention. As shown in FIG. 5, the test specification file 5 includes a test target function / source code file name 51, a test case number or test program number (illustrated number 52), an input value (illustrated number 53), and a verification value (illustrated number 54). Consists of The test target function / source code file name 51 stores the test target function name and the source code file name to identify the test specification. In the test case number or the test program number (number 52 in the figure), a number for identifying the test case or a number for identifying the test program when there is a test program for executing the test case is stored. The input value (number 53 in the figure) stores the input value necessary for passing the route of the test case. A verification value (verification number 54) stores a verification value for verifying whether the source code is valid.

図6は、本発明の実施形態に係る変更テスト仕様ファイルの構成例を示す図である。図6に示すように変更テスト仕様ファイル6は、図5に示したテスト仕様ファイル5の変更部分を格納するもので、テスト対象関数・ソースコードファイル名61、テストケース番号またはテストプログラム番号(図示番号62)、入力値(図示番号63)、検証値(図示番号64)から構成される。そしてテスト対象関数・ソースコードファイル名61には、テスト仕様の識別をするためにテスト対象関数名およびソースコードファイル名を格納する。テストケース番号またはテストプログラム番号(図示番号62)には、テストケースを識別する番号または当該テストケースを実行するテストプログラムがある場合は当該テストプログラムを識別する番号を格納する。入力値(図示番号63)には、当該テストケースのルートを通すために必要な入力値を格納する。検証値(図示番号64)には、ソースコードが妥当かを検証するための検証値を格納する。   FIG. 6 is a diagram showing a configuration example of a change test specification file according to the embodiment of the present invention. As shown in FIG. 6, the changed test specification file 6 stores the changed portion of the test specification file 5 shown in FIG. 5, and includes a test target function / source code file name 61, a test case number or a test program number (shown in FIG. 6). Number 62), an input value (illustrated number 63), and a verification value (illustrated number 64). The test target function / source code file name 61 stores the test target function name and the source code file name to identify the test specification. In the test case number or the test program number (number 62 in the figure), a number for identifying the test case or a number for identifying the test program when there is a test program for executing the test case is stored. The input value (number 63 in the figure) stores the input value necessary for passing the route of the test case. The verification value (in the figure, number 64) stores a verification value for verifying whether the source code is valid.

図7は、本発明の実施形態に係るコードクローン検出・マージ処理部9のコードクローン検出処理により得られたコードクローン検出表示例を示す図である。図7に示すようにコードクローン検出ツール、例えば上述したCCFinderXなどを用いて検出されたコードクローンのソースコード(図7に示す111行〜122行参照)を例えば網掛けなどを施して検出されたコードクローンのソースコードが明確になるように表示する。   FIG. 7 is a diagram showing a code clone detection display example obtained by the code clone detection process of the code clone detection / merge processing unit 9 according to the embodiment of the present invention. As shown in FIG. 7, the code clone source code (see lines 111 to 122 shown in FIG. 7) detected using a code clone detection tool such as the CCFinderX described above is detected by, for example, shading. Display the code clone source code clearly.

図8は、本発明の実施形態に係るコードクローン検出・マージ処理部9のコードクローン検出・マージ処理により得られたコードクローン検出・マージ表示例を示す図である。図8に示す表示例では、例示された網掛け矩形部の左右、すなわち、網掛け矩形部81,82、網掛け矩形部83,84、網掛け矩形部85,86、がそれぞれ同一コードクローンセットを示している。また縦の3つのコードクローンセット(網掛け矩形部82,84,86)が左側の3つのクローンセットをマージしたマージコードクローンセットを示している。   FIG. 8 is a diagram showing a code clone detection / merge display example obtained by the code clone detection / merge processing of the code clone detection / merge processing unit 9 according to the embodiment of the present invention. In the display example shown in FIG. 8, the left and right sides of the illustrated shaded rectangular portion, that is, the shaded rectangular portions 81 and 82, the shaded rectangular portions 83 and 84, and the shaded rectangular portions 85 and 86 are the same code clone set. Is shown. In addition, three vertical code clone sets (shaded rectangular portions 82, 84, 86) indicate merge code clone sets obtained by merging the left three clone sets.

図9は、本発明の実施形態に係るテスト結果設定処理部10によるテスト結果設定例を示す図である。図9に示すようにソースコードの行番号に対応して実施されたテストのテストケース番号がソースコード行の右余白に設定される。図示例では、実施されたテストに対応してテストケース番号1およびテストケース番号2が設定されたことを示しており、テストが実施されなかったソースコードは空白にされている。   FIG. 9 is a diagram showing a test result setting example by the test result setting processing unit 10 according to the embodiment of the present invention. As shown in FIG. 9, the test case number of the test performed corresponding to the line number of the source code is set in the right margin of the source code line. In the illustrated example, it is shown that test case number 1 and test case number 2 are set corresponding to the performed test, and the source code where the test was not performed is blank.

図10は、本発明の実施形態に係るテスト結果設定処理部10の処理により得られたテスト結果設定・表示例を示す図である。図10に示す例では、図8に示したコードクローン検出・マージ表示例に対応したテスト結果のテストケース番号(テストケース番号1,2,3を(a)で代表標記)と、新たに設定されたテストケース番号「1a」が図10の右端に表示される。図示例は、第1画面(左部)と第2画面(右部)とを図の最上部の数字によって区別して2画面を左右に表示し、第1画面(左部)では実施したテストケースの行番号105のテストケース番号(図示番号91)及び行番号117のテストケース番号(図示番号92)が変更対象のテストケース番号として摘出され、第2画面(右部)では実施されてテストケースの行番号255のテストケース番号(図示番号93)及び行番号267のテストケース番号(図示番号94)が新たにテストケース番号「1a」が設定されたことを示している。   FIG. 10 is a diagram showing a test result setting / display example obtained by the processing of the test result setting processing unit 10 according to the embodiment of the present invention. In the example shown in FIG. 10, test case numbers (test case numbers 1, 2, and 3 are represented by (a)) of test results corresponding to the code clone detection / merge display example shown in FIG. 8 are newly set. The test case number “1a” is displayed at the right end of FIG. In the example shown, the first screen (left part) and the second screen (right part) are distinguished by the numbers at the top of the figure and the two screens are displayed on the left and right. The test case number (illustrated number 91) of line number 105 and the test case number (illustrated number 92) of line number 117 are extracted as the test case numbers to be changed and executed on the second screen (right part). The test case number (illustrated number 93) of the line number 255 and the test case number (illustrated number 94) of the line number 267 indicate that the test case number “1a” is newly set.

図11は、本発明の実施形態に係るコードクローンマージファイルの構成例を示す図である。図11に示すようにコードクローンマージファイル7は、マージ名71、コードクローンセット名72、ソースコードファイル名73、開始行番号(図示番号74)、終了行番号(図示番号75)から構成される。そしてマージ名71はコードクローンセットの順序が同じものについて同一名称となるようにしている。コードクローンセット名72はコードクローンセットの順序が同じコードクローンセット名を格納する。ソースコードファイル名73にはコードクローンセットの順序が同じコードクローンがあるソースコードファイル名を格納す
る。また開始行番号(図示番号74)には、当該クローンセット名の順序で最初のコードクローンセットの開始行番号を格納する。さらに、終了行番号(図示番号75)には、当該コードクローンセット名の順序で最後のコードクローンセットの終了行番号を格納する。なお、図示例は、図8に示したコードクローン検出・マージ表示例に対応するものである。
FIG. 11 is a diagram showing a configuration example of a code clone merge file according to the embodiment of the present invention. As shown in FIG. 11, the code clone merge file 7 includes a merge name 71, a code clone set name 72, a source code file name 73, a start line number (illustrated number 74), and an end line number (illustrated number 75). . The merge name 71 has the same name for the same code clone set order. The code clone set name 72 stores code clone set names having the same code clone set order. The source code file name 73 stores a source code file name having a code clone having the same code clone set order. In the starting line number (illustrated number 74), the starting line number of the first code clone set in the order of the clone set name is stored. Further, the ending line number (number 75 in the figure) stores the ending line number of the last code clone set in the order of the code clone set name. The illustrated example corresponds to the code clone detection / merge display example shown in FIG.

以上までの各構成要素の詳細説明をベースに次に本発明の実施形態に係るコードクローンのテスト装置の動作を各処理部の動作の流れおよび以下に示す動作を説明するフローチャートを用いて説明する。なお図示省略しているが、クライアント300の利用者端末にはサーバ100へのログインにより初期画面が表示され、この初期画面でコードクローンテスト装置1を起動させることになる。つまりクライアント300の利用者端末においてまず初めにデータ設定処理部8を始動させる。以下に示す各処理部においても図1に示した処理の流れおよびデータの流れに基づいて処理を遂行することになる。   Based on the detailed description of each component described above, the operation of the code clone test apparatus according to the embodiment of the present invention will be described below with reference to the flow of operations of the processing units and the flowcharts describing the operations shown below. . Although not shown, an initial screen is displayed on the user terminal of the client 300 by logging in to the server 100, and the code clone test apparatus 1 is activated on this initial screen. That is, the data setting processing unit 8 is first started at the user terminal of the client 300. Each processing unit shown below also performs processing based on the processing flow and data flow shown in FIG.

図12は、本発明の実施形態に係るデータ設定処理部8の動作を説明するフローチャートである。以下に示すフローチャートにおいてはステップを‘S’と略記する。図12においてステップS1ではソースコードファイル2に対象とするソースコードを書き込み、ソースコードファイル名21(図2参照)をソースコードファイル2に登録する。そして処理を終了する。   FIG. 12 is a flowchart for explaining the operation of the data setting processing unit 8 according to the embodiment of the present invention. In the flowchart shown below, step is abbreviated as “S”. 12, in step S1, the target source code is written in the source code file 2, and the source code file name 21 (see FIG. 2) is registered in the source code file 2. Then, the process ends.

図13は、本発明の実施形態に係るコードクローン検出・マージ処理部9の動作を説明するフローチャートである。図13においてステップS11では、ソースコードファイル2から対象とするソースコードを読み込む。ステップS12では、コードクローン検出ツール(図示せず)により、コードクローンを検出する。なお、CCFinderXなどのコードクローン検出ツール(図示せず)は、コードクローンテスト装置1と同様に、サーバ100内に用意されていてアクセス可能にされるか、又はネットワーク200を経てアクセス可能にされる。次にステップS13では、コードクローン出力ファイル3にコードクローン検出ツール(図示せず)によって得たデータを書き込む。   FIG. 13 is a flowchart for explaining the operation of the code clone detection / merge processing unit 9 according to the embodiment of the present invention. In step S11 in FIG. 13, the target source code is read from the source code file 2. In step S12, a code clone is detected by a code clone detection tool (not shown). Note that a code clone detection tool (not shown) such as CCFinderX is prepared in the server 100 and made accessible as in the code clone test apparatus 1, or made accessible through the network 200. . In step S13, data obtained by a code clone detection tool (not shown) is written in the code clone output file 3.

次にステップS14では、コードクローン出力ファイル3を読み込む。ステップS15では、同一ソースコードファイル名に複数のコードクローンセット名があるか否かを判定し、複数のコードクローンセット名がない場合はステップS20の処理に飛ぶ。複数のコードクローンセット名がある場合にステップS16では、当該コードクローンセット名の間隔の行数が閾値より小さいか否かを判定し、大きい場合はステップS20の処理に飛ぶ。この場合、閾値は利用者が任意に設定できる。閾値より小さいとステップS17では、コードクローンセット名の名前と順序を例えばワークメモリ(図示せず)に(一時)記憶する。   In step S14, the code clone output file 3 is read. In step S15, it is determined whether or not there are a plurality of code clone set names in the same source code file name. If there are not a plurality of code clone set names, the process jumps to step S20. If there are a plurality of code clone set names, in step S16, it is determined whether or not the number of lines in the interval of the code clone set names is smaller than the threshold value. If larger, the process jumps to step S20. In this case, the threshold can be arbitrarily set by the user. If it is smaller than the threshold, in step S17, the name and order of the code clone set names are stored (temporarily) in, for example, a work memory (not shown).

ステップS18では、他のソースコードファイル名に上記に(一時)記憶したコードクローンセット名の名前と順序が同じものがあるか否かを判定し、同じものがない場合にはステップS20の処理に飛ぶ。同じものがある場合にステップS19では、当該コードクローンセット名の配列にマージ名を付けてコードクローンマージファイル7のマージ名71、コードクローンセット名72、ソースコードファイル名73、開始行番号(図示番号74)、終了行番号(図示番号75)の各項目(図11参照)に書き込む。ステップS20では、コードクローン出力ファイル3のソースコードファイル名32(図3参照)の全てを確認し、確認できた場合は処理を終了する。未確認のものがある場合にはステップS15に戻る。   In step S18, it is determined whether other source code file names have the same order as the names of the code clone set names stored above (temporarily). If there is no same, the process proceeds to step S20. jump. If there is the same one, in step S19, a merge name is added to the sequence of the code clone set name, merge name 71 of code clone merge file 7, code clone set name 72, source code file name 73, start line number (illustrated Number 74) and the end line number (illustrated number 75) are written in each item (see FIG. 11). In step S20, all of the source code file names 32 (see FIG. 3) of the code clone output file 3 are confirmed. If the code clone output file 3 is confirmed, the process ends. If there is an unconfirmed item, the process returns to step S15.

図14は、本発明の実施形態に係るテスト結果設定処理部10の動作を説明するフローチャートである。図14においてステップS21では、コードクローン出力ファイル3およびコードクローンマージファイル7、ソースコードファイル2を読み込む。ステップS22では、同一コードクローンセット名の複数あるソースコードファイル名のうち1つのソースコードファイル名のコードクローンが該当する関数についてのテスト仕様をテスト仕様フ
ァイル5に登録する。コードクローンセット名にマージ名が付いている場合は、同一マージ名の複数のソースコードファイル名のうち1つのソースコードファイル名のコードクローンが該当する関数についてのテスト仕様をテスト仕様ファイル5に登録する。
FIG. 14 is a flowchart for explaining the operation of the test result setting processing unit 10 according to the embodiment of the present invention. In FIG. 14, in step S21, the code clone output file 3, the code clone merge file 7, and the source code file 2 are read. In step S22, a test specification for a function corresponding to a code clone having one source code file name among a plurality of source code file names having the same code clone set name is registered in the test specification file 5. If the code clone set name has a merge name, register the test specification for the function to which the code clone of one source code file name among the multiple source code file names with the same merge name corresponds in the test specification file 5 To do.

ステップS23では、ステップS22の処理で登録したテスト仕様についてテストを実行する。この場合、手動でテストを行う場合と、テストプログラムによって自動でテストを行う場合と、XUNITなどのテストツール(図示せず)によって自動でテストを行う場合とがある。なお、上述したXUNITなどのテストツール(図示せず)は、コードクローンテスト装置1と同様に、サーバ100内に用意されていてアクセス可能にされるか、又はネットワーク200を経てアクセス可能にされる。ステップS24では、実行したテストケース番号をテストを実行したソースコードファイル名の行に対応付けてテスト結果ファイル4に書き込む。この場合、書き込む行番号は、マージ名が付いていないコードクローンセット名についてはコードクローン出力ファイル3の開始行番号から終了行番号について書き込み、マージ名が付いているコードクローンセット名についてはコードクローンマージファイル7の開始行番号から終了行番号について書き込みを行う。ステップS25では、同一コードクローンセット名の他のソースコードファイル名の行に対応して同様にテストケース番号をテスト結果ファイル4に書き込む。そして処理を終了する。   In step S23, a test is executed for the test specification registered in the process of step S22. In this case, there are a case where the test is performed manually, a case where the test is automatically performed by a test program, and a case where the test is automatically performed by a test tool (not shown) such as XUNIT. Note that the test tool (not shown) such as the XUNIT described above is prepared in the server 100 and can be accessed as in the code clone test apparatus 1, or can be accessed via the network 200. . In step S24, the executed test case number is written in the test result file 4 in association with the line of the source code file name that executed the test. In this case, the line number to be written is written from the start line number to the end line number of the code clone output file 3 for the code clone set name without the merge name, and the code clone for the code clone set name with the merge name. Writing from the start line number to the end line number of the merge file 7 is performed. In step S25, the test case number is similarly written in the test result file 4 corresponding to the other source code file name line of the same code clone set name. Then, the process ends.

図15は、本発明の実施形態に係る変更テストケース抽出処理部11の動作を説明するフローチャートである。図15においてステップS31では、テスト結果ファイル4およびコードクローンマージファイル7を読み込む。ステップS32では、コードクローンマージファイル7の同一マージ名71(図11参照)で開始行番号(図示番号74)から終了行番号(図示番号75)の中でテスト結果ファイル4のテストケース番号が記載されていない行番号の範囲を抽出する。当該行番号はコードクローンセット間の行が該当する。ステップS33では、上記ステップS32の処理で抽出したコードクローンセット間の行でテストケース番号が記載されているもののテスト対象関数とテストケース番号を抽出する。ステップS34では、上記ステップS33の処理で抽出したテスト対象関数とテストケース番号に相当するテスト仕様をテスト仕様ファイル5から読み込んで、変更テスト仕様ファイル6に書き込む。そして処理を終了する。   FIG. 15 is a flowchart for explaining the operation of the changed test case extraction processing unit 11 according to the embodiment of the present invention. In step S31 in FIG. 15, the test result file 4 and the code clone merge file 7 are read. In step S32, the same merge name 71 (see FIG. 11) of the code clone merge file 7 describes the test case number of the test result file 4 from the start line number (illustrated number 74) to the end line number (illustrated number 75). Extract a range of line numbers that have not been processed. The line number corresponds to a line between code clone sets. In step S33, although the test case number is described in the line between the code clone sets extracted in step S32, the test target function and the test case number are extracted. In step S34, the test specification corresponding to the test target function and the test case number extracted in the process of step S33 is read from the test specification file 5 and written to the changed test specification file 6. Then, the process ends.

図16は、本発明の実施形態に係る変更テスト仕様作成処理部12の動作を説明するフローチャートである。図16においてステップS41では、変更テスト仕様ファイル6を読み込む。ステップS42では、変更テスト仕様ファイル6のテストケースを修正する。分岐が追加されているなどテストケースの修正で対応できない場合は、テストケースを新規に変更テスト仕様ファイル6に追加する。そして処理を終了する。   FIG. 16 is a flowchart for explaining the operation of the modified test specification creation processing unit 12 according to the embodiment of the present invention. In step S41 in FIG. 16, the modified test specification file 6 is read. In step S42, the test case of the change test specification file 6 is corrected. If the test case cannot be dealt with, such as when a branch is added, a new test case is added to the changed test specification file 6. Then, the process ends.

以上に述べたことを綜合すると、本発明の実施形態に係るコードクローンのテスト装置は、ソースコードファイルに設定されたソースコードのコードクローンセットを、コードクローン検出ツール、例えば上述したCCFinderXなどを用いることにより検出する。そして検出したコードクローンセットのうち1つのコードクローンをテストした場合、他のコードクローンは同一ソースコードであるので既にテストされたものと見做してテストを省略することができる。また、コードクローンをした後に一部を変更して利用する場合もあり、この場合には、複数のコードクローンセットが同一順序で配列していることにより検出できる。検出する際にはコードクローンセット間のソースコード行数に閾値を設けることで意図した以外の検出を排除することができる。またマージしたコードクローンセットの場合には、一部変更した部分をテストする必要があり、テスト仕様を半自動で生成する。   In combination with what has been described above, the code clone test apparatus according to the embodiment of the present invention uses a code clone detection tool such as the above-described CCFinderX for the code clone set of the source code set in the source code file. To detect. When one code clone of the detected code clone set is tested, since the other code clones are the same source code, the test can be omitted assuming that the code clones have already been tested. In some cases, a part of the code clone is changed and used, and in this case, detection can be made by arranging a plurality of code clone sets in the same order. When detecting, by setting a threshold value for the number of source code lines between code clone sets, detection other than intended can be eliminated. In the case of a merged code clone set, it is necessary to test a part that has been partially changed, and a test specification is generated semi-automatically.

テスト結果の設定は、当該コードクローンセットまたは当該マージしたコードクローンセットに対応するテスト仕様についてテストを実行し、ソースコードに対応するテストケ
ース番号を特定することで対応する。なお、XUNITなどのテストツールを利用することでテストの実行とカバレッジを自動的に把握することもできる。
The test result is set by executing a test on the test specification corresponding to the code clone set or the merged code clone set and specifying the test case number corresponding to the source code. It is also possible to automatically grasp the test execution and coverage by using a test tool such as XUNIT.

マージしたコードクローンセットの一部変更した部分をテストする方法として、変更部分はコードクローンセット間のソースコードとして検出できるので、当該ソースコードがどのテスト仕様のどのテストケースであるかを把握できる。変更部分は分岐に関与しないコードと分岐を含んだコードが存在する。分岐に関与しないコードの変更部分は、テストケースの入力値または検証値の追加・削除・変更で対応できる。一方、分岐を含んだコードの変更部分は、テストケースの追加・削除・変更も含まれる。   As a method for testing a part of the merged code clone set that has been partially changed, the changed part can be detected as source code between code clone sets, so that it is possible to grasp which test case of which test specification the source code is. The changed part includes code that does not participate in branching and code that includes branching. Code changes that do not participate in branching can be handled by adding, deleting, or changing test case input values or verification values. On the other hand, the change part of the code including the branch includes addition / deletion / change of the test case.

分岐に関与しないコードの変更部分におけるテスト仕様のテストケースについて、対応するテストケースは、テストを実施したマージしたコードクローンセットのテストケースにより自動的に抽出することができる。当該テストケースを人手で入力値または検証値を追加・削除・変更するので半自動となる。分岐を含んだコードの変更部分におけるテスト仕様のテストケースについて、テスト仕様は自動的に抽出できるが、テストケースの追加・削除・変更を人手で行うことになり半自動となる。   For the test cases of the test specification in the changed part of the code not involved in the branching, the corresponding test case can be automatically extracted by the test case of the merged code clone set on which the test is performed. This test case is semi-automatic because the input value or verification value is added, deleted, or changed manually. Test specifications can be automatically extracted for test cases of test specifications in the changed part of the code including the branch, but the test cases are added / deleted / changed manually and become semi-automatic.

なおコードクローンされた部分にバグが発見されて変更した場合に、当該変更部分が、マージ対象のコードクローンセット間の先のコードクローンセットの終了行と後のコードクローン開始行の間のソースコード行として容易に検出でき、変更忘れによるバグ発生を防止でき、ソフトウェア開発の品質向上に貢献することができる。   In addition, when a bug is found in the code cloned part and changed, the changed part is the source code between the end line of the previous code clone set and the start line of the subsequent code clone set between the code clone sets to be merged It can be easily detected as a line, bugs caused by forgetting to change can be prevented, and the quality of software development can be improved.

本発明の実施形態に係るコードクローンのテスト装置を具現するシステムの構成概要を示す図である。It is a figure which shows the structure outline | summary of the system which implements the test apparatus of the code clone which concerns on embodiment of this invention. 本発明の実施形態に係るソースコードファイルの構成例を示す図である。It is a figure which shows the structural example of the source code file which concerns on embodiment of this invention. 本発明の実施形態に係るコードクローン出力ファイルの構成例を示す図である。It is a figure which shows the structural example of the code clone output file which concerns on embodiment of this invention. 本発明の実施形態に係るテスト結果ファイルの構成例を示す図である。It is a figure which shows the structural example of the test result file which concerns on embodiment of this invention. 本発明の実施形態に係るテスト仕様ファイルの構成例を示す図である。It is a figure which shows the structural example of the test specification file which concerns on embodiment of this invention. 本発明の実施形態に係る変更テスト仕様ファイルの構成例を示す図である。It is a figure which shows the structural example of the change test specification file which concerns on embodiment of this invention. 本発明の実施形態に係るコードクローン検出・マージ処理部のコードクローン検出処理により得られたコードクローン検出表示例を示す図である。It is a figure which shows the code clone detection display example obtained by the code clone detection process of the code clone detection and merge process part which concerns on embodiment of this invention. 本発明の実施形態に係るコードクローン検出・マージ処理部のコードクローン検出・マージ処理により得られたコードクローン検出・マージ表示例を示す図である。It is a figure which shows the example of a code clone detection and merge display obtained by the code clone detection and merge process of the code clone detection and merge process part which concerns on embodiment of this invention. 本発明の実施形態に係るテスト結果設定処理部によるテスト結果設定例を示す図である。It is a figure which shows the example of a test result setting by the test result setting process part which concerns on embodiment of this invention. 本発明の実施形態に係るテスト結果設定処理部の設定処理により得られたテスト結果設定・表示例を示す図である。It is a figure which shows the example of a test result setting and display obtained by the setting process of the test result setting process part which concerns on embodiment of this invention. 本発明の実施形態に係るコードクローンマージファイルの構成例を示す図である。It is a figure which shows the structural example of the code clone merge file which concerns on embodiment of this invention. 本発明の実施形態に係るデータ設定処理部の動作を説明するフローチャートである。It is a flowchart explaining operation | movement of the data setting process part which concerns on embodiment of this invention. 本発明の実施形態に係るコードクローン検出・マージ処理部の動作を説明するフローチャートである。It is a flowchart explaining operation | movement of the code clone detection and merge process part which concerns on embodiment of this invention. 本発明の実施形態に係るテスト結果設定処理部の動作を説明するフローチャートである。It is a flowchart explaining operation | movement of the test result setting process part which concerns on embodiment of this invention. 本発明の実施形態に係る変更テストケース抽出処理部の動作を説明するフローチャートである。It is a flowchart explaining operation | movement of the change test case extraction process part which concerns on embodiment of this invention. 本発明の実施形態に係る変更テスト仕様作成処理部の動作を説明するフローチャートである。It is a flowchart explaining operation | movement of the change test specification creation process part which concerns on embodiment of this invention.

符号の説明Explanation of symbols

1 コードクローンテスト装置
2 ソースコードファイル
3 コードクローン出力ファイル
4 テスト結果ファイル
5 テスト仕様ファイル
6 変更テスト仕様ファイル
7 コードクローンマージファイル
8 データ設定処理部
9 コードクローン検出・マージ処理部
10 テスト結果設定処理部
11 変更テストケース抽出処理部
12 テスト結果設定処理部
100 サーバ
200 ネットワーク
300 クライアント
DESCRIPTION OF SYMBOLS 1 Code clone test apparatus 2 Source code file 3 Code clone output file 4 Test result file 5 Test specification file 6 Change test specification file 7 Code clone merge file 8 Data setting process part 9 Code clone detection and merge process part
10 Test result setting processing section
11 Change test case extraction processing part
12 Test result setting processing section
100 servers
200 networks
300 clients

Claims (9)

コードクローンセットを含むソフトウェアソースプログラムをソースコードファイルに格納するデータ設定手段と、
前記ソースコードファイルに格納された前記ソフトウェアソースプログラムから前記コードクローンセットを検出するコードクローン検出手段と、
検出した前記コードクローンセットの内1つのコードクローンをテストし、テストされたソースコード行にテストケース番号を設定して前記コードクローンセット全体がテストされたことを表示するテスト結果設定処理手段、
を有することを特徴とするコードクローンのテスト装置。
Data setting means for storing a software source program including a code clone set in a source code file;
Code clone detection means for detecting the code clone set from the software source program stored in the source code file;
Test result setting processing means for testing one code clone of the detected code clone set, setting a test case number in the tested source code line, and displaying that the entire code clone set has been tested,
A test apparatus for a code clone, comprising:
前記ソースコードファイルに格納された複数のコードクローンセットの同一順序配列のコードクローンセットを検出してマージ処理するコードクローン検出・マージ処理手段を有することを特徴とする請求項1記載のコードクローンセットのテスト装置。   2. The code clone set according to claim 1, further comprising: a code clone detection / merging processing means for detecting and merging a code clone set having the same sequence of a plurality of code clone sets stored in the source code file. Testing equipment. 前記コードクローン検出・マージ処理手段は、コードクローンセットの同一順序配列の検出に用いる閾値を持ち、該閾値により意図した以外のコードクローンセット間のソースコード行数を検出しないようにしたことを特徴とする請求項2記載のコードクローンセットのテスト装置。   The code clone detection / merge processing means has a threshold used for detecting the same sequence of code clone sets, and the threshold does not detect the number of source code lines between code clone sets other than intended. The code clone set test apparatus according to claim 2. 前記マージされた前記複数のコードクローンセットを格納するコードクローンマージファイルと、該コードクローンマージファイルに格納された前記マージされた前記複数のコードクローンセットにわたる一連のソースコードを読込み、テストが実施されていない部分を自動的に検出する変更テストケース抽出処理手段を有することを特徴とする請求項2または3記載のコードクローンのテスト装置。   A code clone merge file storing the plurality of merged code clone sets and a series of source codes across the plurality of merged code clone sets stored in the code clone merge file are read and tested. 4. The code clone test apparatus according to claim 2, further comprising a modified test case extraction processing means for automatically detecting a portion that is not present. 前記テストが実施されていないソースコードのテスト仕様を半自動生成する変更テスト仕様作成処理手段を有することを特徴とする請求項4記載のコードクローンのテスト装置。   5. The code clone test apparatus according to claim 4, further comprising a modified test specification creation processing means for semi-automatically generating a test specification of source code for which the test is not performed. コードクローンセットを含むソフトウェアソースプログラムを格納する過程と、
格納された前記ソフトウェアソースプログラムから前記コードクローンセットを検出する過程と、
前記コードクローンセットの内1つのコードクローンをテストする過程と、
前記コードクローンについてテストされたソースコード行にテストケース番号を設定し前記コードクローンセット全体がテストされたことを表示する過程と、
を含むことを特徴とするコードクローンのテスト方法。
Storing a software source program including a code clone set;
Detecting the code clone set from the stored software source program;
Testing one code clone of the code clone set;
Setting a test case number in the source code line tested for the code clone and displaying that the entire code clone set has been tested;
A method for testing a code clone, comprising:
複数のコードクローンセットの同一順序配列のコードクローンセットを検出してマージする過程を含むことを特徴とする請求項6記載のコードクローンセットのテスト方法。   7. The method for testing a code clone set according to claim 6, further comprising a step of detecting and merging code clone sets having the same sequence in a plurality of code clone sets. 前記マージされた前記複数のコードクローンセットにわたる一連のソースコードについて、テストが実施されていない部分を自動的に検出する過程を含むことを特徴とする請求項7記載のコードクローンのテスト方法。   8. The method for testing code clones according to claim 7, further comprising a step of automatically detecting a portion of the source code that is merged in the plurality of code clone sets that has not been tested. 前記テストが実施されていないソースコードのテスト仕様を半自動生成する過程を含むことを特徴とする請求項8記載のコードクローンのテスト方法。   9. The code clone test method according to claim 8, further comprising a step of semi-automatically generating a test specification of a source code for which the test is not performed.
JP2007277023A 2007-10-24 2007-10-24 Apparatus and method for testing code clone Withdrawn JP2009104489A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2007277023A JP2009104489A (en) 2007-10-24 2007-10-24 Apparatus and method for testing code clone

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2007277023A JP2009104489A (en) 2007-10-24 2007-10-24 Apparatus and method for testing code clone

Publications (1)

Publication Number Publication Date
JP2009104489A true JP2009104489A (en) 2009-05-14

Family

ID=40706081

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2007277023A Withdrawn JP2009104489A (en) 2007-10-24 2007-10-24 Apparatus and method for testing code clone

Country Status (1)

Country Link
JP (1) JP2009104489A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2012248118A (en) * 2011-05-30 2012-12-13 Fujitsu Ltd Program execution trace information aggregation program, device, and method
JP2013507670A (en) * 2009-10-08 2013-03-04 イルデト カナダ コーポレーション System and method for aggressive automatic correction in a dynamic function call system

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2013507670A (en) * 2009-10-08 2013-03-04 イルデト カナダ コーポレーション System and method for aggressive automatic correction in a dynamic function call system
JP2012248118A (en) * 2011-05-30 2012-12-13 Fujitsu Ltd Program execution trace information aggregation program, device, and method

Similar Documents

Publication Publication Date Title
US8627290B2 (en) Test case pattern matching
JP4148527B2 (en) Functional test script generator
US20080126867A1 (en) Method and system for selective regression testing
Kawamitsu et al. Identifying source code reuse across repositories using lcs-based source code similarity
US8434062B2 (en) Enhancing source code debugging and readability using visual symbols
US8863100B2 (en) Application services source refactoring
US20090199096A1 (en) Automated gui test recording/playback
US10049031B2 (en) Correlation of violating change sets in regression testing of computer software
US10481898B2 (en) Automated software package deployment
JP2008191963A (en) Source code verification system, source code verification method and source code verification program
EP3264274B1 (en) Input discovery for unknown program binaries
Calvagna et al. Delivering dependable reusable components by expressing and enforcing design decisions
CN106776266B (en) Configuration method of test tool and terminal equipment
JP2009140155A (en) Test program for application program
CN108694049B (en) Method and equipment for updating software
JP2009104489A (en) Apparatus and method for testing code clone
US8234525B2 (en) Method and system for anomaly detection in software programs with reduced false negatives
WO2019225366A1 (en) Screen discrimination device, screen discrimination method, and program
CN111240987A (en) Migration program detection method and device, electronic equipment and computer readable storage medium
JP7380851B2 (en) Test script generation device, test script generation method and program
JP2016128941A (en) Output determination device, output determination method, output determination program, and static analysis device
JP2005276040A (en) Degrade confirming examining method and system, and program for the same
US8572005B2 (en) Representation of a set of numeric values in a computerized environment
WO2020230241A1 (en) Testing device, testing method, and program
Dhatchayani et al. Test Case Generation and Reusing Test Cases for GUI Designed with HTML.

Legal Events

Date Code Title Description
A300 Withdrawal of application because of no request for examination

Free format text: JAPANESE INTERMEDIATE CODE: A300

Effective date: 20110104