JP2014126900A - Program analysis device, program analysis method, and program analysis program - Google Patents

Program analysis device, program analysis method, and program analysis program Download PDF

Info

Publication number
JP2014126900A
JP2014126900A JP2012280814A JP2012280814A JP2014126900A JP 2014126900 A JP2014126900 A JP 2014126900A JP 2012280814 A JP2012280814 A JP 2012280814A JP 2012280814 A JP2012280814 A JP 2012280814A JP 2014126900 A JP2014126900 A JP 2014126900A
Authority
JP
Japan
Prior art keywords
program
change
test
post
changed
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
JP2012280814A
Other languages
Japanese (ja)
Inventor
Kensuke Shibuya
健介 渋谷
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.)
NEC Corp
Original Assignee
NEC Corp
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 NEC Corp filed Critical NEC Corp
Priority to JP2012280814A priority Critical patent/JP2014126900A/en
Publication of JP2014126900A publication Critical patent/JP2014126900A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Debugging And Monitoring (AREA)

Abstract

PROBLEM TO BE SOLVED: To provide a program analysis device which can optimize verification of validity of a program which has been modified.SOLUTION: A program analysis device comprises: find means which, on the basis of an execution path of a test item of which test result indicates an error in a first program, finds whether a second program including the same code as the first program has a second passage position corresponding to a first passage position on the execution path; and output means which, on the basis of presence of difference between a first part of the first program corresponding to the passage position after modification and a second part of the second program corresponding to the passage position before modification, outputs the first part or the second part.

Description

本発明は、テストの実行結果を利用してプログラムの差分を抽出するプログラム解析装置、プログラム解析方法、及び、プログラム解析プログラムに関する。   The present invention relates to a program analysis apparatus, a program analysis method, and a program analysis program that extract program differences using test execution results.

ソフトウェア開発では、新規開発だけでなく、既存システムの保守・改善開発がなされることが多い。保守・改善開発では、保守・改善によって仕様が変わらない箇所が、ソフトウェアの変更前と変更後とで同じ動作をすることを確認しなければならない。そのため、変更前に実施したものと同じテスト項目が、変更後にも実施されることがある。このようなテストは、回帰テスト(リグレッションテスト)と呼ばれる。   In software development, not only new development but also maintenance / improvement development of existing systems are often performed. In maintenance / improvement development, it is necessary to confirm that the parts whose specifications do not change due to maintenance / improvement operate the same before and after the software change. For this reason, the same test items as those performed before the change may be performed after the change. Such a test is called a regression test.

回帰テストは、テスト支援ツール等を使うことにより自動化されることが多い。このとき、テスト結果を確認し、テスト結果がエラーになった原因を特定する作業(デバッグ作業)は人手で行われる必要がある。そのため、エラーが多く発生した場合は、デバッグ作業に大きな時間を要するという問題があった。   The regression test is often automated by using a test support tool or the like. At this time, work (debugging work) for confirming the test result and identifying the cause of the error in the test result needs to be performed manually. Therefore, when many errors occur, there is a problem that a long time is required for debugging work.

デバッグ支援技術の一例が、特許文献1に開示されている。特許文献1のデバッグ支援技術では、正常に動作していたソースコードと、正常に動作していたソースコードに変更が加えられ、実行時にエラーを発生するようになったソースコードとの差分情報を提示することにより、テスト結果がエラーになった原因である変更箇所を特定する作業の効率化を図っている。   An example of the debugging support technique is disclosed in Patent Document 1. In the debugging support technology of Patent Document 1, the difference information between the source code that has been operating normally and the source code that has been changed to the source code that has been operating normally and that has generated an error during execution is obtained. By presenting it, the efficiency of the work which specifies the changed part which is the cause of the error of the test result is aimed at.

デバッグ支援技術の別の一例が、特許文献2に開示されている。特許文献2のテスト支援システムは、ソースコード比較手段と、修正前ソースコード記憶手段と、修正後ソースコード記憶手段と、通過モジュール情報記憶手段と、テスト項目抽出手段と、通過モジュール情報記憶手段とを備える。特許文献2のテスト支援システムは、以下のように動作する。   Another example of the debugging support technique is disclosed in Patent Document 2. The test support system of Patent Document 2 includes a source code comparison unit, a source code storage unit before correction, a source code storage unit after correction, a passing module information storage unit, a test item extraction unit, a passing module information storage unit, Is provided. The test support system of Patent Document 2 operates as follows.

ソースコード比較手段は、修正前ソースコード記憶手段が記憶する修正前ソースコードと、修正後ソースコード記憶手段が記憶する修正後のソースコードとを比較し、変更が行われたモジュールを特定する。通過モジュール情報記憶手段は、修正前のソースコードに対して複数のテスト項目のテストを実行した際に、実行すべき対象を示す指示が通過する、すなわち実行対象として呼び出され実行されるモジュールを、テスト項目と対応付けて記憶する。テスト項目抽出手段は、通過モジュール情報記憶手段を参照し、変更が行われたモジュールを通過するテスト項目を抽出する。   The source code comparison means compares the pre-correction source code stored in the pre-correction source code storage means with the corrected source code stored in the post-correction source code storage means, and identifies the module in which the change has been made. The passing module information storage means, when a test of a plurality of test items is executed on the source code before correction, an instruction indicating a target to be executed passes, that is, a module that is called and executed as an execution target, Store in association with the test item. The test item extraction unit refers to the passing module information storage unit and extracts a test item that passes through the changed module.

以上のように、「実行対象の位置を示す指示が移動すること」を「処理が通過する」という。したがって、「通過位置」とは、「過去に実行対象として指定された位置」を意味する。又、プログラムを構成する部分処理が実行対象としてたどられるときの通過位置の並びを、以降、「実行経路」という。   As described above, “the instruction indicating the execution target position moves” is referred to as “the process passes”. Therefore, “passing position” means “a position designated as an execution target in the past”. In addition, the sequence of passage positions when the partial processes constituting the program are traced as execution targets are hereinafter referred to as “execution paths”.

上記の動作の結果、このテスト支援システムでは、プログラムの詳細な解析を必要とせず、また、ユーザが変更箇所を指定しなくても、修正後のソースコードについて実行すべきテスト項目を抽出できる。   As a result of the above operation, this test support system does not require detailed analysis of the program, and can extract test items to be executed on the modified source code without the user specifying a changed portion.

特開2007−4255号公報(第4−10ページ、図1)JP 2007-4255 A (page 4-10, FIG. 1) 特開2010−122959号公報(第4−5ページ、図1)JP 2010-122959 A (page 4-5, FIG. 1)

特許文献1に開示されている技術では、テスト結果がエラーになったテスト項目に関係ない情報も差分情報に含まれるため、関係する部分だけを抽出するという作業が必要となるという問題がある。   The technique disclosed in Patent Document 1 has a problem that it is necessary to extract only a related portion because information not related to the test item in which the test result is an error is also included in the difference information.

特許文献2に開示されているテスト支援システムでは、プログラムの詳細な解析を必要とせず、また、ユーザが変更箇所を指定しなくても、修正後のソースコードについて実行すべきテスト項目を抽出できる。   The test support system disclosed in Patent Document 2 does not require detailed analysis of the program, and can extract test items to be executed on the modified source code without requiring the user to specify a changed portion. .

ところで、プログラムを変更した場合は、変更後のプログラムの、変更された部分のみ、すなわちプログラムの差分に着目して、変更後のプログラムの妥当性を検証することができれば、効率的である。ところが、特許文献2のテスト支援システムは、修正前及び修正後のソースコードの差分に着目した処理を行わない。特許文献2のテスト支援システムは、そもそも、修正後のソースコードについて実行したテスト結果を利用していない。   By the way, when the program is changed, it is efficient if the validity of the changed program can be verified by paying attention to only the changed part of the changed program, that is, the difference of the program. However, the test support system of Patent Document 2 does not perform processing focusing on the difference between the source code before and after the correction. In the first place, the test support system of Patent Document 2 does not use the test results executed on the corrected source code.

本発明の目的は、プログラムを変更した場合の、変更後のプログラムの妥当性の検証を効率化できる、プログラム解析装置、プログラム解析方法、及び、プログラム解析プログラムを提供することにある。   An object of the present invention is to provide a program analysis apparatus, a program analysis method, and a program analysis program that can efficiently verify the validity of a program after the change when the program is changed.

本発明のプログラム解析装置は、第1のプログラムについて行われたテストの結果がエラーになったテスト項目に関する、第1のプログラム上の実行経路に基づいて、第1のプログラムと共通のコードを含む第2のプログラムに、実行経路上の第1の通過位置に対応する第2の通過位置が含まれるかどうかを検索する検索手段と、変更後通過位置に対応する第1のプログラムの第1の部分と、変更前通過位置に対応する第2のプログラムの第2の部分との差分の有無に基づいて、第1の部分又は第2の部分を出力する出力手段と、を備えることを特徴とする。   The program analysis apparatus of the present invention includes a code common to the first program based on the execution path on the first program regarding the test item in which the result of the test performed on the first program results in an error. Search means for searching whether or not the second program includes a second passing position corresponding to the first passing position on the execution path, and a first program of the first program corresponding to the changed passing position Output means for outputting the first part or the second part based on whether there is a difference between the part and the second part of the second program corresponding to the pre-change passing position, To do.

本発明のプログラム解析方法は、第1のプログラムについて行われたテストの結果がエラーになったテスト項目に関する、第1のプログラム上の実行経路に基づいて、第1のプログラムと共通のコードを含む第2のプログラムに、実行経路上の第1の通過位置に対応する第2の通過位置が含まれるかどうかを検索し、変更後通過位置に対応する第1のプログラムの第1の部分と、第2の通過位置に対応する第2のプログラムの第2の部分との差分の有無に基づいて、第1の部分又は第2の部分を出力することを特徴とする。   The program analysis method of the present invention includes a code common to the first program based on the execution path on the first program regarding the test item in which the result of the test performed on the first program results in an error. The second program searches for whether or not the second passage position corresponding to the first passage position on the execution path is included, and the first part of the first program corresponding to the changed passage position; The first part or the second part is output based on the presence or absence of a difference from the second part of the second program corresponding to the second passage position.

本発明のプログラム解析プログラムは、プログラム解析装置が備えるコンピュータを、
第1のプログラムについて行われたテストの結果がエラーになったテスト項目に関する、第1のプログラム上の実行経路に基づいて、第1のプログラムと共通のコードを含む第2のプログラムに、実行経路上の第1の通過位置に対応する第2の通過位置が含まれるかどうかを検索する検索手段と、変更後通過位置に対応する第1のプログラムの第1の部分と、第2の通過位置に対応する第2のプログラムの第2の部分との差分の有無に基づいて、第1の部分又は第2の部分を出力する出力手段、として機能させることを特徴とする。
The program analysis program of the present invention includes a computer included in the program analysis device,
Based on the execution path on the first program regarding the test item in which the result of the test performed on the first program is an error, the execution path is transferred to the second program including the code common to the first program. Search means for searching whether or not the second passage position corresponding to the first passage position above is included, the first part of the first program corresponding to the changed passage position, and the second passage position Based on the presence or absence of a difference from the second part of the second program corresponding to, the output part outputs the first part or the second part.

本発明によれば、プログラムを変更した場合の、変更後のプログラムの妥当性の検証を効率化できるという効果がある。   According to the present invention, there is an effect that it is possible to efficiently verify the validity of the changed program when the program is changed.

本発明の第1の実施形態におけるプログラム解析装置の構成を示すブロック図である。It is a block diagram which shows the structure of the program analysis apparatus in the 1st Embodiment of this invention. 本発明の第1の実施形態における変更前プログラムの一例を示す図である。It is a figure which shows an example of the program before a change in the 1st Embodiment of this invention. 本発明の第1の実施形態における変更後プログラムの一例を示す図である。It is a figure which shows an example of the program after a change in the 1st Embodiment of this invention. 本発明の第1の実施形態における回帰テスト項目の一例を示す図である。It is a figure which shows an example of the regression test item in the 1st Embodiment of this invention. 本発明の第1の実施形態における実行経路情報の一例を示す図である。It is a figure which shows an example of the execution path information in the 1st Embodiment of this invention. 本発明の第1の実施形態における実行経路情報の別の一例を示す図である。It is a figure which shows another example of the execution path information in the 1st Embodiment of this invention. 本発明の第1の実施形態における差分情報の一例を示す図である。It is a figure which shows an example of the difference information in the 1st Embodiment of this invention. 本発明の第1の実施形態における差分情報の別の一例を示す図である。It is a figure which shows another example of the difference information in the 1st Embodiment of this invention. 本発明の第1の実施形態におけるプログラム解析装置のハードウェア構成の一例を示すブロック図である。It is a block diagram which shows an example of the hardware constitutions of the program analysis apparatus in the 1st Embodiment of this invention. 本発明の第1の実施形態におけるプログラム解析装置の動作を示すフローチャートである。It is a flowchart which shows operation | movement of the program analysis apparatus in the 1st Embodiment of this invention.

以下、本発明の実施形態について図面を参照して詳細に説明する。尚、すべての図面において、同様な構成要素には同様の符号を付し、適宜説明を省略する。
(第1の実施形態)
図1は、本発明の第1の実施形態におけるプログラム解析装置の構成を示すブロック図である。
Hereinafter, embodiments of the present invention will be described in detail with reference to the drawings. In all the drawings, the same reference numerals are given to the same components, and the description will be omitted as appropriate.
(First embodiment)
FIG. 1 is a block diagram showing a configuration of a program analysis apparatus according to the first embodiment of the present invention.

まず、プログラム解析装置の構成を説明するための前提について説明する。   First, the premise for demonstrating the structure of a program analysis apparatus is demonstrated.

あるコンピュータプログラム(以下、「変更前プログラム」という。)がコンピュータ上で動作可能であるものとする。尚、変更前プログラム130が、ソースコードである場合等、そのままではコンピュータ上で動作可能ではないときには、変更前プログラム130を実行可能形式に変換後に、コンピュータ上で動作させてもよい。変更前プログラム130は、一群のテスト項目に対して、正常に動作することが確認されている。   It is assumed that a certain computer program (hereinafter referred to as “pre-change program”) is operable on the computer. When the pre-change program 130 is a source code or the like and is not operable on the computer as it is, the pre-change program 130 may be operated on the computer after being converted into an executable format. It has been confirmed that the pre-change program 130 operates normally for a group of test items.

図2は、本実施形態における変更前プログラムの一例を示す図である。   FIG. 2 is a diagram illustrating an example of a pre-change program in the present embodiment.

1〜10行において“Main.func”メソッドが、11〜16行において“SubA.m”メソッドが、17〜22行において“SubB.m”メソッドが、定義されている。   The “Main.func” method is defined in lines 1 to 10, the “SubA.m” method is defined in lines 11 to 16, and the “SubB.m” method is defined in lines 17 to 22.

変更前プログラム130に変更が加えられた、別のプログラム(以下、「変更後プログラム」という。)が存在し、コンピュータ上で動作可能であるものとする。尚、変更後プログラム150も、そのままではコンピュータ上で動作可能ではないときには、変更後プログラム150を実行可能形式に変換後に、コンピュータ上で動作させてもよい。なお、変更前プログラム130、変更後プログラム150のそれぞれの記述に用いられる言語は、共通の言語であってもよいし、別個の言語であってもよい。   It is assumed that there is another program (hereinafter referred to as “program after change”) in which a change is made to the pre-change program 130 and it can operate on the computer. If the changed program 150 is not operable on the computer as it is, the changed program 150 may be operated on the computer after being converted into an executable format. The language used for describing each of the pre-change program 130 and the post-change program 150 may be a common language or a separate language.

図3は、本実施形態における変更後プログラムの一例を示す図である。   FIG. 3 is a diagram showing an example of the changed program in the present embodiment.

“Main.func”メソッドは変更されておらず、14行において“SubA.m”メソッドが変更され、20行において“SubB.m”メソッドが変更され、23〜32行において“SubC.m”メソッドが新たに定義されている。   The “Main.func” method is not changed, the “SubA.m” method is changed in line 14, the “SubB.m” method is changed in line 20, and the “SubC.m” method is changed in lines 23 to 32. Is newly defined.

尚、ここでは、変更前プログラムが変更されて、変更後プログラムが作成されたものとして説明した。しかし、変更後プログラムは、変更前プログラムが変更されて、作成されたものには限定されない。第1のプログラムが、一群のテスト項目に対して、正常に動作することが確認されていて、かつ、第2のプログラムが、第1のプログラムに対して、コードが一致する部分と、コードが一致しない部分とに分割できれば、第1のプログラムが変更されて、第2のプログラムが作成されたものとみなすことができる。従って、第1のプログラムと第2のプログラムとが、独立して作られた2つのプログラムであってもよい。   Here, the description has been made assuming that the pre-change program is changed and the post-change program is created. However, the post-change program is not limited to a program created by changing the pre-change program. The first program has been confirmed to operate normally for a group of test items, and the second program has a portion where the code matches the first program and the code is If it can be divided into parts that do not match, it can be considered that the first program is changed and the second program is created. Accordingly, the first program and the second program may be two programs created independently.

変更前プログラムと変更後プログラムは、例えば、1つのアプリケーション・プログラミング・インタフェース仕様に従って、共通するメソッドの名称及び機能を含むように、独立して作られた2つのプログラムであってもよい。この場合、どちらか一方のプログラムが、一群のテスト項目に対して、正常に動作することが確認されていれば、一方のプログラムは、他方のプログラムが変更されて作成されたものとみなすことができる。   The pre-change program and the post-change program may be, for example, two programs created independently so as to include common method names and functions according to one application programming interface specification. In this case, if one of the programs is confirmed to operate normally for a group of test items, one program may be regarded as having been created by changing the other program. it can.

例えば、第1のアプリケーション・プログラミング・インタフェース仕様に規定されるメソッドの名称及び機能を含むように作られた第1のプログラムがあるものとする。又、第1のアプリケーション・プログラミング・インタフェース仕様と共通するメソッドの名称及び機能を含む第2のアプリケーション・プログラミング・インタフェース仕様があるものとする。更に、第2のアプリケーション・プログラミング・インタフェース仕様に規定されたメソッドの名称及び機能を含むように、第1のプログラムとは独立して作られた第2のプログラムがあるものとする。このとき、第1のプログラムと第2のプログラムのどちらか一方が、一群のテスト項目に対して、正常に動作することが確認されていれば、一方のプログラムは、他方のプログラムが変更されて作成されたものとみなすことができる。   For example, it is assumed that there is a first program created to include the method names and functions defined in the first application programming interface specification. It is also assumed that there is a second application programming interface specification that includes method names and functions in common with the first application programming interface specification. Further, it is assumed that there is a second program created independently of the first program so as to include the method names and functions defined in the second application programming interface specification. At this time, if one of the first program and the second program is confirmed to operate normally with respect to a group of test items, one program is changed to the other program. It can be considered as created.

変更後プログラム150は、変更前プログラム130が正常に動作した一群のテスト項目の一部項目(以下、「回帰テスト項目」という。)に対して、正常又は異常に動作することが確認されている。回帰テスト項目170の各テスト項目は、例えば、テスト内容と、テスト内容を実行したときの期待結果と、各テスト項目を識別するためのテスト項目名を含んでもよい。   It has been confirmed that the post-change program 150 operates normally or abnormally with respect to some items (hereinafter referred to as “regression test items”) of a group of test items in which the pre-change program 130 has operated normally. . Each test item of the regression test item 170 may include, for example, a test content, an expected result when the test content is executed, and a test item name for identifying each test item.

図4は、本実施形態における回帰テスト項目の一例を示す図である。   FIG. 4 is a diagram illustrating an example of regression test items in the present embodiment.

図4の回帰テスト項目170は、3番目のテスト項目は、テスト項目名が“3”で、テスト内容が“Main.func”メソッドに引数“−1”を与えて実行するテストで、期待結果が“Main.func”メソッドの戻り値が“2”であることを示している。   In the regression test item 170 of FIG. 4, the third test item is a test executed with the test item name “3” and the test content given by the argument “−1” to the “Main.func” method. Indicates that the return value of the “Main.func” method is “2”.

回帰テスト項目170を実行するときの変更後プログラム150上の実行経路を示す実行経路情報180は、異常に動作したテスト項目毎に記録されている。実行経路情報180によって示される実行経路は、回帰テスト項目170の実行時に、変更後プログラム150が実行された、変更後プログラム150上の一連の部分(以下、「変更後通過位置」という。)を1個以上含む。各変更後通過位置は、テスト項目の実行時に実行された変更後プログラム150上のメソッド名、関数名、ラベル名、デバッグ命令文、行番号、行番号の範囲、又は、コメント等により識別されてもよい。又、実行経路情報180は、テスト項目名等を更に含んでもよい。   The execution path information 180 indicating the execution path on the post-change program 150 when the regression test item 170 is executed is recorded for each test item that operates abnormally. The execution path indicated by the execution path information 180 is a series of portions on the changed program 150 (hereinafter referred to as “changed passage position”) in which the changed program 150 is executed when the regression test item 170 is executed. Contains one or more. Each changed passage position is identified by a method name, a function name, a label name, a debug command statement, a line number, a range of line numbers, or a comment on the changed program 150 executed when the test item is executed. Also good. The execution path information 180 may further include a test item name and the like.

例えば、図3に示した変更後プログラム150中の、3行、13行、19行、25行にある“System.out.println”メッソドが実行されることにより、実行されたメソッド名が出力される。異常に動作したテスト項目について、メソッド名のリストを記録することで、実行経路情報180を得ることができる。   For example, the name of the executed method is output by executing the “System.out.println” method in lines 3, 13, 19, and 25 in the modified program 150 shown in FIG. The The execution path information 180 can be obtained by recording a list of method names for abnormally operated test items.

あるいは、例えば、プログラミング言語にJava(登録商標)を用いる場合、JUnit等のテストツールを用いることができる。この場合には、jcoverage等のカバレッジツールを用いて、実行経路情報180を得ることができる。   Alternatively, for example, when Java (registered trademark) is used as a programming language, a test tool such as JUnit can be used. In this case, the execution path information 180 can be obtained using a coverage tool such as jcoverage.

図5は、本実施形態における実行経路情報180の一例を示す図である。   FIG. 5 is a diagram illustrating an example of the execution path information 180 in the present embodiment.

図5の実行経路情報180は、テスト項目名が“3”のテスト項目に対応する、“Main.func”、“SubB.m”、“SubC.m”メソッドの変更後通過位置を含む実行経路であることを示す。   The execution path information 180 in FIG. 5 includes an execution path including the changed passage position of the “Main.func”, “SubB.m”, and “SubC.m” methods corresponding to the test item whose test item name is “3”. Indicates that

実行経路情報180は、変更後プログラム150が異常に動作したテスト項目に対してのみ生成されてもよいし、あるいは、変更後プログラム150が正常又は異常に動作したテスト項目に対して生成され、動作が正常又は異常のどちらかの情報(以下、「テスト結果」という。)を含んでもよい。   The execution path information 180 may be generated only for a test item in which the post-change program 150 operates abnormally, or is generated for a test item in which the post-change program 150 operates normally or abnormally. May include information of either normal or abnormal (hereinafter referred to as “test result”).

図6は、本実施形態における実行経路情報の別の一例を示す図である。   FIG. 6 is a diagram illustrating another example of the execution path information in the present embodiment.

図6の実行経路情報180は、テスト項目名が“3”のテスト項目に対応し、テスト結果が“NG”で、“Main.func”、“SubB.m”、“SubC.m”メソッドの変更後通過位置を含む実行経路であることを示す。   The execution path information 180 in FIG. 6 corresponds to the test item whose test item name is “3”, the test result is “NG”, and “Main.func”, “SubB.m”, “SubC.m” method Indicates that the execution path includes the changed passage position.

以上の前提のもとに、プログラム解析装置の構成について説明する。   Based on the above assumptions, the configuration of the program analysis apparatus will be described.

本実施形態のプログラム解析装置100は、通過位置検索手段110と、差分出力手段120とを備える。   The program analysis apparatus 100 according to the present embodiment includes passage position search means 110 and difference output means 120.

通過位置検索手段110は、入力された実行経路情報180に基づいて、実行経路情報180に含まれる各変更後通過位置について、入力された変更前プログラム130から、変更後通過位置に対応する変更前プログラム130上の通過位置(以下、「変更前通過位置」という。)を検索して、変更後通過位置と変更前通過位置との組を出力する。尚、通過位置検索手段110は、変更後プログラム150が正常に動作したテスト項目に対する実行経路情報を無視する。又、変更後通過位置に対応する変更前通過位置は、変更前プログラム130上に、変更後通過位置と同じ、メソッド名、関数名、ラベル名、デバッグ命令文、行番号、行番号の範囲、又は、コメント等をもつ部分があるか否か等に基づいて検索されてもよい。又、変更後通過位置に対応する変更前通過位置が見つからなかったときは、通過位置検索手段110は、変更前通過位置として、「空」であることを示す値を出力する。   Based on the input execution path information 180, the passage position search unit 110 determines, for each post-change passage position included in the execution path information 180, from the input pre-change program 130 before the change corresponding to the post-change passage position. A passing position on the program 130 (hereinafter referred to as “passing position before change”) is searched, and a set of a passing position after change and a passing position before change is output. The passage position search unit 110 ignores the execution path information for the test item for which the changed program 150 has operated normally. In addition, the pre-change pass position corresponding to the post-change pass position is the same as the post-change pass position on the pre-change program 130, the method name, function name, label name, debug command statement, line number, range of line numbers, Alternatively, the search may be performed based on whether there is a part having a comment or the like. When the pre-change passage position corresponding to the post-change passage position is not found, the passage position search means 110 outputs a value indicating “empty” as the pre-change passage position.

差分出力手段120は、まず、変更後通過位置と変更前通過位置との組と、変更後プログラム150と、変更前プログラム130とに基づいて、変更前通過位置に対応する変更前プログラム130の部分と、変更後通過位置に対応する変更後プログラム150の部分とに差分があるか否かを検査する。差分出力手段120は、つづいて、差分があれば、変更後通過位置に対応する変更後プログラム150の部分を含む差分情報190を出力する。尚、入力された変更前通過位置の値が“空”のときは、変更後通過位置に対応する変更後プログラム150の部分を出力する。又、差分情報190には、変更前通過位置に対応する変更前プログラム130の部分や、テスト項目名等が更に含まれてもよい。   First, the difference output means 120 is a part of the pre-change program 130 corresponding to the pre-change pass position based on the set of the post-change pass position and the pre-change pass position, the post-change program 150, and the pre-change program 130. And whether there is a difference between the changed program 150 corresponding to the changed passage position. If there is a difference, the difference output means 120 outputs difference information 190 including the part of the changed program 150 corresponding to the changed passage position. When the input pre-change passing position value is “empty”, the post-change program 150 corresponding to the post-change passing position is output. The difference information 190 may further include a part of the pre-change program 130 corresponding to the pre-change passing position, a test item name, and the like.

尚、差分出力手段120は、変更前プログラム130と変更後プログラム150のコードの部分が、完全に一致しなくても、差分がないと判定してもよい。例えば、コード中のコメント、スペース、タブ、改行等の、プログラムの実行結果に影響しないコードの違いは無視してもよい。   The difference output means 120 may determine that there is no difference even if the code portions of the pre-change program 130 and the post-change program 150 do not completely match. For example, code differences that do not affect the execution result of the program, such as comments, spaces, tabs, and line breaks in the code, may be ignored.

又、差分情報190に含まれる、変更後通過位置に対応する変更後プログラム150の部分や、変更前通過位置に対応する変更前プログラム130の部分は、コードの差分がある部分のみでなくてもよい。例えば、差分情報190には、コードの差分があるメソッドの定義全体が含まれてもよい。   Further, the part of the post-change program 150 corresponding to the post-change passing position and the part of the pre-change program 130 corresponding to the pre-change passing position included in the difference information 190 need not be only parts having code differences. Good. For example, the difference information 190 may include the entire definition of a method having a code difference.

図7は、本実施形態における差分情報の一例を示す図である。   FIG. 7 is a diagram illustrating an example of difference information in the present embodiment.

図7の差分情報190は、1番目の差分情報は、テスト項目名が“3”のテスト項目に対応し、変更後通過位置“Main.func”、“SubB.m”、“SubC.m”メソッドのうち、変更前通過位置に対応する変更前プログラム130の部分と、変更後通過位置に対応する変更後プログラム150の部分とに差分がある“SubB.m”及び“SubC.m”メソッドに対応する変更後プログラム150の部分を含んでいる。   In the difference information 190 of FIG. 7, the first difference information corresponds to the test item whose test item name is “3”, and the changed passage positions “Main.func”, “SubB.m”, “SubC.m”. Among the methods, the “SubB.m” and “SubC.m” methods have a difference between the part of the pre-change program 130 corresponding to the pre-change passing position and the part of the post-change program 150 corresponding to the post-change passing position. A corresponding post-change program 150 portion is included.

図8は、本実施形態における差分情報の別の一例を示す図である。   FIG. 8 is a diagram illustrating another example of difference information in the present embodiment.

図8の差分情報190は、1番目の差分情報は、テスト項目名が“3”のテスト項目に対応し、変更後通過位置“Main.func”、“SubB.m”、“SubC.m”メソッドのうち、変更前通過位置に対応する変更前プログラム130の部分と、変更後通過位置に対応する変更後プログラム150の部分とに差分がある“SubB.m”及び“SubC.m”メソッドに対応する変更後プログラム150の部分、並びに、変更前通過位置に対応する変更前プログラム130の部分と、変更後通過位置に対応する変更後プログラム150の部分とに差分がある“SubB.m”メソッドに対応する変更前プログラム130の部分を含んでいる。   In the difference information 190 of FIG. 8, the first difference information corresponds to the test item whose test item name is “3”, and the changed passage positions “Main.func”, “SubB.m”, “SubC.m”. Among the methods, the “SubB.m” and “SubC.m” methods have a difference between the part of the pre-change program 130 corresponding to the pre-change passing position and the part of the post-change program 150 corresponding to the post-change passing position. "SubB.m" method in which there is a difference between the corresponding post-change program 150 part and the pre-change program part 130 corresponding to the pre-change passing position and the post-change program 150 part corresponding to the post-change passing position The portion of the pre-change program 130 corresponding to is included.

図9は、本実施形態におけるプログラム解析装置のハードウェア構成の一例を示すブロック図である。   FIG. 9 is a block diagram illustrating an example of a hardware configuration of the program analysis apparatus according to the present embodiment.

プログラム解析装置907は、記憶装置902と、CPU(Central Processing Unit)903と、キーボード904と、モニタ905と、I/O(Input/Output)908とを備え、これらが内部バス906で接続されている。記憶装置902は、差分出力手段120等のCPU903の動作プログラムを格納する。CPU903は、プログラム解析装置907全体を制御し、記憶装置902に格納された動作プログラムを実行し、I/O908を介して差分出力手段120等のプログラムの実行やデータの送受信を行なう。なお、上記のプログラム解析装置907の内部構成は一例である。プログラム解析装置907は、CPU903のみを備え、外部に備えられた、記憶装置902、キーボード904、モニタ905、及びI/O908を用いて動作してもよい。   The program analysis device 907 includes a storage device 902, a CPU (Central Processing Unit) 903, a keyboard 904, a monitor 905, and an I / O (Input / Output) 908, which are connected via an internal bus 906. Yes. The storage device 902 stores an operation program for the CPU 903 such as the difference output unit 120. The CPU 903 controls the entire program analysis device 907, executes an operation program stored in the storage device 902, and executes programs such as the differential output means 120 and transmits / receives data via the I / O 908. The internal configuration of the program analysis device 907 is an example. The program analysis device 907 may include only the CPU 903 and operate using a storage device 902, a keyboard 904, a monitor 905, and an I / O 908 provided outside.

次に、本実施形態の動作を説明する。   Next, the operation of this embodiment will be described.

図10は、本実施形態におけるプログラム解析装置の動作を示すフローチャートである。但し、実行経路情報180に含まれる1個の変更後通過位置に対する動作を示す。実行経路情報180に複数の変更後通過位置が含まれる場合には、1個の変更後通過位置に対する動作が繰り返される。   FIG. 10 is a flowchart showing the operation of the program analysis apparatus according to this embodiment. However, an operation for one post-change passing position included in the execution route information 180 is shown. When the execution path information 180 includes a plurality of changed passage positions, the operation for one changed passage position is repeated.

通過位置検索手段110は、入力された実行経路情報180に含まれる各変更後通過位置について、入力された変更前プログラム130から、変更後通過位置に対応する変更前通過位置を検索して、変更後通過位置と変更前通過位置との組を出力する(ステップS110)。   The passage position search means 110 searches the changed pre-change passage position corresponding to the post-change passage position from the input pre-change program 130 for each post-change passage position included in the input execution route information 180, and changes it. A set of the rear passage position and the pre-change passage position is output (step S110).

差分出力手段120は、変更前通過位置の有無を調べる(ステップS120)。   The difference output means 120 checks the presence / absence of the pre-change passing position (step S120).

差分出力手段120は、変更前通過位置がなければ(ステップS120:No)、次のステップS150へ進む。   If there is no pre-change passing position (step S120: No), the difference output means 120 proceeds to the next step S150.

変更前通過位置があれば(ステップS120:Yes)、差分出力手段120は、変更前通過位置に対応する変更前プログラム130の部分と、変更後通過位置に対応する変更後プログラム150の部分とに差分があるか否かを検査する(ステップS130)。   If there is a pre-change passing position (step S120: Yes), the difference output means 120 will convert the pre-change program 130 corresponding to the pre-change passing position and the post-change program 150 corresponding to the post-change passing position. It is checked whether or not there is a difference (step S130).

差分出力手段120は、差分がなければ(ステップS140:No)、その変更後通過位置に対する処理を終了する。   If there is no difference (step S140: No), the difference output means 120 ends the process for the changed passing position.

差分出力手段120は、差分があれば(ステップS140:Yes)、変更後通過位置に対応する変更後プログラム150の部分を含む差分情報190を出力する。   If there is a difference (step S140: Yes), the difference output means 120 outputs the difference information 190 including the part of the changed program 150 corresponding to the changed passage position.

以上説明したように、本実施形態におけるプログラム解析装置100は、回帰テストの特定のテスト項目でエラーが発生したとき、変更前後でのプログラムの差分の情報のうち、特定のテスト項目の実行経路に含まれるプログラムの差分の情報のみを抽出できる。その理由は、通過位置検索手段110が、特定のテスト項目に関連したプログラムの部分を検索し、差分出力手段120が、特定のテスト項目に関連したプログラムの部分から、プログラムの変更前後で差分がある部分を抽出するからである。   As described above, when an error occurs in a specific test item of the regression test, the program analysis apparatus 100 according to the present embodiment uses the execution path of the specific test item in the information on the difference between the programs before and after the change. Only the difference information of the included programs can be extracted. The reason is that the passage position search means 110 searches for a part of the program related to the specific test item, and the difference output means 120 detects the difference before and after the program change from the part of the program related to the specific test item. This is because a certain part is extracted.

又、本実施形態におけるプログラム解析装置100は、回帰テストの特定のテスト項目でエラーが発生したとき、変更後プログラムのデバッグ作業の支援に利用できる。その理由は、プログラム解析装置100が、回帰テストの特定のテスト項目でエラーが発生したとき、特定のテスト項目に関連した変更前後でのプログラムの差分の情報のみを抽出し、デバッグ作業者は、バグが存在する差分の情報を参照できるからである。   In addition, the program analysis apparatus 100 according to the present embodiment can be used to support the debugging work of the changed program when an error occurs in a specific test item of the regression test. The reason is that when an error occurs in a specific test item of the regression test, the program analysis apparatus 100 extracts only the information of the program difference before and after the change related to the specific test item. This is because it is possible to refer to information on differences in which bugs exist.

尚、本実施形態では、差分情報190は、変更後通過位置に対応する変更後プログラム150の部分を含むものとして説明した。しかし、差分情報190は、変更後通過位置に対応する変更後プログラム150の部分を含むものには限定されない。すなわち、差分情報190は、変更後通過位置に対応する変更前プログラム130の部分を含むものでもよい。この場合、プログラム解析装置100は、バグが存在する変更後プログラム150の部分に対応する、バグが存在しない変更前プログラム130の部分を抽出できる。従って、差分情報190は、変更後通過位置に対応する変更前プログラム130の部分を含むものでもよい。   In the present embodiment, the difference information 190 has been described as including the part of the changed program 150 corresponding to the changed passage position. However, the difference information 190 is not limited to the information including the part of the changed program 150 corresponding to the changed passage position. That is, the difference information 190 may include a part of the pre-change program 130 corresponding to the post-change passing position. In this case, the program analysis apparatus 100 can extract the portion of the pre-change program 130 that does not have a bug, corresponding to the portion of the post-change program 150 that has a bug. Therefore, the difference information 190 may include a part of the pre-change program 130 corresponding to the post-change passing position.

尚、本実施例では、プログラムを記述するプログラミング言語として、Java(登録商標)を用いた例を挙げたが、これに限られず、C、アセンブリ言語等の任意の手続き型プログラミング言語であってもよい。   In this embodiment, an example in which Java (registered trademark) is used as a programming language for describing a program has been described. However, the present invention is not limited to this, and any procedural programming language such as C or assembly language may be used. Good.

尚、本願発明は、上述の実施形態に限定されるものではなく、本願発明の要旨を逸脱しない範囲で種々変更、変形して実施することができる。   In addition, this invention is not limited to the above-mentioned embodiment, It can implement in various changes and deformation | transformation in the range which does not deviate from the summary of this invention.

Claims (6)

第1のプログラムについて行われたテストの結果がエラーになったテスト項目に関する、前記第1のプログラム上の実行経路に基づいて、前記第1のプログラムと共通のコードを含む第2のプログラムに、前記実行経路上の第1の通過位置に対応する第2の通過位置が含まれるかどうかを検索する検索手段と、
前記変更後通過位置に対応する前記第1のプログラムの第1の部分と、前記第2の通過位置に対応する前記第2のプログラムの第2の部分との差分の有無に基づいて、前記第1の部分又は前記第2の部分を出力する出力手段と、
を備えることを特徴とするプログラム解析装置。
Based on the execution path on the first program related to the test item in which the result of the test performed on the first program results in an error, the second program including a code common to the first program, Search means for searching whether a second passage position corresponding to the first passage position on the execution path is included;
Based on the presence / absence of a difference between the first part of the first program corresponding to the post-change passing position and the second part of the second program corresponding to the second passing position, Output means for outputting the first part or the second part;
A program analysis apparatus comprising:
前記変更後通過位置は、前記第1のプログラムに含まれる第1のメソッドの定義部分である
ことを特徴とする請求項1に記載のプログラム解析装置。
The program analysis apparatus according to claim 1, wherein the changed passage position is a definition part of a first method included in the first program.
前記変更前通過位置は、前記第2のプログラムに含まれる第2のメソッドの定義部分である
ことを特徴とする請求項1又は2に記載のプログラム解析装置。
The program analysis apparatus according to claim 1, wherein the pre-change passing position is a definition part of a second method included in the second program.
前記変更後通過位置に対応する前記変更前通過位置は、前記第1のメソッドと同じ名称を持つ前記第2のメソッドの定義部分である
ことを特徴とする請求項3に記載のプログラム解析装置。
4. The program analysis apparatus according to claim 3, wherein the pre-change passing position corresponding to the post-change passing position is a definition part of the second method having the same name as the first method.
第1のプログラムについて行われたテストの結果がエラーになったテスト項目に関する、前記第1のプログラム上の実行経路に基づいて、前記第1のプログラムと共通のコードを含む第2のプログラムに、前記実行経路上の第1の通過位置に対応する第2の通過位置が含まれるかどうかを検索し、
前記変更後通過位置に対応する前記第1のプログラムの第1の部分と、前記第2の通過位置に対応する前記第2のプログラムの第2の部分との差分の有無に基づいて、前記第1の部分又は前記第2の部分を出力する
ことを特徴とするプログラム解析方法。
Based on the execution path on the first program related to the test item in which the result of the test performed on the first program results in an error, the second program including a code common to the first program, Searching whether a second passage position corresponding to the first passage position on the execution path is included;
Based on the presence / absence of a difference between the first part of the first program corresponding to the post-change passing position and the second part of the second program corresponding to the second passing position, A program analysis method comprising: outputting one part or the second part.
プログラム解析装置が備えるコンピュータを、
第1のプログラムについて行われたテストの結果がエラーになったテスト項目に関する、前記第1のプログラム上の実行経路に基づいて、前記第1のプログラムと共通のコードを含む第2のプログラムに、前記実行経路上の第1の通過位置に対応する第2の通過位置が含まれるかどうかを検索する検索手段と、
前記変更後通過位置に対応する前記第1のプログラムの第1の部分と、前記第2の通過位置に対応する前記第2のプログラムの第2の部分との差分の有無に基づいて、前記第1の部分又は前記第2の部分を出力する出力手段と、
として機能させるためのプログラム解析プログラム。
A computer included in the program analysis device,
Based on the execution path on the first program related to the test item in which the result of the test performed on the first program results in an error, the second program including a code common to the first program, Search means for searching whether a second passage position corresponding to the first passage position on the execution path is included;
Based on the presence / absence of a difference between the first part of the first program corresponding to the post-change passing position and the second part of the second program corresponding to the second passing position, Output means for outputting the first part or the second part;
Program analysis program to function as
JP2012280814A 2012-12-25 2012-12-25 Program analysis device, program analysis method, and program analysis program Pending JP2014126900A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2012280814A JP2014126900A (en) 2012-12-25 2012-12-25 Program analysis device, program analysis method, and program analysis program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2012280814A JP2014126900A (en) 2012-12-25 2012-12-25 Program analysis device, program analysis method, and program analysis program

Publications (1)

Publication Number Publication Date
JP2014126900A true JP2014126900A (en) 2014-07-07

Family

ID=51406375

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2012280814A Pending JP2014126900A (en) 2012-12-25 2012-12-25 Program analysis device, program analysis method, and program analysis program

Country Status (1)

Country Link
JP (1) JP2014126900A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2016110419A (en) * 2014-12-08 2016-06-20 富士通株式会社 Program, information processor, and information processing method
JP2019057118A (en) * 2017-09-21 2019-04-11 株式会社東芝 Debug support device and debug support program
CN112114993A (en) * 2020-09-28 2020-12-22 中国建设银行股份有限公司 Configuration information processing method and device of application system

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2007004255A (en) * 2005-06-21 2007-01-11 Fujitsu Ltd Program for debug support
JP2009104252A (en) * 2007-10-19 2009-05-14 Toshiba Corp Debugging support device and debugging support method
JP2010067188A (en) * 2008-09-12 2010-03-25 Internatl Business Mach Corp <Ibm> Information processor for supporting programming, information processing system, and programming support method and program
JP2011048714A (en) * 2009-08-28 2011-03-10 Fujitsu Ltd Test support method and test support apparatus

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2007004255A (en) * 2005-06-21 2007-01-11 Fujitsu Ltd Program for debug support
JP2009104252A (en) * 2007-10-19 2009-05-14 Toshiba Corp Debugging support device and debugging support method
JP2010067188A (en) * 2008-09-12 2010-03-25 Internatl Business Mach Corp <Ibm> Information processor for supporting programming, information processing system, and programming support method and program
JP2011048714A (en) * 2009-08-28 2011-03-10 Fujitsu Ltd Test support method and test support apparatus

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2016110419A (en) * 2014-12-08 2016-06-20 富士通株式会社 Program, information processor, and information processing method
JP2019057118A (en) * 2017-09-21 2019-04-11 株式会社東芝 Debug support device and debug support program
CN112114993A (en) * 2020-09-28 2020-12-22 中国建设银行股份有限公司 Configuration information processing method and device of application system

Similar Documents

Publication Publication Date Title
US8370816B2 (en) Device, method and computer program product for evaluating a debugger script
US9898387B2 (en) Development tools for logging and analyzing software bugs
WO2016177124A1 (en) Method and device for implementing continuous integration test
CN106506283B (en) Business test method and device of bank and enterprise docking system
US20130179863A1 (en) Bug variant detection using program analysis and pattern identification
US20080126867A1 (en) Method and system for selective regression testing
US9639454B2 (en) Computer-readable recording medium storing therein test data generating program, test data generating method, test data generating apparatus and information processing system
US20110126179A1 (en) Method and System for Dynamic Patching Software Using Source Code
JP2015011372A (en) Debug support system, method, program, and recording medium
JP2016115175A (en) Software test apparatus and software test program
US8898649B2 (en) Application program analysis method, analysis system and recording medium for identifying a contributing factor for an invalid operation of an application program
JP2015204065A (en) Test case generation device and test case generation method
JP2014126900A (en) Program analysis device, program analysis method, and program analysis program
Prinz et al. A first step towards a compiler for business processes
US8359579B2 (en) Monitoring dynamic aspect oriented applications at execution time
JP6451417B2 (en) Debug support device, debug support system, debug support method, and debug support program
US9396239B2 (en) Compiling method, storage medium and compiling apparatus
JP5811859B2 (en) Source code static analysis device, system, method, and program therefor
US20190286453A1 (en) System construction assisting apparatus, method, and program
JP2016128941A (en) Output determination device, output determination method, output determination program, and static analysis device
CN113051582B (en) Computer software technology development and debugging system
CN115757099A (en) Automatic test method and device for platform firmware protection recovery function
JP7436848B2 (en) FFU inspection device and FFU inspection program
CN114327588A (en) Method and device for processing code submission log
JP6840656B2 (en) Test script modifiers and programs

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20151117

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20160804

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20160830

A02 Decision of refusal

Free format text: JAPANESE INTERMEDIATE CODE: A02

Effective date: 20170228