JP2014191652A - Test case generation method, test case generation device, and test case generation program - Google Patents
Test case generation method, test case generation device, and test case generation program Download PDFInfo
- Publication number
- JP2014191652A JP2014191652A JP2013067571A JP2013067571A JP2014191652A JP 2014191652 A JP2014191652 A JP 2014191652A JP 2013067571 A JP2013067571 A JP 2013067571A JP 2013067571 A JP2013067571 A JP 2013067571A JP 2014191652 A JP2014191652 A JP 2014191652A
- Authority
- JP
- Japan
- Prior art keywords
- path
- test case
- conditional expression
- program
- case generation
- 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.)
- Granted
Links
Images
Landscapes
- Debugging And Monitoring (AREA)
Abstract
Description
本発明は、テストケース生成方法、テストケース生成装置、およびテストケース生成プログラムに関する。 The present invention relates to a test case generation method, a test case generation device, and a test case generation program.
従来、プログラム開発において、テストケースを用いて、プログラムの動作をテストする技術がある。テストケースは、プログラムに与える入力値と、入力値を与えた結果出力される値の期待値とを有する。関連する先行技術として、たとえば、過去に行われたテストケースについての情報を保存しておき、テストケースについての情報と対象プログラムを解析して得られた依存関係を組み合わせることにより、テストを行うリグレッションシステムを構築するものがある。また、分析対象プログラムに定義される全ての変数をカバーするようにシンボル化対象の変数を変化させつつ繰り返しシンボリック実行し、分析対象プログラムのコード網羅率が所定の基準を満たせば、分析対象プログラムのテストが完了したこととする技術がある。(たとえば、下記特許文献1、2を参照。)
Conventionally, in program development, there is a technique for testing a program operation using a test case. The test case has an input value given to the program and an expected value of a value output as a result of giving the input value. Relevant prior art, for example, regression for testing by storing information about test cases that have been performed in the past and combining the information about the test cases with the dependencies obtained by analyzing the target program There is something that builds a system. In addition, symbolic execution is repeatedly performed while changing the variables to be symbolized so as to cover all variables defined in the analysis target program, and if the code coverage rate of the analysis target program satisfies a predetermined standard, the analysis target program There is a technique that the test has been completed. (For example, see
しかしながら、従来技術によれば、変更前プログラムの一部が変更された変更後プログラムをテストする際に、変更前プログラムをテストした時に使用されたテストケースをそのまま流用可能か、またはテストケースを新たに生成すべきか、を判定することが難しい。 However, according to the prior art, when testing a post-change program in which a part of the pre-change program has been changed, the test case used when the pre-change program was tested can be used as is or a new test case can be used. It is difficult to determine whether it should be generated.
1つの側面では、本発明は、プログラムの変更に伴うテストケース生成作業の負荷の低減を図るテストケース生成方法、テストケース生成装置、およびテストケース生成プログラムを提供することを目的とする。 In one aspect, an object of the present invention is to provide a test case generation method, a test case generation device, and a test case generation program that reduce the load of test case generation work associated with a program change.
本発明の一側面によれば、第1のプログラムをシンボリック実行することにより、第1のプログラムに含まれる入力変数が取り得る値のうちの第1のプログラムに含まれる第1のパスが実行される条件となる入力変数の値を表す第1の条件式と、第1のパスが実行された場合に出力される第1のプログラムに含まれる出力変数を表す第1の数式と、を含む第1の実行結果を取得し、第1のプログラムの一部が変更された第2のプログラムをシンボリック実行することにより、入力変数の取り得る値のうちの第2のプログラムに含まれる第2のパスが実行される条件となる入力変数の値を表す第2の条件式と、第2のパスが実行された場合に出力される第2のプログラムに含まれる出力変数を表す第2の数式と、を含む第2の実行結果を取得し、入力変数が取り得る値のうちの、取得した第1の条件式と取得した第2の条件式との論理積を真とする値の有無に基づいて、第2のパスが第1のパスに関連するか否かを判断し、取得した第1の数式と、取得した第2の数式とが一致するか否かを判定し、判断結果と判定結果とに基づいて、第2のパスの動作をテストするテストケースを生成すべきか否かを判定するテストケース生成方法、テストケース生成装置、およびテストケース生成プログラムが提案される。 According to an aspect of the present invention, by executing the first program symbolically, the first pass included in the first program is executed out of the possible values of the input variable included in the first program. A first conditional expression representing a value of an input variable serving as a condition to be satisfied, and a first mathematical expression representing an output variable included in the first program output when the first pass is executed The second path included in the second program among the possible values of the input variable by acquiring the execution result of 1 and executing symbolically the second program in which a part of the first program is changed A second conditional expression that represents the value of an input variable that is a condition for executing, and a second mathematical expression that represents an output variable included in the second program that is output when the second pass is executed; To get the second execution result containing Of the possible values of the input variable, the second path is changed to the first path based on the presence or absence of a value that is true of the logical product of the acquired first conditional expression and the acquired second conditional expression. It is determined whether or not they are related, and it is determined whether or not the acquired first mathematical expression matches the acquired second mathematical expression. Based on the determination result and the determination result, the operation of the second path A test case generation method, a test case generation device, and a test case generation program for determining whether or not to generate a test case for testing is proposed.
本発明の一態様によれば、プログラムの変更に伴うテストケース生成作業の負荷の低減を図ることができるという効果を奏する。 According to one aspect of the present invention, there is an effect that it is possible to reduce a load of test case generation work associated with a program change.
以下に図面を参照して、開示のテストケース生成方法、テストケース生成装置、およびテストケース生成プログラムの実施の形態を詳細に説明する。 Exemplary embodiments of a disclosed test case generation method, test case generation apparatus, and test case generation program will be described below in detail with reference to the drawings.
(実施の形態1の説明)
図1は、実施の形態1におけるテストケース生成装置の動作例を示す説明図である。テストケース生成装置100は、第1のプログラムの一部が変更された第2のプログラムのテストケースを生成すべきか否かを判定するコンピュータである。ここで、プログラムのテストについて説明を行う。また、以下、第1のプログラムを、「変更前プログラム」と呼称する。また、第2のプログラムを、「変更後プログラム」と呼称する。
(Description of Embodiment 1)
FIG. 1 is an explanatory diagram illustrating an operation example of the test case generation device according to the first embodiment. The test
変更前プログラムがリリースされた後、変更前プログラムが稼働して、変更前プログラムの利用が開始された後、変更前プログラムの機能の変更や追加、あるいは、機能の障害や不具合などに対応するため、変更前プログラムの一部を変更することが行われる。変更前プログラムの一部を変更する場合、変更前プログラムの変更が原因となって、変更前プログラムの一部が変更された変更後プログラム全体において、仕様外の機能障害が発生しないか、および仕様通りに部分変更が実装されたか、を確認することが行われる。機能障害は、デグレード、退行と呼ばれる。 After the pre-change program is released, after the pre-change program is started and the use of the pre-change program is started, the function of the pre-change program is changed or added, or a function failure or malfunction is dealt with. A part of the pre-change program is changed. When changing a part of the program before the change, if the program before the change is caused by the change of the program before the change, there is no functional failure outside the specification in the entire program after the change, and the specification It is confirmed whether the partial change is implemented as described above. The dysfunction is called degradation, regression.
したがって、確認のため、変更前プログラムの部分変更が終了した後、変更後プログラムに対して再度テストが行われる。テストには、テストケースが利用される。テストケースは、テスト対象となるプログラムに与えるテスト入力値と、テスト入力値をプログラムに与えた場合に、プログラムから出力される値の期待値とを有する。テストケースは、プログラムの機能ごとに用意される。 Therefore, after the partial change of the pre-change program is completed, the test is performed again on the post-change program for confirmation. Test cases are used for testing. The test case has a test input value given to the program to be tested and an expected value of a value output from the program when the test input value is given to the program. A test case is prepared for each function of the program.
また、具体的な、変更後プログラムのテストの確認内容としては、以下の2つとなる。1つ目の確認内容は、変更後プログラムの機能のうちの変更されていない機能が、プログラム開発者の意図に反して変更されていないことを確認する内容である。1つ目の確認内容を行うテストは、「リグレッションテスト」と呼称される。2つ目の確認内容は、変更後プログラムの機能のうちの変更および追加の機能が、プログラム開発者の意図通り、変更および追加されていることを確認する内容である。 In addition, there are the following two specific confirmation contents of the test of the changed program. The first confirmation content is a content for confirming that an unchanged function among the functions of the changed program has not been changed against the intention of the program developer. The test for performing the first confirmation content is referred to as a “regression test”. The second confirmation content is a content for confirming that a change and an additional function among the functions of the changed program are changed and added as intended by the program developer.
ここで、プログラムの機能ごとのテストケースを1つ目の確認内容に関連するテストケースと、2つ目の確認内容に関連するテストケースとに分類することと、追加された機能に関連するテストケースを生成することとは、手間がかかる。したがって、この2つの作業は、プログラム開発プロジェクトにおいて、テストの工数を増大させる要因となる。 Here, the test cases for each function of the program are classified into test cases related to the first confirmation contents and test cases related to the second confirmation contents, and tests related to the added functions. Generating a case is troublesome. Therefore, these two operations are factors that increase the number of test steps in the program development project.
テストケースを分類する技術として、テストケース実行時の実行トレースの動的解析などを利用して、プログラムとテストケースの関係を構築し、構築した関係を利用して、プログラム変更に対応するテストケースを選択するものがある。プログラム変更に対応するテストケースだけを選択して再実行することにより、リグレッションテストの手間を削減することができる。 As a technology for classifying test cases, the relationship between programs and test cases is built using dynamic analysis of execution traces during test case execution, and test cases corresponding to program changes using the built relationships. There is something to choose. By selecting only test cases corresponding to program changes and re-execution, it is possible to reduce the labor of regression testing.
また、追加された機能に関連するテストケースのテスト入力値を生成する技術として、プログラムや設計書や設計モデルを分析することにより、テスト入力値を生成するものがある。 Further, as a technique for generating test input values for test cases related to added functions, there is a technique for generating test input values by analyzing a program, a design document, or a design model.
しかしながら、上述したテストケースを分類する技術は、ある機能を追加するためにプログラムの部分変更を行うと、今回追加した機能のテストケースは、既存のテストケースの中には存在しないため、追加した機能に関連するテストケースを選択することが難しい。また、上述した追加された機能に関連するテストケースのテスト入力値を生成する技術は、あるバージョンのプログラム等を部分変更して次のバージョンを開発すると、変更に起因する変更および追加の部分を対象としたテストケースを特定することが難しい。 However, the above-mentioned technology for classifying test cases has been added because the test case for the function added this time does not exist in the existing test cases when the program is partially changed to add a certain function. It is difficult to select test cases related to the function. In addition, the technology for generating test input values for test cases related to the added functions described above is to change the part of a certain version of the program and develop the next version. It is difficult to specify the target test case.
そこで、テストケース生成装置100は、プログラムの一部変更時に、変更前後のパスが実行される条件式が充足可能となるパス同士の出力変数を比較してテストケースを生成すべきか否かを判断する。これにより、テストケース生成装置100は、プログラムの一部変更に伴うテストケース生成作業の負荷を削減する。
Accordingly, the test
ここで、図1に表示する変更前プログラムPrePrgと変更後プログラムPostPrgとについて説明する。変更後プログラムPostPrgは、変更前プログラムPrePrgの一部が変更されたプログラムである。変更前プログラムPrePrgは、if文の条件が真のときに実行する処理を経由するパスp1とelse if文とを経由するパスとの2つのパスがある。ここで、p1を第1のパスとする。また、変更後プログラムPostPrgは、if文の条件が真のときに実行する処理を経由するパスp2とelse if文とを経由するパスとの2つのパスがある。ここで、p2を第2のパスとする。また、パスとは、プログラムに含まれる一連の命令文である。一連の命令文が実行されることにより、何らかの機能を実現する可能性がある。 Here, the pre-change program PrePrg and the post-change program PostPrg displayed in FIG. 1 will be described. The post-change program PostPrg is a program in which a part of the pre-change program PrePrg has been changed. The pre-change program PrePrg has two paths: a path p1 that passes through a process that is executed when the condition of the if statement is true, and a path that passes through an else if statement. Here, let p1 be the first pass. Further, the post-change program PostPrg has two paths: a path p2 that passes through a process that is executed when the condition of the if statement is true, and a path that passes through an else if statement. Here, let p2 be the second path. A path is a series of statements included in a program. Some functions may be realized by executing a series of statements.
本実施の形態にかかるテストケース生成装置100は、あるパスが実行される条件となる入力変数の値を表す条件式と、パスが実行された場合に出力されるプログラムに含まれる出力変数を表す数式と、を含むシンボリック実行の実行結果を取得する。シンボリック実行の実行結果を、以下、「シンボリック実行結果」と称する。なお、シンボリック実行を行う装置は、テストケース生成装置100でもよいし、他の装置であってもよい。
The test
パスが実行される条件となる入力変数の値を表す条件式を、以下、「パス条件式」と呼称する。また、パスが実行された場合に出力されるプログラムに含まれる出力変数を表す数式を、「パス出力数式」と呼称する。入力変数とは、あるプログラムに含まれる変数であり、プログラムパスに与えられる値が格納される変数である。また、出力変数は、あるプログラムに含まれる変数であり、プログラムから出力される値が格納される変数である。図1の変更前プログラムPrePrgと変更後プログラムPostPrgでは、入力変数は“x”となり、出力変数は、“rtn”となる。本実施の形態では、入力変数と出力変数との数が、変更前プログラムPrePrgと変更後プログラムPostPrgとでそれぞれ一致することを前提とする。 A conditional expression representing the value of an input variable that is a condition for executing a pass is hereinafter referred to as a “pass conditional expression”. A mathematical expression representing an output variable included in a program output when a pass is executed is referred to as a “pass output mathematical expression”. An input variable is a variable included in a certain program, and is a variable in which a value given to a program path is stored. The output variable is a variable included in a certain program, and is a variable in which a value output from the program is stored. In the pre-change program PrePrg and the post-change program PostPrg in FIG. 1, the input variable is “x” and the output variable is “rtn”. In the present embodiment, it is assumed that the numbers of input variables and output variables are the same in the pre-change program PrePrg and the post-change program PostPrg.
シンボリック実行とは、プログラムPの変数に具体的な確定値を入力する代わりにシンボル値と呼ばれる記号値を入力して、シンボル値のままプログラムを模擬的に実行し、プログラムの実行結果を評価する技術である。図1に示す変更前プログラムPrePrgと変更後プログラムPostPrgとは、Java(登録商標)により記述されているが、変更前プログラムPrePrgと変更後プログラムPostPrgとは、シンボリック実行が行える他の言語で記述されていてもよい。 In symbolic execution, instead of inputting a specific definite value into a variable of program P, a symbol value called a symbol value is input, the program is simulated and executed as it is, and the execution result of the program is evaluated. Technology. The pre-change program PrePrg and the post-change program PostPrg shown in FIG. 1 are described in Java (registered trademark), but the pre-change program PrePrg and the post-change program PostPrg are described in other languages that can perform symbolic execution. It may be.
図1では、テストケース生成装置100は、パスp2をテストするテストケースについて、テストケースを生成すべきか否かを判定する。具体的に、テストケース生成装置100は、パスp1をテストするテストケースをそのまま流用できて、テストケースの生成が不要であるのか、または、流用できず、パスp2のテストするテストケースを生成すべきなのかを判定することを行う。
In FIG. 1, the test
図1の例では、テストケース生成装置100は、パスp1が実行される条件となるパス条件式102−1と、パスp1が実行された場合に出力されるパス出力数式103−1とを含むシンボリック実行結果101−1を取得する。さらに、テストケース生成装置100は、パスp2が実行される条件となるパス条件式102−2とパスp2が実行された場合に出力されるパス出力数式103−2とを含むシンボリック実行結果101−2を取得する。
In the example of FIG. 1, the test
次に、テストケース生成装置100は、入力変数“x”が取り得る値のうちの、パス条件式102−1とパス条件式102−2との論理積を真とする値の有無に基づいて、パスp2がパスp1に関連するか否かを判断する。ここで、ある条件式と別の条件式との論理積を真とする値の有無を特定することを、以下、“充足可能性の判定”と呼称する。ある条件式と別の条件式との論理積を真とする値が有る場合、“充足可能”であるとし、ある条件式と別の条件式との論理積を真とする値が無い場合、“充足不可能”であるとする。テストケース生成装置100は、論理積が充足可能となる場合、パスp2がパスp1に関連すると判断し、論理積が充足不可能となる場合、パスp2がパスp1に関連しないと判断する。
Next, the test
グラフ110は、入力変数“x”に対して、パス条件式102−1とパス条件式102−2とが真となる範囲を示す。グラフ110が示すように、int型の入力変数“x”が取り得る値のうちのx<10の値が与えられる場合、パスp1のパス条件式とパスp2のパス条件式との論理積が真となる。したがって、パス条件式102−1とパス条件式102−2との論理積を真とする値があるため、充足可能となり、テストケース生成装置100は、パスp2がパスp1に関連すると判断する。
The
また、テストケース生成装置100は、パス出力数式103−1と、パス出力数式103−2とを比較する。具体的な比較方法としては、図13〜図16にて後述する。図1の例では、比較結果が一致しなかったことを示すこととする。
Further, the test
テストケース生成装置100は、判断結果と比較結果とに基づいて、パスp2の動作をテストするテストケースを生成すべきか否かを判定する。具体的に、テストケース生成装置100は、判断結果がパスp2がパスp1に関連することを示し、かつ、比較結果が一致することを示す場合、パスp1の動作をテストするテストケースがそのまま流用できるため、テストケースを生成しなくてよいと判定する。また、テストケース生成装置100は、判断結果がパスp2がパスp1に関連することを示し、かつ、比較結果が一致しないことを示す場合、パスp1の動作をテストするテストケースがそのまま流用できないため、テストケースを生成すべきであると判定する。
The test
図1の例では、テストケース生成装置100は、パスp2の動作をテストするテストケースを生成すべきであると判定する。以下、図2〜図26を用いて、実施の形態1にかかるテストケース生成装置100の説明を行う。
In the example of FIG. 1, the test
(テストケース生成装置のハードウェア)
図2は、テストケース生成装置のハードウェアの一例を示すブロック図である。図2において、テストケース生成装置100は、CPU(Central Processing Unit)201と、ROM(Read‐Only Memory)202と、RAM(Random Access Memory)203と、を含む。また、テストケース生成装置100は、ディスクドライブ204と、ディスク205と、通信インターフェース206と、を含む。また、テストケース生成装置100は、ディスプレイ207と、キーボード208と、マウス209とを含む。また、CPU201〜マウス209はバス210によってそれぞれ接続される。
(Test case generator hardware)
FIG. 2 is a block diagram illustrating an example of hardware of the test case generation device. 2, the test
CPU201は、テストケース生成装置100の全体の制御を司る演算処理装置である。ROM202は、ブートプログラムなどのプログラムを記憶する不揮発性メモリである。RAM203は、CPU201のワークエリアとして使用される揮発性メモリである。
The
ディスクドライブ204は、CPU201の制御に従ってディスク205に対するデータのリードおよびライトを制御する制御装置である。ディスクドライブ204には、たとえば、磁気ディスクドライブ、光ディスクドライブ、ソリッドステートドライブなどを採用することができる。ディスク205は、ディスクドライブ204の制御で書き込まれたデータを記憶する不揮発性メモリである。たとえばディスクドライブ204が磁気ディスクドライブである場合、ディスク205には、磁気ディスクを採用することができる。また、ディスクドライブ204が光ディスクドライブである場合、ディスク205には、光ディスクを採用することができる。また、ディスクドライブ204がソリッドステートドライブである場合、ディスク205には、半導体素子メモリを採用することができる。
The
通信インターフェース206は、ネットワーク211と内部とのインターフェースを司り、外部装置からのデータの入出力を制御する制御装置である。具体的に、通信インターフェース206は、通信回線を通じてネットワーク211となるLAN(Local Area Network)、WAN(Wide Area Network)、インターネットなどに接続され、ネットワーク211を介して他の装置に接続される。通信インターフェース206には、たとえば、モデムやLANアダプタなどを採用することができる。
The
ディスプレイ207は、マウスカーソル、アイコンあるいはツールボックスをはじめ、文書、画像、機能情報などのデータを表示する装置である。ディスプレイ207には、たとえば、CRT(Cathode Ray Tube)、TFT(Thin Film Transistor)液晶ディスプレイ、プラズマディスプレイなどを採用することができる。 The display 207 is a device that displays data such as a document, an image, and function information as well as a mouse cursor, an icon, or a tool box. As the display 207, for example, a cathode ray tube (CRT), a thin film transistor (TFT) liquid crystal display, a plasma display, or the like can be employed.
キーボード208は、文字、数字、各種指示などの入力のためのキーを有し、データの入力を行う装置である。また、キーボード208は、タッチパネル式の入力パッドやテンキーなどであってもよい。マウス209は、マウスカーソルの移動や範囲選択、あるいはウィンドウの移動やサイズの変更などを行う装置である。マウス209は、ポインティングデバイスとして同様に機能を有するものであれば、トラックボールやジョイスティックなどであってもよい。次に、図3を用いて、テストケースの実行手順の一例を示す。
The
図3は、テストケースの実行手順の一例を示す説明図である。テストケースが実行される時に入力されるデータは、テスト対象プログラムPrg、テスト入力値Inv、および、期待値Epvである。テスト入力値Invは、テスト対象プログラムPrgの様々な動作のうち、仕様通りであるか確認したい動作をテスト対象プログラムPrgに実行させる値である。テストケースは、テスト対象プログラムの動作が想定通りか確認したい事柄である。また、様々な確認事項をテストするテストケースを作成して、テストケースらを集合させたものを、「テストスィート」と呼称する。期待値Epvは、仕様通りにテスト対象プログラムPrgが動作した場合のテスト対象プログラムPrgの望ましい動作結果であり、たとえば、注目する変数の出力値などである。 FIG. 3 is an explanatory diagram illustrating an example of a test case execution procedure. Data input when the test case is executed are the test target program Prg, the test input value Inv, and the expected value Epv. The test input value Inv is a value that causes the test target program Prg to perform an operation to be confirmed as being in accordance with the specification among various operations of the test target program Prg. The test case is a matter to confirm whether the operation of the test target program is as expected. Also, a test case for testing various confirmation items and a collection of the test cases are referred to as a “test suite”. The expected value Epv is a desired operation result of the test target program Prg when the test target program Prg operates according to the specification, and is, for example, an output value of a variable of interest.
テスト対象プログラムPrgは、プログラム実行環境が構築された装置によって実行される。プログラム実行環境が構築された装置は、テストケース生成装置100でもよいし、他の装置でもよい。図3では、説明の簡略化のため、テストケース生成装置100がテスト対象プログラムPrgを実行するものとする。
The test target program Prg is executed by a device in which a program execution environment is constructed. The apparatus in which the program execution environment is constructed may be the test
テストケース生成装置100は、テスト入力値Invをテスト対象プログラムPrgに与えて、プログラム実行結果Prsを得る。そして、テストケース生成装置100は、プログラム実行結果Prsと期待値Epvとを比較することによりテスト結果判定を行い、テスト結果Trsを出力する。具体的に、プログラム実行結果Prsと期待値Epvとが一致する場合、テスト結果Trsは、成功となる。また、プログラム実行結果Prsと期待値Epvとが一致しない場合、テスト結果Trsは、失敗となる。次に、図4を用いてプログラム変更前後でのプログラムとテストケースの関係を説明する。
The test
図4は、変更前後のプログラムとテストケースの関係の一例を示す説明図である。変更前プログラムPrePrgは、機能PreF1と、機能PreF2と、…、機能PreFMとを含む。また、変更前プログラムPrePrgが変更された変更後プログラムPostPrgは、機能PostF1と、機能PostF2と、…、機能PostFMと、機能PostFXとを含む。変更後プログラムPostPrgの各機能のうち、機能PostF1は変更されておらず、機能PostF2は変更されており、…、機能PostFMは変更されておらず、機能PostFXは追加された機能である。 FIG. 4 is an explanatory diagram illustrating an example of a relationship between a program and a test case before and after the change. The pre-change program PrePrg includes a function PreF1, a function PreF2, ..., a function PreFM. The post-change program PostPrg in which the pre-change program PrePrg has been changed includes a function PostF1, a function PostF2,..., A function PostFM, and a function PostFX. Among the functions of the post-change program PostPrg, the function PostF1 is not changed, the function PostF2 is changed,..., The function PostFM is not changed, and the function PostFX is an added function.
また、変更前プログラムPrePrgのテストスィートPreTsは、テストケース1と、テストケース2と、…、テストケースNとを有する。テストケース1は、機能PreF1をテストするテストケースである。テストケース2は、機能PreF2をテストするテストケースである。テストケースNは、機能PreFMをテストするテストケースである。
Further, the test suite PreTs of the pre-change program PrePrg has a
テストケース生成装置100は、既存のテストケースとなるテストケース1〜テストケースNが、変更前プログラムPrePrgの変更の結果、変更しなくてよいのか、それとも変更すべきであるのかを分類する。また、テストケース生成装置100は、変更前プログラムPrePrgの変更の結果、対応するテストケースが既存のテストケースになく、追加された機能があるかを判断する。さらに、テストケース生成装置100は、追加された機能に対するテストケースを生成する。
The test
具体的に、図4の例では、機能PostF1と、機能PostFMとに対して、テストケース生成装置100は、テストケース1〜テストケースNから対応するテストケースを特定する。そして、テストケース生成装置100は、機能PostF1と、機能PostFMの動作をテストするテストケースとして用いることができると判定する。
Specifically, in the example of FIG. 4, for the function PostF1 and the function PostFM, the test
また、機能PostF2に対して、テストケース生成装置100は、テストケース1〜テストケースNから対応するテストケースを特定する。そして、テストケース生成装置100は、特定したテストケースを用いて、機能PostF2をテストするテストケースを生成すべきであると判定する。さらに、機能PostFXに対して、テストケース生成装置100は、テストケースを追加すべきであることを判定する。そして、テストケース生成装置100は、機能PostFXに対する追加テストケースを生成する。
In addition, for the function PostF2, the test
機能PostF1〜機能PostFXに対応するテストケースを特定する際には、テストケース生成装置100は、機能PostF1〜機能PostFXに対応する機能PreF1〜機能PreFMを特定する。機能PreF1〜機能PreFMは、テストケース1〜テストケースNのいずれかに関連付けられている。したがって、機能PostF1〜機能PostFXに対応する機能PostF1〜機能PostFXをそれぞれ特定することにより、機能PostF1〜機能PostFXに対応するテストケースも特定することができる。機能PostF1〜機能PostFXに対応する機能PreF1〜機能PreFMを特定する手順の詳細については、図10〜図12にて後述する。
When specifying the test cases corresponding to the functions PostF1 to PostFX, the test
また、機能PostF1〜機能PostFXに対応する機能PreF1〜機能PreFMを特定したのち、機能PostF1〜機能PostFXの動作をテストするテストケースを生成の要否についての手順の詳細は、図13〜図19にて後述する。 Details of the procedure for determining whether it is necessary to generate a test case for testing the operation of the function PostF1 to the function PostFX after specifying the function PreF1 to the function PreFM corresponding to the function PostF1 to the function PostFX will be described with reference to FIGS. Will be described later.
次に、図5を用いて、本実施の形態における、変更前プログラムPrePrgの一例と変更後プログラムPostPrgの一例とを説明する。 Next, an example of the pre-change program PrePrg and an example of the post-change program PostPrg in the present embodiment will be described with reference to FIG.
図5は、変更前プログラムと変更後プログラムとの一例を示す説明図である。図5に示す変更前プログラムPrePrgのソースコードである変更前ソースコードPrePrgSrcは、“TestTarget”クラスの“targetFunc”メソッドについて規定したものである。変更前ソースコードPrePrgSrcが示すように、変更前プログラムPrePrgは、変数「x」を入力値として、変数「rtn」を出力結果とする。 FIG. 5 is an explanatory diagram showing an example of the pre-change program and the post-change program. The pre-change source code PrePrgSrc, which is the source code of the pre-change program PrePrg shown in FIG. 5, defines the “targetFunc” method of the “TestTarget” class. As indicated by the pre-change source code PrePrgSrc, the pre-change program PrePrg takes the variable “x” as an input value and the variable “rtn” as an output result.
また、変更前ソースコードPrePrgSrcは、if文501と、else if文502と、else文503とを有する。そして、変更前ソースコードPrePrgSrcは、if文501の条件を満たすと実行される更新文504と、else if文502の条件を満たすと実行される更新文505と、else文503に制御が到達した際に実行される更新文506とを有する。
The pre-change source code PrePrgSrc includes an if
また、変更後プログラムPostPrgのソースコードである変更後ソースコードPostPrgSrcは、if文511と、else if文512と、else if文513と、else文514とを有する。そして、変更後ソースコードPostPrgSrcは、if文511の条件を満たすと実行される更新文515と、else if文512の条件を満たすと実行される更新文516とを有する。さらに、変更後ソースコードPostPrgSrcは、else if文513の条件を満たすと実行される更新文517と、else文514に制御が到達した際に実行される更新文518とを有する。
The changed source code PostPrgSrc, which is the source code of the changed program PostPrg, includes an if
if文511は、if文501の条件式が変更された文である。else if文512は、else if文502の条件式が変更された文である。else if文513は、新たに追加された条件文である。else文514は、if文511〜else if文513の変更により、制御が到達する条件がelse文503と比較して変更されている。更新文515は、更新文504と同一内容である。更新文516は、更新文505と同一内容である。更新文517は、追加された文である。更新文518は、更新文506と比較して出力結果が変更されている。
The if
次に、変更前プログラムPrePrgと、変更後プログラムPostPrgとをシンボリック実行するシンボリック実行ドライバのプログラムの一例を示す。 Next, an example of a symbolic execution driver program for executing symbolically the pre-change program PrePrg and the post-change program PostPrg is shown.
図6は、シンボリック実行ドライバのプログラムの一例を示す説明図である。図6に示すシンボリック実行用ドライバのソースコードSymDrvSrcは、“TestDriver”クラスを規定したものである。ソースコードSymDrvSrcは、コード群601〜コード群603を含む。また、図6では、テスト対象プログラムのソースコードPrgSrcを図示する。
FIG. 6 is an explanatory diagram of an example of a symbolic execution driver program. The source code SymDrvSrc of the symbolic execution driver shown in FIG. 6 defines the “TestDriver” class. The source code SymDrvSrc includes a
コード群601は、シンボリック変数を指定したコードである。ここで、シンボリック変数とは、変数xを具体的な値ではなくxという文字として扱う変数のことである。コード群602は、出力変数を指定したコードである。コード群603は、パス結果の記録対象を指定したコードである。
The
“TestDriver”クラスの“testFunc”メソッドが実行されることにより、ソースコードPrgSrcの実行オブジェクトが実行される。次に、図7と図8とを用いて、変更前プログラムPrePrgと変更後プログラムPostPrgとのシンボリック実行の結果について説明する。 By executing the “testFunc” method of the “TestDriver” class, the execution object of the source code PrgSrc is executed. Next, the result of symbolic execution of the pre-change program PrePrg and the post-change program PostPrg will be described with reference to FIGS.
図7は、変更前プログラムのシンボリック実行の結果の一例を示す説明図である。テストケース生成装置100は、変更前プログラムPrePrgに対してシンボリック実行用ドライバを実行することにより、変更前プログラムのシンボリック実行結果701を得る。
FIG. 7 is an explanatory diagram showing an example of the result of symbolic execution of the pre-change program. The test
シンボリック実行結果701は、3つのパスについてのシンボリック実行結果を示す。図7に示すシンボリック実行結果701は、レコード701−1〜レコード701−3を有する。シンボリック実行結果701は、パスIDと、パス条件式と、パス出力数式という3つのフィールドを有する。パスIDは、パスを識別するIDである。パス条件式は、該当のパスが実行される条件となる入力変数の値を表す条件式である。パス出力数式は、該当のパスが実行された場合に出力される出力変数を表す数式である。
A
本実施の形態において、変更前プログラムPrePrgは、M個のパスを含むものとする。Mは、1以上の整数である。図7に示すシンボリック実行結果701は、M=3の場合の例を示す。また、xを1以上M以下の整数として、変更前プログラムPrePrgのパスxのパス条件式を、“PrexPC”と呼称する。また、変更前プログラムPrePrgのパスxのパス出力数式を、“PrexR”と呼称する。
In the present embodiment, the pre-change program PrePrg includes M paths. M is an integer of 1 or more. A
図8は、変更後プログラムのシンボリック実行の結果の一例を示す説明図である。テストケース生成装置100は、変更後プログラムPostPrgに対してシンボリック実行用ドライバを実行することにより、変更後プログラムのシンボリック実行結果801を得る。
FIG. 8 is an explanatory diagram illustrating an example of a result of symbolic execution of the changed program. The test
シンボリック実行結果801は、4つのパスについてのシンボリック実行結果を示す。図8に示すシンボリック実行結果801は、レコード801−1〜レコード801−4を有する。
A
本実施の形態において、変更後プログラムPostPrgは、N個のパスを含むものとする。Nは、1以上の整数である。図8に示すシンボリック実行結果801は、N=4の場合の例を示す。また、xを1以上N以下の整数として、変更後プログラムPostPrgのパスxのパス条件式を、“PostxPC”と呼称する。また、変更後プログラムPostPrgのパスxのパス出力数式を、“PostxR”と呼称する。
In the present embodiment, it is assumed that the post-change program PostPrg includes N paths. N is an integer of 1 or more. A
(テストケース生成装置100の機能)
次に、テストケース生成装置100の機能について説明する。図9は、テストケース生成装置の機能例を示すブロック図である。テストケース生成装置100は、第1取得部901と、第2取得部902と、パス関連判断部903と、関連情報作成部904と、特定部905と、数式判定部906と、生成判定部907と、算出部908と、テストケース生成部909を含む。制御部となる第1取得部901〜テストケース生成部909は、記憶装置に記憶されたプログラムをCPU201が実行することにより、第1取得部901〜テストケース生成部909の機能を実現する。記憶装置とは、具体的には、たとえば、図2に示したROM202、RAM203、ディスク205などである。または、通信インターフェース206を経由して他のCPUが実行することにより、第1取得部901〜テストケース生成部909の機能を実現してもよい。
(Function of test case generation apparatus 100)
Next, functions of the test
第1取得部901は、変更前プログラムPrePrgをシンボリック実行することにより、変更前プログラムPrePrgに含まれる第1のパスの第1のパス条件式と、第1のパスの第1のパス出力数式と、を含む第1のシンボリック実行結果を取得する。
The
また、第1のシンボリック実行結果は、変更前プログラムPrePrgに含まれるパス群の各々のパスごとの、パス条件式と、パス出力数式とを含んでもよい。なお、取得された第1のシンボリック実行結果は、RAM203、ディスク205などの記憶領域に記憶される。
Further, the first symbolic execution result may include a path condition expression and a path output expression for each path of the path group included in the pre-change program PrePrg. The obtained first symbolic execution result is stored in a storage area such as the
第2取得部902は、変更後プログラムPostPrgをシンボリック実行することにより、変更後プログラムPostPrgに含まれる第2のパスの第2のパス条件式と、第2のパスの第2のパス出力数式と、を含む第2のシンボリック実行結果を取得する。
The
また、第2のシンボリック実行結果は、変更後プログラムPostPrgに含まれるパス群の各々のパスごとの、パス条件式と、パス出力数式とを含んでもよい。なお、取得された第2のシンボリック実行結果は、RAM203、ディスク205などの記憶領域に記憶される。
The second symbolic execution result may include a path condition expression and a path output expression for each path in the path group included in the post-change program PostPrg. The acquired second symbolic execution result is stored in a storage area such as the
パス関連判断部903は、入力変数が取り得る値のうちの、第1取得部901によって取得された第1のパス条件式と第2取得部902によって取得された第2のパス条件式との充足可能性に基づいて、第2のパスが第1のパスに関連するか否かを判断する。
The path-related determining
また、パス関連判断部903は、第1のシンボリック実行結果に含まれるパスと第2のパスとの組ごとに、前述のパスのパス条件式と第2の条件式との充足可能性に基づいて、第2のパスが第1の実行結果に含まれるパスに関連するか否かを判断してもよい。
Further, the path
また、パス関連判断部903は、第1のシンボリック実行結果に含まれるパスと第2のシンボリック実行結果に含まれるパスとの組ごとに、2つのパスの条件式の論理積を真とする値の有無に基づいて、2つのパスが関連するか否かを判断してもよい。なお、判断結果は、RAM203、ディスク205などの記憶領域に記憶される。
In addition, the path
関連情報作成部904は、パス関連判断部903によって第2のパスが第1のシンボリック実行結果に含まれるパスに関連すると判断された場合、第2のパスが第1のシンボリック実行結果に含まれるパスに関連することを示す関連情報を作成する。関連情報の作成については、図10にて後述する。
When the path
また、関連情報作成部904は、次の条件を満たすと判断された場合、第2のシンボリック実行結果に含まれるパスが第1のシンボリック実行結果に含まれるパスに関連することを示す関連情報を作成してもよい。次の条件とは、パス関連判断部903によって第2のシンボリック実行結果に含まれるパスが第1のシンボリック実行結果に含まれるパスに関連すると判断された場合である。なお、関連情報は、RAM203、ディスク205などの記憶領域に記憶される。
In addition, when it is determined that the following condition is satisfied, the related
特定部905は、パス関連判断部903によって第2のパスが第1のパスに関連すると判断した場合、第1のパス条件式と第2のパス条件式の否定との充足可能性を特定するとともに、第1のパス条件式の否定と第2の条件式との充足可能性を特定する。2つの充足可能性の特定については、具体的には、図11にて説明する。
When the path
また、特定部905は、関連情報が示す第1の実行結果に含まれる各パスに対応するパス条件式と関連情報が示す第2の実行結果に含まれる各パスに対応するパス条件式の否定との充足可能性を関連情報ごとに特定する。さらに、特定部905は、関連情報が示す第1の実行結果に含まれる各パスに対応するパス条件式の否定と関連情報が示す第1の実行結果に含まれる各パスに対応する条件式との充足可能性を関連情報ごとに特定してもよい。なお、特定結果は、RAM203、ディスク205などの記憶領域に記憶される。
Further, the specifying
数式判定部906は、第1取得部901によって取得された第1のパス出力数式と、第2取得部902によって取得された第2のパス出力数式とが一致するか否かを判定する。具体的な判定の方法としては、図13〜図16にて後述する。また、数式判定部906は、関連情報作成部904によって作成された関連情報が示す第1のパス出力数式と第2のパス出力数式とが一致するか否かを判定してもよい。
The
また、数式判定部906は、第1のシンボリック実行結果に含まれる各パスと第2のパスとの組合せの組ごとに、第1のシンボリック実行結果に含まれるパス出力数式と、第2のパス出力数式とが一致するか否かを判定してもよい。
In addition, the mathematical
また、数式判定部906は、第1のシンボリック実行結果に含まれるパス出力数式と、取得した第2のシンボリック実行結果に含まれるパス出力数式とが一致するか否かを判定してもよい。数式判定部906は、第1のシンボリック実行結果に含まれる各パスと第2のシンボリック実行結果に含まれる各パスとの組合せの組ごとに一致するか否かを判定する。なお、判定結果は、RAM203、ディスク205などの記憶領域に記憶される。
Further, the mathematical
生成判定部907は、パス関連判断部903による判断結果と数式判定部906による判定結果とに基づいて、第2のパスの動作をテストするテストケースを生成すべきか否かを判定する。また、生成判定部907は、特定部905による特定結果と数式判定部906による判定結果とに基づいて、第2のパスの動作をテストするテストケースを生成すべきか否かを判定してもよい。具体的な判定方法は、図18にて後述する。
The
また、生成判定部907は、次に示す条件を満たす場合、第2のパスの動作をテストするテストケースを生成すべきであると判定してもよい。次に示す条件とは、特定部905が第1のパス条件式の否定と第2のパス条件式とが充足可能であると特定し、かつ、数式判定部906による判定結果が第1のパス出力数式と第2のパス出力数式とが一致することを示す場合である。
The
また、生成判定部907は、次の情報に基づいて、第2のパスの動作をテストするテストケースを生成すべきか否かを判定してもよい。次の情報とは、関連情報作成部904によって作成された関連情報と、数式判定部906による第1の実行結果に含まれるパスと第2のパスとの組ごとの判定結果とである。
The
また、生成判定部907は、次に示す情報に基づいて、第2のシンボリック実行結果に含まれる各パスの動作をテストするテストケースを生成すべきか否かを判定してもよい。次に示す情報は、関連情報作成部904によって作成された関連情報と、数式判定部906による第1のシンボリック実行結果に含まれるパスと第2のシンボリック実行結果に含まれるパスとの組ごとの判定結果とになる。
Further, the
また、生成判定部907は、次に示す情報に基づいて、第2のシンボリック実行結果に含まれる各パスの動作をテストするテストケースを生成すべきか否かを判定してもよい。次に示す情報は、特定部905による関連情報ごとの特定結果と、数式判定部906による第1のシンボリック実行結果に含まれるパスと第2の実行結果に含まれる各パスとの組ごとの判定結果とになる。なお、判定結果は、RAM203、ディスク205などの記憶領域に記憶される。
Further, the
算出部908は、生成判定部907によって第2のパスの動作をテストするテストケースを生成すべきであると判定された場合、第2のパス条件式を真とする入力変数の値を算出する。具体的な算出例は、図20にて後述する。
When the
また、算出部908は、生成判定部907によって第2のパスの動作をテストするテストケースを生成すべきであると判定された場合、第1のパス条件式の否定と第2のパス条件式との論理積を真とする値を算出してもよい。なお、算出した値は、RAM203、ディスク205などの記憶領域に記憶される。
In addition, when the
テストケース生成部909は、算出部908によって算出された値を入力変数の値とする第2のパスの動作をテストするテストケースを生成する。なお、生成したテストケースは、RAM203、ディスク205などの記憶領域に記憶されてもよいし、ディスプレイ207に表示されてもよいし、通信インターフェース206を経由して外部装置へ送信されてもよい。
The test
図10は、実施の形態1における変更前後のパスを関連付けた結果の一例を示す説明図である。テストケース生成装置100は、シンボリック実行結果701と、シンボリック実行結果801と、を受け付けて、パス関連付け結果1001を出力する。具体的に、テストケース生成装置100は、変更前後プログラムのパス条件式を、それぞれ、PrePC、PostPCとすると、下記条件式(1)を作成し、条件式(1)の充足可能性を判定する。
FIG. 10 is an explanatory diagram illustrating an example of a result of associating paths before and after the change in the first embodiment. The test
PrePC∧PostPC …(1) PrePC ∧ PostPC (1)
テストケース生成装置100は、Pre1PC〜Pre3PCと、Post1PC〜Post4PCとの全ての組合せに対して、条件式(1)の充足可能性を判定する。そして、テストケース生成装置100は、充足可能となったパスの組合せを関連付ける。
The test
条件式の充足可能性の判定は、たとえばSMT(Satisfiability Modulo Theory)ソルバやSAT(SATisfiability)ソルバなどの制約ソルバが利用される。 For example, a constraint solver such as an SMT (Satisfiability Modulus Theory) solver or an SAT (SAT is a fidelity) solver is used to determine whether the conditional expression is satisfiable.
図10の例では、Pre2PCとPost1PC、Pre2PCとPost2PC、Pre2PCとPost3PC、Pre2PCとPost4PC、という4つの組合せについての条件式(1)の充足可能性を図示する。Pre2PC∧Post1PCは、10≦x<20となるxによって真となるため、条件式(1)が充足可能である。Pre2PC∧Post2PCは、20≦x<30となるxによって真となるため、条件式(1)が充足可能である。Pre2PC∧Post3PCは、30≦x<40となるxによって真となるため、条件式(1)が充足可能である。Pre2PC∧Post4PCは、真となるxが存在しないため、条件式(1)が充足不可能である。 In the example of FIG. 10, the satisfiability of the conditional expression (1) for four combinations of Pre2PC and Post1PC, Pre2PC and Post2PC, Pre2PC and Post3PC, Pre2PC and Post4PC is illustrated. Since Pre2PC∧Post1PC is true when x satisfies 10 ≦ x <20, conditional expression (1) can be satisfied. Since Pre2PC∧Post2PC is true when x satisfies 20 ≦ x <30, the conditional expression (1) can be satisfied. Since Pre2PC∧Post3PC is true when x satisfies 30 ≦ x <40, conditional expression (1) can be satisfied. Since Pre2PC∧Post4PC does not have true x, conditional expression (1) cannot be satisfied.
したがって、テストケース生成装置100は、条件式(1)が充足可能となった、Pre2PCとPost1PCとを関連付け、Pre2PCとPost2PCとを関連付け、Pre2PCとPost3PCとを関連付ける。以下、関連付けた組合せを含む情報を、関連情報とする。関連情報は、パス関連付け結果1001のレコード1つ分の情報である。
Therefore, the test
パス関連付け結果1001は、テストケース組番号と、変更前プログラムのパスIDと、変更後プログラムのパスIDという3つのフィールドを有する。パス関連付け結果1001は、レコード1001−1〜レコード1001−6を有する。テストケース組番号フィールドには、関連付けられた組合せを一意に特定する番号が格納される。変更前プログラムのパスIDフィールドは、関連情報の変更前プログラムのパスIDが格納される。変更後プログラムのパスIDフィールドは、関連情報の変更後プログラムのパスIDが格納される。
The
以下、関連情報の変更前プログラムのパス条件式を、“PrePC_TC”と呼称する。同様に、関連情報の変更後プログラムのパス条件式を、“PostPC_TC”と呼称する。また、関連情報の変更前プログラムのパス出力数式を、“PreR_TC”と呼称する。同様に、関連情報の変更後プログラムのパス出力数式を、“PostR_TC”と呼称する。 Hereinafter, the path conditional expression of the pre-change program for related information is referred to as “PrePC_TC”. Similarly, the path conditional expression of the program after the change of the related information is referred to as “PostPC_TC”. Further, the path output formula of the pre-change program of related information is referred to as “PreR_TC”. Similarly, the path output formula of the program after changing the related information is referred to as “PostR_TC”.
また、本実施の形態において、関連情報は、L個作成されるものとする。Lは、1以上の整数である。図10に示すパス関連付け結果1001は、L=6の場合の例を示す。
In the present embodiment, L pieces of related information are created. L is an integer of 1 or more. A
図11は、パス条件式変更種別の分類例を示す説明図である。テストケース生成装置100は、図10により関連付けられた関連情報のそれぞれに対して、パス条件式がどのように変更されたかを示す種別に分類する。具体的に、テストケース生成装置100は、条件式(2−1)と条件式(2−2)の充足可能性を、制約ソルバを用いて判定する。
FIG. 11 is an explanatory diagram of a classification example of the path conditional expression change type. The test
PrePC_TC(i)∧¬PostPC_TC(i) …(2−1)
¬PrePC_TC(i)∧PostPC_TC(i) …(2−2)
PrePC_TC (i) ∧PostPC_TC (i) (2-1)
¬PrePC_TC (i) ∧PostPC_TC (i) (2-2)
ただし、“(i)”は、関連情報のi番目の組であることを示す。テストケース生成装置100は、条件式(2−1)と条件式(2−2)の充足可能性の結果に基づいて、パス条件式変更種別を4つに分類する。
However, “(i)” indicates the i-th set of related information. The test
1つ目の分類として、条件式(2−1)と条件式(2−2)が共に充足不可能である場合、PrePC_TC(i)を真とする入力変数が取り得る集合とPostPC_TC(i)を真とする入力変数が取り得る集合が一致することを示す。この場合、テストケース生成装置100は、パス条件式変更種別を“不変”に特定する。特定したパス条件式変更種別は、関連情報に付与される。
As a first classification, when both the conditional expression (2-1) and the conditional expression (2-2) are unsatisfiable, a set that can be taken by an input variable having PrePC_TC (i) as true and PostPC_TC (i) Indicates that the sets that can be taken by the input variable that is true match. In this case, the test
2つ目の分類として、条件式(2−1)が充足可能であり、条件式(2−2)が充足不可能である場合、PostPC_TC(i)を真とする入力変数が取り得る値の集合が、PrePC_TC(i)を真とする入力変数が取り得る値の集合に含まれることを示す。この場合、テストケース生成装置100は、パス条件式変更種別を“縮小”に特定する。特定したパス条件式変更種別は、関連情報に付与される。
As the second classification, when the conditional expression (2-1) is satisfiable and the conditional expression (2-2) is unsatisfiable, the value of the input variable that PostPC_TC (i) is true can be taken. It indicates that the set is included in the set of possible values for the input variable that is true for PrePC_TC (i). In this case, the test
3つ目の分類として、条件式(2−1)が充足不可能であり、条件式(2−2)が充足可能である場合、PostPC_TC(i)を真とする入力変数が取り得る値の集合が、PrePC_TC(i)を真とする入力変数が取り得る値の集合を含むことを示す。この場合、テストケース生成装置100は、パス条件式変更種別を“拡大”に特定する。特定したパス条件式変更種別は、関連情報に付与される。
As a third classification, when conditional expression (2-1) is unsatisfiable and conditional expression (2-2) is satisfiable, an input variable having PostPC_TC (i) as true Indicates that the set includes a set of possible values for an input variable that is true for PrePC_TC (i). In this case, the test
4つ目の分類として、条件式(2−1)と条件式(2−2)が共に充足可能である場合、PrePC_TC(i)を真とする入力変数が取り得る集合とPostPC_TC(i)を真とする入力変数が取り得る集合とが一部重なることを示す。この場合、テストケース生成装置100は、パス条件式変更種別を“重複”に特定する。特定したパス条件式変更種別は、関連情報に付与される。
As a fourth classification, when both the conditional expression (2-1) and the conditional expression (2-2) can be satisfied, a set that can be taken by an input variable having PrePC_TC (i) as true and PostPC_TC (i) Indicates that the set that can be assumed by the input variable that is true partially overlaps. In this case, the test
図12は、実施の形態1におけるパス条件式変更種別の分類結果の一例を示す説明図である。図12では、テストケース生成装置100が、図11にて示したパス条件式変更種別の分類手順に従って、関連情報のパス条件式変更種別を分類した結果となるパス条件式変更種別結果1201を示す。
FIG. 12 is an explanatory diagram illustrating an example of the classification result of the path conditional expression change type in the first embodiment. FIG. 12 shows a path condition expression
パス条件式変更種別結果1201は、パス関連付け結果1001が有するフィールドと、パス条件式変更種別フィールドとを有する。パス条件式変更種別フィールドには、該当の関連情報のパス条件式変更種別が格納される。図12に示すパス条件式変更種別結果1201は、レコード1201−1〜レコード1201−6を有する。たとえば、レコード1201−1は、Pre1とPost1の関連情報のパス条件式変更種別が、“拡大”であることを示す。
The path conditional expression
図13は、パス出力数式変更種別の判定ルールの一例を示す説明図である。図13では、パス出力数式変更種別の判定ルールを表1301として示す。表1301は、ルール番号と、パス出力数式変更種別判定ルールとを有する。パス出力数式変更種別判定ルールを、以下、単に、「判定ルール」と称する。表1301は、レコード1301−1〜1301−4を有する。レコード1301−1〜1301−4のそれぞれが1つの判定ルールを示す。以下、レコード1301−1〜レコード1301−4がそれぞれ示す判定ルールを、「判定ルール1」〜「判定ルール4」と呼称する。 FIG. 13 is an explanatory diagram of an example of a determination rule for the path output formula change type. In FIG. 13, the determination rule of the path output formula change type is shown as a table 1301. Table 1301 has a rule number and a path output formula change type determination rule. The path output formula change type determination rule is hereinafter simply referred to as “determination rule”. The table 1301 includes records 1301-1 to 1301-4. Each of the records 1301-1 to 1301-4 indicates one determination rule. Hereinafter, the determination rules respectively indicated by the records 1301-1 to 1301-4 are referred to as “determination rules 1” to “determination rules 4”.
テストケース生成装置100は、関連情報のPreR_TC(i)とPostR_TC(i)とが、レコード1301−1が示す判定ルール1を満たす場合、パス出力数式変更種別を“不変”と判定する。判定したパス出力数式変更種別は、関連情報に付与される。
When the related information PreR_TC (i) and PostR_TC (i) satisfy the
一方、テストケース生成装置100は、PreR_TC(i)とPostR_TC(i)とが判定ルール1を満たさない場合、判定ルール2〜判定ルール4のいずれかを適用する。適用手順の第1の例として、テストケース生成装置100は、判定ルール2を適用して、判定ルール2による判定結果を出力する。また、適用手順の第2の例として、テストケース生成装置100は、適用手順の第1の例に従って判定ルール2を適用して、判定ルール2による判定結果が“判定不能”となった場合、判定ルール3を適用し、判定ルール3による判定結果を出力してもよい。さらに、適用手順の第3の例として、テストケース生成装置100は、適用手順の第2の例に従って、判定ルール3を適用して、判定ルール3による判定結果が“判定不能”となった場合、判定ルール4を適用し、判定ルール4による判定結果を出力してもよい。
On the other hand, when PreR_TC (i) and PostR_TC (i) do not satisfy the
判定ルール1は、PreR_TC(i)とPostR_TC(i)とを、文字列として比較し、一致した場合、パス出力数式変更種別を“不変”と判断するルールである。文字列として比較する場合に、テストケース生成装置100は、PreR_TC(i)の文字列と、PostR_TC(i)の文字列をそのまま比較してもよいし、スペースやタブを除いて比較してもよい。
The
判定ルール2については、図14にて説明する。判定ルール3のパス出力数式変更種別判定ルールについては、図15にて説明する。判定ルール4のパス出力数式変更種別判定ルールについては、図16にて説明する。
The
図14は、判定ルール2を適用した場合の一例を示す説明図である。判定ルール2は、下記条件式(3−1)、下記条件式(3−2)、下記条件式(3−3)の充足可能性を判定した結果を用いて、パス出力数式変更種別を判定するルールである。
FIG. 14 is an explanatory diagram showing an example when the
(R=PreR_TC(i))∧(R=PostR_TC(i)) …(3−1)
¬(R=PreR_TC(i))∧(R=PostR_TC(i)) …(3−2)
(R=PreR_TC(i))∧¬(R=PostR_TC(i)) …(3−3)
(R = PreR_TC (i)) ∧ (R = PostR_TC (i)) (3-1)
¬ (R = PreR_TC (i)) ∧ (R = PostR_TC (i)) (3-2)
(R = PreR_TC (i)) ∧¬ (R = PostR_TC (i)) (3-3)
具体的に、判定ルール2を適用した場合、テストケース生成装置100は、条件式(3−1)、条件式(3−2)、条件式(3−3)の順に、充足可能、充足不可能、充足不可能となる場合、パス出力数式変更種別を“不変”と判定する。また、条件式(3−1)、条件式(3−2)、条件式(3−3)の順に、充足可能、充足不可能、充足不可能の順とならない場合、テストケース生成装置100は、パス出力数式変更種別を“変更”と判定する。さらに、制約ソルバが充足可能性を判定できない場合、テストケース生成装置100は、パス出力数式変更種別を“判定不能”と判定する。判定したパス出力数式変更種別は、関連情報に付与される。
Specifically, when the
表1401は、判定ルール2を適用しようとする関連情報TC1〜TC3について表示する。表1401は、レコード1401−1〜レコード1401−3を有する。関連情報TC1〜TC3に対して、判定ルール2を適用した際の判定結果が表1402である。表1402は、レコード1402−1〜レコード1402−3を有する。たとえば、レコード1402−1は、条件式(3−1)、条件式(3−2)、条件式(3−3)の順に、充足可能、充足不可能、充足不可能となったため、判定結果が“不変”であると判定されたことを示す。
The table 1401 displays related information TC1 to TC3 to which the
また、レコード1402−2とレコード1402−3は、制約ソルバが、条件式(3−1)、条件式(3−2)、条件式(3−3)の充足可能性を判定不能であったため、判断結果が“判定不能”であると判定されたことを示す。なお、制約ソルバが判定不能となる場合として、たとえば、条件式に、非線形の関数が含まれる場合である。 In addition, in record 1402-2 and record 1402-3, the constraint solver was unable to determine the satisfiability of conditional expression (3-1), conditional expression (3-2), and conditional expression (3-3). , Indicating that the determination result is determined to be “determination impossible”. The case where the constraint solver cannot be determined is, for example, a case where a nonlinear function is included in the conditional expression.
図15は、判定ルール3を適用した場合の一例を示す説明図である。判定ルール3は、交換法則、分配法則などを利用してパス出力数式変更種別を判定するルールである。具体的に、判定ルール3を適用した場合、テストケース生成装置100は、PreR_TC(i)とPostR_TC(i)を展開し、変数のアルファベット順に並べた式とした後、文字列として比較し、一致した場合、パス出力数式変更種別を“不変”と判定する。一方、一致しない場合、テストケース生成装置100は、パス出力数式変更種別を“変更”と判定する。また、交換法則、分配法則などが利用できない場合、テストケース生成装置100は、パス出力数式変更種別を“判定不能”と判定する。また、交換法則と分配法則以外として、テストケース生成装置100は、結合法則を利用してもよい。
FIG. 15 is an explanatory diagram illustrating an example when the
表1401は、判定ルール3を適用しようとする関連情報TC1〜TC3について表示する。関連情報TC1〜TC3に対して、判定ルール3を適用した際の判定結果が表1501である。表1501は、レコード1501−1〜レコード1501−3を有する。
A table 1401 displays related information TC1 to TC3 to which the
たとえば、レコード1501−1は、交換法則をPreR_TCとPostR_TCとに適用した結果の文字列が共に“x+2*y”となり、パス出力数式変更種別が“不変”であると判定されたことを示す。また、レコード1501−2は、分配法則と交換法則とをPreR_TCとPostR_TCとに適用した結果の文字列が共に“f(x)*z(x,y)+g(y)*z(x,y)”となり、パス出力数式変更種別が“不変”であると判定されたことを示す。一方、レコード1501−3は、分配法則と交換法則とがPreR_TCとPostR_TCとに適用できず、パス出力数式変更種別が“判定不能”であると判定されたことを示す。 For example, the record 1501-1 indicates that the character strings resulting from applying the exchange rule to PreR_TC and PostR_TC are both “x + 2 * y” and the path output formula change type is determined to be “invariant”. In the record 1501-2, a character string resulting from applying the distribution law and the exchange law to PreR_TC and PostR_TC is “f (x) * z (x, y) + g (y) * z (x, y ) ”, Indicating that the path output formula change type is determined to be“ invariant ”. On the other hand, the record 1501-3 indicates that the distribution law and the exchange law cannot be applied to PreR_TC and PostR_TC, and it is determined that the path output formula change type is “undecidable”.
図16は、判定ルール4を適用した場合の一例を示す説明図である。判定ルール4は、パス条件式が真となる入力値を用いて、パス出力数式変更種別を判定するルールである。具体的に、判定ルール4を適用した場合、テストケース生成装置100は、PrePC_TC(i)と、PostPC_TC(i)とが真となる入力値を指定数個生成する。図16の例では、指定数を、2とする。そして、テストケース生成装置100は、生成した入力値全てに対して、PreR_TC(i)の値と、PostR_TC(i)の値とが一致した場合、パス出力数式変更種別を“不変”と判定する。また、一致しない場合、テストケース生成装置100は、パス出力数式変更種別を“変更”と判定する。
FIG. 16 is an explanatory diagram illustrating an example when the
表1601は、判定ルール4を適用しようとする関連情報TC3、TC4について表示する。表1601は、レコード1601−1、レコード1601−2を有する。関連情報TC3、TC4に対して、判定ルール4を適用した際の判定結果が表1602である。表1602は、レコード1602−1、レコード1602−2を有する。
A table 1601 displays related information TC3 and TC4 to which the
たとえば、レコード1602−1は、PreR_TCとPostR_TCのそれぞれに入力値x=X1、y=Y1を入力した結果が一致し、入力値x=X2、y=Y2を入力した結果が一致して、判定結果が“不変”であると判定されたことを示す。また、レコード1602−2は、PreR_TCとPostR_TCのそれぞれに入力値x=X3、y=Y3を入力した結果が一致しないため、判定結果が“変更”であると判定されたことを示す。 For example, in the record 1602-1, the result of inputting the input values x = X1 and y = Y1 to PreR_TC and PostR_TC respectively matches, and the result of inputting the input values x = X2 and y = Y2 matches. Indicates that the result is determined to be “invariant”. The record 1602-2 indicates that the determination result is determined to be “change” because the input values x = X3 and y = Y3 do not match with each of PreR_TC and PostR_TC.
図17は、パス出力数式変更判定の分類結果の一例を示す説明図である。図17では、テストケース生成装置100が、図13〜図16にて示したパス出力数式変更種別の分類手順に従って、関連情報のパス出力数式変更種別を分類した結果となるパス出力数式変更種別結果1701を示す。
FIG. 17 is an explanatory diagram illustrating an example of the classification result of the path output formula change determination. In FIG. 17, the test
パス出力数式変更種別結果1701は、パス関連付け結果1001が有するフィールドと、パス出力数式変更種別フィールドとを有する。パス出力数式変更種別フィールドには、該当の関連情報のパス出力数式変更種別が格納される。図17に示すパス出力数式変更種別結果1701は、レコード1701−1〜レコード1701−6を有する。たとえば、レコード1701−1は、Pre1とPost1の関連情報のパス出力数式変更種別が、“不変”であることを示す。
The path output formula
図18は、テストケース分類ルールの一例を示す説明図である。図18に示すテストケース分類ルールテーブル1801は、パス条件式変更種別とパス出力数式変更種別とに応じて、テストケース種別の分類ルールを示す。テストケース種別は、テストケースを生成すべきか否かを示す。さらに、テストケース種別は、テストケースを生成すべき際に新たな機能に対するテストケースである可能性があるか否かを示す。テストケース分類ルールを、以下、単に、「分類ルール」と呼称する。テストケース分類ルールテーブル1801は、レコード1801−1〜レコード1801−13を有する。 FIG. 18 is an explanatory diagram of an example of the test case classification rule. A test case classification rule table 1801 shown in FIG. 18 shows test rule classification rules according to the path condition formula change type and the path output formula change type. The test case type indicates whether or not a test case should be generated. Furthermore, the test case type indicates whether or not there is a possibility of a test case for a new function when a test case is to be generated. Hereinafter, the test case classification rule is simply referred to as “classification rule”. The test case classification rule table 1801 includes records 1801-1 to 1801-13.
テストケース分類ルールテーブル1801は、分類ルール、パス条件式変更種別、パス出力数式変更種別、テストケースパス条件式、テストケース種別という5つのフィールドを含む。分類ルールフィールドには、分類ルールを識別する番号が格納される。以下、レコード1801−1〜レコード1801−13がそれぞれ示す分類ルールを、「分類ルール1」〜「分類ルール9」と呼称する。
The test case classification rule table 1801 includes five fields: classification rule, path condition expression change type, path output formula change type, test case path condition expression, and test case type. In the classification rule field, a number for identifying the classification rule is stored. Hereinafter, the classification rules indicated by the records 1801-1 to 1801-13 are referred to as “
パス条件式変更種別フィールドには、該当の分類ルールが適用される条件の1つとなるパス条件式変更種別が格納される。パス出力数式変更種別フィールドには、該当の分類ルールが適用される条件の1つとなるパス出力数式変更種別が格納される。テストケースパス条件式フィールドには、該当の分類ルールが適用された場合のテストケースの入力値が満たす条件式が格納される。テストケース種別フィールドには、該当の分類ルールが適用された場合のテストケースの変更要否種別が格納される。テストケース種別は、“不変”と、“回帰”と、“変更”と、“追加”と、“確認”がある。 The path condition expression change type field stores a path condition expression change type that is one of the conditions to which the corresponding classification rule is applied. The path output formula change type field stores a path output formula change type that is one of the conditions to which the corresponding classification rule is applied. The test case path conditional expression field stores a conditional expression that satisfies the input value of the test case when the corresponding classification rule is applied. The test case type field stores the type of necessity of changing the test case when the corresponding classification rule is applied. Test case types include “invariant”, “regression”, “change”, “add”, and “confirm”.
“不変”と“回帰”とは、変更後プログラムPostPrgのパスの機能が、変更前プログラムPrePrgのパスの機能から変更されておらず、変更前プログラムPrePrgのパスをテストするテストケースを生成しなくてよいことを示す。また、“回帰”は、変更後プログラムPostPrgのパス条件式が、変更前プログラムPrePrgのパス条件式から変更されており、該当のテストケースが、変更後プログラムPostPrgの動作を確認するテストケースとして実行された方がよいことも示す。 “Invariant” and “Regression” means that the path function of the post-change program PostPrg is not changed from the path function of the pre-change program PrePrg, and does not generate a test case for testing the path of the pre-change program PrePrg. Indicates that it is okay. “Regression” is executed as a test case in which the path condition formula of the post-change program PostPrg is changed from the path condition formula of the pre-change program PrePrg, and the corresponding test case confirms the operation of the post-change program PostPrg. It also shows that it is better to be done.
“変更”と“追加”とは、変更後プログラムPostPrgのパスの機能が、変更前プログラムPrePrgのパスの機能から変更されており、変更後プログラムPostPrgのパスをテストするテストケースを生成すべきであることを示す。さらに、“追加”は、変更後プログラムPostPrgのパスの機能が新しい機能である可能性も示す。 “Change” and “add” means that the path function of the post-change program PostPrg is changed from the path function of the pre-change program PrePrg, and a test case for testing the path of the post-change program PostPrg should be generated. It shows that there is. Furthermore, “add” indicates that the path function of the post-change program PostPrg may be a new function.
“確認”は、変更後プログラムPostPrgのパスの機能が、変更前プログラムPrePrgのパスの機能から変更されたか否かを判断できず、変更後プログラムPostPrgのパスをテストするテストケースを生成すべきか否か判断できないことを示す。テストケース生成装置100の利用者は、テストケース種別が“確認”となったテストケースに対して、たとえば、該当のパスの処理内容の確認を行う。
“Confirmation” cannot determine whether or not the path function of the post-change program PostPrg has been changed from the pre-change program PrePrg path function, and whether or not to generate a test case for testing the post-change program PostPrg path Indicates that it cannot be determined. The user of the test
レコード1801−1は、パス条件式変更種別が“不変”であり、パス出力数式変更種別が“不変”である関連情報についての分類ルールである分類ルール1について示す。分類ルール1の条件が満たされた関連情報は、テストケース種別が“不変”となり、テストケースパス条件式がPostPC_TCとなることを示す。
A record 1801-1 indicates a
レコード1801−2は、パス条件式変更種別が“不変”であり、パス出力数式変更種別が“変更”である関連情報についての分類ルールである分類ルール2について示す。分類ルール2の条件が満たされた関連情報は、テストケース種別が“変更”となり、テストケースパス条件式がPostPC_TCとなることを示す。
A record 1801-2 indicates a
レコード1801−3は、パス条件式変更種別が“縮小”であり、パス出力数式変更種別が“不変”である関連情報についての分類ルールである分類ルール3について示す。分類ルール3の条件が満たされた関連情報は、テストケース種別が“回帰”となり、テストケースパス条件式がPostPC_TCとなることを示す。
A record 1801-3 indicates a
レコード1801−4は、パス条件式変更種別が“縮小”であり、パス出力数式変更種別が“変更”である関連情報についての分類ルールである分類ルール4について示す。分類ルール4の条件が満たされた関連情報は、テストケース種別が“追加”となり、テストケースパス条件式がPostPC_TCとなることを示す。テストケース種別を“追加”とする根拠として、パス条件式変更種別が“縮小”であり、機能が変更しているということは、新しい機能を提供するために、パス条件式を細分化して、新しい機能となるソースコードを記述した可能性が高いからである。
A record 1801-4 indicates a
レコード1801−5とレコード1801−6とは、パス条件式変更種別が“拡大”であり、パス出力数式変更種別が“不変”である関連情報についての分類ルールである分類ルール5について示す。分類ルール5の条件が満たされた関連情報は、テストケースパス条件式に応じて2つに分割することになる。分類ルール5の条件が満たされた関連情報のうちのテストケースパス条件式PrePC_TC∧PostPC_TCを満たす関連情報のテストケース種別は、“回帰”となることを示す。
Records 1801-5 and 1801-6 indicate
一方、分類ルール5の条件が満たされた関連情報のうちのテストケースパス条件式¬PrePC_TC∧PostPC_TCを満たす関連情報のテストケース種別は、“追加”となる。テストケース種別を“追加”とする根拠として、パス条件式変更種別が“拡大”であるということは、新しい入力値に対応するために、パス条件式を拡大した可能性が高いからである。
On the other hand, the test case type of the related information satisfying the test case path conditional expression ¬ PrePC_TC∧PostPC_TC among the related information satisfying the condition of the
レコード1801−7とレコード1801−8とは、パス条件式変更種別が“拡大”であり、パス出力数式変更種別が“変更”である関連情報についての分類ルールである分類ルール6について示す。分類ルール6の条件が満たされた関連情報は、テストケースパス条件式に応じて2つに分割することになる。分類ルール6の条件が満たされた関連情報のうちのテストケースパス条件式prePC_TC∧PostPC_TCを満たす関連情報のテストケース種別は、“変更”となる。一方、分類ルール6の条件が満たされた関連情報のうちのテストケースパス条件式¬PrePC_TC∧PostPC_TCを満たす関連情報のテストケース種別は、“変更”となる。
Records 1801-7 and 1801-8 indicate the
レコード1801−9とレコード1801−10とは、パス条件式変更種別が“重複”であり、パス出力数式変更種別が“不変”である関連情報についての分類ルールである分類ルール7について示す。分類ルール7の条件が満たされた関連情報は、テストケースパス条件式に応じて2つに分割することになる。分類ルール7の条件が満たされた関連情報のうちのテストケースパス条件式prePC_TC∧PostPC_TCを満たす関連情報のテストケース種別は、“回帰”となることを示す。
Records 1801-9 and 1801-10
一方、分類ルール7の条件が満たされた関連情報のうちのテストケースパス条件式¬PrePC_TC∧PostPC_TCを満たす関連情報のテストケース種別は、“追加”となる。テストケース種別を“追加”とする根拠として、パス条件式変更種別が“重複”であるということは、パス条件式を縮小した箇所と拡大した箇所があることになり、新しい入力値に対応するために、パス条件式を拡大した可能性が高いからである。
On the other hand, the test case type of the related information satisfying the test case path conditional expression ¬ PrePC_TC∧PostPC_TC among the related information satisfying the condition of the
レコード1801−11とレコード1801−12とは、パス条件式変更種別が“重複”であり、パス出力数式変更種別が“変更”である関連情報についての分類ルールである分類ルール8について示す。分類ルール8の条件が満たされた関連情報は、テストケースパス条件式に応じて2つに分割することになる。分類ルール8の条件が満たされた関連情報のうちのテストケースパス条件式prePC_TC∧PostPC_TCを満たす関連情報のテストケース種別は、“変更”となる。一方、分類ルール8の条件が満たされた関連情報のうちのテストケースパス条件式¬prePC_TC∧PostPC_TCを満たす関連情報のテストケース種別は、“変更”となる。
A record 1801-11 and a record 1801-12 indicate a
レコード1801−13は、パス出力数式変更種別が“判定不能”である関連情報についての分類ルールである分類ルール9について示す。分類ルール9の条件が満たされた関連情報は、テストケース種別が“確認”となり、テストケースパス条件式がPostPC_TCとなることを示す。
A record 1801-13 indicates a
図19は、テストケース分類結果の一例を示す説明図である。図19では、図18にて示したテストケース分類ルールに従って、テストケース生成要否を分類した結果となる結果を示す。 FIG. 19 is an explanatory diagram illustrating an example of a test case classification result. FIG. 19 shows a result obtained by classifying the necessity of test case generation according to the test case classification rule shown in FIG.
図19に示す表1901は、パス条件式変更種別結果1201が有するフィールドと、パス出力数式変更種別フィールドとを有する。テストケース生成装置100は、表1901から、テストケース生成要否分類結果1902を出力する。テストケース生成要否分類結果1902は、レコード1902−1〜レコード1902−10を有する。たとえば、レコード1902−1は、Pre1とPost1の関連情報のテストケースパス条件式が、PrePC_TC∧PostPC_TCであり、テストケース種別が“回帰”であることを示す。
A table 1901 illustrated in FIG. 19 includes a field included in the path conditional expression
図20は、変更後プログラムのテストケースの入力値生成の一例を示す説明図である。図20では、図19にて得たテストケース生成要否分類結果1902から、変更後プログラムPostPrgのテストケースの入力値を生成する例を示す。具体的に、図20では、テストケース生成要否分類結果1902のうちの、利用者が指定したテストケース種別が“追加”となったレコード1902−2とレコード1902−6とについてのテストケースの入力値を生成する。
FIG. 20 is an explanatory diagram illustrating an example of generating an input value of a test case of the changed program. FIG. 20 shows an example of generating test case input values of the post-change program PostPrg from the test case generation
テストケース生成装置100は、テストケースパス条件式を満たす値を、制約ソルバを利用して算出する。算出した結果を、表2001として示す。表2001は、レコード2001−1とレコード2001−2を有する。
The test
表2001は、テストケース組番号と、テストケース種別と、テストケースパス条件式と、テスト入力値の条件式と、テスト入力値という5つのフィールドを有する。テストケース組番号と、テストケース種別と、テストケースパス条件式とは、テストケース生成要否分類結果1902の同名のフィールドと同じである。テスト入力値の条件式フィールドには、テストケースパス条件式から得られるテスト入力値の条件式が格納される。テスト入力値フィールドには、算出した値が格納される。
The table 2001 has five fields: a test case group number, a test case type, a test case pass conditional expression, a test input value conditional expression, and a test input value. The test case group number, the test case type, and the test case pass conditional expression are the same as the field of the same name in the test case generation
テストケース生成装置100は、入力値として算出した値を設定したテストケースを、変更後プログラムPostPrgのテストケースとして生成する。なお、テストケースの期待値に関しては、テストケース生成装置100の利用者等により設定される。
The test
次に、図21〜図26を用いて、テストケース生成装置100が実行するフローチャートの説明を行う。
Next, a flowchart executed by the test
図21は、テストケース生成処理手順の一例を示すフローチャートである。テストケース生成処理は、変更後プログラムPostPrgに対するテストケースを生成する処理である。テストケース生成装置100は、変更前プログラムPrePrgと変更後プログラムPostPrgとのシンボリック実行結果を取得する(ステップS2101)。次に、テストケース生成装置100は、変更前後パス関連付け処理を実行する(ステップS2102)。変更前後パス関連付け処理の詳細は、図22にて後述する。なお、変更前後パス関連付け処理によって、L個の関連情報が生成されたものとする。
FIG. 21 is a flowchart illustrating an example of a test case generation processing procedure. The test case generation process is a process for generating a test case for the post-change program PostPrg. The test
続けて、テストケース生成装置100は、1をiに代入する(ステップS2103)。次に、テストケース生成装置100は、i番目の関連情報に対して、パス条件式変更種別分類処理を実行する(ステップS2104)。パス条件式変更種別分類処理の詳細は、図23にて説明する。続けて、テストケース生成装置100は、i番目の関連情報に対して、パス出力数式変更種別分類処理を実行する(ステップS2105)。パス出力数式変更種別分類処理の詳細は、図24にて説明する。
Subsequently, the test
なお、ステップS2104の処理と、ステップS2105の処理には依存関係がないことから、テストケース生成装置100は、ステップS2104の処理とステップS2105の処理とを並列に実行してもよい。また、ステップS2105の処理は、関連情報に対してでなく、変更前後のパスの全ての組合せに対して行ってもよい。
Note that since there is no dependency relationship between the process of step S2104 and the process of step S2105, the test
次に、テストケース生成装置100は、i番目の関連情報に対して、テストケース分類処理を実行する(ステップS2106)。テストケース分類処理の詳細は、図25にて後述する。なお、ステップ2106の処理について、ステップS2105の処理において、パス出力数式変更種別が“変更”となった場合、図18を参照すると、テストケース種別は、テストケースを生成すべきことを示す“変更”か“追加”となる。
Next, the test
したがって、利用者がテストケースを生成すべきか否かを知りたい場合、テストケース生成装置100は、関連情報に対して、ステップS2104の処理を行わず、ステップS2105の処理を行ってもよい。そして、テストケース生成装置100は、パス出力数式変更種別が“不変”となった場合に、ステップS2104の処理を行ってもよい。ステップS2104の結果が “拡大”または“重複”である場合、テストケース生成装置100は、¬PrePC_TC∧PostPC_TCとなるテストケースパス条件式において、テストケース種別を“変更”か“追加”と判定する。
Therefore, when the user wants to know whether or not a test case should be generated, the test
続けて、テストケース生成装置100は、i+1をiに代入する(ステップS2107)。次に、テストケース生成装置100は、iがLより大きいか否かを判断する(ステップS2108)。iがL以下である場合(ステップS2108:No)、テストケース生成装置100は、ステップS2104の処理に移行する。iがLより大きい場合(ステップS2108:Yes)、テストケース生成装置100は、テストケース分類結果を出力する(ステップS2109)。出力先として、テストケース生成装置100は、テストケース分類結果をRAM203、ディスク205等の記憶装置に格納してもよいし、テストケース分類結果をディスプレイ207に表示してもよい。
Subsequently, the test
次に、テストケース生成装置100は、変更後プログラムのテストケースの入力値生成処理を実行する(ステップS2110)。変更後プログラムのテストケースの入力値生成処理の詳細は、図26にて後述する。続けて、テストケース生成装置100は、テスト入力値を生成したテストケースを出力する(ステップS2111)。
Next, the test
ステップS2111の処理終了後、テストケース生成装置100は、テストケース生成処理を終了する。テストケース生成処理を実行することにより、テストケース生成装置100は、変更後プログラムPostPrgの動作をテストするテストケースを生成することができる。
After the process of step S2111 ends, the test
図22は、変更前後パス関連付け処理手順の一例を示すフローチャートである。変更前後パス関連付け処理は、変更前プログラムPrePrgの各パスと変更後プログラムPostPrgの各パスとのうち、関連するパス同士を検出して関連情報を作成する処理である。また、図22では、変更前プログラムPrePrgのi番目のパスをPre(i)と表現し、i番目のパスの条件式をPrePC(i)と表現する。同様に、変更後プログラムPostPrgのj番目のパスをPost(j)と表現し、j番目のパスの条件式を、PostPC(j)と表現する。 FIG. 22 is a flowchart illustrating an example of the pre-change path association processing procedure. The pre-change path association process is a process for creating related information by detecting related paths among the paths of the pre-change program PrePrg and the post-change program PostPrg. In FIG. 22, the i-th path of the pre-change program PrePrg is expressed as Pre (i), and the conditional expression of the i-th path is expressed as PrePC (i). Similarly, the jth path of the post-change program PostPrg is expressed as Post (j), and the conditional expression of the jth path is expressed as PostPC (j).
テストケース生成装置100は、iに1を代入し、jに1を代入する(ステップS2201)。次に、テストケース生成装置100は、PrePC(i)∧PostPC(j)が充足可能か否かを判断する(ステップS2202)。PrePC(i)∧PostPC(j)が充足可能である場合(ステップS2202:Yes)、テストケース生成装置100は、Pre(i)とPost(j)とをテストケース組とする関連情報を作成する(ステップS2203)。ステップS2203の処理終了後、または、PrePC(i)∧PostPC(j)が充足不可能である場合(ステップS2202:No)、テストケース生成装置100は、j+1をjに代入する(ステップS2204)。
The test
続けて、テストケース生成装置100は、jがNより大きいか否かを判断する(ステップS2205)。jがN以下である場合(ステップS2205:No)、テストケース生成装置100は、ステップS2202の処理に移行する。jがNより大きい場合(ステップS2205:Yes)、テストケース生成装置100は、i+1をiに代入し、1をjに代入する(ステップS2206)。
Subsequently, the test
続けて、テストケース生成装置100は、iがMより大きいか否かを判断する(ステップS2207)。iがM以下である場合(ステップS2207:No)、テストケース生成装置100は、ステップS2202の処理に移行する。iがMより大きい場合(ステップS2207:Yes)、テストケース生成装置100は、作成した関連情報を出力する(ステップS2208)。ステップS2208の処理終了後、テストケース生成装置100は、変更前後パス関連付け処理を終了する。変更前後パス関連付け処理を実行することにより、テストケース生成装置100は、関連するパス同士を検出して関連情報を作成することができる。
Subsequently, the test
図23は、パス条件式変更種別分類処理手順の一例を示すフローチャートである。パス条件式変更種別分類処理は、関連情報のパス条件式変更種別を分類する処理である。図23では、i番目の関連情報が示す変更前プログラムPrePrgのパス条件式をPrePC_TC(i)と表現する。また、i番目の関連情報が示す変更後プログラムPostPrgのパス条件式をPostPC_TC(i)と表現する。 FIG. 23 is a flowchart illustrating an example of a path conditional expression change type classification processing procedure. The path condition expression change type classification process is a process of classifying the path condition expression change type of the related information. In FIG. 23, the path conditional expression of the pre-change program PrePrg indicated by the i-th related information is expressed as PrePC_TC (i). Further, the path conditional expression of the post-change program PostPrg indicated by the i-th related information is expressed as PostPC_TC (i).
テストケース生成装置100は、条件式(2−1)の充足可能性と条件式(2−2)の充足可能性とを判定する(ステップS2301)。次に、テストケース生成装置100は、条件式(2−1)と条件式(2−2)とが共に充足不可能であると判定したか否かを判断する(ステップS2302)。条件式(2−1)と条件式(2−2)とが共に充足不可能であると判定した場合(ステップS2302:Yes)、テストケース生成装置100は、パス条件式変更種別を“不変”に特定する(ステップS2303)。
The test
条件式(2−1)と条件式(2−2)とのうち少なくとも一方の条件式が充足不可能でないと判定した場合(ステップS2302:No)、テストケース生成装置100は、条件式(2−1)が充足可能であり、かつ条件式(2−2)が充足不可能であると判定したか否かを判断する(ステップS2304)。条件式(2−1)が充足可能であり、かつ条件式(2−2)が充足不可能である場合(ステップS2304:Yes)、テストケース生成装置100は、パス条件式変更種別を“縮小”に特定する(ステップS2305)。
When it is determined that at least one of the conditional expression (2-1) and the conditional expression (2-2) is unsatisfiable (step S2302: No), the test
条件式(2−1)が充足可能でない、または条件式(2−2)が充足不可能でない場合(ステップS2304:No)、テストケース生成装置100は、条件式(2−1)が充足不可能であり、かつ条件式(2−2)が充足可能であると判定したか否かを判断する(ステップS2306)。条件式(2−1)が充足不可能であり、かつ条件式(2−2)が充足可能である場合(ステップS2306:Yes)、テストケース生成装置100は、パス条件式変更種別を“拡大”に特定する(ステップS2307)。
When the conditional expression (2-1) is not satisfiable or the conditional expression (2-2) is not satisfiable (step S2304: No), the test
一方、条件式(2−1)と条件式(2−2)が共に充足可能である場合(ステップS2306:No)、テストケース生成装置100は、パス条件式変更種別を“重複”に特定する(ステップS2308)。ステップS2303、ステップS2305、ステップS2307、ステップS2308、のうちのいずれかの処理終了後、テストケース生成装置100は、特定したパス条件式変更種別を出力する(ステップS2309)。出力されたパス条件式変更種別は、i番目の関連情報に付与される。
On the other hand, when both the conditional expression (2-1) and the conditional expression (2-2) can be satisfied (step S2306: No), the test
ステップS2309の処理終了後、テストケース生成装置100は、パス条件式変更種別分類処理を終了する。パス条件式変更種別分類処理を実行することにより、テストケース生成装置100は、i番目の関連情報が示す変更後プログラムPostPrgのパス条件式が、変更前プログラムPrePrgのパス条件式からどのように変更されたかを取得することができる。
After the process of step S2309 ends, the test
図24は、パス出力数式変更種別分類処理手順の一例を示すフローチャートである。パス出力数式変更種別分類処理は、関連情報のパス出力数式変更種別を分類する処理である。図24では、i番目の関連情報が示す変更前プログラムPrePrgのパス出力数式をPreR_TC(i)と表現する。また、i番目の関連情報が示す変更後プログラムPostPrgのパス出力数式をPostR_TC(i)と表現する。 FIG. 24 is a flowchart illustrating an example of a path output formula change type classification processing procedure. The path output formula change type classification process is a process of classifying the path output formula change type of the related information. In FIG. 24, the path output formula of the pre-change program PrePrg indicated by the i-th related information is expressed as PreR_TC (i). Further, the path output formula of the post-change program PostPrg indicated by the i-th related information is expressed as PostR_TC (i).
テストケース生成装置100は、判定ルール1として、PreR_TC(i)とPostR_TC(i)とが文字列として比較して一致するか否かを判断する(ステップS2401)。一致しない場合(ステップS2401:No)、テストケース生成装置100は、判定ルール2〜4を適用する(ステップS2402)。続けて、テストケース生成装置100は、判定ルール2〜4を適用した結果、“不変”であると判断したか否かを判断する(ステップS2403)。
As the
文字列として比較して一致した場合(ステップS2401:Yes)、または、判定ルール2〜4を適用した結果、“不変”であると判断した場合(ステップS2403:Yes)、テストケース生成装置100は、パス出力数式変更種別を“不変”と判断する(ステップS2404)。
When compared as a character string and matched (step S2401: Yes), or when it is determined to be “invariant” as a result of applying the determination rules 2 to 4 (step S2403: Yes), the test
判定ルール2〜4を適用した結果、“不変”でないと判断した場合(ステップS2403:No)、テストケース生成装置100は、判定ルール2〜4を適用した結果、“変更”であると判断したか否かを判断する(ステップS2405)。判定ルール2〜4を適用した結果、“変更”であると判断した場合(ステップS2405:Yes)、テストケース生成装置100は、パス出力数式変更種別を“変更”と判断する(ステップS2406)。
As a result of applying the determination rules 2 to 4, when it is determined that it is not “invariant” (step S <b> 2403: No), the test
一方、判定ルール2〜4を適用した結果、“判定不能”であると判断した場合(ステップS2405:No)、テストケース生成装置100は、パス出力数式変更種別を“判定不能”と判断する(ステップS2407)。ステップS2404、ステップS2406、ステップS2407、のうちのいずれかの処理終了後、テストケース生成装置100は、判断したパス出力数式変更種別を出力する(ステップS2408)。出力されたパス出力数式変更種別は、i番目の関連情報に付与される。
On the other hand, when it is determined that “determination is impossible” as a result of applying the determination rules 2 to 4 (step S2405: No), the test
ステップS2408の処理終了後、テストケース生成装置100は、パス出力数式変更種別分類処理を終了する。パス出力数式変更種別分類処理を実行することにより、テストケース生成装置100は、i番目の関連情報が示す変更後プログラムPostPrgのパスの機能が、変更前プログラムPrePrgのパスの機能から変更されたか否かを特定することができる。
After the process of step S2408 ends, the test
図25は、テストケース分類処理手順の一例を示すフローチャートである。テストケース分類処理は、関連情報のテストケース分類を特定する処理である。テストケース生成装置100は、関連情報のパス条件式変更種別とパス出力数式変更種別とを取得する(ステップS2501)。次に、テストケース生成装置100は、テストケース分類ルールテーブル1801を参照して、取得したパス条件式変更種別とパス出力数式変更種別とに応じたテストケース分類を判定する(ステップS2502)。続けて、テストケース生成装置100は、判定したテストケース分類を出力する(ステップS2503)。ステップS2503の処理終了後、テストケース生成装置100は、テストケース分類処理を終了する。テストケース分類処理を実行することにより、テストケース生成装置100は、テストケース分類を特定することができる。
FIG. 25 is a flowchart illustrating an example of a test case classification processing procedure. The test case classification process is a process for specifying the test case classification of the related information. The test
図26は、変更後プログラムのテストケースの入力値生成処理手順の一例を示すフローチャートである。変更後プログラムのテストケースの入力値生成処理は、変更後プログラムPostPrgのテストケースの入力値を生成する処理である。 FIG. 26 is a flowchart illustrating an example of an input value generation processing procedure for a test case of the changed program. The test case input value generation process of the post-change program is a process of generating the test case input value of the post-change program PostPrg.
テストケース生成装置100は、テストケース種別の指定を受け付ける(ステップS2601)。次に、テストケース生成装置100は、指定されたテストケース種別の関連情報を選択する(ステップS2602)。続けて、テストケース生成装置100は、選択した関連情報のテストケースパス条件式を取得する(ステップS2603)。次に、テストケース生成装置100は、取得したテストケースパス条件式を満たす値を、制約ソルバを利用して算出する(ステップS2604)。続けて、テストケース生成装置100は、算出した値をテスト入力値とするテストケースを生成する(ステップS2605)。
The test
ステップS2605において、テストケース生成装置100は、たとえば、関連情報の変更前プログラムPrePrgのパスの動作をテストするテストケースをコピーして、コピー先のテストケースのテスト入力値を算出した値に上書きしてもよい。コピー先のテストケースが、変更後プログラムPostPrgのパスの動作をテストするテストケースとして生成されたこととなる。また、変更前プログラムPrePrgの試験を今後行わないのであれば、テストケース生成装置100は、関連情報の変更前プログラムPrePrgのパスの動作をテストするテストケースのテスト入力値を、算出した値で上書きしてもよい。上書きされたテストケースが、変更後プログラムPostPrgのパスの動作をテストするテストケースとして生成されたこととなる。
In step S2605, for example, the test
ステップS2605の処理終了後、テストケース生成装置100は、変更後プログラムのテストケースの入力値生成処理を終了する。変更後プログラムのテストケースの入力値生成処理を実行することにより、テストケース生成装置100は、変更後プログラムのテストケースの入力値を用意することができる。
After the process of step S2605 ends, the test
以上説明したように、テストケース生成装置100によれば、プログラムの一部が変更された場合、変更前後のパスが実行される条件式が充足可能となるパス同士の出力変数を比較してテストケースを生成すべきか否かを判断する。これにより、テストケース生成装置100の利用者は、第2のパスの動作をテストするテストケースを生成すべきか否かを知ることができ、テストケースを生成すべきか否かを利用者が判断しなくてよい分、テストケース生成作業の負荷を削減することができる。
As described above, according to the test
また、テストケース生成装置100によれば、第2のパスの動作をテストするテストケースを生成すべきであると判定した際、第2のパス条件式を真とする入力変数の値を算出し、算出した値を入力変数の値とする第2のパスのテストケースを生成してもよい。変更されたテストケースが第2のパスの動作をテストするテストケースとなり、テストケース生成装置100の利用者は、変更部分および追加部分のテストケースを生成せずに済み、テストケース生成作業の負荷を削減することができる。
Also, according to the test
また、テストケース生成装置100によれば、条件式(2−1)と条件式(2−2)との充足可能性とに基づいて、第2のパスの動作をテストするテストケースを生成すべきか否かを判定してもよい。
Further, according to the test
これにより、テストケース生成装置100の利用者は、テストケース種別が“不変”か“回帰”であれば、テストケースを生成しなくてよいことを知ることができ、また、“変更”か“追加”であれば、テストケースを生成すべきであることを知ることができる。また、テストケース種別が“回帰”である場合、出力される値は同一であるがパス条件式が変更したため、たとえば、第1のパス条件式を真とするテスト入力値を有するテストケースのうち、第2のパス条件式を真としないテストケースがある可能性がある。第2のパス条件式を真としないテストケースは実行しなくてよいため、テストケース種別が“回帰”であると知ったテストケース生成装置100の利用者は、テストケースの実行の要否を検討することができる。
Thus, the user of the test
また、テストケース生成装置100の利用者は、条件式(2−2)が充足可能であると特定し、かつ、第1のパス出力数式と第2のパス出力数式とが一致する場合、第1のパス条件式の否定と第2のパス条件式を真とする入力変数の値を算出してもよい。条件式(2−2)が充足可能となる場合とは、パス条件式変更種別が“拡大”または“重複”となる場合である。テストケース生成装置100は、第1のパス条件式の否定と第2のパス条件式を真とする入力変数の値を算出して、変更前プログラムには含まれていないパス条件式に対する、テストケースのテスト入力値を生成することができる。
In addition, when the user of the test
また、テストケース生成装置100によれば、変更前プログラムPrePrgに含まれるパスごとのパス条件式とパス出力数式と第2のパスのパス条件式とパス出力数式とに基づき、第2のパスの動作をテストするテストケースを生成すべきか否かを判定してもよい。これにより、テストケース生成装置100の利用者は、変更前プログラムPrePrgに含まれるパスのうち、第2のパスに関連するパスのテストケースがそのまま流用できるか、または第2のパス用にテストケースを生成すべきかを知ることができる。
Further, according to the test
また、テストケース生成装置100によれば、変更前プログラムPrePrgと変更後プログラムPostPrgとのパスごとのパス条件式とパス出力数式とに基づき、変更後プログラムPostPrgの各パスのテストケースを生成すべきか否かを判定してもよい。これにより、テストケース生成装置100の利用者は、変更後プログラムPostPrgに含まれるパス全てに対して、テストケースを生成すべきか否かを知ることができる。
Further, according to the test
また、テストケース生成装置100によれば、関連情報ごとに、パス条件式変更種別を特定し、パス条件式変更種別と、パス出力数式とに基づいて、変更後プログラムPostPrgの各パスのテストケース種別を判定してもよい。たとえば、テストケース生成装置100の利用者は、出力された変更後プログラムPostPrgの各パスのテストケース種別のうちの“不変”と“回帰”とを指定することにより、リグレッションテストを実行するテストケースを選択することができる。また、テストケース生成装置100の利用者は、出力された変更後プログラムPostPrgの各パスのテストケース種別のうちの“変更”と“追加”とを指定することにより、変更部分および追加部分を実行するテストケースを選択することができる。
Further, according to the test
(実施の形態2の説明)
実施の形態1にかかるテストケース生成装置100は、変更前後のパスの関連付けにおける条件式(1)の充足可能性の判定と、パス条件式変更種別の分類における条件式(2−1)と条件式(2−2)の充足可能性の判定とにおいて、制約ソルバを利用する。しかしながら、制約ソルバによる充足可能性の判定は時間を要する。そこで、実施の形態2にかかるテストケース生成装置は、制約ソルバによる充足可能性の判定の回数を削減する。以下、図27〜図34を用いて、実施の形態2にかかるテストケース生成装置2700について説明する。なお、実施の形態1において説明した箇所と同様の箇所については、同一符号を付して図示および説明を省略する。
(Description of Embodiment 2)
The test
図27は、実施の形態2におけるテストケース生成装置の機能例を示すブロック図である。テストケース生成装置2700は、第1取得部2701と、第2取得部2702と、テスト入力値判断部2703と、関連情報生成部2704と、特定部2705と、組作成部2706と、パス関連判断部2707と、関連情報作成部2708と、を含む。さらに、テストケース生成装置2700は、数式判定部2709と、生成判定部2710と、算出部908と、テストケース生成部909を含む。
FIG. 27 is a block diagram illustrating a functional example of the test case generation device according to the second embodiment. The test
制御部となる第1取得部2701〜生成判定部2710と、算出部908と、テストケース生成部909は、記憶装置に記憶されたプログラムをCPU201が実行することにより、各機能を実現する。記憶装置とは、具体的には、たとえば、図2に示したROM202、RAM203、ディスク205などである。または、通信インターフェース206を経由して他のCPUが実行することにより、第1取得部2701〜生成判定部2710と、算出部908と、テストケース生成部909の機能を実現してもよい。
The
第1取得部2701は、第1のシンボリック実行結果と、第1のシンボリック実行結果に含まれる各パスの動作をテストするテストケースのテスト入力値とを取得する。なお、取得された情報は、RAM203、ディスク205などの記憶領域に記憶される。
The
第2取得部2702は、第2のシンボリック実行結果と、第2のシンボリック実行結果に含まれる各パスのパス条件式を満たすテスト入力値とを取得する。第2のパス条件式を満たすテスト入力値の取得例として、第2取得部2702は、制約ソルバを利用して、第2のパス条件式を満たす値を取得する。なお、取得された情報は、RAM203、ディスク205などの記憶領域に記憶される。
The
テスト入力値判断部2703は、第1のパスの動作をテストするテストケースの入力値を、第2のパスのパス条件式に与えた場合に第2の条件式が真となるか否かを判断する。また、テスト入力値判断部2703は、第2取得部2702によって取得されたテスト入力値を、第1のパスのパス条件式に与えた場合に第1の条件式が真となるか否かを判断してもよい。
The test input
また、テスト入力値判断部2703は、第1取得部2701によって取得されたテストケースごとに、テストケースのテスト入力値を、第2のシンボリック実行結果に含まれる各パスのパス条件式に与える。そして、テスト入力値判断部2703は、テスト入力値を与えた場合に第2のシンボリック実行結果に含まれる各パスのパス条件式が真となるか否かを判断してもよい。
Also, the test input
また、テスト入力値判断部2703は、第2取得部2702によって取得されたテスト入力値ごとに、テスト入力値を第1のシンボリック実行結果に含まれる各パスのパス条件式に与える。そして、テスト入力値判断部2703は、テスト入力値を与えた場合に第1のシンボリック実行結果に含まれる各パスのパス条件式が真となるか否かを判断してもよい。具体的な判断方法については、図28にて後述する。なお、判断結果は、RAM203、ディスク205などの記憶領域に記憶される。
Also, the test input
関連情報生成部2704は、次に示す場合、第2のシンボリック実行結果に含まれる各パスが、前述の各パスの条件式が真となる入力値に対応する第1のシンボリック実行結果に含まれるパスに関連することを示す第1の関連情報を生成する。次に示す場合とは、テスト入力値判断部2703が第2のシンボリック実行結果に含まれる各パスの条件式が真となると判断した場合である。
In the following case, the related
また、関連情報生成部2704は、次に示す場合、真となった第2のシンボリック実行結果に含まれるパスが、第1のシンボリック実行結果に含まれるパスに関連することを示す第1の関連情報を生成してもよい。次に示す場合とは、テスト入力値判断部2703が第1のシンボリック実行結果に含まれる各パスの条件式が真となると判断した場合である。具体的な生成方法については、図28にて後述する。なお、生成された関連情報は、RAM203、ディスク205などの記憶領域に記憶される。
Further, in the following case, the related
特定部2705は、第1の関連情報が示す第1のシンボリック実行結果に含まれるパスに対応するパス条件式と第2のシンボリック実行結果に含まれる各パスに対応するパス条件式の否定との充足可能性を第1の関連情報ごとに特定する。さらに、特定部2705は、第1の関連情報が示す第1のシンボリック実行結果に含まれるパスに対応するパス条件式の否定と第2のシンボリック実行結果に含まれる各パスに対応するパス条件式との充足可能性を第1の関連情報ごとに特定する。
The specifying
また、特定部2705は、第2の関連情報が示す第1のシンボリック実行結果に含まれるパスに対応する条件式と第2のシンボリック実行結果に含まれるパスに対応するパス条件式の否定との充足可能性を第2の関連情報ごとに特定する。さらに、特定部2705は、第2の関連情報が示す第1のシンボリック実行結果に含まれるパスに対応する条件式の否定と第2のシンボリック実行結果に含まれるパスに対応するパス条件式との充足可能性を第2の関連情報ごとに特定する。なお、生成された関連情報は、RAM203、ディスク205などの記憶領域に記憶される。
In addition, the specifying
組作成部2706は、第1のシンボリック実行結果に含まれるパスと第2のシンボリック実行結果に含まれるパスとの組から、第1の関連情報ごとの特定結果に基づいて特定される組を除く残余の組を作成する。第1の関連情報ごとの特定結果に基づいて特定される組については、図30について後述する。なお、作成された組を示す情報は、RAM203、ディスク205などの記憶領域に記憶される。
The
パス関連判断部2707は、テスト入力値判断部2703による判断結果に基づいて、第2のパスが前記第1のパスに関連するか否かを判断する。たとえば、テスト入力値判断部2703が、第1のパスの動作をテストするテストケースの入力値を、第2のパスのパス条件式に与えた場合に第2の条件式が真となったと判断したとする。このとき、パス関連判断部2707は、第2のパスが前記第1のパスに関連すると判断する。
The path
また、パス関連判断部2707は、特定部2705による特定結果に基づいて、第2のパスが変更前プログラムPrePrgに含まれるパス群のうちの第1のパスとは異なるパスに関連しないことを判断してもよい。たとえば、特定部2705が、第1のパスのパス条件式の否定と第2のパスのパス条件式との論理積が充足可能であり、かつ、第1のパスのパス条件式と第2のパスのパス条件式の否定との論理積が充足不可能であると特定したとする。このとき、パス関連判断部2707は、第2のパスが変更前プログラムPrePrgに含まれるパス群のうちの第1のパスとは異なるパスに関連しないと判断する。なお、関連しないと判断されたパス同士の組が、組生成部2706にて説明した、第1の関連情報ごとの特定結果に基づいて特定される組のこととなる。
The path
また、パス関連判断部2707は、特定部2705による特定結果に基づいて、変更後プログラムPostPrgに含まれるパス群のうちの第2のパスとは異なるパスが第1のパスに関連しないことを判断してもよい。たとえば、特定部2705が、第1のパスのパス条件式の否定と第2のパスのパス条件式との論理積が充足不可能であり、かつ、第1のパスのパス条件式と第2のパスのパス条件式の否定との論理積が充足可能であると特定したとする。このとき、パス関連判断部2707は、第2のパスが変更前プログラムPrePrgに含まれるパス群のうちの第1のパスとは異なるパスに関連しないと判断する。
Further, the path
また、パス関連判断部2707は、組作成部2706によって作成された残余の組ごとに、次に示す情報に基づいて、第2の実行結果に含まれる各パスが第1の実行結果に含まれる各パスに関連するか否かを判断してもよい。次に示す情報は、第1のシンボリック実行結果に含まれる各パスの条件式と第2のシンボリック実行結果に含まれる各パスとの充足可能性である。なお、判断結果は、RAM203、ディスク205などの記憶領域に記憶される。
In addition, for each remaining pair created by the
関連情報作成部2708は、次に示す場合、第2のシンボリック実行結果に含まれる各パスが第1のシンボリック実行結果に含まれる各パスに関連することを示す第2の関連情報を作成する。次に示す場合は、パス関連判断部2707によって第2のシンボリック実行結果に含まれる各パスが第1の実行結果に含まれる各パスに関連すると判断された場合である。なお、作成された第2の関連情報は、RAM203、ディスク205などの記憶領域に記憶される。
In the following case, the related
数式判定部2709は、第1のシンボリック実行結果に含まれるパス出力数式と、取得した第2のシンボリック実行結果に含まれるパス出力数式とが一致するか否かを判断する。数式判定部2709は、第1のシンボリック実行結果に含まれる各パスと第2のシンボリック実行結果に含まれる各パスとの組合せの組ごとに比較する。また、数式判定部2709は、関連情報生成部2704によって生成された第1の関連情報および関連情報作成部2708によって作成された第2の関連情報が示す第1のパス出力数式と第2のパス出力数式とを比較してもよい。なお、比較結果は、RAM203、ディスク205などの記憶領域に記憶される。
The
生成判定部2710は、次に示す情報に基づいて、第2の実行結果に含まれる各パスの動作をテストするテストケースを生成すべきか否かを判定する。次に示す情報は、特定部2705による第1の関連情報ごとの特定結果および第2の関連情報ごとの特定結果と、数式判定部2709による第1の実行結果に含まれる各パスと第2の実行結果に含まれる各パスとの組合せの組ごとの判定結果とである。なお、判定結果は、RAM203、ディスク205などの記憶領域に記憶される。
The generation determination unit 2710 determines whether or not to generate a test case for testing the operation of each path included in the second execution result, based on the following information. The following information includes the identification result for each first related information and the identification result for each second related information by the specifying
図28は、実施の形態2における変更前後のパスを関連付けた結果の一例を示す説明図である。表2801は、変更前プログラムPrePrgのパス条件式とテスト入力値とを示す。表2801は、レコード2801−1〜レコード2801−3を有する。また、表2802は、変更後プログラムPostPrgのパス条件式とテスト入力値とを示す。表2802は、レコード2802−1〜レコード2802−4を有する。表2801と表2802とは、パスIDと、入力変数と、テスト入力値と、パス条件式という、4つのフィールドを有する。 FIG. 28 is an explanatory diagram illustrating an example of a result of associating paths before and after the change in the second embodiment. Table 2801 shows the path conditional expression and test input value of the pre-change program PrePrg. The table 2801 includes records 2801-1 to 2801-3. Table 2802 shows the path conditional expression and the test input value of the post-change program PostPrg. The table 2802 includes records 2802-1 to 2802-4. Tables 2801 and 2802 have four fields: a path ID, an input variable, a test input value, and a path conditional expression.
テストケース生成装置2700は、変更前プログラムPrePrgの各パスのテスト入力値を、変更後プログラムPostPrgのパス条件式PostPCに与える。値を与えたパス条件式が真となった場合、テストケース生成装置2700は、該当のパスPreと、与えられたパス条件式PostPCに対応するパスPostとを関連付けて、関連情報とする。なお、変更前プログラムPrePrgの各パスのテスト入力値は、変更前プログラムをテストする際に生成されており、本実施の形態を実行するために改めて用意しなくてよい。
The test
さらに、テストケース生成装置2700は、変更後プログラムPostPrgの各パスのテスト入力値を、変更前プログラムPrePrgのパス条件式PrePCに与える。値を与えたパス条件式が真となった場合、テストケース生成装置2700は、該当のパスPostと、与えられたパス条件式PostPCに対応するパスPreとを関連付けて、関連情報とする。なお、変更後プログラムPostPrgの各パスのテスト入力値は、制約ソルバを利用することにより生成できる。この時の制約ソルバによるテスト入力値の算出については、条件式が論理積でないために処理量が多くなく、算出にかかる時間は短く済む。
Further, the test
たとえば、テストケース生成装置2700は、Pre1のテスト入力値“0”を、Post1のパス条件式〜Post4のパス条件式のそれぞれに与える。図28の例では、Post1PCにX=0を与えると真となるため、テストケース生成装置2700は、テストケース組番号1として、Pre1とPost1とを有する関連情報を生成する。
For example, the test
関連情報が生成された結果として、図28では、パス関連付け結果2803を示す。パス関連付け結果2803は、パス関連付け結果1001と同一のフィールドを有する。パス関連付け結果2803は、レコード2803−1〜レコード2803−5を有する。ここで、図28で示した関連付け手順では、パス関連付け結果1001のレコード1001−3が示すPre3とPost3との関連情報が生成できていない。Pre3とPost3との関連情報を検出して生成する手順については、図30にて後述する。
As a result of generating the related information, FIG. 28 shows a
図29は、実施の形態2におけるパス条件式変更種別の分類結果の一例を示す説明図である。図29では、テストケース生成装置2700が、図11にて示したパス条件式変更種別の分類手順に従って、関連情報のパス条件式変更種別を分類した結果となるパス条件式変更種別結果2901を示す。パス条件式変更種別結果2901は、レコード2901−1〜レコード2901−5を有する。パス条件式変更種別結果2901の各フィールドは、パス条件式変更種別結果1201と同一であるため、説明を省略する。
FIG. 29 is an explanatory diagram of an example of the classification result of the path conditional expression change type in the second embodiment. In FIG. 29, the test
図30は、未生成の変更前後のパス関連付けの作成手順の一例を示す説明図である。図30では、図29から得たパス条件式変更種別結果2901を用いて、未生成の変更前後のパス関連付けを検出して、関連情報を生成する手順について説明する。
FIG. 30 is an explanatory diagram illustrating an example of a procedure for creating a path association before and after an ungenerated change. In FIG. 30, a procedure for generating related information by detecting path association before and after an ungenerated change using the path conditional expression
表3001は、Pre1PC〜Pre3PCと、Post1PC〜Post4PCとの組合せを示す。まず、Pre1PC〜Pre3PCはそれぞれ排他の関係となる。同様に、Post1PC〜Post4PCもそれぞれ排他の関係となる。また、テストケース生成装置2700は、パス条件式変更種別結果2901から特定される組を取り除いた残余の組に対して、充足可能性を判定する。たとえば、パス条件式変更種別が“重複”を示すレコード2901−2とレコード2901−4とについて、既にテストケース組となった組合せは、充足可能であることが明らかであるため、制約ソルバを使用しなくてよい。
A table 3001 shows combinations of Pre1PC to Pre3PC and Post1PC to Post4PC. First, Pre1PC to Pre3PC have an exclusive relationship. Similarly, Post1PC to Post4PC also have an exclusive relationship. Further, the test
たとえば、パス条件式変更種別が“拡大”を示すレコード2901−1より、Post1PCがPre1PCの拡大の関係となることから、Pre1PCが、Post2PC〜Post4PCと関連することはない。したがって、Pre1PC∧Post2PCの充足可能性と、Pre1PC∧Post3PCの充足可能性と、Pre1PC∧Post4PCの充足可能性とは、全て充足不可能であることが明らかである。これにより、表3001の(1)の矢印が示すように、Pre1PCと、Post1PC〜Post4PCとの制約ソルバによる充足可能性の判定を行わなくてよい。 For example, from the record 2901-1 in which the path conditional expression change type indicates “expanded”, Post1PC has a relationship of expanding Pre1PC, so Pre1PC is not related to Post2PC to Post4PC. Therefore, it is clear that the satisfiability of Pre1PC∧Post2PC, the satisfiability of Pre1PC∧Post3PC, and the satisfiability of Pre1PC∧Post4PC are all unsatisfiable. Thereby, as indicated by the arrow (1) in the table 3001, it is not necessary to determine the satisfiability by the constraint solver between Pre1PC and Post1PC to Post4PC.
また、パス条件式変更種別が“縮小”を示すレコード2901−3より、Post2PCがPre2PCの縮小の関係となることから、Post2PCが、Pre1PCとPre3PCと関連することはない。したがって、Pre2PC∧Post1PCの充足可能性と、Pre2PC∧Post3PCの充足可能性とは、全て充足不可能であることが明らかである。これにより、表3001の(2)の矢印が示すように、Post2PCと、Pre1PC〜Pre3PCとの制約ソルバによる充足可能性の判定を行わなくてよい。 Further, from the record 2901-3 in which the path conditional expression change type indicates “reduction”, Post2PC has a relationship of reduction of Pre2PC, so that Post2PC is not related to Pre1PC and Pre3PC. Therefore, it is clear that the satisfiability of Pre2PC∧Post1PC and the satisfiability of Pre2PC∧Post3PC are all unsatisfiable. As a result, as indicated by the arrow (2) in the table 3001, it is not necessary to determine the satisfiability by the constraint solver between Post2PC and Pre1PC to Pre3PC.
さらに、パス条件式変更種別が“縮小”を示すレコード2901−5より、Post4PCがPre3PCの縮小の関係となることから、Post4PCが、Pre1PCとPre2PCと関連することはない。したがって、Pre1PC∧Post4PCの充足可能性と、Pre2PC∧Post4PCの充足可能性とは、全て充足不可能であることが明らかである。これにより、表3001の(3)の矢印が示すように、Post4PCと、Pre1PC〜Pre3PCとの制約ソルバによる充足可能性の判定を行わなくてよい。 Furthermore, from the record 2901-5 in which the path conditional expression change type indicates “reduction”, Post4PC has a relationship of reduction of Pre3PC, so that Post4PC is not related to Pre1PC and Pre2PC. Therefore, it is clear that the satisfiability of Pre1PC∧Post4PC and the satisfiability of Pre2PC∧Post4PC are all unsatisfiable. As a result, as indicated by the arrow (3) in the table 3001, determination of satisfiability by the constraint solver between Post4PC and Pre1PC to Pre3PC does not have to be performed.
以上より、充足可能か否かを判定できていない組合せは、表3001にて、ハッチを付与した、Pre3PC∧Post1PCと、Pre3PC∧Post3PCとなる。テストケース生成装置2700は、制約ソルバを利用して、Pre3PC∧Post1PCの充足可能性と、Pre3PC∧Post3PCの充足可能性を判定する。判定した結果、Pre3PC∧Post1PCが充足不可能となり、Pre3PC∧Post3PCが充足可能となったため、テストケース生成装置2700は、Pre3PCとPost3PCとの関連情報を作成し、パス条件式変更種別を分類する。
As described above, combinations that have not been determined whether or not they can be satisfied are Pre3PC∧Post1PC and Pre3PC∧Post3PC with hatching in Table 3001. The test
図30では示さなかったが、パス条件式変更種別が“不変”となった、あるPrePCとあるPostPCがある場合には、あるPrePCと他のPostPCとが関連することはないし、他のPrePCとあるPostPCとが関連することもない。したがって、あるPrePC∧他のPostPCの充足可能性と、他のPrePC∧あるPostPCとは、全て充足不可能であることが明らかであり、制約ソルバを使用しなくてよい。また、上述にて、パス条件式変更種別が“不変”、“拡大”、“縮小”、“重複”それぞれの場合に取り除く組を示したが、取り除く組は、“不変”、“拡大”、“縮小”、“重複”のうちの少なくともいずれか一つであってもよい。 Although not shown in FIG. 30, when there is a certain PrePC and a certain PostPC whose path conditional expression change type is “invariant”, there is no relation between a certain PrePC and another PostPC, It is not related to a certain PostPC. Therefore, it is clear that the satisfaction of a certain PrePC∧other PostPC and the other PrePC∧PostPC are all unsatisfiable, and it is not necessary to use a constraint solver. Further, in the above description, the group to be removed is shown when the path conditional expression change type is “invariant”, “enlarge”, “reduce”, and “duplicate”. It may be at least one of “reduction” and “overlap”.
ここで、実施の形態1における制約ソルバの実行回数と、実施の形態2における制約ソルバの実行回数とを比較する。実施の形態1における制約ソルバは、変更前後のパスの関連付け時に行われる条件式(1)と、作成した関連情報に対する条件式(2−1)、(2−2)と、の充足可能性の判定に使用される。具体的に、テストケース生成装置2700は、制約ソルバを、条件式(1)の充足可能性の判定に3×4=12[回]使用し、6つの関連情報に対して、条件式(2−1)と条件式(2−2)の充足可能性の判定に、6×2=12[回]使用する。以上より、実施の形態1における制約ソルバの合計の使用回数は、12+12=24[回]となる。
Here, the number of executions of the constraint solver in the first embodiment is compared with the number of executions of the constraint solver in the second embodiment. The constraint solver in the first embodiment has a possibility of satisfying the conditional expression (1) performed when the paths before and after the change are associated and the conditional expressions (2-1) and (2-2) for the created related information. Used for judgment. Specifically, the test
一方、実施の形態2における制約ソルバは、テスト入力値を用いて生成した関連情報に対する条件式(2−1)、(2−2)と、残余の組に対する条件式(1)と、作成した関連情報に対する条件式(2−1)、(2−2)と、の充足可能性の判定に使用される。具体的に、テストケース生成装置2700は、制約ソルバを、生成した関連情報に対する条件式(2−1)、(2−2)の充足可能性の判定に、5×2=10[回]使用する。そして、テストケース生成装置2700は、制約ソルバを、残余の組に対する条件式(1)の充足可能性の判定に2[回]使用し、作成した関連情報に対する条件式(2−1)と、(2−2)の充足可能性の判定に、1×2=2[回]使用する。以上より、実施の形態2における制約ソルバの合計の使用回数は、10+2+2=14[回]となる。
On the other hand, the constraint solver in the second embodiment is created with the conditional expressions (2-1) and (2-2) for the related information generated using the test input values, and the conditional expression (1) for the remaining set. It is used to determine whether or not the conditional expressions (2-1) and (2-2) for the related information are satisfied. Specifically, the test
したがって、実施の形態2における制約ソルバの合計の使用回数は、実施の形態1における制約ソルバの合計の使用回数より10回分少なくなる。次に、図31〜図34を用いて、実施の形態2におけるテストケース生成処理のフローチャートを説明する。 Therefore, the total number of times the constraint solver is used in the second embodiment is 10 times less than the total number of times the constraint solver is used in the first embodiment. Next, a flowchart of the test case generation process according to the second embodiment will be described with reference to FIGS.
図31は、実施の形態2におけるテストケース生成処理手順の一例を示すフローチャート(その1)である。また、図32は、実施の形態2におけるテストケース生成処理手順の一例を示すフローチャート(その2)である。 FIG. 31 is a flowchart (part 1) illustrating an example of a test case generation processing procedure according to the second embodiment. FIG. 32 is a flowchart (part 2) illustrating an example of a test case generation processing procedure according to the second embodiment.
テストケース生成装置2700は、変更前プログラムPrePrgと変更後プログラムPostPrgとのシンボリック実行結果を取得する(ステップS3101)。次に、テストケース生成装置2700は、変更前プログラムPrePrgのテストケースから、テスト入力値を取得する(ステップS3102)。続けて、テストケース生成装置2700は、変更後プログラムPostPrgのパス条件式を制約ソルバに与えることにより、テスト入力値を生成する(ステップS3103)。次に、テストケース生成装置2700は、テスト入力値による変更前後パス関連付け処理を実行する(ステップS3104)。テスト入力値による変更前後パス関連付け処理の詳細は、図33にて後述する。また、テスト入力値による変更前後パス関連付け処理により、L1個の関連情報を作成したものとする。
The test
続けて、テストケース生成装置2700は、1をiに代入する(ステップS3105)。次に、テストケース生成装置2700は、i番目の関連情報のパス条件式を、文字列として比較する(ステップS3106)。続けて、テストケース生成装置2700は、比較結果が文字列の一致を示すか否かを判断する(ステップS3107)。
Subsequently, the test
比較結果が文字列の一致を示す場合(ステップS3107:Yes)、テストケース生成装置2700は、i番目の関連情報のパス条件式の変更種別を、“不変”に特定する(ステップS3108)。比較結果が文字列の不一致を示す場合(ステップS3107:No)、テストケース生成装置2700は、i番目の関連情報に対して、パス条件式の変更種別特定処理を実行する(ステップS3109)。
If the comparison result indicates that the character strings match (step S3107: YES), the test
ステップS3108、またはステップS3109の処理終了後、テストケース生成装置2700は、i+1をiに代入する(ステップS3110)。次に、テストケース生成装置2700は、iがL1より大きいか否かを判断する(ステップS3111)。iがL1以下である場合(ステップS3111:No)、テストケース生成装置2700は、ステップS3106の処理に移行する。
After the process of step S3108 or step S3109 is completed, the test
iがL1より大きい場合(ステップS3111:Yes)、テストケース生成装置2700は、未検出の変更前後パス関連付け処理を実行する(ステップS3112)。未検出の変更前後パス関連付け処理の詳細は、図34にて後述する。また、未検出の変更前後パス関連付け処理により、L2個の関連情報を作成したものとする。また、L1+L2が、図22で作成した関連情報の個数Lと同一の値となる。ステップS3112の処理終了後、テストケース生成装置2700は、図32に示すステップS3201の処理を実行する。
When i is larger than L1 (step S3111: Yes), the test
ステップS3112の処理終了後、テストケース生成装置2700は、1をiに代入する(ステップS3201)。次に、テストケース生成装置2700は、新たに追加されたL2個の関連情報のうちのi番目の関連情報に対して、パス条件式変更種別分類処理を実行する(ステップS3202)。続けて、テストケース生成装置2700は、i+1をiに代入する(ステップS3203)。次に、テストケース生成装置2700は、iがL2より大きいか否かを判断する(ステップS3204)。iがL2以下である場合(ステップS3204:No)、テストケース生成装置2700は、ステップS3202の処理に移行する。iがL2より大きい場合(ステップS3204:Yes)、テストケース生成装置2700は、1をiに代入する(ステップS3205)。
After the process of step S3112 ends, the test
次に、テストケース生成装置2700は、L1+L2個の関連情報のうちのi番目の関連情報に対して、パス出力数式変更種別分類処理を実行する(ステップS3206)。続けて、テストケース生成装置2700は、L1+L2個の関連情報のうちのi番目の関連情報に対して、テストケース分類処理を実行する(ステップS3207)。次に、テストケース生成装置2700は、i+1をiに代入する(ステップS3208)。続けて、テストケース生成装置2700は、iがL1+L2より大きいか否かを判断する(ステップS3209)。iがL1+L2以下である場合(ステップS3209:No)、テストケース生成装置2700は、ステップS3206の処理に移行する。
Next, the test
iがL1+L2より大きい場合(ステップS3209:Yes)、テストケース生成装置2700は、テストケース分類結果を出力する(ステップS3210)。次に、テストケース生成装置2700は、テストケースのテスト入力値生成処理を実行する(ステップS3211)。続けて、テストケース生成装置2700は、テスト入力値を生成したテストケースを出力する(ステップS3212)。
When i is larger than L1 + L2 (step S3209: Yes), the test
ステップS3212の終了後、テストケース生成装置2700は、実施の形態2におけるテストケース生成処理を終了する。実施の形態2におけるテストケース生成処理を実行することにより、テストケース生成装置2700は、変更後プログラムPostPrgの動作をテストするテストケースを生成することができる。さらに、実施の形態2におけるテストケース生成処理を実行することにより、テストケース生成装置2700は、制約ソルバの実行回数を実施の形態2におけるテストケース生成処理より少なくすることができる。
After the end of step S3212, the test
図33は、テスト入力値による変更前後パス関連付け処理手順の一例を示すフローチャートである。テスト入力値による変更前後パス関連付け処理は、テスト入力値を利用して、関連するパス同士を検出して関連情報を生成する処理である。また、図33では、変更前プログラムPrePrgのi番目のパスをPre(i)と表現し、i番目のパスの条件式をPrePC(i)と表現し、i番目のパスをテストするテストケースの入力値をPreIn(i)と表現する。同様に、変更後プログラムPostPrgのk番目のパスをPost(k)と表現し、k番目のパスの条件式を、PostPC(k)と表現し、k番目のパスをテストするテストケースの入力値をPostIn(k)と表現する。 FIG. 33 is a flowchart illustrating an example of a pre-change path association processing procedure based on a test input value. The path association process before and after the change by the test input value is a process for generating related information by detecting related paths using the test input value. In FIG. 33, the i-th path of the pre-change program PrePrg is expressed as Pre (i), the conditional expression of the i-th path is expressed as PrePC (i), and the i-th path is tested. The input value is expressed as PreIn (i). Similarly, the kth path of the post-change program PostPrg is expressed as Post (k), the conditional expression of the kth path is expressed as PostPC (k), and the input value of the test case for testing the kth path Is expressed as PostIn (k).
テストケース生成装置2700は、1をiに代入し、1をkに代入する(ステップS3301)。次に、テストケース生成装置2700は、PreIn(i)を与えたPostPC(k)が真となるか否かを判断する(ステップS3302)。PreIn(i)を与えたPostPC(k)が真となる場合(ステップS3302:Yes)、テストケース生成装置2700は、Pre(i)とPost(k)とをテストケース組とする関連情報を生成する(ステップS3303)。
The test
ステップS3303の処理終了後、または、PreIn(i)を与えたPostPC(k)が偽となる場合(ステップS3302:No)、テストケース生成装置2700は、PostIn(k)を与えたPrePC(i)が真となるか否かを判断する(ステップS3304)。PostIn(k)を与えたPrePC(i)が真となる場合(ステップS3304:Yes)、テストケース生成装置2700は、Pre(i)とPost(k)とをテストケース組とする関連情報を生成する(ステップS3305)。
After the processing of step S3303 or when PostPC (k) given PreIn (i) becomes false (step S3302: No), the test
ステップS3305の処理終了後、または、PostIn(k)を与えたPrePC(i)が偽となる場合(ステップS3304:No)、テストケース生成装置2700は、k+1をkに代入する(ステップS3306)。次に、テストケース生成装置2700は、kがNより大きいか否かを判断する(ステップS3307)。kがN以下である場合(ステップS3307:No)、テストケース生成装置2700は、ステップS3302の処理に移行する。kがNより大きい場合(ステップS3307:Yes)、テストケース生成装置2700は、i+1をiに代入し、1をkに代入する(ステップS3308)。次に、テストケース生成装置2700は、iがMより大きいか否かを判断する(ステップS3309)。
After the processing of step S3305 is completed, or when PrePC (i) given PostIn (k) becomes false (step S3304: No), the test
iがM以下である場合(ステップS3309:No)、テストケース生成装置2700は、ステップS3302の処理に移行する。iがMより大きい場合(ステップS3309:Yes)、テストケース生成装置2700は、関連情報を出力する(ステップS3310)。ステップS3310の処理終了後、テストケース生成装置2700は、テスト入力値による変更前後パス関連付け処理を終了する。テスト入力値による変更前後パス関連付け処理を実行することにより、テストケース生成装置2700は、制約ソルバを用いずに、関連情報を作成することができる。
When i is M or less (step S3309: No), the test
図34は、未検出の変更前後パス関連付け処理手順の一例を示すフローチャートである。未検出の変更前後パス関連付け処理は、テスト入力値によるテストケース関連付け処理により検出されなかった関連情報を検出して、関連情報を生成する処理である。また、図34では、変更前プログラムPrePrgのi番目のパスをPre(i)と表現し、i番目のパスの条件式をPrePC(i)と表現する。同様に、変更後プログラムPostPrgのk番目のパスをPost(k)と表現し、k番目のパスの条件式を、PostPC(k)と表現する。 FIG. 34 is a flowchart illustrating an example of an undetected before / after change path association processing procedure. The undetected pre-change path association process is a process of generating related information by detecting related information that has not been detected by the test case association process based on the test input value. In FIG. 34, the i-th path of the pre-change program PrePrg is expressed as Pre (i), and the conditional expression of the i-th path is expressed as PrePC (i). Similarly, the kth path of the post-change program PostPrg is expressed as Post (k), and the conditional expression of the kth path is expressed as PostPC (k).
テストケース生成装置2700は、1をiに代入する(ステップS3401)。次に、テストケース生成装置2700は、PrePC(i)が、PostPC(k)、k=1,…,Nのいずれかと“不変”または“拡大”の関係か否かを判断する(ステップS3402)。PrePC(i)が、PostPC(k)、k=1,…,Nのいずれかと“不変”または“拡大”の関係でない場合(ステップS3402:No)、テストケース生成装置2700は、1をkに代入する(ステップS3403)。
The test
次に、テストケース生成装置2700は、PrePCを先頭から末尾まで走査するための変数jを使って、PrePC(j),j=1,…,Mのいずれかが、PostPC(k)と“不変”または“縮小”の関係か否かを判断する(ステップS3404)。PrePC(j),j=1,…,Mのいずれかが、PostPC(k)と“不変”または“縮小”の関係でない場合(ステップS3404:No)、テストケース生成装置2700は、Pre(i)とPost(k)が既にテストケース組か否かを判断する(ステップS3405)。Pre(i)とPost(k)が既にテストケース組でない場合(ステップS3405:No)、テストケース生成装置2700は、PrePC(i)∧PostPC(k)が充足可能か否かを判断する(ステップS3406)。
Next, the test
PrePC(i)∧PostPC(k)が充足可能である場合(ステップS3406:Yes)、テストケース生成装置2700は、Pre(i)とPost(k)とをテストケース組とする関連情報を作成する(ステップS3407)。
If PrePC (i) ∧PostPC (k) is satisfiable (step S3406: YES), the test
ステップS3407の実行後、または、PrePC(i)∧PostPC(k)が充足可能でない場合(ステップS3406:No)、テストケース生成装置2700は、k+1をkに代入する(ステップS3408)。また、PrePC(j),j=1,…,Mのいずれかが、PostPC(k)と“不変”または“縮小”の関係である場合(ステップS3404:Yes)、Pre(i)とPost(k)が既にテストケース組である場合(ステップS3405:Yes)、テストケース生成装置2700は、ステップS3408の処理を実行する。
After execution of step S3407 or when PrePC (i) ∧PostPC (k) is not satisfiable (step S3406: No), the test
ステップS3408の処理終了後、テストケース生成装置2700は、kがNより大きいか否かを判断する(ステップS3409)。kがN以下である場合(ステップS3409:No)、テストケース生成装置2700は、ステップS3404の処理に移行する。
After the process of step S3408 is completed, the test
PrePC(i)が、PostPC(k)、k=1,…,Nのいずれかと“不変”または“拡大”の関係である場合(ステップS3402:Yes)、または、kがNより大きい場合(ステップS3409:Yes)、テストケース生成装置2700は、i+1をiに代入する(ステップS3410)。次に、テストケース生成装置2700は、iがMより大きいか否かを判断する(ステップS3411)。
When PrePC (i) has a relationship of “invariant” or “enlargement” with any of PostPC (k), k = 1,..., N (step S3402: Yes), or when k is larger than N (step (S3409: Yes), the test
iがM以下である場合(ステップS3411:No)、テストケース生成装置2700は、ステップS3402の処理に移行する。iがMより大きい場合(ステップS3411:Yes)、テストケース生成装置2700は、生成した関連情報を新たな関連情報として追加する(ステップS3412)。ステップS3412の処理終了後、テストケース生成装置2700は、未検出の変更前後パス関連付け処理を終了する。未検出の変更前後パス関連付け処理を実行することにより、テストケース生成装置2700は、テスト入力値による変更前後パス関連付け処理により検出されなかった関連情報を検出することができる。
When i is M or less (step S3411: NO), the test
以上説明したように、テストケース生成装置2700によれば、テスト入力値を用いて関連情報を作成してもよい。これにより、テストケース生成装置2700は、制約ソルバを用いずに、関連情報を作成することができ、制約ソルバの実行回数を削減することができる。
As described above, according to the test
また、テストケース生成装置2700によれば、変更前プログラムPrePrgに含まれる各パスと変更後プログラムPostPrgに含まれる各パスとの組合せの組から、関連情報のパス条件式変更種別から特定される組を取り除く。続けて、テストケース生成装置2700は、取り除いた残余の組に対して、変更前プログラムPrePrgに含まれる各パスと変更後プログラムPostPrgに含まれる各パスが関連するか否かを判断してもよい。これにより、テストケース生成装置2700は、テストケース生成装置100が制約ソルバを利用する回数よりも少ない回数で、関連情報を特定することができる。
Further, according to the test
なお、本実施の形態で説明したテストケース生成方法は、予め用意されたプログラムをパーソナル・コンピュータやワークステーション等のコンピュータで実行することにより実現することができる。本テストケース生成プログラムは、ハードディスク、フレキシブルディスク、CD−ROM、MO、DVD等のコンピュータで読み取り可能な記録媒体に記録され、コンピュータによって記録媒体から読み出されることによって実行される。また本テストケース生成プログラムは、インターネット等のネットワークを介して配布してもよい。 Note that the test case generation method described in the present embodiment can be realized by executing a program prepared in advance on a computer such as a personal computer or a workstation. The test case generation program is recorded on a computer-readable recording medium such as a hard disk, a flexible disk, a CD-ROM, an MO, and a DVD, and is executed by being read from the recording medium by the computer. The test case generation program may be distributed via a network such as the Internet.
上述した実施の形態1、2に関し、さらに以下の付記を開示する。 The following additional notes are disclosed with respect to the first and second embodiments described above.
(付記1)コンピュータが、
第1のプログラムをシンボリック実行することにより、前記第1のプログラムに含まれる入力変数が取り得る値のうちの前記第1のプログラムに含まれる第1のパスが実行される条件となる前記入力変数の値を表す第1の条件式と、前記第1のパスが実行された場合に出力される前記第1のプログラムに含まれる出力変数を表す第1の数式と、を含む第1の実行結果を取得し、
前記第1のプログラムの一部が変更された第2のプログラムをシンボリック実行することにより、前記入力変数の取り得る値のうちの前記第2のプログラムに含まれる第2のパスが実行される条件となる前記入力変数の値を表す第2の条件式と、前記第2のパスが実行された場合に出力される前記第2のプログラムに含まれる出力変数を表す第2の数式と、を含む第2の実行結果を取得し、
前記入力変数が取り得る値のうちの、取得した前記第1の条件式と取得した前記第2の条件式との論理積を真とする値の有無に基づいて、前記第2のパスが前記第1のパスに関連するか否かを判断し、
取得した前記第1の数式と、取得した前記第2の数式とが一致するか否かを判定し、
判断結果と判定結果とに基づいて、前記第2のパスの動作をテストするテストケースを生成すべきか否かを判定する、
処理を実行することを特徴とするテストケース生成方法。
(Supplementary note 1)
The input variable which becomes a condition for executing the first pass included in the first program out of the possible values of the input variable included in the first program by performing symbolic execution of the first program A first execution result including a first conditional expression representing the value of the first expression and a first mathematical expression representing an output variable included in the first program that is output when the first pass is executed Get
Conditions for executing a second pass included in the second program among possible values of the input variable by executing symbolically the second program in which a part of the first program is changed A second conditional expression representing the value of the input variable, and a second mathematical expression representing an output variable included in the second program that is output when the second pass is executed. Get the second execution result,
Of the possible values of the input variable, based on the presence or absence of a value that makes the logical product of the acquired first conditional expression and the acquired second conditional expression true, the second path is Determine if it is related to the first pass,
Determining whether the acquired first mathematical formula and the acquired second mathematical formula match,
Determining whether to generate a test case for testing the operation of the second path based on the determination result and the determination result;
A test case generation method characterized by executing processing.
(付記2)前記コンピュータが、
前記第2のパスの動作をテストするテストケースを生成すべきであると判定した場合、前記第2の条件式を真とする前記入力変数の値を算出し、
算出した前記値を前記入力変数の値とする前記第2のパスの動作をテストするテストケースを生成する、
処理を実行することを特徴とする付記1に記載のテストケース生成方法。
(Appendix 2) The computer
If it is determined that a test case for testing the operation of the second path should be generated, the value of the input variable that makes the second conditional expression true is calculated;
Generating a test case for testing the operation of the second pass using the calculated value as the value of the input variable;
The test case generation method according to
(付記3)前記コンピュータが、
前記第2のパスが前記第1のパスに関連すると判断し、かつ、前記第1の数式と前記第2の数式とが一致すると判定した場合、前記入力変数が取り得る値のうちの前記第1の条件式と前記第2の条件式の否定との論理積を真とする値の有無を特定するとともに、前記入力変数が取り得る値のうちの前記第1の条件式の否定と前記第2の条件式との論理積を真とする値の有無を特定する、処理を実行し、
前記テストケースを生成すべきか否かを判定する処理は、
特定結果に基づいて、前記第2のパスの動作をテストするテストケースを生成すべきか否かを判定することを特徴とする付記1または2に記載のテストケース生成方法。
(Supplementary note 3)
When it is determined that the second path is related to the first path, and the first mathematical expression and the second mathematical expression match, the first of the possible values of the input variable The presence or absence of a value that is true of the logical product of the
The process of determining whether to generate the test case is as follows:
3. The test case generation method according to
(付記4)前記コンピュータが、
前記第2のパスが前記第1のパスに関連すると判断し、かつ、前記第1の数式と前記第2の数式とが一致すると判定した場合、前記入力変数が取り得る値のうちの前記第1の条件式の否定と前記第2の条件式との論理積を真とする値の有無を特定する、処理を実行し、
前記テストケースを生成すべきか否かを判定する処理は、
前記第1の条件式の否定と前記第2の条件式との論理積を真とする値が有ると特定した場合、前記第2のパスの動作をテストするテストケースを生成すべきであると判定し、
前記算出する処理は、
前記第2のパスの動作をテストするテストケースを生成すべきであると判定した場合、前記第1の条件式の否定と前記第2の条件式との論理積を真とする前記入力変数の値を算出することを特徴とする付記2に記載のテストケース生成方法。
(Appendix 4) The computer
When it is determined that the second path is related to the first path, and the first mathematical expression and the second mathematical expression match, the first of the possible values of the input variable Specifying the presence or absence of a value that is the logical product of the negation of the
The process of determining whether to generate the test case is as follows:
When it is specified that there is a value that is the logical product of the negation of the first conditional expression and the second conditional expression, a test case for testing the operation of the second pass should be generated. Judgment,
The calculation process is as follows:
If it is determined that a test case for testing the operation of the second path should be generated, the input variable that is the logical product of the negation of the first conditional expression and the second conditional expression is true. The test case generation method according to
(付記5)前記判断する処理は、
前記第1のパスの動作をテストするテストケースの入力値を、前記第2のパスの条件式に与えた場合に前記第2の条件式が真となるか否かに基づいて、前記第2のパスが前記第1のパスに関連するか否かを判断することを特徴とする付記1〜4のいずれか一つに記載のテストケース生成方法。
(Supplementary Note 5)
Based on whether or not the second conditional expression is true when an input value of a test case for testing the operation of the first path is given to the conditional expression of the second path, The test case generation method according to any one of
(付記6)前記コンピュータが、
前記第2のパスが前記第1のパスに関連すると判断した場合、前記入力変数が取り得る値のうちの前記第1の条件式と前記第2の条件式の否定との論理積を真とする値の有無を特定するとともに、前記入力変数が取り得る値のうちの前記第1の条件式の否定と前記第2の条件式との論理積を真とする値の有無を特定し、
特定結果に基づいて、前記第2のパスが前記第1のプログラムに含まれるパス群のうちの前記第1のパスとは異なるパスに関連しないことを判断する、
処理を実行することを特徴とする付記1〜5のいずれか一つに記載のテストケース生成方法。
(Appendix 6) The computer
If it is determined that the second path is related to the first path, the logical product of the first conditional expression and the negation of the second conditional expression among the possible values of the input variable is true. Specifying the presence or absence of a value to be determined, and specifying the presence or absence of a value that makes the logical product of the negation of the first conditional expression and the second conditional expression out of the possible values of the input variable,
Determining that the second path is not related to a path different from the first path in the path group included in the first program based on the specific result;
The test case generation method according to any one of
(付記7)前記コンピュータが、
前記第2のパスが前記第1のパスに関連すると判断した場合、前記入力変数が取り得る値のうちの前記第1の条件式と前記第2の条件式の否定との論理積を真とする値の有無を特定するとともに、前記入力変数が取り得る値のうちの前記第1の条件式の否定と前記第2の条件式との論理積を真とする値の有無を特定し、
特定結果に基づいて、前記第2のプログラムに含まれるパス群のうちの前記第2のパスとは異なるパスが前記第1のパスに関連しないことを判断する、
処理を実行することを特徴とする付記1〜6のいずれか一つに記載のテストケース生成方法。
(Supplementary note 7)
If it is determined that the second path is related to the first path, the logical product of the first conditional expression and the negation of the second conditional expression among the possible values of the input variable is true. Specifying the presence or absence of a value to be determined, and specifying the presence or absence of a value that makes the logical product of the negation of the first conditional expression and the second conditional expression out of the possible values of the input variable,
Based on the specific result, it is determined that a path different from the second path in the path group included in the second program is not related to the first path.
The test case generation method according to any one of
(付記8)前記入力変数が取り得る値のうちの前記各々のパスが実行される条件となる前記入力変数の値を表す条件式と、前記各々のパスが実行された場合に出力される前記第1のプログラムに含まれる出力変数を表す数式とを含み、
前記コンピュータが、
前記第1の実行結果に含まれるパスと前記第2のパスとの組ごとに、前記入力変数が取り得る値のうちの前記パスの条件式と前記第2の条件式との論理積を真とする値の有無に基づいて、前記第2のパスが前記パスに関連するか否かを判断する、処理を実行し、
前記数式を判定する処理は、
前記組ごとに、取得した前記第1の実行結果に含まれる数式と、取得した前記第2の数式とが一致するか否かを判定し、
前記テストケースを生成すべきか否かを判定する処理は、
前記組ごとの判断情報と前記組ごとの判定結果とに基づいて、前記第2のパスの動作をテストするテストケースを生成すべきか否かを判定することを特徴とする付記1〜4のいずれか一つに記載のテストケース生成方法。
(Additional remark 8) The conditional expression showing the value of the said input variable used as the condition for each said path | pass being executed among the values which the said input variable can take, and the said output when each said path | pass is performed A mathematical expression representing an output variable included in the first program,
The computer is
For each pair of the path and the second path included in the first execution result, the logical product of the conditional expression of the path and the second conditional expression among the possible values of the input variable is true. Performing a process of determining whether the second path is related to the path based on the presence of a value of
The process of determining the formula is as follows:
For each set, it is determined whether the mathematical expression included in the acquired first execution result matches the acquired second mathematical expression;
The process of determining whether to generate the test case is as follows:
Any one of
(付記9)前記第2の実行結果は、前記第2のプログラムに含まれるパス群の各々のパスごとの、前記入力変数が取り得る値のうちの前記各々のパスが実行される条件となる前記入力変数の値を表す条件式と、前記各々のパスが実行された場合に出力される前記第2のプログラムに含まれる出力変数を表す数式とを含み、
前記判断する処理は、
前記第1の実行結果に含まれるパスと前記第2の実行結果に含まれる各パスとの組ごとに、前記入力変数が取り得る値のうちの前記第1の実行結果に含まれるパスの条件式と前記第2の実行結果に含まれるパスとの論理積を真とする値の有無に基づいて、前記第2の実行結果に含まれるパスが前記第1の実行結果に含まれるパスに関連するか否かを判断し、
前記数式を判定する処理は、
前記第1の実行結果に含まれる各パスと前記第2の実行結果に含まれる各パスとの組合せの組ごとに、取得した前記第1の実行結果に含まれる数式と、取得した前記第2の実行結果に含まれる数式とが一致するか否かを判定し、
前記テストケースを生成すべきか否かを判定する処理は、
前記組ごとの判断結果と、前記組ごとの判定結果と、に基づいて、前記第2の実行結果に含まれるパスの動作をテストするテストケースを生成すべきか否かを判定することを特徴とする付記8に記載のテストケース生成方法。
(Supplementary Note 9) The second execution result is a condition for executing each of the paths that can be taken by the input variable for each path of the path group included in the second program. A conditional expression representing the value of the input variable, and a mathematical expression representing an output variable included in the second program that is output when each of the passes is executed,
The determination process is as follows:
A condition of the path included in the first execution result among the possible values of the input variable for each set of the path included in the first execution result and each path included in the second execution result. The path included in the second execution result is related to the path included in the first execution result based on the presence / absence of a value that makes the logical product of the expression and the path included in the second execution result true. Decide whether or not to
The process of determining the formula is as follows:
For each set of combinations of each path included in the first execution result and each path included in the second execution result, the mathematical expression included in the acquired first execution result, and the acquired second It is determined whether or not the mathematical expression included in the execution result of
The process of determining whether to generate the test case is as follows:
Determining whether to generate a test case for testing the operation of a path included in the second execution result based on the determination result for each set and the determination result for each set; The test case generation method according to
(付記10)第1のプログラムをシンボリック実行することにより、前記第1のプログラムに含まれる入力変数が取り得る値のうちの前記第1のプログラムに含まれる第1のパスが実行される条件となる前記入力変数の値を表す第1の条件式と、前記第1のパスが実行された場合に出力される前記第1のプログラムに含まれる出力変数を表す第1の数式と、を含む第1の実行結果を取得する第1取得部と、
前記第1のプログラムの一部が変更された第2のプログラムをシンボリック実行することにより、前記入力変数の取り得る値のうちの前記第2のプログラムに含まれる第2のパスが実行される条件となる前記入力変数の値を表す第2の条件式と、前記第2のパスが実行された場合に出力される前記第2のプログラムに含まれる出力変数を表す第2の数式と、を含む第2の実行結果を取得する第2取得部と、
前記入力変数が取り得る値のうちの、前記第1取得部によって取得された前記第1の条件式と前記第2取得部によって取得された前記第2の条件式との論理積を真とする値の有無に基づいて、前記第2のパスが前記第1のパスに関連するか否かを判断するパス関連判断部と、
前記第1取得部によって取得された前記第1の数式と、前記第2取得部によって取得された前記第2の数式とが一致するか否かを判定する数式判定部と、
前記パス関連判断部による判断結果と前記数式判定部による判定結果とに基づいて、前記第2のパスの動作をテストするテストケースを生成すべきか否かを判定する生成判定部と、
を有することを特徴とするテストケース生成装置。
(Supplementary Note 10) Conditions for executing the first pass included in the first program out of the possible values of the input variable included in the first program by executing the first program symbolically. A first conditional expression that represents the value of the input variable and a first mathematical expression that represents the output variable included in the first program that is output when the first pass is executed. A first acquisition unit that acquires an execution result of 1;
Conditions for executing a second pass included in the second program among possible values of the input variable by executing symbolically the second program in which a part of the first program is changed A second conditional expression representing the value of the input variable, and a second mathematical expression representing an output variable included in the second program that is output when the second pass is executed. A second acquisition unit for acquiring a second execution result;
Of the possible values of the input variable, the logical product of the first conditional expression acquired by the first acquisition unit and the second conditional expression acquired by the second acquisition unit is true. A path-related determination unit that determines whether the second path is related to the first path based on the presence or absence of a value;
A formula determination unit that determines whether or not the first formula acquired by the first acquisition unit matches the second formula acquired by the second acquisition unit;
A generation determination unit that determines whether to generate a test case for testing the operation of the second path, based on a determination result by the path relation determination unit and a determination result by the formula determination unit;
A test case generation device characterized by comprising:
(付記11)第1のプログラムをシンボリック実行することにより、前記第1のプログラムに含まれる入力変数が取り得る値のうちの前記第1のプログラムに含まれる第1のパスが実行される条件となる前記入力変数の値を表す第1の条件式と、前記第1のパスが実行された場合に出力される前記第1のプログラムに含まれる出力変数を表す第1の数式と、を含む第1の実行結果を取得する第1取得部と、
前記第1のプログラムの一部が変更された第2のプログラムをシンボリック実行することにより、前記入力変数の取り得る値のうちの前記第2のプログラムに含まれる第2のパスが実行される条件となる前記入力変数の値を表す第2の条件式と、前記第2のパスが実行された場合に出力される前記第2のプログラムに含まれる出力変数を表す第2の数式と、を含む第2の実行結果を取得する第2取得部と、
前記入力変数が取り得る値のうちの、前記第1取得部によって取得された前記第1の条件式と前記第2取得部によって取得された前記第2の条件式との論理積を真とする値の有無に基づいて、前記第2のパスが前記第1のパスに関連するか否かを判断するパス関連判断部と、
前記第1取得部によって取得された前記第1の数式と、前記第2取得部によって取得された前記第2の数式とが一致するか否かを判定する数式判定部と、
前記パス関連判断部による判断結果と前記数式判定部による判定結果とに基づいて、前記第2のパスの動作をテストするテストケースを生成すべきか否かを判定する生成判定部と、
を有するコンピュータを含むことを特徴とするテストケース生成装置。
(Supplementary Note 11) Conditions for executing the first pass included in the first program among the possible values of the input variable included in the first program by performing symbolic execution of the first program A first conditional expression that represents the value of the input variable and a first mathematical expression that represents the output variable included in the first program that is output when the first pass is executed. A first acquisition unit that acquires an execution result of 1;
Conditions for executing a second pass included in the second program among possible values of the input variable by executing symbolically the second program in which a part of the first program is changed A second conditional expression representing the value of the input variable, and a second mathematical expression representing an output variable included in the second program that is output when the second pass is executed. A second acquisition unit for acquiring a second execution result;
Of the possible values of the input variable, the logical product of the first conditional expression acquired by the first acquisition unit and the second conditional expression acquired by the second acquisition unit is true. A path-related determination unit that determines whether the second path is related to the first path based on the presence or absence of a value;
A formula determination unit that determines whether or not the first formula acquired by the first acquisition unit matches the second formula acquired by the second acquisition unit;
A generation determination unit that determines whether or not to generate a test case for testing the operation of the second path based on a determination result by the path relation determination unit and a determination result by the formula determination unit;
A test case generation apparatus including a computer having
(付記12)コンピュータに、
第1のプログラムをシンボリック実行することにより、前記第1のプログラムに含まれる入力変数が取り得る値のうちの前記第1のプログラムに含まれる第1のパスが実行される条件となる前記入力変数の値を表す第1の条件式と、前記第1のパスが実行された場合に出力される前記第1のプログラムに含まれる出力変数を表す第1の数式と、を含む第1の実行結果を取得し、
前記第1のプログラムの一部が変更された第2のプログラムをシンボリック実行することにより、前記入力変数の取り得る値のうちの前記第2のプログラムに含まれる第2のパスが実行される条件となる前記入力変数の値を表す第2の条件式と、前記第2のパスが実行された場合に出力される前記第2のプログラムに含まれる出力変数を表す第2の数式と、を含む第2の実行結果を取得し、
前記入力変数が取り得る値のうちの、取得した前記第1の条件式と取得した前記第2の条件式との論理積を真とする値の有無に基づいて、前記第2のパスが前記第1のパスに関連するか否かを判断し、
取得した前記第1の数式と、取得した前記第2の数式とが一致するか否かを判定し、
判断結果と判定結果とに基づいて、前記第2のパスの動作をテストするテストケースを生成すべきか否かを判定する、
処理を実行させることを特徴とするテストケース生成プログラム。
(Supplementary note 12)
The input variable which becomes a condition for executing the first pass included in the first program out of the possible values of the input variable included in the first program by performing symbolic execution of the first program A first execution result including a first conditional expression representing the value of the first expression and a first mathematical expression representing an output variable included in the first program that is output when the first pass is executed Get
Conditions for executing a second pass included in the second program among possible values of the input variable by executing symbolically the second program in which a part of the first program is changed A second conditional expression representing the value of the input variable, and a second mathematical expression representing an output variable included in the second program that is output when the second pass is executed. Get the second execution result,
Of the possible values of the input variable, based on the presence or absence of a value that makes the logical product of the acquired first conditional expression and the acquired second conditional expression true, the second path is Determine if it is related to the first pass,
Determining whether the acquired first mathematical formula and the acquired second mathematical formula match,
Determining whether to generate a test case for testing the operation of the second path based on the determination result and the determination result;
A test case generation program characterized by causing a process to be executed.
(付記13)第1のプログラムをシンボリック実行することにより、前記第1のプログラムに含まれる入力変数が取り得る値のうちの前記第1のプログラムに含まれる第1のパスが実行される条件となる前記入力変数の値を表す第1の条件式と、前記第1のパスが実行された場合に出力される前記第1のプログラムに含まれる出力変数を表す第1の数式と、を含む第1の実行結果を取得し、
前記第1のプログラムの一部が変更された第2のプログラムをシンボリック実行することにより、前記入力変数の取り得る値のうちの前記第2のプログラムに含まれる第2のパスが実行される条件となる前記入力変数の値を表す第2の条件式と、前記第2のパスが実行された場合に出力される前記第2のプログラムに含まれる出力変数を表す第2の数式と、を含む第2の実行結果を取得し、
前記入力変数が取り得る値のうちの、取得した前記第1の条件式と取得した前記第2の条件式との論理積を真とする値の有無に基づいて、前記第2のパスが前記第1のパスに関連するか否かを判断し、
取得した前記第1の数式と、取得した前記第2の数式とが一致するか否かを判定し、
判断結果と判定結果とに基づいて、前記第2のパスの動作をテストするテストケースを生成すべきか否かを判定する、
処理をコンピュータに実行させるテストケース生成プログラムを記録したことを特徴する記録媒体。
(Supplementary note 13) Conditions for executing the first pass included in the first program out of the possible values of the input variables included in the first program by performing symbolic execution of the first program A first conditional expression that represents the value of the input variable and a first mathematical expression that represents the output variable included in the first program that is output when the first pass is executed. Get the execution result of 1,
Conditions for executing a second pass included in the second program among possible values of the input variable by executing symbolically the second program in which a part of the first program is changed A second conditional expression representing the value of the input variable, and a second mathematical expression representing an output variable included in the second program that is output when the second pass is executed. Get the second execution result,
Of the possible values of the input variable, based on the presence or absence of a value that makes the logical product of the acquired first conditional expression and the acquired second conditional expression true, the second path is Determine if it is related to the first pass,
Determining whether the acquired first mathematical formula and the acquired second mathematical formula match,
Determining whether to generate a test case for testing the operation of the second path based on the determination result and the determination result;
A recording medium on which a test case generation program for causing a computer to execute processing is recorded.
100、2700 テストケース生成装置
701、801 シンボリック実行結果
901、2701 第1取得部
902、2702 第2取得部
903、2707 パス関連判断部
904、2708 関連情報作成部
905、2705 特定部
906、2709 数式判定部
907、2710 生成判定部
908 算出部
909 テストケース生成部
2703 テスト入力値判断部
2704 関連情報生成部
2706 組作成部
100, 2700 Test
Claims (9)
第1のプログラムをシンボリック実行することにより、前記第1のプログラムに含まれる入力変数が取り得る値のうちの前記第1のプログラムに含まれる第1のパスが実行される条件となる前記入力変数の値を表す第1の条件式と、前記第1のパスが実行された場合に出力される前記第1のプログラムに含まれる出力変数を表す第1の数式と、を含む第1の実行結果を取得し、
前記第1のプログラムの一部が変更された第2のプログラムをシンボリック実行することにより、前記入力変数の取り得る値のうちの前記第2のプログラムに含まれる第2のパスが実行される条件となる前記入力変数の値を表す第2の条件式と、前記第2のパスが実行された場合に出力される前記第2のプログラムに含まれる出力変数を表す第2の数式と、を含む第2の実行結果を取得し、
前記入力変数が取り得る値のうちの、取得した前記第1の条件式と取得した前記第2の条件式との論理積を真とする値の有無に基づいて、前記第2のパスが前記第1のパスに関連するか否かを判断し、
取得した前記第1の数式と、取得した前記第2の数式とが一致するか否かを判定し、
判断結果と判定結果とに基づいて、前記第2のパスの動作をテストするテストケースを生成すべきか否かを判定する、
処理を実行することを特徴とするテストケース生成方法。 Computer
The input variable which becomes a condition for executing the first pass included in the first program out of the possible values of the input variable included in the first program by performing symbolic execution of the first program A first execution result including a first conditional expression representing the value of the first expression and a first mathematical expression representing an output variable included in the first program that is output when the first pass is executed Get
Conditions for executing a second pass included in the second program among possible values of the input variable by executing symbolically the second program in which a part of the first program is changed A second conditional expression representing the value of the input variable, and a second mathematical expression representing an output variable included in the second program that is output when the second pass is executed. Get the second execution result,
Of the possible values of the input variable, based on the presence or absence of a value that makes the logical product of the acquired first conditional expression and the acquired second conditional expression true, the second path is Determine if it is related to the first pass,
Determining whether the acquired first mathematical formula and the acquired second mathematical formula match,
Determining whether to generate a test case for testing the operation of the second path based on the determination result and the determination result;
A test case generation method characterized by executing processing.
前記第2のパスの動作をテストするテストケースを生成すべきであると判定した場合、前記第2の条件式を真とする前記入力変数の値を算出し、
算出した前記値を前記入力変数の値とする前記第2のパスの動作をテストするテストケースを生成する、
処理を実行することを特徴とする請求項1に記載のテストケース生成方法。 The computer is
If it is determined that a test case for testing the operation of the second path should be generated, the value of the input variable that makes the second conditional expression true is calculated;
Generating a test case for testing the operation of the second pass using the calculated value as the value of the input variable;
The test case generation method according to claim 1, wherein the process is executed.
前記第2のパスが前記第1のパスに関連すると判断し、かつ、前記第1の数式と前記第2の数式とが一致すると判定した場合、前記入力変数が取り得る値のうちの前記第1の条件式と前記第2の条件式の否定との論理積を真とする値の有無を特定するとともに、前記入力変数が取り得る値のうちの前記第1の条件式の否定と前記第2の条件式との論理積を真とする値の有無を特定する、処理を実行し、
前記テストケースを生成すべきか否かを判定する処理は、
特定結果に基づいて、前記第2のパスの動作をテストするテストケースを生成すべきか否かを判定することを特徴とする請求項1または2に記載のテストケース生成方法。 The computer is
When it is determined that the second path is related to the first path, and the first mathematical expression and the second mathematical expression match, the first of the possible values of the input variable The presence or absence of a value that is true of the logical product of the conditional expression 1 and the negation of the second conditional expression, and the negation of the first conditional expression and the first Execute the process of specifying the presence or absence of a value that is the logical product of the conditional expression 2 and
The process of determining whether to generate the test case is as follows:
The test case generation method according to claim 1, wherein it is determined whether or not a test case for testing the operation of the second path should be generated based on a specific result.
前記第2のパスが前記第1のパスに関連すると判断し、かつ、前記第1の数式と前記第2の数式とが一致すると判定した場合、前記入力変数が取り得る値のうちの前記第1の条件式の否定と前記第2の条件式との論理積を真とする値の有無を特定する、処理を実行し、
前記テストケースを生成すべきか否かを判定する処理は、
前記第1の条件式の否定と前記第2の条件式との論理積を真とする値が有ると特定した場合、前記第2のパスの動作をテストするテストケースを生成すべきであると判定し、
前記算出する処理は、
前記第2のパスの動作をテストするテストケースを生成すべきであると判定した場合、前記第1の条件式の否定と前記第2の条件式との論理積を真とする前記入力変数の値を算出することを特徴とする請求項2に記載のテストケース生成方法。 The computer is
When it is determined that the second path is related to the first path, and the first mathematical expression and the second mathematical expression match, the first of the possible values of the input variable Specifying the presence or absence of a value that is the logical product of the negation of the conditional expression 1 and the second conditional expression,
The process of determining whether to generate the test case is as follows:
When it is specified that there is a value that is the logical product of the negation of the first conditional expression and the second conditional expression, a test case for testing the operation of the second pass should be generated. Judgment,
The calculation process is as follows:
If it is determined that a test case for testing the operation of the second path should be generated, the input variable that is the logical product of the negation of the first conditional expression and the second conditional expression is true. The test case generation method according to claim 2, wherein a value is calculated.
前記第1のパスの動作をテストするテストケースの入力値を、前記第2のパスの条件式に与えた場合に前記第2の条件式が真となるか否かに基づいて、前記第2のパスが前記第1のパスに関連するか否かを判断することを特徴とする請求項1〜4のいずれか一つに記載のテストケース生成方法。 The determination process is as follows:
Based on whether or not the second conditional expression is true when an input value of a test case for testing the operation of the first path is given to the conditional expression of the second path, 5. The test case generation method according to claim 1, wherein it is determined whether or not the first path is related to the first path.
前記第2のパスが前記第1のパスに関連すると判断した場合、前記入力変数が取り得る値のうちの前記第1の条件式と前記第2の条件式の否定との論理積を真とする値の有無を特定するとともに、前記入力変数が取り得る値のうちの前記第1の条件式の否定と前記第2の条件式との論理積を真とする値の有無を特定し、
特定結果に基づいて、前記第2のパスが前記第1のプログラムに含まれるパス群のうちの前記第1のパスとは異なるパスに関連しないことを判断する、
処理を実行することを特徴とする請求項1〜5のいずれか一つに記載のテストケース生成方法。 The computer is
If it is determined that the second path is related to the first path, the logical product of the first conditional expression and the negation of the second conditional expression among the possible values of the input variable is true. Specifying the presence or absence of a value to be determined, and specifying the presence or absence of a value that makes the logical product of the negation of the first conditional expression and the second conditional expression out of the possible values of the input variable,
Determining that the second path is not related to a path different from the first path in the path group included in the first program based on the specific result;
6. The test case generation method according to claim 1, wherein the process is executed.
前記第2のパスが前記第1のパスに関連すると判断した場合、前記入力変数が取り得る値のうちの前記第1の条件式と前記第2の条件式の否定との論理積を真とする値の有無を特定するとともに、前記入力変数が取り得る値のうちの前記第1の条件式の否定と前記第2の条件式との論理積を真とする値の有無を特定し、
特定結果に基づいて、前記第2のプログラムに含まれるパス群のうちの前記第2のパスとは異なるパスが前記第1のパスに関連しないことを判断する、
処理を実行することを特徴とする請求項1〜6のいずれか一つに記載のテストケース生成方法。 The computer is
If it is determined that the second path is related to the first path, the logical product of the first conditional expression and the negation of the second conditional expression among the possible values of the input variable is true. Specifying the presence or absence of a value to be determined, and specifying the presence or absence of a value that makes the logical product of the negation of the first conditional expression and the second conditional expression out of the possible values of the input variable,
Based on the specific result, it is determined that a path different from the second path in the path group included in the second program is not related to the first path.
The test case generation method according to claim 1, wherein the process is executed.
前記第1のプログラムの一部が変更された第2のプログラムをシンボリック実行することにより、前記入力変数の取り得る値のうちの前記第2のプログラムに含まれる第2のパスが実行される条件となる前記入力変数の値を表す第2の条件式と、前記第2のパスが実行された場合に出力される前記第2のプログラムに含まれる出力変数を表す第2の数式と、を含む第2の実行結果を取得する第2取得部と、
前記入力変数が取り得る値のうちの、前記第1取得部によって取得された前記第1の条件式と前記第2取得部によって取得された前記第2の条件式との論理積を真とする値の有無に基づいて、前記第2のパスが前記第1のパスに関連するか否かを判断するパス関連判断部と、
前記第1取得部によって取得された前記第1の数式と、前記第2取得部によって取得された前記第2の数式とが一致するか否かを判定する数式判定部と、
前記パス関連判断部による判断結果と前記数式判定部による判定結果とに基づいて、前記第2のパスの動作をテストするテストケースを生成すべきか否かを判定する生成判定部と、
を有することを特徴とするテストケース生成装置。 The input variable which becomes a condition for executing the first pass included in the first program out of the possible values of the input variable included in the first program by performing symbolic execution of the first program A first execution result including a first conditional expression representing the value of the first expression and a first mathematical expression representing an output variable included in the first program that is output when the first pass is executed A first acquisition unit for acquiring
Conditions for executing a second pass included in the second program among possible values of the input variable by executing symbolically the second program in which a part of the first program is changed A second conditional expression representing the value of the input variable, and a second mathematical expression representing an output variable included in the second program that is output when the second pass is executed. A second acquisition unit for acquiring a second execution result;
Of the possible values of the input variable, the logical product of the first conditional expression acquired by the first acquisition unit and the second conditional expression acquired by the second acquisition unit is true. A path-related determination unit that determines whether the second path is related to the first path based on the presence or absence of a value;
A formula determination unit that determines whether or not the first formula acquired by the first acquisition unit matches the second formula acquired by the second acquisition unit;
A generation determination unit that determines whether or not to generate a test case for testing the operation of the second path based on a determination result by the path relation determination unit and a determination result by the formula determination unit;
A test case generation device characterized by comprising:
第1のプログラムをシンボリック実行することにより、前記第1のプログラムに含まれる入力変数が取り得る値のうちの前記第1のプログラムに含まれる第1のパスが実行される条件となる前記入力変数の値を表す第1の条件式と、前記第1のパスが実行された場合に出力される前記第1のプログラムに含まれる出力変数を表す第1の数式と、を含む第1の実行結果を取得し、
前記第1のプログラムの一部が変更された第2のプログラムをシンボリック実行することにより、前記入力変数の取り得る値のうちの前記第2のプログラムに含まれる第2のパスが実行される条件となる前記入力変数の値を表す第2の条件式と、前記第2のパスが実行された場合に出力される前記第2のプログラムに含まれる出力変数を表す第2の数式と、を含む第2の実行結果を取得し、
前記入力変数が取り得る値のうちの、取得した前記第1の条件式と取得した前記第2の条件式との論理積を真とする値の有無に基づいて、前記第2のパスが前記第1のパスに関連するか否かを判断し、
取得した前記第1の数式と、取得した前記第2の数式とが一致するか否かを判定し、
判断結果と判定結果とに基づいて、前記第2のパスの動作をテストするテストケースを生成すべきか否かを判定する、
処理を実行させることを特徴とするテストケース生成プログラム。 On the computer,
The input variable which becomes a condition for executing the first pass included in the first program out of the possible values of the input variable included in the first program by performing symbolic execution of the first program A first execution result including a first conditional expression representing the value of the first expression and a first mathematical expression representing an output variable included in the first program that is output when the first pass is executed Get
Conditions for executing a second pass included in the second program among possible values of the input variable by executing symbolically the second program in which a part of the first program is changed A second conditional expression representing the value of the input variable, and a second mathematical expression representing an output variable included in the second program that is output when the second pass is executed. Get the second execution result,
Of the possible values of the input variable, based on the presence or absence of a value that makes the logical product of the acquired first conditional expression and the acquired second conditional expression true, the second path is Determine if it is related to the first pass,
Determining whether the acquired first mathematical formula and the acquired second mathematical formula match,
Determining whether to generate a test case for testing the operation of the second path based on the determination result and the determination result;
A test case generation program characterized by causing a process to be executed.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2013067571A JP6032095B2 (en) | 2013-03-27 | 2013-03-27 | Test case generation method, test case generation apparatus, and test case generation program |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2013067571A JP6032095B2 (en) | 2013-03-27 | 2013-03-27 | Test case generation method, test case generation apparatus, and test case generation program |
Publications (2)
Publication Number | Publication Date |
---|---|
JP2014191652A true JP2014191652A (en) | 2014-10-06 |
JP6032095B2 JP6032095B2 (en) | 2016-11-24 |
Family
ID=51837826
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2013067571A Expired - Fee Related JP6032095B2 (en) | 2013-03-27 | 2013-03-27 | Test case generation method, test case generation apparatus, and test case generation program |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP6032095B2 (en) |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106326125A (en) * | 2016-08-26 | 2017-01-11 | 上海合福信息科技有限公司 | Test case generating method |
US20170046252A1 (en) * | 2014-06-30 | 2017-02-16 | Hitachi Automotive Systems, Ltd. | Test case generation system and recording medium wherein test case is recorded |
JP2018147106A (en) * | 2017-03-02 | 2018-09-20 | 富士通株式会社 | Program analyzer, program analysis method and program analysis program |
KR20200098078A (en) * | 2019-02-11 | 2020-08-20 | 현대자동차주식회사 | Apparatus and method for managing testcase for testing software |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112181833A (en) * | 2020-09-28 | 2021-01-05 | 全球能源互联网研究院有限公司 | Intelligent fuzzy test method, device and system |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH11110257A (en) * | 1997-10-03 | 1999-04-23 | Fujitsu Ltd | Device and method for updatin database, and storage medium stored with database update program |
JP2013003854A (en) * | 2011-06-16 | 2013-01-07 | Fujitsu Ltd | Test data generation program, test data generation method and test data generation device |
-
2013
- 2013-03-27 JP JP2013067571A patent/JP6032095B2/en not_active Expired - Fee Related
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH11110257A (en) * | 1997-10-03 | 1999-04-23 | Fujitsu Ltd | Device and method for updatin database, and storage medium stored with database update program |
JP2013003854A (en) * | 2011-06-16 | 2013-01-07 | Fujitsu Ltd | Test data generation program, test data generation method and test data generation device |
Non-Patent Citations (1)
Title |
---|
JPN6015037816; 吉田 雅年: '仕様記述を必要としない有界レグレッション検知フレームワークの提案' レクチャーノート/ソフトウェア学36 ソフトウェア工学の基礎XVII , 20101130, pp.181-182, 株式会社近代科学社 * |
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20170046252A1 (en) * | 2014-06-30 | 2017-02-16 | Hitachi Automotive Systems, Ltd. | Test case generation system and recording medium wherein test case is recorded |
US10162739B2 (en) * | 2014-06-30 | 2018-12-25 | Hitachi Automotive Systems, Ltd | Test case generation system and recording medium wherein test case is recorded |
CN106326125A (en) * | 2016-08-26 | 2017-01-11 | 上海合福信息科技有限公司 | Test case generating method |
JP2018147106A (en) * | 2017-03-02 | 2018-09-20 | 富士通株式会社 | Program analyzer, program analysis method and program analysis program |
KR20200098078A (en) * | 2019-02-11 | 2020-08-20 | 현대자동차주식회사 | Apparatus and method for managing testcase for testing software |
KR102610756B1 (en) * | 2019-02-11 | 2023-12-07 | 현대자동차주식회사 | Apparatus and method for managing testcase for testing software |
Also Published As
Publication number | Publication date |
---|---|
JP6032095B2 (en) | 2016-11-24 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
Ciccozzi et al. | Execution of UML models: a systematic review of research and practice | |
US9298453B2 (en) | Source code analytics platform using program analysis and information retrieval | |
JP6032095B2 (en) | Test case generation method, test case generation apparatus, and test case generation program | |
US20200133662A1 (en) | Automatic generation of documentation and aggregation of community content | |
Osman et al. | Automatic feature selection by regularization to improve bug prediction accuracy | |
CN104969188B (en) | A method for modeling source code having code segments that lack source location | |
McBurney et al. | Towards prioritizing documentation effort | |
US9311077B2 (en) | Identification of code changes using language syntax and changeset data | |
Sae‐Lim et al. | Context‐based approach to prioritize code smells for prefactoring | |
Wang et al. | Lightweight global and local contexts guided method name recommendation with prior knowledge | |
Torunski et al. | Code style analytics for the automatic setting of formatting rules in ides: A solution to the tabs vs. spaces debate | |
Ma'ayan | The quality of junit tests: an empirical study report | |
Siddiq et al. | A Lightweight Framework for High-Quality Code Generation | |
US10073764B1 (en) | Method for instruction sequence execution analysis and visualization | |
Kozik et al. | Q-Rapids framework for advanced data analysis to improve rapid software development | |
JP2010102620A (en) | User operation scenario generating device, method and program | |
Walunj et al. | Defect prediction using deep learning with Network Portrait Divergence for software evolution | |
Aho et al. | Automated extraction of GUI models for testing | |
KR20150128711A (en) | Method and system for analyzing a trace timeline of computer system activity | |
Mendonça et al. | Test2feature: Feature-based test traceability tool for highly configurable software | |
Pinto et al. | TOM: a model-based GUI testing framework | |
JP7380851B2 (en) | Test script generation device, test script generation method and program | |
GB2397905A (en) | Method for automatically generating and ordering test scripts | |
Alvin et al. | StaticGen: static generation of UML sequence diagrams | |
Kodhai et al. | Method-Level code clone modification using refactoring techniques for clone maintenance |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20151204 |
|
A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20160908 |
|
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: 20160927 |
|
A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20161010 |
|
R150 | Certificate of patent or registration of utility model |
Ref document number: 6032095 Country of ref document: JP Free format text: JAPANESE INTERMEDIATE CODE: R150 |
|
LAPS | Cancellation because of no payment of annual fees |