JP6330490B2 - Test case generation program, test case generation apparatus, and test case generation method - Google Patents
Test case generation program, test case generation apparatus, and test case generation method Download PDFInfo
- Publication number
- JP6330490B2 JP6330490B2 JP2014112808A JP2014112808A JP6330490B2 JP 6330490 B2 JP6330490 B2 JP 6330490B2 JP 2014112808 A JP2014112808 A JP 2014112808A JP 2014112808 A JP2014112808 A JP 2014112808A JP 6330490 B2 JP6330490 B2 JP 6330490B2
- Authority
- JP
- Japan
- Prior art keywords
- index
- index value
- test case
- generated
- unit
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Images
Landscapes
- Debugging And Monitoring (AREA)
Description
本発明は、テストケース生成プログラム、テストケース生成装置、及びテストケース生成方法に関する。 The present invention relates to a test case generation program, a test case generation device, and a test case generation method.
従来から、コンピュータのプログラムを実行し、正しく動作するかどうか確認する作業が行われている。 Conventionally, an operation for executing a computer program and confirming whether or not it operates correctly has been performed.
プログラムのテストを実行するためには、入力データ(テストデータ)及び期待結果等を含むテストケースが必要となる。テストで実行する一連のテストケースの集合をここではテストケースセットと呼ぶ。テストでは、確認すべき観点を全て網羅するようにテストケースセットを準備する必要がある。 In order to execute a program test, a test case including input data (test data) and expected results is required. A set of test cases to be executed in the test is referred to as a test case set here. In the test, it is necessary to prepare a test case set to cover all the viewpoints to be confirmed.
ここでは、テストの中でも、特にプログラムのホワイトボックステストに注目する。ホワイトボックステストでは、コードカバレッジの指標に従って、プログラム中の命令や分岐、あるいは実行パスを網羅するようにテストケースを準備してテストを実行する。 Here, we focus on the white box test of the program. In the white box test, a test case is prepared and the test is executed so as to cover instructions, branches, or execution paths in the program according to the code coverage index.
テストケースの準備、特に入力データの作成は、多くの場合は人手でなされており、大きな労力を要している。この労力を解決する方法として、近年注目されているのが、シンボリック実行(Symbolic execution)によるテストデータ生成技術である。 The preparation of test cases, especially the creation of input data, is often done manually and requires a lot of effort. As a method for solving this labor, a test data generation technique based on symbolic execution has been attracting attention in recent years.
シンボリック実行を効率化する技術として、例えば、特許文献1及び特許文献2に記載された技術が知られている。
As a technique for improving the efficiency of symbolic execution, for example, techniques described in
シンボリック実行では、パス条件を生成するために探索及び実行するパスの範囲が広くなり、実用的な時間及び空間計算量で扱えなくなる、いわゆる組合せ爆発を引き起こす懸念がある。組合せ爆発を抑制するために、シンボリック実行を効率化することが望まれる。 In symbolic execution, the range of paths to be searched and executed in order to generate a path condition is widened, and there is a concern of causing a so-called combination explosion that cannot be handled with practical time and space complexity. In order to suppress combinational explosions, it is desirable to improve the efficiency of symbolic execution.
本発明は一つの側面として、シンボリック実行によるプログラムのテストケースの生成において、シンボリック実行の効率化を実現することを目的とする。 An object of the present invention is to realize the efficiency of symbolic execution in generating a test case of a program by symbolic execution.
1つの態様では、配列を構成する複数の要素の各々の位置を表すシンボル変数であるインデックス値で、除外されていない未選択のインデックス値を選択対象として、該選択対象からインデックス値を選択する。また、対象プログラムをシンボリック実行することにより、選択したインデックス値に対応する要素に応じて分岐するパスを表すパス条件を生成する。さらに、生成したパス条件及び該生成したパス条件が表すパスを通過するテストデータをテストケースとして出力する。また、前記選択対象に含まれるインデックス値であり、パス条件を生成した要素と同一の要素に対応するインデックス値が、生成した該パス条件からインデックス値に由来する制約を除外したインデックス等価条件を充足可能か判定する。さらに、充足可能なインデックス値を前記選択対象から除外する。 In one aspect, an index value that is a symbol variable representing the position of each of a plurality of elements constituting an array and an unselected index value that is not excluded is selected, and the index value is selected from the selection target. Further, by executing symbolically the target program, a path condition representing a path that branches depending on the element corresponding to the selected index value is generated. Further, the generated path condition and test data passing through the path represented by the generated path condition are output as test cases. In addition, the index value included in the selection target, the index value corresponding to the same element as the element that generated the path condition satisfies the index equivalent condition that excludes the constraint derived from the index value from the generated path condition Determine if it is possible. Further, a satisfiable index value is excluded from the selection target.
一つの側面として、シンボリック実行によるプログラムのテストケースの生成において、シンボリック実行の効率化を実現することができる、という効果を有する。 As one aspect, in the generation of a test case of a program by symbolic execution, the efficiency of symbolic execution can be realized.
以下、図面を参照して開示の技術の一例を詳細に説明する。 Hereinafter, an example of the disclosed technique will be described in detail with reference to the drawings.
まず、開示の技術の一例の概略について説明する。図1は、本実施形態に係るテストケース生成装置10の一例の概略構成を示すブロック図である。図1に示すように、テストケース生成装置10は、シンボリック実行部12、インデックスアクセス検出部14、及びインデックス選択部16を備える。さらに、テストケース生成装置10は、同一要素インデックス情報生成部18、同一要素判定部20、インデックス等価条件生成部22、及びインデックス等価判定部24を備える。
First, an outline of an example of the disclosed technique will be described. FIG. 1 is a block diagram illustrating a schematic configuration of an example of a test
本実施形態のテストケース生成装置10は、配列を構成する複数の要素の位置を表すインデックスをシンボル変数としたシンボリック実行を行う機能を有する。
The test
シンボリック実行とは、プログラム中の変数を具体化せず、シンボル値という特殊な値を持たせたまま実行する技術である。このシンボル値を保持する変数のことをシンボル変数という。 Symbolic execution is a technique that does not embody variables in a program but executes them with special values called symbol values. A variable that holds this symbol value is called a symbol variable.
シンボリック実行では、シンボル変数が分岐等の判定条件に利用された場合に、判定条件が成立する場合及び成立しない場合のそれぞれのパターンを網羅的に実行する。この場合、現在のパターンを実行するために、すなわち、判定条件を成立させる及び成立させないために、シンボル値が満たさなければならない条件を保持する。シンボル値が満たさなければならない条件をパス条件という。パス条件は、シンボリック実行によって実行された各実行パス毎に保持される。あるパス条件を充足するようなシンボル値が存在しない場合、そのパス条件を保持する実行パスは実行不可能であるため、テスト対象から除外できる。充足可能なパス条件を保持する実行パスについては、パス条件の充足値をテストデータとみなすことで、テストデータを生成することができる。また、各テストデータが満たすパス条件は、テストデータがどのような実行経路を通過したかを示しており、テストデータに対するある面からの意味づけを与えている。 In symbolic execution, when a symbol variable is used for a determination condition such as a branch, each pattern when the determination condition is satisfied and when the determination condition is not satisfied is comprehensively executed. In this case, in order to execute the current pattern, that is, in order to satisfy and not satisfy the determination condition, the condition that the symbol value must satisfy is held. A condition that a symbol value must satisfy is called a path condition. The path condition is held for each execution path executed by symbolic execution. If there is no symbol value that satisfies a certain path condition, the execution path that holds the path condition is not executable and can be excluded from the test target. For an execution path that holds a satisfying path condition, test data can be generated by regarding the satisfaction value of the path condition as test data. The path condition satisfied by each test data indicates what execution path the test data has passed through, and gives a certain meaning to the test data.
なお、シンボリック実行に関する基礎的な事項は、非特許文献である玉井哲雄、福永光一、「記号実行システム」、情報処理、pp.18-28等に記載されている。また、Java(登録商標)プログラムに対するシンボリック実行エンジンとしては、http://babelfish.arc.nasa.gov/trac/jpfに、Java(登録商標) PathFinder等が開示されている。また、シンボリック実行技術の公知例としては、特開2009−087355号公報に記載された技術等が挙げられる。そのため、ここでは、シンボリック実行に関する基礎的な事項の詳細な説明を省略する。 Basic items regarding symbolic execution are described in non-patent documents Tetsuo Tamai, Koichi Fukunaga, “Symbol Execution System”, Information Processing, pp.18-28, etc. Further, as a symbolic execution engine for a Java (registered trademark) program, Java (registered trademark) PathFinder or the like is disclosed at http://babelfish.arc.nasa.gov/trac/jpf. Further, as a known example of the symbolic execution technique, a technique described in JP 2009-087355 A can be cited. For this reason, detailed description of basic matters related to symbolic execution is omitted here.
開示の技術の実行部の一例であるシンボリック実行部12は、シンボリック実行対象であるプログラム11(以下、「対象プログラム」という)に対して、シンボリック実行を行う機能を有する。また、シンボリック実行部12は、シンボル変数に関するテストデータとパス条件26とを含むテストケース33を生成して出力する機能を有する。具体的には、シンボリック実行部12は、シンボリック実行を行い、インデックス選択部16により選択されたインデックス値に対応する要素(シンボル値)が通過するパスを表すパス条件26を生成する。さらに、シンボリック実行部12は、生成したパス条件26を充足するテストデータと、前記パス条件とを含むテストケース33を出力する。
The
なお、シンボリック実行においては、配列のアクセスに関するパス条件を制約ソルバが扱える形で表現することが必要となる。制約ソルバが扱える条件式は、数値、文字列等のプリミティブ、あるいはそれに準ずるデータ型に関するものであり、データ型がinstanceof等の一般のオブジェクト型(Object型)である条件式は扱えない。そのため、シンボリック実行部12では、データ型がint型のパス条件26を生成する。
In symbolic execution, it is necessary to express path conditions related to array access in a form that can be handled by the constraint solver. The conditional expressions that can be handled by the constraint solver are related to primitives such as numerical values and character strings, or data types equivalent thereto, and cannot handle conditional expressions whose data type is a general object type (Object type) such as instanceof. Therefore, the
インデックスアクセス検出部14は、シンボリック実行部12で実行する命令が、シンボル変数をインデックスとした配列を構成する要素へのアクセス命令か否かを検出する機能を有する。インデックスアクセス検出部14は、開示の技術の検出部の一例である。
The index
開示の技術の選択部の一例であるインデックス選択部16は、インデックス値の中から、現在の命令の後続の処理を継続するインデックス値を選択する機能を有する。シンボリック実行部12では、選択されたインデックス値に対応するパス条件26を生成する。そのため、具体的には、インデックス選択部16は、シンボリック実行部12によってパス条件を生成するインデックス値を選択してシンボリック実行部12に出力する機能を有する。より具体的には、インデックス選択部16は、選択済のインデックス値と未選択のインデックス値とを表す情報であるインデックス選択情報28を生成する。インデックス選択情報28の未選択のインデックス値がインデックス値の選択対象となる。そして、インデックス選択部16は、生成したインデックス選択情報28から、未選択のインデックス値を選択してシンボリック実行部12に出力する機能を有する。
The
同一要素判定部20は、命令を実行する際の配列に存在する要素同士が同一で有るか否かを判定する機能を有する。
The same
同一要素インデックス情報生成部18は、シンボル変数をインデックスとした配列のアクセス命令に対して、同一要素が格納されているインデックス値をまとめた同一要素インデックス情報30を生成する機能を有する。具体的には、同一要素インデックス情報生成部18は、同一要素判定部20の判定結果に基づいて、同一要素インデックス情報30を生成する。同一要素インデックス情報生成部18は、開示の技術の生成部の一例である。
The same element index
インデックス等価条件生成部22は、シンボル変数をインデックスとした配列のアクセス命令を含む実行パスに関し、対応するパス条件からインデックス等価条件32を生成する機能を有する。具体的には、インデックス等価条件32とは、シンボリック実行部12が生成したパス条件26から選択したインデックス値に由来する制約式を除いたものである。すなわち、インデックス等価条件32とは、同一要素を有し、インデックス値が同じパスを通過するための条件である。
The index equivalent
インデックス等価判定部24は、シンボリック実行部12で使用したインデックス値の要素と同一の要素に対応する未選択のインデックス値が、インデックス等価条件32を充足可能か否かを判定する機能を有する。具体的には、同一要素インデックス情報30に基づいて、シンボリック実行部12で使用したインデックス値の要素と同一の要素を検出して、判定を行う。また、インデックス等価判定部24は、インデックス値がインデックス等価条件32を充足可能と判定した場合は、判定したインデックス値をインデックス選択情報28において未選択のインデックス値から除外する機能を有する。すなわち、インデックス等価判定部24は、インデックス等価条件32を充足可能なインデックス値を選択対象のインデックス値から除外する機能を有する。具体的には、インデックス等価判定部24は、除外するインデックス値を、インデックス選択情報28において未選択から選択済に変更することにより選択対象から除外して更新を行う。
The index
このように、インデックス等価判定部24がインデックス値を未選択から選択済に変更する更新を行うことにより、インデックス値が選択対象から除外されるため、インデックス選択部16は、除外されたインデックス値を選択することがなくなる。このため、シンボリック実行部12では、間引かれたインデックス値に対するパス条件の生成(後続処理の実行)を行わない。
As described above, since the index
テストケース生成装置10の動作について説明する。具体例として、TargetClass.method1に対して、テストケース生成装置10がシンボリック実行を行い、テストケース33を生成する場合について説明する。図2には、プログラム(TargetClass.method1)の具体例を示す。また、図3には、図2に示したプログラムのフローを表したフロー図を示す。なお、図3に示したフロー図の記号内の数字は、プログラムの行に対応している。さらに、図4には、テストケース生成装置10によるテストケースの生成を説明するための図を示す。
The operation of the test
テストケース生成装置10により、図2及び図3に示した、プログラム(TargetClass.method1)のシンボリック実行を実行する。TargetClass.method1では、シンボル変数としてidxが指定されている。このidxに対するシンボル値をαとした場合、シンボリック実行では、図5に示した実行空間を探索する。
The test
シンボリック実行開始後、シンボリック実行部12はプログラムの06行目の命令を実行する。ここではシンボル変数に関する操作はないので実行空間上で分岐は生成されず、シンボリック実行部12は、引き続き07行目を実行する。07行目の命令の「value = array[α]」は配列へのアクセスを行う。この場合、アクセスに使用するインデックス値はシンボル値であり、シンボル値の条件によって返却される配列の要素が異なってくるので実行空間に分岐が発生する。実行空間の07行目から続く各エッジが発生する分岐に対応している。エッジに付与した「α==0」及び「α==1」といったラベルはそれぞれインデックス値が「0」の場合及び「1」の場合といった場合分けを示唆している。ここで、07行目の実行時点において、配列(array)には6つの要素(「a1」、「b1」、「a2]、「b1」、「b1」、及び「a1」)が格納されている。
After starting symbolic execution, the
インデックスアクセス検出部14は、07行目の「value=array[α]」がシンボル変数を使用した配列へのアクセス命令であることを検出する。
The index
同一要素インデックス情報生成部18及び同一要素判定部20は、この配列に基づいて、同一要素インデックス情報30を生成する。図4及び図5には、生成される同一要素インデックス情報30の具体例が示されている。
The same element index
インデックス選択部16は、インデックス選択情報28を生成する。図4に示した更新前のインデックス選択情報28は、既に、インデックス値「0」及び「5」が選択済であり、新たに、インデックス選択部16がインデックス値「1」を選択して、シンボリック実行部12に出力した状態を示している。
The
シンボリック実行部12では、インデックス値「1」に応じたパス条件26を生成する。ここでは、図4及び図5に示したように、パス条件26として、「α==1 && α<4」が生成される。シンボリック実行部12は、テスト入力が「idx(α):1」、及びパス条件が「α==1 && α<4」のテストケースをテストケース33の1つとして出力する。
The
インデックス等価条件生成部22は、生成されたパス条件26からインデックス値(idx)に由来した制約を除いたインデックス等価条件32を生成する。パス条件26が「α==1 && α<4」の場合、「α==1」を除くため、インデックス等価条件32は、「α<4」となる。
The index equivalent
インデックス等価判定部24は、同一要素インデックス情報30に基づいて、インデックス等価条件32を充足可能なインデックス値を判定する。上記具体例の場合、インデックス値が1と同じ要素を有するインデックス値は、同一要素インデックス情報30によると、「3」及び「4」である。インデックス値が「3」の場合は、インデックス等価条件32である「α<4」を充足する。一方、インデックス値が「4」の場合は、インデックス等価条件32である「α<4」を充足できない。そのため、インデックス等価判定部24は、インデックス値「3」を充足可能であると判定する。すなわち、インデックス値「3」の場合は、パス条件26がインデックス値「1」の場合と同様になるため、テストケースを生成せずとも(テストを行わなくとも)、プログラムの動作確認には支障がない。そこで、インデックス等価判定部24は、インデックス値「3」を未選択から選択済に変更し、インデックス選択情報28の更新を行う。インデックス値「3」が選択済となったため、インデックス選択部16は、インデックス値「3」を選択しない。そのため、シンボリック実行部12では、インデックス値「3」に応じたパス条件26は生成しない。
The index
図6には、上述のようにしてテストケース生成装置10により形成されるテストケース33を示す。テストケース生成装置10では、図5に示したように、インデックス値が「0」及び「5」の場合は、生成されるテストケースを1つにまとめることができる。また、テストケース生成装置10では、図5に示したように、インデックス値が「1」及び「3」の場合は、生成されるテストケースを1つにまとめることができる。従って、テストケース生成装置10では、図6に示したように、No.1〜4まで、4つのテストケースを含むテストケース33が生成される。
FIG. 6 shows the
(比較例)
ここで、比較例として、従来のテストケース生成装置によりシンボリック実行を行う場合について説明する。
(Comparative example)
Here, a case where symbolic execution is performed by a conventional test case generation device will be described as a comparative example.
シンボリック実行ではシンボル変数が関係する各分岐に関して、分岐条件成立の場合と非成立の場合のそれぞれの場合を探索・実行する。すなわち、各分岐条件の成立・非成立の組合せを行うことに等しい。この組合せの数はシンボル変数が関係する分岐条件数に対して幾何級数的に増加するため、ある程度規模の大きいプログラムになると組合せ数が多くなりすぎてシンボリック実行に要する計算資源が用意されたものを超えてしまう。例えば、図38に示すように、n個の独立した分岐が存在するプログラムを考える。図38に示したプログラムは分岐の組合せとして、2nのパスを持つため、容易に組合せ爆発を引き起こす懸念がある。 In symbolic execution, each branch related to a symbol variable is searched for and executed when the branch condition is satisfied and when it is not satisfied. That is, it is equivalent to performing a combination of establishment / non-establishment of each branch condition. Since the number of combinations increases geometrically with respect to the number of branch conditions related to the symbol variable, the number of combinations becomes too large for a program with a certain size, so that the computing resources required for symbolic execution are prepared. It will exceed. For example, consider a program in which n independent branches exist as shown in FIG. Since the program shown in FIG. 38 has 2n paths as a combination of branches, there is a concern that a combination explosion may easily occur.
配列へのアクセスが含まれるプログラムに対するシンボリック実行の従来技術として、次に述べる手法を比較例として説明する。比較例の手法では、シンボリック実行中にシンボル変数による配列へのインデックスアクセスに遭遇した場合、配列を構成する全要素に関して、各要素を選択した場合のパスを解析する。例えば、配列に3要素ある場合、0番目、1番目、2番目をそれぞれ選択した場合の実行パターンをすべて解析する。 As a conventional technique of symbolic execution for a program including access to an array, the following method will be described as a comparative example. In the method of the comparative example, when index access to an array by a symbol variable is encountered during symbolic execution, the path when each element is selected is analyzed for all elements constituting the array. For example, when there are three elements in the array, all execution patterns when 0th, 1st, and 2nd are selected are analyzed.
実施形態で示したプログラム(図2参照)に対して比較例の手法を適用した場合について説明する。命令の07行目を実行する時点において、配列(array)には6つの要素が格納されており、比較例ではそれにしたがって「α==0」から「α==5」までの6通りの分岐を発生させる。シンボリック実行エンジンはこれら6通りの分岐を解析し、最終的には図39に示す実行空間を探索してNo.1〜6までのテストケースを含んだテストケースを得る。ここで、探索した実行パターンは9パターンであるが、そのうちの3パターンは実際には通過し得ない分岐の組合せを経ていることがパス条件から分かり、対応するテストケースもそれらのパターンを除いたものとなっている。 A case where the method of the comparative example is applied to the program (see FIG. 2) shown in the embodiment will be described. At the time of executing the 07th line of the instruction, six elements are stored in the array, and in the comparative example, there are six branches from “α == 0” to “α == 5” accordingly. Is generated. The symbolic execution engine analyzes these six branches, and finally searches the execution space shown in FIG. A test case including 1 to 6 test cases is obtained. Here, there are nine execution patterns that have been searched for, but it is clear from the path condition that three of these patterns have undergone a combination of branches that cannot actually pass through, and the corresponding test cases also exclude those patterns. It has become a thing.
比較例のテストケース生成装置では、9パターンを探索した結果、6つのテストケースを生成している。一方、上述したように本実施形態のテストケース生成装置10では、6パターンを探索した結果、4つのテストケースを含むテストケース33を生成している。このように、本実施形態のテストケース生成装置10では、探索するパターンの数を少なくし、シンボリック実行の効率化を図ることができる。そのため、本実施形態のテストケース生成装置10では、組合せ爆発の発生を抑制することができる。
In the test case generation device of the comparative example, six test cases are generated as a result of searching for nine patterns. On the other hand, as described above, the test
(実施例)
次に、開示の技術について、実施例を参照して詳細に説明する。なお、本実施例は、上述したテストケース生成装置10と同様の技術に関して詳細に説明するためのものであるため、テストケース生成装置100において上述と同様の構成及び動作については、詳細な説明を省略する場合がある。
(Example)
Next, the disclosed technique will be described in detail with reference to examples. In addition, since the present Example is for explaining in detail about the same technology as the test
図7は、本実施例に係るテストケース生成装置100の一例の概略構成を示すブロック図である。図7に示すように、テストケース生成装置100は、シンボリック実行部112、インデックスアクセス検出部114、及びインデックス選択部116を備える。さらに、テストケース生成装置100は、同一要素インデックス情報生成部118、同一要素判定部120、インデックス等価条件生成部122、及びインデックス等価判定部124を備える。
FIG. 7 is a block diagram illustrating a schematic configuration of an example of the test
シンボリック実行部112は、上述したテストケース生成装置10のシンボリック実行部12(図1参照)に対応している。なお、シンボリック実行部112は、シンボリック実行部12と有している機能は同じであるが、有している種々の機能を実現するための機能部を備える。本実施例のシンボリック実行部112は、プログラム実行部140、パス条件計算部142、及び充足可能性判定部144を備えている。
The
プログラム実行部140は、シンボリック実行対象であるプログラム111(以下、「対象プログラム」という)に対して、シンボリック実行を行う機能を有する。パス条件計算部142は、インデックス選択部116により選択されたインデックス値に対応する要素(シンボル値)が通過するパスを表すパス条件126を計算することによりパス条件126を生成する機能を有する。充足可能性判定部144は、インデックス選択部116により選択されたインデックス値がパス条件126を充足する可能性の有無を判定する機能を有する。シンボリック実行部112は、パス条件126と充足可能性判定結果146とを含むテストケース133を出力する。
The
インデックスアクセス検出部114は、上述したテストケース生成装置10のインデックスアクセス検出部14(図1参照)に対応している。また、インデックス選択部116は、上述したテストケース生成装置10のインデックス選択部16(図1参照)に対応している。また、同一要素インデックス情報生成部118は、上述したテストケース生成装置10の同一要素インデックス情報生成部18(図1参照)に対応している。また、同一要素判定部120は、上述したテストケース生成装置10の同一要素判定部20(図1参照)に対応している。さらに、インデックス等価条件生成部122は、上述したテストケース生成装置10のインデックス等価条件生成部22(図1参照)に対応している。テストケース生成装置100が有するこれらの各機能部は、それぞれ対応するテストケース生成装置10の各機能部と同様の機能を有している。
The index
また、インデックス等価判定部124は、上述したテストケース生成装置10のインデックス等価判定部24(図1参照)に対応している。なお、インデックス等価判定部124は、インデックス等価判定部24と有している機能は同じであるが、有している種々の機能を実現するための機能部を備える。本実施例のインデックス等価判定部124は、チェック対象インデックス特定部150、シンボルインデックス具体化部152、充足可能性判定部154、結果集計部156、及びインデックス選択情報更新部158を備えている。
The index
チェック対象インデックス特定部150は、同一の要素に対応する未選択のインデックス値をインデックス選択情報128及び同一要素インデックス情報130に基づいて特定する機能を有する。シンボルインデックス具体化部152は、インデックス等価条件132に対してシンボル化されたインデックス(シンボルインデックス)を具体化して制約ソルバとする機能を有する。充足可能性判定部154は、未選択のインデックス値が、制約ソルバ(インデックス等価条件132)を全て充足可能か否かを判定する機能を有する。結果集計部156は、充足可能性判定部154の判定結果を集計する機能を有する。また、インデックス選択情報更新部158は、結果集計部156で集計した集計結果に基づいて、インデックス選択情報128を更新する機能を有する。
The check target
なお、テストケース生成装置100及び上述したテストケース生成装置10は、例えば図8に示すコンピュータ60で実現することができる。コンピュータ60はCPU(Central Processing Unit)62、メモリ64、不揮発性の記憶部66、入出力インターフェース(I/F)68、及びネットワークI/F70を備える。CPU62、メモリ64、記憶部66、入出力I/F68、及びネットワークI/F70は、バス71を介して互いに接続されている。入出力I/F68は、外部の入力装置及び出力装置に接続されている。入力装置は、テストケースを生成するための種々の情報を入力するための機能を有する装置であり、具体例としては、キーボードや、マウス等が挙げられる。また、出力装置は、生成されたテストケース133、33等を出力する機能を有する装置であり、具体例としては、ディスプレイ等の各種表示装置やプリンタ等が挙げられる。
Note that the test
記憶部66はHDD(Hard Disk Drive)やフラッシュメモリ等によって実現できる。記憶媒体としての記憶部66には、コンピュータ60をテストケース生成装置100、10として機能させるためのテストケース生成プログラム72が記憶されている。CPU62は、テストケース生成プログラム72を記憶部66から読み出してメモリ64に展開し、テストケース生成プログラム72が有する各プロセスを順次実行する。
The
テストケース生成プログラム72は、シンボリック実行プロセス74、インデックスアクセス検出プロセス76、インデックス選択プロセス78、及び同一要素インデックス情報生成プロセス80を有する。また、テストケース生成プログラム72は、同一要素判定プロセス82、インデックス等価条件生成プロセス84、及びインデックス等価判定プロセス86を有する。
The test
CPU62は、シンボリック実行プロセス74を実行することで、シンボリック実行部112、12として動作する。また、CPU62は、インデックスアクセス検出プロセス76を実行することで、インデックスアクセス検出部114、14として動作する。また、CPU62は、インデックス選択プロセス78を実行することで、インデックス選択部116、16として動作する。また、CPU62は、同一要素インデックス情報生成プロセス80を実行することで、同一要素インデックス情報生成部118、18として動作する。また、CPU62は、同一要素判定プロセス82を実行することで、同一要素判定部120、20として動作する。また、CPU62は、インデックス等価条件生成プロセス84を実行することで、インデックス等価条件生成部122、22として動作する。さらに、CPU62は、インデックス等価判定プロセス86を実行することで、インデックス等価判定部124、24として動作する。
The
これにより、テストケース生成プログラム72を実行したコンピュータ60が、テストケース生成装置100、10として機能する。
As a result, the
なお、テストケース生成装置100、10は、例えば半導体集積回路、より詳しくはASIC(Application Specific Integrated Circuit)等で実現することも可能である。
Note that the test
次に、本実施例に係るテストケース生成装置100による作用を、具体例として、図9に示したプログラム(TargetClass.method1)のテストケース133を生成する場合について説明する。図9には、プログラム(TargetClass.method1)の具体例を示す。また、図10には、図9に示したプログラムのフローを表したフロー図を示す。なお、図10に示したフロー図の記号内の数字は、プログラムの行に対応している。
Next, a case where the
まず、テストケース生成装置100で実行されるテストケース生成処理の全体の流れについて説明する。図11は、テストケース生成装置100で実行されるテストケース生成処理の一例を示すフローチャートである。図11に示したテストケース生成処理は、入出力I/F68等を介して、ユーザ等からテストケースの生成を指示された場合に実行される。
First, the overall flow of the test case generation process executed by the test
ステップS100では、詳細を後述するシンボリック実行処理を、テストケース生成装置100の各機能部が、シンボリック実行対象111のプログラム(図9参照)に対して行う。シンボリック実行処理により、テストケース133が生成される。
In step S100, each functional unit of the test
なお、本実施例では、具体例として、対象プログラムは、入出力I/F68または、ネットワークI/F70を介してメモリ64に格納される。
In the present embodiment, as a specific example, the target program is stored in the memory 64 via the input / output I /
次のステップS102では、テストケース生成装置100が、入出力I/F68等を介して生成されたテストケース133を出力した後、本処理を終了する。
In the next step S102, the test
本実施例のテストケース生成装置100で、生成されて出力される図9に示したプログラムのテストケース133を図12に示す。
FIG. 12 shows a
次に、テストケース生成処理のステップS100のシンボリック実行処理について説明する。図13は、テストケース生成装置100で実行されるシンボリック実行処理(図11、ステップS100)の一例を示すフローチャートである。
Next, the symbolic execution process in step S100 of the test case generation process will be described. FIG. 13 is a flowchart illustrating an example of symbolic execution processing (FIG. 11, step S100) executed by the test
まず、ステップS200では、シンボリック実行部112が、シンボリック実行を開始するための処理として初期化を行う。初期化の手順を手順1として説明する。図14は、本実施例のテストケース生成装置100で実行される手順1を説明するための図である。
First, in step S200, the
対象プログラムでは、具体例として、06行目までは、シンボル変数が関係しないため、実行パスの分岐が生じない。そのため、シンボリック実行部112が、対象プログラムを06行目まで実行する。
In the target program, as a specific example, up to the 06th line, since the symbol variable is not related, the branch of the execution path does not occur. Therefore, the
次のステップS202では、シンボリック実行部112が対象プログラムに後続の命令が存在するか否かを判定し、後続する命令が有る場合は、ステップS204へ移行する。
In the next step S202, the
ステップS204では、シンボリック実行部112が対象プログラムの命令を解析し、さらに次のステップS206では、各機能部により分岐選択処理が実行される。図15は、ステップS206の分岐選択処理の一例を示すフローチャートである。
In step S204, the
ステップS300では、インデックスアクセス検出部114が、シンボル変数による配列アクセスであるか否かを判定する。シンボル変数ではない場合は、ステップS310へ移行する。シンボル変数である場合は、ステップS302へ移行する。ステップS300の処理の手順を手順2として説明する。図16は、本実施例のテストケース生成装置100で実行される手順2を説明するための図である。
In step S300, the index
シンボリック実行部112は、07行目の命令「07:value = array[α]」が配列アクセス命令のオペランドがシンボル値であるか否かを確認する。なお、簡略化のため、array[α]と記載しているが、配列(array)のメモリ状態は、{a1,b1,b2,b1,b1,a1}であるため、正確には、{a1,b1,b2,b1,b1,a1}[α]と記載すべきである。より正確には、a1,b1,b2もヒープへの参照IDとすべきであるが、説明の便宜上、上記のように簡略化する。
The
シンボル変数を使用しないアクセスであれば、シンボリック実行部112は、通常のシンボリック実行を継続するため、ステップS300からステップS310へ移行する。ステップS310では、分岐発生の有無を判定し、分岐が発生していない場合は、本分岐選択処理を終了する。一方、分岐が発生している場合は、ステップS312へ移行する。ステップS312でシンボリック実行部12は、命令に従い分岐を選択した後、本分岐選択処理を終了する。
If the access does not use a symbol variable, the
一方、シンボリック実行部112が、シンボル変数を使用するアクセスであると判定した場合は、ステップS302へ移行する。
On the other hand, if the
ステップS302では、テストケース生成装置100がインデックス情報の有無を判定する。具体的には、テストケース生成装置100は、インデックス選択情報128及び同一要素インデックス情報130の両方が存在するか否かを判定する。インデックス選択情報128及び同一要素インデックス情報130の少なくとも一方が存在しない場合は、ステップS304へ移行する。ステップS304では、同一要素インデックス情報生成部118が同一要素インデックス情報130を生成する。次のステップS306では、インデックス選択部16がインデックス選択情報128を生成する。ステップS304及びS306の処理の手順を手順3として説明する。図17は、本実施例のテストケース生成装置100で実行される手順3を説明するための図である。
In step S302, the test
同一要素インデックス情報生成部118は、同一要素判定部120の判定結果に基づいて、ヒープ上の同じオブジェクトを参照しているものをまとめることにより、同一要素インデックス情報130を生成する。本実施例の同一要素インデックス情報生成部118は、配列の各要素の中で、インデックス値が同じものとして、ヒープ上の同じオブジェクトを参照しているものをまとめる。同一要素インデックス情報130のNo.1は、配列(array)の0番目と5番目は、内容的に同じ要素を有することを表している。また、No.2は、配列(array)の1番目、3番目、及び4番目は、内容的に同じ要素を有することを表している。さらにNo.3は、配列(array)の2番目は、内容的に同じ要素を有するものがないことを表している。
The same element index
なお、ここで、同一要素判定部120が同一要素であるか否かについて判定する判定基準は予め定めておき、記憶部66やメモリ64等に記憶しておけばよい。判定基準は、本実施例に限らず、属性やオブジェクト等に応じて可変であり、対象プログラムのテストを行いたい観点等に基づいて定めることができる。例えば、要素「a」、「b」という観点を判定基準として、同一要素インデックス情報生成部118が同一要素インデックス情報を生成した場合は、図18に示した同一要素インデックス情報130Aが生成される。
Here, determination criteria for determining whether or not the same
また、インデックス選択部116は、インデックス選択情報128を生成する。ここでは、インデックス選択情報128を生成したばかりであり、いずれのインデックス値も選択されていないため、インデックス選択情報128は、全てのインデックス値が未選択(初期化)の状態となる。
Further, the
ステップS306の次、または、ステップS302でインデックス情報が有ると判定した場合に移行するステップS308では、インデックス選択部116が未選択のインデックス値を選択した後、本分岐選択処理を終了する。ステップS308の処理の手順を手順4として説明する。図19は、本実施例のテストケース生成装置100で実行される手順4を説明するための図である。
Subsequent to step S306 or in step S308, which is shifted when it is determined that there is index information in step S302, the
インデックス選択部116は、インデックス選択情報128を参照し、未選択のインデックス値の中から一つ選択し、選択したインデックス値を選択済とする。図19は、インデックス選択部116がインデックス値「0」を選択した状態を示している。インデックス選択部116は、選択したインデックス値をシンボリック実行部112に出力する。なお、インデックス選択部116がいずれのインデックス値を選択するかは任意である。シンボリック実行部112は、インデックス選択部116が選択したインデックス値に対応する分岐を作成し、実行する。
The
このようにしてステップS206の分岐選択処理が終了すると、ステップS208へ進む。 When the branch selection process in step S206 is completed in this way, the process proceeds to step S208.
ステップS208では、シンボリック実行部112が、インデックス選択部116により選択されたインデックス値に応じたパス条件を計算して生成する。シンボリック実行部112は、計算したパス条件に基づいて、各制約(制約ソルバ)がどの分岐に由来するものかを表す対応関係をメモリ64等に記憶しておく。
In step S208, the
次のステップS210では、シンボリック実行部112は、ステップS208で得たパス条件を充足可能であるか否かを判定する。充足不可能である場合は、ステップS218へ移行する。一方、充足可能である場合は、ステップS212へ移行する。ステップS212では、シンボリック実行部12が対象プログラムの命令を実行した後、ステップS202に戻る。
In the next step S210, the
ステップS202で、後続の命令が存在しない場合は、ステップS214へ移行する。ステップS214では、シンボリック実行部112が、テストケースを生成する。具体的には、シンボリック実行部112は、インデックス選択部116で選択されたインデックス値に対応するテストケースを生成する。
If there is no subsequent instruction in step S202, the process proceeds to step S214. In step S214, the
次のステップS216では、インデックス情報更新処理を行う。図20は、ステップS216の情報更新処理の一例を示すフローチャートである。 In the next step S216, index information update processing is performed. FIG. 20 is a flowchart illustrating an example of the information update process in step S216.
ステップS400では、インデックス等価条件生成部122が、ステップS214で生成したテストケースがシンボル変数による配列アクセスが関係するテストケースであるか否かを判定する。本実施例では、シンボリック実行部112は、上記ステップS208の処理で記憶しておいた、対応関係に基づいて、パス条件の各制約式が由来する命令を取得し、取得した命令が配列アクセス命令であるか否かを確認する。配列アクセスが関係するテストケースではない場合は、本インデックス情報更新処理を終了する。一方、配列アクセスが関係するテストケースである場合は、ステップS402へ移行する。
In step S400, the index equivalent
ステップS402では、インデックス等価条件生成部122がインデックス等価条件132を計算する。本実施例では、計算したインデックス等価条件132は、少なくとも、下記のステップS406の処理まで、保持する必要があるため、メモリ64等に記憶しておく。テップS402の処理の手順を手順5として説明する。図21は、本実施例のテストケース生成装置100で実行される手順5を説明するための図である。インデックス等価条件生成部122は、インデックス選択を含むパス毎に、インデックス等価条件132を計算する。具体的には、パス条件からインデックス値によるアクセス由来の制約を除いたものがインデックス等価条件132である。図21に示した例では、インデックス値「0」の場合、No.1のテストケースは、テスト入力が「idx(α):0、n(β):4」、「パス条件が「α==0 && β>3」である。この場合は、インデックス値に由来する「α==0」を除いたものがインデックス等価条件132となるため、インデックス等価条件132は、「β>3」となる。また、No.2のテストケースは、テスト入力が「idx(α):0、n(β):0」、「パス条件が「α==0 && β<=3」である。この場合は、インデックス値に由来する「α==0」を除いたものがインデックス等価条件132となるため、インデックス等価条件132は、「β<=3」となる。
In step S402, the index equivalent
次のステップS404では、インデックス等価判定部124は、注目するインデックス値選択について以降の全状態を探索済みであるか否かを判定する。すなわち、インデックス等価判定部124は、インデックス選択部116で選択し、テストケースを生成したインデックス値について、全状態の探索が済んでいるか否かを判定する。探索済みでない場合は、本インデックス情報更新処理を終了する。一方、探索済みの場合は、ステップS406へ移行する。
In the next step S404, the index
ステップS406では、インデックス等価判定部124が、未選択かつ注目するインデックス値と同じ要素が格納されているインデックス値を取得する。次のステップS408では、インデックス等価判定部124が、インデックス選択情報128において、取得したインデックス値のうち、インデックス等価条件132を満たすものを選択済にする。ステップS408の処理によりインデックス等価判定部124がインデックス選択情報128を更新した後、本インデックス情報更新処理を終了する。
In step S406, the index
ステップS406及びS408の処理の手順を手順6として説明する。図22は、本実施例のテストケース生成装置100で実行される手順6を説明するための図である。インデックス等価判定部124は、同一要素インデックス情報130を参照し、選択(注目)したインデックス値と要素が同一のインデックス値を取得する。上述した具体例のように、インデックス値「0」を選択(注目)している場合、インデックス等価判定部124は、同一要素インデックス情報130を参照し、同じ「a1」を要素とする、インデックス値「5」を取得する。なお、この時点では、インデックス選択情報128において、インデックス値「5」は、未選択状態である。
The procedure of steps S406 and S408 will be described as
さらに、インデックス等価判定部124は、上記ステップS402(手順5)で計算したインデックス等価条件132の全てをインデックス値「5」の場合に充足可能か否かを判定する。具体的には、インデックス等価判定部124は、インデックス等価条件132に、インデックス値に由来する制約である「α==5」を付加して制約ソルバを生成する。そして、インデックス等価判定部124は、インデックス値「5」の場合に、生成した全ての制約ソルバを充足可能か否かを判定する。インデックス値「5」の場合は、全ての制約ソルバを充足する。これは、インデックス値「0」の場合と、インデックス値「5」の場合とでは、同じパスを通過することを意味している。そのため、本実施例のテストケース生成装置100では、インデックス値「5」については、探索を行わず、テストケースを生成しない。そのため、インデックス等価判定部124は、インデックス選択情報128において、インデックス値「5」を選択済にして更新する。
Furthermore, the index
このようにしてステップS216のインデックス情報更新処理が終了すると、ステップS218へ進む。 When the index information update process in step S216 is completed in this way, the process proceeds to step S218.
ステップS218では、シンボリック実行部112がバックトラック先の有無を判定する。図23は、ステップS218におけるバックトラック先判定処理の一例を示すフローチャートである。
In step S218, the
ステップS500では、シンボリック実行部112が、対象プログラムが開始状態であるか否かを判定する。開始状態である場合は、バックトラック先が無いとして、本バックトラック先判定処理を終了する。一方、開始状態ではない場合は、ステップS502へ移行する。
In step S500, the
ステップS502では、シンボリック実行部112がシンボル変数による配列アクセスであるか否かを判定する。シンボル変数による配列アクセスである場合は、ステップS504へ移行する。ステップS502及びS504の処理の手順を手順7として説明する。図24は、本実施例のテストケース生成装置100で実行される手順7を説明するための図である。図24(1)は、上述した具体例のように、インデックス値「0」、「5」が選択済となっている場合のインデックス選択情報128を示している。また、図24(2)は、具体例として、全てのインデックス値が選択済となっている場合のインデックス選択情報128を示している。
In step S502, the
シンボル変数による配列アクセスであり、未選択のインデックス値がある場合、すなわち、図24(1)の場合は、ステップS504の判定により、バックトラック先が有るとして本バックトラック先判定処理を終了する。一方、シンボル変数による配列アクセスであり、未選択のインデックス値が無い場合、すなわち、図24(2)の場合は、配列アクセスの前の命令までバックトラックするために、ステップS506へ移行する。 In the case of array access by symbol variables and there is an unselected index value, that is, in the case of FIG. 24 (1), the backtrack destination determination processing is terminated by determining in step S504 that there is a backtrack destination. On the other hand, in the case of array access using symbol variables and there is no unselected index value, that is, in the case of FIG. 24 (2), the process proceeds to step S506 in order to backtrack to the instruction before the array access.
ステップS506で、シンボリック実行部112が、直前の状態に戻った後、ステップS500に戻る。ステップS500でプログラム開始状態ではなく、また、ステップS502でシンボル変数による配列アクセスでは無い場合は、ステップS508へ移行する。ステップS508では、シンボリック実行部112が、未選択の分岐の有無を判定する。全て選択済の場合等は、ステップS506へ移行し、本バックトラック先判定処理を繰り返す。一方、未選択の分岐がある場合は、バックトラック先が有るとして本バックトラック先判定処理を終了する。
In step S506, the
このようにしてステップS218のバックトラック先判定処理が終了すると、バックトラック先が無い場合は、対象プログラムの全てのテストケース(テストケース133)を生成したため、本シンボリック実行処理を終了する。一方、パックトラック先がある場合は、ステップS220へ移行し、シンボリック実行部112が、バックトラック先にバックトラックした後、ステップS204へ移行し、本シンボリック実行処理を繰り返す。
When the backtrack destination determination processing in step S218 is completed in this way, if there is no backtrack destination, all test cases (test case 133) of the target program have been generated, and thus this symbolic execution processing ends. On the other hand, if there is a pack track destination, the process proceeds to step S220, where the
上記では具体例として、インデックス値「0」、「5」が選択済となった状態について説明した。この具体例の場合は、ステップS218からステップS220、ステップS204を経由してステップS206の分岐選択処理を再び行う。分岐選択処理(図15参照)では、ステップS300で肯定され、さらにステップS302で肯定されるため、ステップS308に移行する。この場合の、ステップS308の処理である手順4(2回目)について説明する。図25は、本実施例のテストケース生成装置100で実行される手順4(2回目)を説明するための図である。上述の処理により、インデックス値「0」については、テストケースが生成されており、パス条件126を満たすインデックス値「5」も選択状態となっている。インデックス選択部116は、インデックス選択情報128を参照し、未選択のインデックス値「1」を選択し、選択済にする。
In the above, as a specific example, the state where the index values “0” and “5” have been selected has been described. In this specific example, the branch selection process in step S206 is performed again from step S218 through step S220 and step S204. In the branch selection process (see FIG. 15), the result is affirmative in step S300 and further affirmed in step S302, so the process proceeds to step S308. The procedure 4 (second time) that is the process of step S308 in this case will be described. FIG. 25 is a diagram for explaining the procedure 4 (second time) executed by the test
このように未選択のインデックス値をインデックス選択部116が選択することにより、シンボリック実行部112は、新たにインデックス値「0」に対応するパスを実行し、テストケースを生成する。そのため、シンボリック実行処理(図13参照)を継続し、ステップS214において、インデックス値「0」に対応するテストケースを生成する。具体的には、シンボリック実行部112は、図12に示したテストケース133のうち、No.3のテストケースを生成する。テストケースの生成後、ステップS216に進み、インデックス情報更新処理を行う。インデックス情報更新処理では、インデックス等価条件生成部122が上述した手順5(図20、ステップS402)によりインデックス等価条件132を生成する。図26は、本実施例のテストケース生成装置100で実行される手順5(2回目)を説明するための図である。
When the
図26に示した例では、インデックス値「1」の場合、No.3のテストケースは、テスト入力が「idx(α):1、n(β):0」、「パス条件が「α==1 && α<4」である。この場合は、インデックス値に由来する「α==1」を除いたものがインデックス等価条件132となるため、インデックス等価条件132は、「α<4」となる。
In the example shown in FIG. 26, when the index value is “1”, No. In the
このようにしてインデックス等価条件132が生成されると、インデックス等価判定部124が、手順6(図20、ステップS406及びS408)を行う。図27は、本実施例のテストケース生成装置100で実行される手順6(2回目)を説明するための図である。インデックス等価判定部124は、同一要素インデックス情報130を参照し、選択(注目)したインデックス値と要素が同一のインデックス値を取得する。ここでは、インデックス値「1」を選択(注目)しているため、インデックス等価判定部124は、同一要素インデックス情報130を参照し、同じ「b1」を要素とするインデックス値を取得する。具体的には、インデックス値「3」及び「4」を取得する。なお、この時点では、インデックス選択情報128において、インデックス値「3」、「4」は、未選択状態である。
When the
さらに、インデックス等価判定部124は、上記ステップS402(手順5(2回目))で計算したインデックス等価条件132の全てをインデックス値「3」及び「4」の場合に、充足可能か否かを判定する。具体的には、インデックス等価判定部124は、インデックス値「3」の場合は、インデックス等価条件132に、インデックス値に由来する制約である「α==3」を付加して制約ソルバを生成する。そして、インデックス等価判定部124は、生成した全ての制約ソルバをインデックス値「3」の場合に充足可能か否かを判定する。インデックス値「3」の場合は、全ての制約ソルバを充足する。これは、インデックス値「1」の場合と、インデックス値「3」の場合とでは、同じパスを通過することを意味している。そのため、本実施例のテストケース生成装置100では、インデックス値「3」については、探索を行わず、テストケースを生成しない。そのため、インデックス等価判定部124は、インデックス選択情報128において、インデックス値「3」を選択済にして更新する。
Further, the index
一方、インデックス値「4」の場合は、インデックス等価条件132に、インデックス値に由来する制約である「α==4」を付加して制約ソルバを生成する。そして、インデックス等価判定部124は、生成した全ての制約ソルバをインデックス値「4」の場合に充足可能か否かを判定する。インデックス値「4」の場合は、充足不能の場合がある。これは、インデックス値「1」の場合と、インデックス値「4」の場合とでは、異なるパスを通過することを意味している。そのため、本実施例のインデックス等価判定部124では、インデックス値「4」については、未選択のままとする。
On the other hand, in the case of the index value “4”, a constraint solver is generated by adding “α == 4”, which is a constraint derived from the index value, to the
このようにしてインデックス等価判定部124がインデックス選択情報128を更新すると、シンボリック実行部112が、手順7(図23、ステップS502及びS504)を行う。図28は、本実施例のテストケース生成装置100で実行される手順7(2回目)を説明するための図である。図28に示したように、インデックス選択情報128には、未選択のインデックス値があるため、上述したように、バックトラックを行い、手順4に戻る。具体例の移行の処理について、上述と同様に、手順4〜7を繰り返すため、以降の処理については、手順に従って、簡略に説明する。
When the index
図29は、本実施例のテストケース生成装置100で実行される手順4(3回目)を説明するための図である。上述の処理により、インデックス値「0」、「1」、「3」、及び「5」が選択状態となっている。インデックス選択部116は、インデックス選択情報128を参照し、未選択のインデックス値「2」を選択し、選択済にする。シンボリック実行部112は、新たにインデックス値「2」に対応するパスを実行し、テストケースを生成する。シンボリック実行部112は、インデックス値「2」に対応して、図12に示したテストケース133のうち、No.4及び5のテストケースを生成する。
FIG. 29 is a diagram for explaining the procedure 4 (third time) executed by the test
テストケースの生成後、手順5(3回目)によりインデックス等価条件132を生成する。図30は、本実施例のテストケース生成装置100で実行される手順5(3回目)を説明するための図である。
After the test case is generated, the index
図30に示した例では、インデックス値「2」の場合、No.4のテストケースは、テスト入力が「idx(α):2、n(β):3」、「パス条件が「α==2 && β>3」である。この場合は、インデックス値に由来する「α==2」を除いたものがインデックス等価条件132となるため、インデックス等価条件132は、「β>3」となる。また、No.5のテストケースは、テスト入力が「idx(α):2、n(β):0」、「パス条件が「α==2 && β<=3」である。この場合は、インデックス値に由来する「α==2」を除いたものがインデックス等価条件132となるため、インデックス等価条件132は、「β<=3」となる。
In the example shown in FIG. 30, when the index value is “2”, No. In the
このようにしてインデックス等価条件132が生成されると、インデックス等価判定部124が、手順6(3回目)を行う。図31は、本実施例のテストケース生成装置100で実行される手順6(3回目)を説明するための図である。インデックス等価判定部124は、同一要素インデックス情報130を参照し、選択(注目)したインデックス値と要素が同一のインデックス値を取得する。インデックス値「2」と要素が同一のインデックス値は存在しない。そのため、インデックス等価判定部124は、インデックス値を取得せず、また、上述した処理も行わない。そのため、インデックス選択情報128は更新前と更新後とで変化しない。
When the
続いてシンボリック実行部112は手順7(3回目)を行う。図32は、本実施例のテストケース生成装置100で実行される手順7(3回目)を説明するための図である。図31に示したように、インデックス選択情報128には、未選択のインデックス値があるため、上述したように、バックトラックを行い、手順4に戻る。
Subsequently, the
図33は、本実施例のテストケース生成装置100で実行される手順4(4回目)を説明するための図である。上述の処理により、インデックス値「0」、「1」、「2」、「3」、及び「5」が選択状態となっている。インデックス選択部116は、インデックス選択情報128を参照し、未選択のインデックス値「4」を選択し、選択済にする。シンボリック実行部112は、新たにインデックス値「4」に対応するパスを実行し、テストケースを生成する。シンボリック実行部112は、インデックス値「4」に対応して、図12に示したテストケース133のうち、No.6及び7のテストケースを生成する。
FIG. 33 is a diagram for explaining the procedure 4 (fourth) executed by the test
テストケースの生成後、手順5(4回目)によりインデックス等価条件132を生成する。図34は、本実施例のテストケース生成装置100で実行される手順5(4回目)を説明するための図である。
After the test case is generated, the index
図34に示した例では、インデックス値「4」の場合、No.6のテストケースは、テスト入力が「idx(α):4、n(β):5」、「パス条件が「α==4 && α>=4 && α<β」である。この場合は、インデックス値に由来する「α==4」を除いたものがインデックス等価条件132となるため、インデックス等価条件132は、「α>=4 && α<β」となる。また、No.7のテストケースは、テスト入力が「idx(α):4、n(β):0」、「パス条件が「α==4 && α>=4 && α>=β」である。この場合は、インデックス値に由来する「α==4」を除いたものがインデックス等価条件132となるため、インデックス等価条件132は、「α>=4 && α>=β」となる。
In the example shown in FIG. 34, when the index value is “4”, No. In the
このようにしてインデックス等価条件132が生成されると、インデックス等価判定部124が、手順6(4回目)を行う。図35は、本実施例のテストケース生成装置100で実行される手順6(4回目)を説明するための図である。インデックス等価判定部124は、同一要素インデックス情報130を参照し、選択(注目)したインデックス値と要素が同一のインデックス値を取得する。インデックス値「4」と要素が同一で未選択のインデックス値は存在しない。そのため、インデックス等価判定部124は、インデックス値を取得せず、また、上述した処理も行わない。そのため、インデックス選択情報128は更新前と更新後とで変化しない。
When the
続いてシンボリック実行部112は手順7(4回目)を行う。図36は、本実施例のテストケース生成装置100で実行される手順7(4回目)を説明するための図である。図36に示したように、インデックス選択情報128には、未選択のインデックス値がない。すなわち、配列アクセスのインデックス値に対応するパスは全て探索済みとなった。そのため、配列アクセスの前までバックトラックを行う。
Subsequently, the
上述の処理により、テストケース133の生成が完了したため、テストケース生成処理では、ステップ100が終了したことになる。このようにして生成されたテストケース133(図12参照)では、No.1〜7まで7つのテストケースが生成される。テストケース生成装置100では、インデックス値「5」の場合は、インデックス値「0」にまとめられ、インデックス値「3」の場合は、インデックス値「1」にまとめられる。そのため、テストケース生成装置100では、これらのインデックス値に対する探索を間引くことにより、シンボリック実行の効率化を図ることができる。テストケース生成装置100では、このようにシンボリック実行を効率化することにより、組合せ爆発の発生を抑制することができる。
Since the generation of the
以上説明したように、テストケース生成装置10及びテストケース生成装置100によれば、インデックス選択部16、116が配列を構成する複数の要素の位置を表すインデックスのインデックス値の中から、パス条件を生成するインデックス値を選択する。シンボリック実行部12、112は、対象プログラムを、シンボリック実行する。シンボリック実行部12、112は、インデックス選択部16、116が選択したインデックス値に対応する要素が通過するパスを表すパス条件を生成して生成したパス条件を充足するテストデータと、前記パス条件とをテストケースとして出力する。
As described above, according to the test
同一要素インデックス情報生成部18、118は、同一要素判定部20、120の判定結果に基づいて、予め定められた判定基準に基づいて同一要素毎に、インデックス値をまとめた同一要素インデックス情報30、130を生成する。インデックス等価判定部24、124は、同一要素インデックス情報30、130を参照し、パス条件を生成した要素と同一要素に対応する未選択のインデックス値を選択する。また、インデックス等価判定部24、124は、パス条件からインデックス値に由来する制約を除いたインデックス等価条件32、132を生成する。インデックス等価判定部24、124は、選択したインデックス値の場合に、インデックス等価条件32、132を充足可能か判定し、充足可能である場合は、インデックス選択情報28、128において選択済として選択対象から除外する。
The same element index
このように、テストケース生成装置10、100では、シンボリック実行によるテストケースの生成において、テストケースを生成したインデックス値と同一要素であり、パス条件が同一のインデックス値を選択済とする。これにより、選択済としたインデックス値については探索を間引く(除外する)ことができるため、パスの発生を抑制することができ、シンボリック実行の効率化を図ることができる。従って、テストケース生成装置10、100では、シンボリック実行に要する時間及び空間計算量を抑制することができ、組合せ爆発の発生を抑制することができる。
As described above, in the test
なお、上記実施形態及び実施例で説明したシンボリック実行(テストケース)は、同一パス上に配列アクセスが複数存在するプログラムに対しても適用可能であることはいうまでもない。この場合のテストケース生成装置の動作の概略について図37に示した具体例を参照して説明する。図37に示した具体例では、対象プログラムの01行目(図37、S1参照)と03行目(図37、S2、S3参照)に配列アクセスが存在するため、同一パス上に、2つの配列アクセスが存在している。インデックスは、idx1=α1と、idx2=α2と2種類存在する。このような場合では、インデックス選択情報及び同一要素インデックス情報を実行空間の状態毎にもたせることで対応することができる。図37に示した場合では、状態S1、S2、及びS3毎に、インデックス選択情報及び同一要素インデックス情報をもたせればよい。また、生成されたパス条件(インデックス等価条件)には、状態S1と、状態S2またはS3と、に応じた条件式が含まれる。例えば、図37に示した場合において、「α1==0」、「α2==0」を選択した場合では、パス条件が「α1==0 && α1<4 && α2==0 && α2<2 && α1<2」となる。このうち、「α2<2 && α1<2」は、「α2==0」を選択した場合の状態S2のインデックス等価条件である。また、「α1<4 && α2==0 && α2<2 && α1<2」は、「α2==1」を選択した場合の状態S1のインデックス等価条件である。このようにインデックス等価条件も独立して計算することができるため、上記実施形態及び実施例で説明したシンボリック実行(テストケース)が適用可能となる。 Needless to say, the symbolic execution (test case) described in the above embodiments and examples can be applied to a program having a plurality of array accesses on the same path. An outline of the operation of the test case generation apparatus in this case will be described with reference to a specific example shown in FIG. In the specific example shown in FIG. 37, there are array accesses in the 01st line (see FIG. 37, S1) and the 03rd line (see FIG. 37, S2, S3) of the target program. Array access exists. There are two types of indexes, idx1 = α1 and idx2 = α2. In such a case, the index selection information and the same element index information can be provided for each state of the execution space. In the case shown in FIG. 37, the index selection information and the same element index information may be provided for each of the states S1, S2, and S3. Further, the generated path condition (index equivalent condition) includes a conditional expression corresponding to the state S1 and the state S2 or S3. For example, in the case shown in FIG. 37, when “α1 == 0” and “α2 == 0” are selected, the path condition is “α1 == 0 && α1 <4 && α2 == 0 && α2 <2. && α1 <2 ”. Among these, “α2 <2 && α1 <2” is an index equivalent condition of the state S2 when “α2 == 0” is selected. Further, “α1 <4 && α2 == 0 && α2 <2 && α1 <2” is an index equivalent condition of the state S1 when “α2 == 1” is selected. Since the index equivalence condition can also be calculated independently in this way, the symbolic execution (test case) described in the above embodiment and examples can be applied.
なお、上記実施形態及び実施例では、対象プログラムとして、プログラミング言語としてJava(登録商標)を用いたプログラムを用いたが、プログラミング言語はこれに限定されず、どのようなものであってもよい。 In the above-described embodiment and examples, a program using Java (registered trademark) as a programming language is used as the target program. However, the programming language is not limited to this, and any program may be used.
また、上記では、テストケース生成プログラム72が記憶部66に予め記憶(インストール)されている態様を説明したが、テストケース生成プログラム72を記憶媒体に記録された形態で提供することも可能である。記憶媒体としては、例えば、CD−ROM(Compact Disc Read Only Memory)、DVD−ROM(Digital Versatile Disk Read Only Memory)、及びUSB(Universal Serial Bus)等が挙げられる。
In the above description, the test
以上の上記実施形態に関し、更に以下の付記を開示する。 Regarding the above embodiment, the following additional notes are disclosed.
(付記1)
コンピュータに、
配列を構成する複数の要素の各々の位置を表すシンボル変数であるインデックス値で、除外されていない未選択のインデックス値を選択対象として、該選択対象からインデックス値を選択し、
対象プログラムをシンボリック実行することにより、選択したインデックス値に対応する要素が通過するパスを表すパス条件を生成し、生成したパス条件及び該生成したパス条件が表すパスを通過するテストデータをテストケースとして出力し、
前記選択対象に含まれるインデックス値であり、パス条件を生成した要素と同一の要素に対応するインデックス値が、生成した該パス条件からインデックス値に由来する制約を除外したインデックス等価条件を充足可能か判定し、充足可能なインデックス値を前記選択対象から除外する、
ことを含む処理を実行させるテストケース生成プログラム。
(Appendix 1)
On the computer,
An index value that is a symbol variable representing the position of each of a plurality of elements constituting the array, and an unselected index value that is not excluded is selected as an object of selection, and an index value is selected from the object of selection,
Generate a path condition that represents the path that the element corresponding to the selected index value passes by executing the target program symbolically, and test data that passes through the path that is generated and the path that the generated path condition represents Output as
Is the index value included in the selection target, and whether the index value corresponding to the same element as the element that generated the path condition can satisfy the index equivalent condition that excludes the constraint derived from the index value from the generated path condition Determining and excluding satisfiable index values from the selection target,
A test case generation program that executes processing including the above.
(付記2)
コンピュータに、
前記対象プログラム中の命令がインデックス値をシンボル変数とした配列の要素へのアクセス命令か否かを検出し、
同一であると判定した要素毎に、インデックス値をまとめた同一要素インデックス情報を生成し、
生成した前記同一要素インデックス情報に基づき、パス条件を生成した要素と同一の要素に対応する前記選択対象に含まれるインデックス値を検出する
ことを含む処理を実行させる付記1に記載のテストケース生成プログラム。
(Appendix 2)
On the computer,
Detecting whether an instruction in the target program is an access instruction to an element of an array having an index value as a symbol variable;
For each element determined to be the same, generate the same element index information that summarizes the index values,
The test case generation program according to
(付記3)
コンピュータに、
前記アクセス命令を検出した場合に、予め定められた判定基準に基づいて同一であると判定し、
判定結果に基づいて、同一であると判定した要素毎に、インデックス値をまとめた同一要素インデックス情報を生成する、
ことを含む処理を実行させる付記2に記載のテストケース生成プログラム。
(Appendix 3)
On the computer,
When the access instruction is detected, it is determined to be the same based on a predetermined criterion,
For each element that is determined to be the same based on the determination result, the same element index information that summarizes the index values is generated.
The test case generation program according to
(付記4)
コンピュータに、
前記インデックス等価条件を、生成したパス条件からインデックス値に由来する制約を除くことにより生成する、
ことを含む処理を実行させる付記1から付記3のいずれか1項に記載のテストケース生成プログラム。
(Appendix 4)
On the computer,
The index equivalent condition is generated by removing the constraint derived from the index value from the generated path condition.
The test case generation program according to any one of
(付記5)
配列を構成する複数の要素の各々の位置を表すシンボル変数であるインデックス値で、除外されていない未選択のインデックス値を選択対象として、該選択対象からインデックス値を選択する選択部と、
対象プログラムをシンボリック実行することにより、前記選択部が選択したインデックス値に対応する要素が通過するパスを表すパス条件を生成し、生成したパス条件及び該生成したパス条件が表すパスを通過するテストデータをテストケースとして出力する実行部と、
前記選択対象に含まれるインデックス値であり、前記実行部でパス条件を生成した要素と同一の要素に対応するインデックス値が、生成した該パス条件からインデックス値に由来する制約を除外したインデックス等価条件を充足可能か判定し、充足可能なインデックス値を前記選択対象から除外する判定部と、
を備えた、テストケース生成装置。
(Appendix 5)
An index value that is a symbol variable representing each position of a plurality of elements constituting the array, and an unselected index value that is not excluded is selected as a selection target; a selection unit that selects an index value from the selection target;
Generate a path condition representing a path through which an element corresponding to the index value selected by the selection unit passes through symbolic execution of the target program, and pass the path represented by the generated path condition and the generated path condition An execution unit that outputs data as a test case;
An index equivalent condition that is an index value that is included in the selection target and that corresponds to an element that is the same as the element that has generated a path condition in the execution unit, and that excludes a constraint derived from the index value from the generated path condition A determination unit that determines whether or not the index value that can be satisfied is excluded from the selection target;
A test case generation apparatus comprising:
(付記6)
前記実行部で実行する命令がインデックス値をシンボル変数とした配列の要素へのアクセス命令か否かを検出する検出部と、
前記検出部が前記アクセス命令であると検出した場合に、予め定められた判定基準に基づいて同一であると判定した要素毎に、インデックス値をまとめた同一要素インデックス情報を生成する生成部と、
を備え、前記判定部は、前記同一要素インデックス情報に基づき、前記実行部によりパス条件を生成した要素と同一の要素に対応する前記選択対象に含まれるインデックス値を検出する、
付記5に記載のテストケース生成装置。
(Appendix 6)
A detection unit that detects whether an instruction to be executed by the execution unit is an instruction to access an element of an array having an index value as a symbol variable;
When the detection unit detects that it is the access command, a generation unit that generates the same element index information that summarizes index values for each element that is determined to be the same based on a predetermined determination criterion;
The determination unit detects an index value included in the selection target corresponding to the same element as the element for which a path condition is generated by the execution unit, based on the same element index information.
The test case generation device according to
(付記7)
前記アクセス命令を検出した場合に、予め定められた判定基準に基づいて同一であると判定する同一要素判定部を備え、
前記生成部は、前記同一要素判定部の判定結果に基づいて、同一であると判定した要素毎に、インデックス値をまとめた同一要素インデックス情報を生成する、
付記6に記載のテストケース生成装置。
(Appendix 7)
When the access instruction is detected, the same element determination unit that determines the same based on a predetermined determination criterion is provided,
The generation unit generates the same element index information that summarizes the index values for each element determined to be the same based on the determination result of the same element determination unit.
The test case generation device according to
(付記8)
前記インデックス等価条件を、生成したパス条件からインデックス値に由来する制約を除くことにより生成する等価条件生成部を備えた、
付記5から付記7のいずれか1項に記載のテストケース生成装置。
(Appendix 8)
An equivalent condition generation unit that generates the index equivalent condition by removing the constraint derived from the index value from the generated path condition,
The test case generation device according to any one of
(付記9)
コンピュータに、
配列を構成する複数の要素の各々の位置を表すシンボル変数であるインデックス値で、除外されていない未選択のインデックス値を選択対象として、該選択対象からインデックス値を選択し、
対象プログラムをシンボリック実行することにより、選択したインデックス値に対応する要素が通過するパスを表すパス条件を生成し、生成したパス条件及び該生成したパス条件が表すパスを通過するテストデータをテストケースとして出力し、
前記選択対象に含まれるインデックス値であり、パス条件を生成した要素と同一の要素に対応するインデックス値が、生成した該パス条件からインデックス値に由来する制約を除外したインデックス等価条件を充足可能か判定し、充足可能なインデックス値を前記選択対象から除外する、
ことを含む処理を実行させるテストケース生成方法。
(Appendix 9)
On the computer,
An index value that is a symbol variable representing the position of each of a plurality of elements constituting the array, and an unselected index value that is not excluded is selected as an object of selection, and an index value is selected from the object of selection,
Generate a path condition that represents the path that the element corresponding to the selected index value passes by executing the target program symbolically, and test data that passes through the path that is generated and the path that the generated path condition represents Output as
Is the index value included in the selection target, and whether the index value corresponding to the same element as the element that generated the path condition can satisfy the index equivalent condition that excludes the constraint derived from the index value from the generated path condition Determining and excluding satisfiable index values from the selection target,
A test case generation method for executing a process including the above.
(付記10)
コンピュータに、
前記対象プログラム中の命令がインデックス値をシンボル変数とした配列の要素へのアクセス命令か否かを検出し、
同一であると判定した要素毎に、インデックス値をまとめた同一要素インデックス情報を生成し、
生成した前記同一要素インデックス情報に基づき、パス条件を生成した要素と同一の要素に対応する前記選択対象に含まれるインデックス値を検出する
ことを含む処理を実行させる付記9に記載のテストケース生成方法。
(Appendix 10)
On the computer,
Detecting whether an instruction in the target program is an access instruction to an element of an array having an index value as a symbol variable;
For each element determined to be the same, generate the same element index information that summarizes the index values,
The test case generation method according to appendix 9, wherein a process including detecting an index value included in the selection target corresponding to the same element as the element that generated the path condition is executed based on the generated same element index information .
(付記11)
コンピュータに、
前記アクセス命令を検出した場合に、予め定められた判定基準に基づいて同一であると判定し、
判定結果に基づいて、同一であると判定した要素毎に、インデックス値をまとめた同一要素インデックス情報を生成する、
ことを含む処理を実行させる付記10に記載のテストケース生成方法。
(Appendix 11)
On the computer,
When the access instruction is detected, it is determined to be the same based on a predetermined criterion,
For each element that is determined to be the same based on the determination result, the same element index information that summarizes the index values is generated.
The test case generation method according to
(付記12)
コンピュータに、
前記インデックス等価条件を、生成したパス条件からインデックス値に由来する制約を除くことにより生成する、
ことを含む処理を実行させる付記9から付記11のいずれか1項に記載のテストケース生成方法。
(Appendix 12)
On the computer,
The index equivalent condition is generated by removing the constraint derived from the index value from the generated path condition.
12. The test case generation method according to any one of appendix 9 to appendix 11, wherein the process including the above is executed.
10、100 テストケース生成装置
12、112 シンボリック実行部
14、114 インデックスアクセス検出部
16、116 インデックス選択部
18、118 同一要素インデックス情報生成部
20、120 同一要素判定部
22、122 インデックス等価条件生成部
24、124 インデックス等価判定部
62 CPU
64 メモリ
66 記憶部
72 テストケース生成プログラム
74 シンボリック実行プロセス
76 インデックスアクセス検出プロセス
78 インデックス選択プロセス
80 同一要素インデックス情報生成プロセス
82 同一要素判定プロセス
84 インデックス等価条件生成プロセス
86 インデックス等価判定プロセス
10, 100 Test
64
Claims (7)
配列を構成する複数の要素の各々の位置を表すシンボル変数であるインデックス値で、除外されていない未選択のインデックス値を選択対象として、該選択対象からインデックス値を選択し、
対象プログラムをシンボリック実行することにより、選択したインデックス値に対応する要素に応じて分岐するパスを表すパス条件を生成し、生成したパス条件及び該生成したパス条件が表すパスを通過するテストデータをテストケースとして出力し、
前記選択対象に含まれるインデックス値であり、パス条件を生成した要素と同一の要素に対応するインデックス値が、生成した該パス条件からインデックス値に由来する制約を除外したインデックス等価条件を充足可能か判定し、充足可能なインデックス値を前記選択対象から除外する、
ことを含む処理を実行させるテストケース生成プログラム。 On the computer,
An index value that is a symbol variable representing the position of each of a plurality of elements constituting the array, and an unselected index value that is not excluded is selected as an object of selection, and an index value is selected from the object of selection,
By performing symbolic execution of the target program, a path condition representing a path branching according to an element corresponding to the selected index value is generated, and the generated path condition and test data passing through the path represented by the generated path condition are Output as a test case,
Is the index value included in the selection target, and whether the index value corresponding to the same element as the element that generated the path condition can satisfy the index equivalent condition that excludes the constraint derived from the index value from the generated path condition Determining and excluding satisfiable index values from the selection target,
A test case generation program that executes processing including the above.
前記対象プログラム中の命令がインデックス値をシンボル変数とした配列の要素へのアクセス命令か否かを検出し、
同一であると判定した要素毎に、インデックス値をまとめた同一要素インデックス情報を生成し、
生成した前記同一要素インデックス情報に基づき、パス条件を生成した要素と同一の要素に対応する前記選択対象に含まれるインデックス値を検出する
ことを含む処理を実行させる請求項1に記載のテストケース生成プログラム。 On the computer,
Detecting whether an instruction in the target program is an access instruction to an element of an array having an index value as a symbol variable;
For each element determined to be the same, generate the same element index information that summarizes the index values,
The test case generation according to claim 1, wherein a process including detecting an index value included in the selection target corresponding to the same element as the element that generated the path condition is executed based on the generated same element index information. program.
前記アクセス命令を検出した場合に、予め定められた判定基準に基づいて同一であると判定し、
判定結果に基づいて、同一であると判定した要素毎に、インデックス値をまとめた同一要素インデックス情報を生成する、
ことを含む処理を実行させる請求項2に記載のテストケース生成プログラム。 On the computer,
When the access instruction is detected, it is determined to be the same based on a predetermined criterion,
For each element that is determined to be the same based on the determination result, the same element index information that summarizes the index values is generated.
The test case generation program according to claim 2, wherein processing including the above is executed.
前記インデックス等価条件を、生成したパス条件からインデックス値に由来する制約を除くことにより生成する、
ことを含む処理を実行させる請求項1から請求項3のいずれか1項に記載のテストケース生成プログラム。 On the computer,
The index equivalent condition is generated by removing the constraint derived from the index value from the generated path condition.
The test case generation program according to any one of claims 1 to 3, wherein a process including the above is executed.
対象プログラムをシンボリック実行することにより、前記選択部が選択したインデックス値に対応する要素に応じて分岐するパスを表すパス条件を生成し、生成したパス条件及び該生成したパス条件が表すパスを通過するテストデータをテストケースとして出力する実行部と、
前記選択対象に含まれるインデックス値であり、前記実行部でパス条件を生成した要素と同一の要素に対応するインデックス値が、生成した該パス条件からインデックス値に由来する制約を除外したインデックス等価条件を充足可能か判定し、充足可能なインデックス値を前記選択対象から除外する判定部と、
を備えた、テストケース生成装置。 An index value that is a symbol variable representing each position of a plurality of elements constituting the array, and an unselected index value that is not excluded is selected as a selection target; a selection unit that selects an index value from the selection target;
By executing the target program symbolically, a path condition representing a path that branches according to the element corresponding to the index value selected by the selection unit is generated, and the generated path condition and the path represented by the generated path condition are passed. An execution unit that outputs test data to be tested as a test case;
An index equivalent condition that is an index value that is included in the selection target and that corresponds to an element that is the same as the element that has generated a path condition in the execution unit, and that excludes a constraint derived from the index value from the generated path condition A determination unit that determines whether or not the index value that can be satisfied is excluded from the selection target;
A test case generation apparatus comprising:
前記検出部が前記アクセス命令であると検出した場合に、予め定められた判定基準に基づいて同一であると判定した要素毎に、インデックス値をまとめた同一要素インデックス情報を生成する生成部と、
を備え、前記判定部は、前記同一要素インデックス情報に基づき、前記実行部によりパス条件を生成した要素と同一の要素に対応する前記選択対象に含まれるインデックス値を検出する、
請求項5に記載のテストケース生成装置。 A detection unit that detects whether an instruction to be executed by the execution unit is an instruction to access an element of an array having an index value as a symbol variable;
When the detection unit detects that it is the access command, a generation unit that generates the same element index information that summarizes index values for each element that is determined to be the same based on a predetermined determination criterion;
The determination unit detects an index value included in the selection target corresponding to the same element as the element for which a path condition is generated by the execution unit, based on the same element index information.
The test case generation device according to claim 5.
配列を構成する複数の要素の各々の位置を表すシンボル変数であるインデックス値で、除外されていない未選択のインデックス値を選択対象として、該選択対象からインデックス値を選択し、
対象プログラムをシンボリック実行することにより、選択したインデックス値に対応する要素に応じて分岐するパスを表すパス条件を生成し、生成したパス条件及び該生成したパス条件が表すパスを通過するテストデータをテストケースとして出力し、
前記選択対象に含まれるインデックス値であり、パス条件を生成した要素と同一の要素に対応するインデックス値が、生成した該パス条件からインデックス値に由来する制約を除外したインデックス等価条件を充足可能か判定し、充足可能なインデックス値を前記選択対象から除外する、
ことを含む処理を実行させるテストケース生成方法。 On the computer,
An index value that is a symbol variable representing the position of each of a plurality of elements constituting the array, and an unselected index value that is not excluded is selected as an object of selection, and an index value is selected from the object of selection,
By performing symbolic execution of the target program, a path condition representing a path branching according to an element corresponding to the selected index value is generated, and the generated path condition and test data passing through the path represented by the generated path condition are Output as a test case,
Is the index value included in the selection target, and whether the index value corresponding to the same element as the element that generated the path condition can satisfy the index equivalent condition that excludes the constraint derived from the index value from the generated path condition Determining and excluding satisfiable index values from the selection target,
A test case generation method for executing a process including the above.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2014112808A JP6330490B2 (en) | 2014-05-30 | 2014-05-30 | Test case generation program, test case generation apparatus, and test case generation method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2014112808A JP6330490B2 (en) | 2014-05-30 | 2014-05-30 | Test case generation program, test case generation apparatus, and test case generation method |
Publications (2)
Publication Number | Publication Date |
---|---|
JP2015228085A JP2015228085A (en) | 2015-12-17 |
JP6330490B2 true JP6330490B2 (en) | 2018-05-30 |
Family
ID=54885533
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2014112808A Active JP6330490B2 (en) | 2014-05-30 | 2014-05-30 | Test case generation program, test case generation apparatus, and test case generation method |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP6330490B2 (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108595341B (en) * | 2018-05-11 | 2019-11-22 | 清华大学 | Automatic example generation method and system |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP5884652B2 (en) * | 2012-06-08 | 2016-03-15 | 富士通株式会社 | Test data generation program, test data generation device, and test data generation method |
-
2014
- 2014-05-30 JP JP2014112808A patent/JP6330490B2/en active Active
Also Published As
Publication number | Publication date |
---|---|
JP2015228085A (en) | 2015-12-17 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP2019220141A (en) | Branch Coverage Guided Symbolic Execution for Hybrid Fuzz Testing of Software Binaries | |
CN101751333A (en) | Method, computer program and computer system for assisting in analyzing program | |
US11610117B2 (en) | System and method for adapting a neural network model on a hardware platform | |
JP2016004576A (en) | Method for verification of model of gui-based application and computer readable memory medium | |
JP6245006B2 (en) | Test case generation apparatus, method, and program | |
JP6330490B2 (en) | Test case generation program, test case generation apparatus, and test case generation method | |
JP5164920B2 (en) | Test data generation method, apparatus and program | |
JP5440287B2 (en) | Symbolic execution support program, method and apparatus | |
KR102255470B1 (en) | Method and apparatus for artificial neural network | |
Legg et al. | A SAT-based counterexample guided method for unbounded synthesis | |
US20120317526A1 (en) | Verification method, computer-readable recording medium, and design verification apparatus | |
JP5887811B2 (en) | Compiling device, compiling method, compiling program, and recording medium | |
Haghighatkhah | Test case prioritization using build history and test distances: an approach for improving automotive regression testing in continuous integration environments | |
US20190294637A1 (en) | Similar data search device, similar data search method, and recording medium | |
JP2008197897A (en) | Test pattern generation apparatus and generation method | |
JP6512032B2 (en) | Stub target determination apparatus, method, and program | |
JP2014048856A (en) | Software verification program and software verification system | |
JP5900212B2 (en) | Test data generation apparatus, program, and method | |
JP5884652B2 (en) | Test data generation program, test data generation device, and test data generation method | |
JP5755861B2 (en) | Test case generation apparatus, test case generation method, and test case generation program | |
JP2017224185A (en) | Bug contamination probability calculation program and bug contamination probability calculation method | |
JP6748357B2 (en) | Analysis device, analysis program, and analysis method | |
JP5900197B2 (en) | Route condition selection apparatus, program, and method | |
JP6583033B2 (en) | Driver generation program, apparatus, and method | |
Zhao et al. | Automatic model completion for Web applications |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20170206 |
|
A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20171130 |
|
A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20171212 |
|
A521 | Written amendment |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20180124 |
|
TRDD | Decision of grant or rejection written | ||
A01 | Written decision to grant a patent or to grant a registration (utility model) |
Free format text: JAPANESE INTERMEDIATE CODE: A01 Effective date: 20180327 |
|
A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20180409 |
|
R150 | Certificate of patent or registration of utility model |
Ref document number: 6330490 Country of ref document: JP Free format text: JAPANESE INTERMEDIATE CODE: R150 |