JP2017041197A - Test data generation device, method, and program - Google Patents
Test data generation device, method, and program Download PDFInfo
- Publication number
- JP2017041197A JP2017041197A JP2015164052A JP2015164052A JP2017041197A JP 2017041197 A JP2017041197 A JP 2017041197A JP 2015164052 A JP2015164052 A JP 2015164052A JP 2015164052 A JP2015164052 A JP 2015164052A JP 2017041197 A JP2017041197 A JP 2017041197A
- Authority
- JP
- Japan
- Prior art keywords
- test data
- type
- path condition
- symbol variable
- path
- 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 disclosed technology relates to a test data generation device, a test data generation method, and a test data generation program.
テスト対象のプログラム中の変数値を具体化せず、記号(シンボル変数)のままプログラムを実行し、条件文などを通過したときにシンボル変数が満たすべき論理的な制約をパス条件として抽出するシンボリック実行技術が存在する。シンボリック実行では、テスト対象プログラムを呼び出し、テスト対象プログラム内の関数に引数を与えるドライバと、テスト対象から呼び出される関数のダミー実装であり、呼び出された際に値を返却するスタブとが用いられる。ドライバから与えられる引数、及びスタブから返却される値をシンボル変数とすると、テスト対象プログラムのパスを網羅するテストデータを生成することができる。 Symbolic that extracts the logical constraints that should be satisfied by the symbol variable as a path condition when the program is executed without passing the symbol (symbol variable), and the conditional variable is passed, without embodying the variable value in the program under test Execution technology exists. In symbolic execution, a driver that calls a test target program and gives an argument to a function in the test target program, and a stub that is a dummy implementation of a function called from the test target and returns a value when called. When the argument given from the driver and the value returned from the stub are symbol variables, test data covering the path of the test target program can be generated.
ここで、プログラムは、プログラムに含まれる変数に適切な型が定義されていない場合には、正しく動作しない。これは、上述のシンボリック実行に用いられるドライバ及びスタブも同様であり、ドライバは、適切な型の値を引数として与える必要があり、スタブは、適切な型の値を返却する必要がある。 Here, the program does not operate correctly if an appropriate type is not defined for a variable included in the program. The same applies to the driver and stub used for the symbolic execution described above, and the driver needs to give an appropriate type value as an argument, and the stub needs to return an appropriate type value.
プログラムのテストデータの生成に関し、変数の型を考慮した技術として、プログラムに特定の処理パスを実行させる条件の情報から,制約ソルバに入力する記述のデータを生成する方法が提案されている。この方法では、数値型の変数に対応する比較用の変数を定義し、数値型の変数と文字列型の変数との比較条件の制約については、数値型の変数の代わりに比較用の変数を用いた制約を設定する。 As a technique for generating test data for a program, a technique for generating description data to be input to a constraint solver from information on conditions for causing a program to execute a specific processing path has been proposed as a technique considering variable types. In this method, a variable for comparison corresponding to a numeric type variable is defined, and for the comparison condition constraint between a numeric type variable and a string type variable, a comparison variable is used instead of the numeric type variable. Set the constraints used.
また、テスト対象のプログラムへ入力されるオブジェクト型変数の状態を示す制御変数を含むシンボル変数を用いたシンボリック実行により第1のテストケースを生成する方法が提案されている。この方法では、第1のテストケースのパス条件から制御変数が満たすべき条件を省き、オブジェクト型変数が状態として満たすべき条件を加えた第2のテストケースを生成し、同義である第2のテストケースの省いた第3のテストケースを抽出する。 A method for generating a first test case by symbolic execution using a symbol variable including a control variable indicating the state of an object type variable input to a program to be tested has been proposed. In this method, a condition to be satisfied by the control variable is omitted from the path condition of the first test case, a second test case is generated by adding the condition to be satisfied by the object type variable as a state, and the second test is synonymous. Extract the third test case without the case.
しかしながら、例えば、動的に型付けを行う言語で記述されたプログラムや、既定の変数の型が与えられていないか、又は誤った変数の型が与えられたプログラムでは、期待する型とは異なる型の値が入力される場合がある。このような場合には、従来技術では、テストデータを生成することができない。 However, for example, in a program written in a dynamically typed language, or in a program in which a default variable type is not given or an incorrect variable type is given, the type is different from the expected type. May be entered. In such a case, the conventional technology cannot generate test data.
開示の技術は、一つの側面として、シンボル変数の型を考慮した網羅性の高いテストデータを生成することを目的とする。 An object of the disclosed technique is to generate test data with high completeness in consideration of a symbol variable type.
開示の技術は、一つの態様として、テスト対象のプログラムに対して、シンボル変数を用いたシンボリック実行により、パス条件を抽出すると共に、抽出したパス条件を充足するテストデータを生成する生成部を備える。また、開示の技術は、前記生成部により抽出されたパス条件のうち、該パス条件を充足するテストデータが生成されていないパス条件に基づいて、該パス条件に含まれるシンボル変数の変更後の型を決定する決定部を備える。さらに、開示の技術は、前記決定部により型が変更されたシンボル変数を用いて、前記パス条件を充足するテストデータが生成されていないパス条件について、再度テストデータを生成するように前記生成部を制御する制御部を備える。 As one aspect, the disclosed technology includes a generation unit that extracts a path condition by symbolic execution using a symbol variable for a test target program and generates test data that satisfies the extracted path condition. . In addition, the disclosed technique is based on a path condition in which test data that satisfies the path condition is not generated among the path conditions extracted by the generation unit, and the symbol variable included in the path condition is changed. A determination unit for determining the type is provided. Further, the disclosed technique uses the symbol variable whose type has been changed by the determining unit to generate test data again for a path condition for which test data that satisfies the path condition has not been generated. The control part which controls is provided.
開示の技術は、一つの側面として、シンボル変数の型を考慮した網羅性の高いテストデータを生成することができる、という効果を有する。 The disclosed technology has an effect that, as one aspect, test data with high completeness can be generated in consideration of the type of the symbol variable.
まず、実施形態の詳細を説明する前に、シンボリック実行技術におけるシンボル変数の型について説明する。 First, before describing the details of the embodiment, the types of symbol variables in the symbolic execution technique will be described.
プログラムが適切に動作するためには、変数に適切な型が定義されていることが必要である。シンボリック実行時においては、ドライバから与える引数、及びスタブから返却される値に、適切な型が定義されている必要がある。そこで、テスト対象プログラム内のソースコード内のコメント(アノテーション)に記述された内容から変数の型を取得して、適切な型が定義された変数を与えることができるドライバ及びスタブを生成することが考えられる。例えば、図2に示すようなテスト対象プログラム131Aのコメント部分(図2中の破線Pの部分)から、変数s1及びs2は文字列(String型)であると言うことを読み取り、図3の上段に示すようなドライバ122Aを生成する。
In order for the program to work properly, it is necessary that the variable has an appropriate type defined. At the time of symbolic execution, an appropriate type must be defined for the argument given by the driver and the value returned from the stub. Therefore, it is possible to obtain a variable type from the contents described in a comment (annotation) in the source code in the test target program and generate a driver and a stub that can give a variable in which an appropriate type is defined. Conceivable. For example, it is read from the comment part (part indicated by the broken line P in FIG. 2) of the
しかし、図2に示すテスト対象プログラム131Aでは、変数s1及びs2がnullの場合についても考慮する必要があるが、ドライバ122Aから与えられる変数s1及びs2の型は文字列である。そのため、変数s1及びs2がnullであることを考慮したテストデータを生成することができない。
However, in the
この問題に対し、例えば、図3の下段に示すドライバ122Bのように、変数s1及びs2がnullの場合に真となるシンボル変数(*_isNull)を定義することが考えられる。ドライバ122Bでは、s?_isNullが真ならnullを、偽ならs?_bodyを代入することが定義されている。これにより、シンボル変数がnullである場合も含めたテストデータを生成することができる。
For example, a symbol variable (* _isNull) that is true when the variables s1 and s2 are null may be defined as in the
しかし、例えば、JavaScript(登録商標)などの動的に型付けを行う言語で記述されたプログラムでは、プログラムの実行時に変数の型を決める。また、プログラム設計の早期段階では、入力される値の型が確定していない場合もある。そのため、図2に示すようなテスト対象プログラム131A内のコメントを利用して、適切な型が定義された値を与えるドライバ及びスタブを生成することは困難である。例えば、図4に示すテスト対象プログラム131Bでは、破線Qで示す条件文は、変数s2が数値の場合にのみ実行可能である。しかし、上述したドライバ122Aを用いた場合には、変数s2の型は文字列で設定されているため、この条件文を実行することができず、この条件文を通過するテストデータを生成することができない。また、ドライバ122Bについても、null値を考慮してシンボル変数の型を定義しているが、期待する型とは全く違う型の値が入力された場合には、テストデータを生成することができず、テストを実行できないパスが存在することになってしまう。
However, for example, in a program written in a dynamically typed language such as Java Script (registered trademark), the type of a variable is determined when the program is executed. In addition, in the early stage of program design, the type of input value may not be determined. For this reason, it is difficult to generate a driver and a stub that give a value in which an appropriate type is defined using a comment in the
そこで、本実施形態では、テストデータが生成されないパス条件に含まれるシンボル変数の型を変更することで、網羅性の高いテストデータを生成する。 Therefore, in this embodiment, test data with high completeness is generated by changing the type of the symbol variable included in the path condition in which test data is not generated.
以下、図面を参照して、開示の技術に関する実施形態の一例を詳細に説明する。 Hereinafter, an exemplary embodiment related to the disclosed technology will be described in detail with reference to the drawings.
図1に示すように、本実施形態に係るテストデータ生成装置10は、テスト対象プログラム31を入力として受け付け、シンボリック実行によりテストデータ35を生成して出力する。
As shown in FIG. 1, the test
テストデータ生成装置10は、図1に示すように、機能的には、シンボリック実行部11と、決定部12と、ドライバ・スタブ生成部13とを含む。なお、シンボリック実行部11は、開示の技術の生成部の一例であり、ドライバ・スタブ生成部13は、開示の技術の制御部の一例である。
As shown in FIG. 1, the test
シンボリック実行部11は、テスト対象プログラム31に対して、ドライバ・スタブ生成部13で生成されたドライバ及びスタブを用いてシンボリック実行を行い、パス条件を抽出して、抽出したパス条件を充足するテストデータを生成する。また、シンボリック実行部11は、テストデータを生成することができなかったパス条件(以下、「未網羅のパス条件」という)を、決定部12に通知する。
The
決定部12は、未網羅のパス条件に基づいて、その未網羅のパス条件に含まれるシンボル変数の変更後の型を決定する。シンボル変数のとりうる型は、シンボル変数型集合15として予め定めておく。本実施形態では、説明を簡単にするため、シンボル変数の取りうる型は、文字列(String型)、数値(Number型)、及びnullの3つである場合について説明する。
The
決定部12は、具体的には、未網羅のパス条件に含まれるシンボル変数を、型を変更するシンボル変数として特定する。そして、決定部12は、未網羅のパス条件に含まれるシンボル変数以外の定数の型を、特定したシンボル変数の変更後の型として決定する。例えば、未網羅のパス条件が、「s1==1(数値)」の場合、決定部12は、型を変更するシンボル変数として「s1」を特定し、変更後の型を「数値」に決定する。
Specifically, the
また、決定部12は、シンボル変数の型変更後もテストデータが生成できない場合には、シンボル変数の型の変更を繰り返すように、シンボル変数型集合15から1つずつ型を選択して、特定したシンボル変数の変更後の型として決定する。例えば、決定部12は、シンボル変数型集合15に含まれる型について、例えば、文字列→数値→nullのように予め定めた順番に従って、未選択の型を選択して、特定したシンボル変数の変更後の型を決定することができる。また、決定部12は、未網羅のパス条件から複数のシンボル変数を特定した場合には、各シンボル変数の型の組み合わせを順次変更する。例えば、特定したシンボル変数がs1及びs2の2つの場合、(s1の型,s2の型)として、(文字列,文字列)→(文字列,数値)→(文字列,null)→(数値,文字列)→・・・→(null,null)のような型の組み合わせの順番を予め定めておく。そして、決定部12は、この順番に従って、未選択の型の組合せを選択して、特定したシンボル変数の変更後の型を決定することができる。
In addition, when the test data cannot be generated even after the symbol variable type is changed, the
また、決定部12は、型を変更するシンボル変数、及び変更後の型を、ドライバ・スタブ生成部13に通知する。
The
ドライバ・スタブ生成部13は、テスト対象プログラム31を解析して、テスト対象プログラム31のシンボリック実行に用いるドライバ及びスタブを生成する。また、ドライバ・スタブ生成部13は、決定部12からの通知に基づいて、シンボル変数の型を変更したドライバ及びスタブを生成する。ドライバ・スタブ生成部13は、生成したドライバ及びスタブをシンボリック実行部11へ受け渡す。
The driver /
テストデータ生成装置10は、例えば、図5に示すコンピュータ40で実現することができる。コンピュータ40はCPU41、一時記憶領域としてのメモリ42、及び不揮発性の記憶部43を備える。また、コンピュータ40は、表示装置及び入力装置等の入出力装置44、記録媒体49に対するデータの読み込みと書き込みとを制御するread/write(R/W)部45、及びインターネット等のネットワークに接続されるネットワークI/F46を備える。CPU41、メモリ42、記憶部43、入出力装置44、R/W部45、及びネットワークI/F46は、バス47を介して互いに接続される。
The test
記憶部43は、HDD(Hard Disk Drive)、SSD(solid state drive)、フラッシュメモリ等によって実現できる。記憶媒体としての記憶部43には、コンピュータ40をテストデータ生成装置10として機能させるためのテストデータ生成プログラム50が記憶される。
The
CPU41は、テストデータ生成プログラム50を記憶部43から読み出してメモリ42に展開し、テストデータ生成プログラム50が有するプロセスを順次実行する。テストデータ生成プログラム50は、シンボリック実行プロセス51と、決定プロセス52と、ドライバ・スタブ生成プロセス53とを有する。CPU41は、シンボリック実行プロセス51を実行することで、図1に示すシンボリック実行部11として動作する。また、CPU41は、決定プロセス52を実行することで、図1に示す決定部12として動作する。また、CPU41は、ドライバ・スタブ生成プロセス53を実行することで、図1に示すドライバ・スタブ生成部13として動作する。これにより、テストデータ生成プログラム50を実行したコンピュータ40が、テストデータ生成装置10として機能することになる。
The
なお、テストデータ生成プログラム50により実現される機能は、例えば半導体集積回路、より詳しくはASIC(Application Specific Integrated Circuit)等で実現することも可能である。
The function realized by the test
次に、本実施形態に係るテストデータ生成装置10の作用について説明する。テストデータ生成装置10にテスト対象プログラム31が入力されると、テストデータ生成装置10において、図6に示すテストデータ生成処理が実行される。なお、ここでは、図7に示すようなテスト対象プログラム31が入力されるものとする。図7に示すテスト対象プログラム31では、変数s1及びs2の型は文字列(String型)である旨のコメントが記述されている(図7中の破線R)。
Next, the operation of the test
図6に示すテストデータ生成処理のステップS11で、ドライバ・スタブ生成部13が、テスト対象プログラム31から、初期のドライバ及びスタブd(0)を生成する。ここでは、テスト対象プログラム31のコメントに基づいて、ドライバ・スタブ生成部13は、図8の上段に示すように、変数s1及びs2の各々を、文字列(String型)のシンボル変数として定義したドライバ22Aを生成する。なお、スタブについては図示を省略する。そして、ドライバ・スタブ生成部13は、生成した初期のドライバ・スタブd(0)をシンボリック実行部11へ受け渡す。シンボリック実行部11では、初期のドライバ・スタブd(0)を用いて、テスト対象プログラム31に対してシンボリック実行を行い、パス条件を抽出して、抽出したパス条件を充足するテストデータを生成する。
In step S <b> 11 of the test data generation process illustrated in FIG. 6, the driver /
図8の下段に、ドライバ22Aを用いたシンボリック実行によるテストデータの生成結果23Aを示す。この生成結果23Aが示すように、テスト対象プログラム31からは、4つのパス条件(No.1〜4)が抽出される。現段階では、シンボル変数s1及びs2の各々の型は文字列であるため、シンボリック実行部11は、No.2及びNo.3のパス条件の各々を充足するテストデータを生成することができる。しかし、No.1の「s2==1(数値)」とのパス条件は、現段階のシンボル変数s2の型が文字列であることから、型不一致となり、シンボリック実行部11は、パス条件を充足するテストデータを生成することができない。同様に、No.4の「s1==null」とのパス条件も、現段階のシンボル変数s1の型が文字列であることから、型不一致となり、シンボリック実行部11は、パス条件を充足するテストデータを生成することができない。すなわち、No.1及びNo.4のパス条件の各々が「未網羅のパス条件」となる。シンボリック実行部11は、No.1及びNo.4のパス条件の各々が未網羅のパス条件であることを決定部12に通知する。
The lower part of FIG. 8 shows a test
なお、図8に示すテストデータの生成結果23Aを、図7に示すテスト対象プログラム31に対応させると、No.2及びNo.3の部分のテストを実行するためのテストデータが生成されたことを示す。一方、No.1及びNo.4の部分のテストを実行するためのテストデータは生成されていないことを示す。
If the test
次に、ステップS12で、決定部12が、シンボリック実行部11から通知された未網羅のパス条件のうち、後述するシンボル変数の型変更の処理を未実施の未網羅のパス条件が存在するか否かを判定する。シンボル変数の型変更の処理が未実施の未網羅のパス条件が存在する場合には、処理はステップS13へ移行する。
Next, in step S <b> 12, among the uncovered path conditions notified from the
ステップS13では、決定部12が、シンボル変数の型変更の処理が未実施の未網羅のパス条件から1つを処理対象のパス条件として選択する。ここでは、No.1のパス条件が選択されるものとする。次に、ステップS14で、決定部12が、シンボル変数の型の変更回数を示す変数iを0に設定し、次に、ステップS15で、決定部12が、変数iを1インクリメントする。
In step S13, the
次に、ステップS16で、決定部12が、処理対象のパス条件に含まれるシンボル変数を、型を変更するシンボル変数として特定する。ここでは、No.1のパス条件に含まれる「s2」が型を変更するシンボル変数として特定される。そして、決定部12は、処理対象のパス条件に含まれるシンボル変数「s2」以外の定数である「1」の型「数値(Number型)」を、シンボル変数「s2」の変更後の型として決定する。決定部12は、型を変更するシンボル変数、及び決定した変更後の型を、ドライバ・スタブ生成部13に通知する。
Next, in step S16, the
次に、ステップS17で、ドライバ・スタブ生成部13が、決定部12からの通知に基づいて、シンボル変数の型を変更したドライバ・スタブd(i)を生成する。なお、d(i)は、シンボル変数の型がi回変更されたドライバ・スタブであることを表す。シンボル変数の数をj、シンボル変数がとりうる型の種類数(シンボル変数型集合15に含まれる型の数)をkとした場合、iは、i=0,1,・・・,N−1(N=j×k)である。
Next, in step S <b> 17, the driver
ここでは、ドライバ・スタブ生成部13が、決定部12からの通知に基づいて、図9の上段に示すように、シンボル変数s2の型を、文字列(String型)から数値(Number型)に変更したドライバ22Bを生成する。そして、ドライバ・スタブ生成部13は、生成したドライバ22Bをシンボリック実行部11へ受け渡す。シンボリック実行部11では、ドライバ22Bを用いて、処理対象のパス条件を充足するテストデータを生成する。
Here, based on the notification from the
図9の下段に、ドライバ22Bによるテストデータの生成結果23Bを示す。シンボル変数s2の型を数値に変更したことにより、No.1のパス条件を充足するテストデータが生成できる。これにより、図7に示すテスト対象プログラム31のNo.2及びNo.3の部分に加え、No.1の部分のテストを実行するためのテストデータが生成されたことを示す。
The lower part of FIG. 9 shows a test
次に、ステップS18で、シンボリック実行部11が、処理対象のパス条件を充足するテストデータが生成された否かを判定する。処理対象のパス条件を充足するテストデータが生成された場合には、処理はステップS12に戻り、生成されていない場合には、処理はステップS19へ移行する。ステップS19では、決定部12が、iがN−1より小さいか否か、すなわち、さらに変更可能な型が存在するか否かを判定する。i<N−1の場合には、処理はステップS15に戻り、i≧N−1の場合には、処理はステップS12に戻る。ここでは、処理対象のNo.1のパス条件を充足するテストデータが生成されたため、処理はステップS12に戻り、次のステップS13で、No.4のパス条件が、次の処理対象のパス条件として選択される。
Next, in step S18, the
そして、ステップS16で、決定部12が、処理対象のNo.4のパス条件に含まれる「s1」を、型を変更するシンボル変数として特定し、処理対象のパス条件から、「null」を、シンボル変数「s1」の変更後の型として決定する。決定部12は、型を変更するシンボル変数、及び決定した変更後の型を、ドライバ・スタブ生成部13に通知する。
In step S16, the
次に、ステップS17で、ドライバ・スタブ生成部13が、決定部12からの通知に基づいて、図10の上段に示すように、シンボル変数s1の型を、文字列(String型)からnullに変更したドライバ22Cを生成する。そして、ドライバ・スタブ生成部13は、生成したドライバ22Cをシンボリック実行部11へ受け渡す。シンボリック実行部11では、ドライバ22Cを用いて、処理対象のパス条件を充足するテストデータを生成する。
Next, in step S17, based on the notification from the
図10の下段に、ドライバ22Cによるテストデータの生成結果23Cを示す。シンボル変数s1の型をnullに変更したことにより、No.4のパス条件を充足するテストデータが生成できる。これにより、図7に示すテスト対象プログラム31のNo.1〜No.3の部分に加え、No.4の部分のテストを実行するためのテストデータが生成されたことを示す。すなわち、テスト対象プログラム31に含まれる全てのパスを網羅するテストデータが生成されたことを示す。
The lower part of FIG. 10 shows a test
ステップS12で否定判定されると、処理はステップS20へ移行し、シンボリック実行部11が、生成されたテストデータ35を出力して、テストデータ生成処理は終了する。
If a negative determination is made in step S12, the process proceeds to step S20, the
なお、上記のテストデータ生成処理では、処理対象のパス条件についてテストデータが生成されるまで、シンボル変数がとりうる型の各々への変更を試みる場合について説明したが、これに限定されない。型の変更処理の実施回数を所定回数に制限してもよい。 In the above-described test data generation process, the case where an attempt is made to change each type of symbol variable until the test data is generated for the path condition to be processed has been described, but the present invention is not limited to this. The number of executions of the mold changing process may be limited to a predetermined number.
以上説明したように、本実施形態に係るテストデータ生成装置によれば、パス条件を充足するテストデータが生成されなかった場合には、そのパス条件に含まれるシンボル変数の型を、そのパス条件に含まれる他の定数の型に変更する。それでもテストデータが生成されなかった場合には、シンボル変数の型を、シンボル変数がとりうる型の中から選択した型に順次変更していく。これにより、予め決められた型のシンボル変数を用いたシンボリック実行によりテストデータを生成する場合に比べ、網羅性の高いテストデータを生成することができる。 As described above, according to the test data generation device according to the present embodiment, when the test data that satisfies the path condition is not generated, the type of the symbol variable included in the path condition is changed to the path condition. Change to the type of other constants included in. If the test data is still not generated, the type of the symbol variable is sequentially changed to a type selected from the types that the symbol variable can take. This makes it possible to generate test data with high completeness compared to the case where test data is generated by symbolic execution using a symbol variable of a predetermined type.
特に、動的に型付けが行われる言語で記述され、変数の型が変更されるプログラムをテスト対象プログラムとする場合に有効である。また、既定の変数の型が与えられていないか、又は誤った変数の型が与えられたプログラムを対象とする場合にも、未網羅のパス条件からシンボル変数の型を変更するため、網羅性の高いテストデータを生成することができる。したがって、変数の型が確定していないプログラム設計の早期段階からシンボリック実行によるテストを行うことが可能となる。 This is particularly effective when a program to be tested is a program that is described in a dynamically typed language and whose variable type is changed. In addition, even if the target variable is not given the default variable type or the program is given the wrong variable type, the symbol variable type is changed from the uncovered path condition. High test data can be generated. Therefore, it is possible to perform a test by symbolic execution from an early stage of program design in which the variable type is not fixed.
また、図3に示すドライバ122Bのようにnull値を考慮したドライバの場合、どのような場合もnullか否かを考慮してシンボル変数の型を定義する。そのため、シンボリック実行時に必要なメモリや、ドライバ及びスタブのコードが大きくなるという問題もある。本実施形態によれば、一回毎のシンボリック実行では、1つのシンボル変数の型について、nullか否かを判定したり、その判定結果に応じて複数の型を考慮したりしないため、一度に必要なメモリや、ドライバ及びスタブのコードサイズを抑えることができる。
Further, in the case of a driver that considers a null value, such as the
また、上記では、テストデータ生成プログラム50が記憶部43に予め記憶(インストール)されている態様を説明したが、これに限定されない。開示の技術に係るプログラムは、CD−ROM、DVD−ROM、USBメモリ等の記録媒体に記録された形態で提供することも可能である。
In the above description, the test
以上の実施形態に関し、更に以下の付記を開示する。 Regarding the above embodiment, the following additional notes are disclosed.
(付記1)
テスト対象のプログラムに対して、シンボル変数を用いたシンボリック実行により、パス条件を抽出すると共に、抽出したパス条件を充足するテストデータを生成する生成部と、
前記生成部により抽出されたパス条件のうち、該パス条件を充足するテストデータが生成されていないパス条件に基づいて、該パス条件に含まれるシンボル変数の変更後の型を決定する決定部と、
前記決定部により型が変更されたシンボル変数を用いて、前記パス条件を充足するテストデータが生成されていないパス条件について、再度テストデータを生成するように前記生成部を制御する制御部と、
を含むテストデータ生成装置。
(Appendix 1)
For the test target program, a symbolic execution using a symbol variable extracts a path condition and generates a test data that satisfies the extracted path condition;
A determination unit that determines a changed type of a symbol variable included in the path condition based on a path condition for which test data that satisfies the path condition is not generated among the path conditions extracted by the generation unit; ,
Using a symbol variable whose type has been changed by the determination unit, a control unit that controls the generation unit to generate test data again for a path condition for which test data that satisfies the path condition is not generated;
Test data generation device including
(付記2)
前記決定部は、前記パス条件を充足するテストデータが生成されていないパス条件に含まれるシンボル変数以外の定数の型を、前記シンボル変数の変更後の型として決定する付記1記載のテストデータ生成装置。
(Appendix 2)
The test data generation according to
(付記3)
前記決定部は、パス条件を充足するテストデータが生成されるまで、複数種類の型から未選択の型を順次選択して、前記シンボル変数の変更後の型として決定する付記2記載のテストデータ生成装置。
(Appendix 3)
The test data according to
(付記4)
前記制御部は、前記テスト対象のプログラムに対してシンボリック実行を行い、かつ該シンボリック実行の際に、前記決定部で決定された型のシンボル変数を与えるドライバ及びスタブを生成する付記1〜付記3のいずれか1項記載のテストデータ生成装置。
(Appendix 4)
The control unit performs symbolic execution on the test target program, and generates a driver and a stub that give the symbol variable of the type determined by the determination unit at the time of the symbolic execution. The test data generation device according to any one of the above.
(付記5)
コンピュータに、
テスト対象のプログラムに対して、シンボル変数を用いたシンボリック実行により、パス条件を抽出すると共に、抽出したパス条件を充足するテストデータを生成し、
抽出されたパス条件のうち、該パス条件を充足するテストデータが生成されていないパス条件に基づいて、該パス条件に含まれるシンボル変数の変更後の型を決定し、
型が変更されたシンボル変数を用いて、前記パス条件を充足するテストデータが生成されていないパス条件について、再度テストデータを生成する
ことを含む処理を実行させるテストデータ生成方法。
(Appendix 5)
On the computer,
For the program to be tested, symbolic execution using symbol variables extracts path conditions and generates test data that satisfies the extracted path conditions.
Of the extracted path conditions, based on a path condition for which test data that satisfies the path condition is not generated, a type of the symbol variable included in the path condition is changed, and
A test data generation method that executes processing including generating test data again for a path condition for which test data that satisfies the path condition is not generated using a symbol variable whose type has been changed.
(付記6)
前記シンボル変数の変更後の型を決定する処理では、前記パス条件を充足するテストデータが生成されていないパス条件に含まれるシンボル変数以外の定数の型を、前記シンボル変数の変更後の型として決定する付記5記載のテストデータ生成方法。
(Appendix 6)
In the process of determining the changed type of the symbol variable, a constant type other than the symbol variable included in the path condition for which test data that satisfies the path condition is not generated is used as the changed type of the symbol variable. The test data generation method according to appendix 5, which is determined.
(付記7)
前記シンボル変数の変更後の型を決定する処理では、パス条件を充足するテストデータが生成されるまで、複数種類の型から未選択の型を順次選択して、前記シンボル変数の変更後の型として決定する付記6記載のテストデータ生成方法。
(Appendix 7)
In the process of determining the changed type of the symbol variable, unselected types are sequentially selected from a plurality of types until test data that satisfies a path condition is generated, and the changed type of the symbol variable is selected. The test data generation method according to appendix 6, which is determined as follows.
(付記8)
再度テストデータを生成する処理では、前記テスト対象のプログラムに対してシンボリック実行を行い、かつ該シンボリック実行の際に、決定された型のシンボル変数を与えるドライバ及びスタブを生成することを含む付記5〜付記7のいずれか1項記載のテストデータ生成方法。
(Appendix 8)
The process of generating test data again includes performing symbolic execution on the test target program and generating a driver and a stub that give a symbol variable of the determined type at the time of the symbolic execution. The test data generation method according to any one of?
(付記9)
コンピュータに、
テスト対象のプログラムに対して、シンボル変数を用いたシンボリック実行により、パス条件を抽出すると共に、抽出したパス条件を充足するテストデータを生成し、
抽出されたパス条件のうち、該パス条件を充足するテストデータが生成されていないパス条件に基づいて、該パス条件に含まれるシンボル変数の変更後の型を決定し、
型が変更されたシンボル変数を用いて、前記パス条件を充足するテストデータが生成されていないパス条件について、再度テストデータを生成する
ことを含む処理を実行させるテストデータ生成プログラム。
(Appendix 9)
On the computer,
For the program to be tested, symbolic execution using symbol variables extracts path conditions and generates test data that satisfies the extracted path conditions.
Of the extracted path conditions, based on a path condition for which test data that satisfies the path condition is not generated, a type of the symbol variable included in the path condition is changed, and
A test data generation program for executing a process including generating test data again for a path condition for which test data that satisfies the path condition is not generated using a symbol variable whose type has been changed.
(付記10)
前記シンボル変数の変更後の型を決定する処理では、前記パス条件を充足するテストデータが生成されていないパス条件に含まれるシンボル変数以外の定数の型を、前記シンボル変数の変更後の型として決定する付記9記載のテストデータ生成プログラム。
(Appendix 10)
In the process of determining the changed type of the symbol variable, a constant type other than the symbol variable included in the path condition for which test data that satisfies the path condition is not generated is used as the changed type of the symbol variable. The test data generation program according to appendix 9, which is determined.
(付記11)
前記シンボル変数の変更後の型を決定する処理では、パス条件を充足するテストデータが生成されるまで、複数種類の型から未選択の型を順次選択して、前記シンボル変数の変更後の型として決定する付記10記載のテストデータ生成プログラム。
(Appendix 11)
In the process of determining the changed type of the symbol variable, unselected types are sequentially selected from a plurality of types until test data that satisfies a path condition is generated, and the changed type of the symbol variable is selected. The test data generation program according to
(付記12)
再度テストデータを生成する処理では、前記テスト対象のプログラムに対してシンボリック実行を行い、かつ該シンボリック実行の際に、決定された型のシンボル変数を与えるドライバ及びスタブを生成することを含む付記9〜付記11のいずれか1項記載のテストデータ生成プログラム。
(Appendix 12)
The process of generating test data again includes performing symbolic execution on the test target program and generating a driver and a stub that give a symbol variable of the determined type at the time of the symbolic execution. The test data generation program according to any one of to 11.
(付記13)
コンピュータに、
テスト対象のプログラムに対して、シンボル変数を用いたシンボリック実行により、パス条件を抽出すると共に、抽出したパス条件を充足するテストデータを生成し、
抽出されたパス条件のうち、該パス条件を充足するテストデータが生成されていないパス条件に基づいて、該パス条件に含まれるシンボル変数の変更後の型を決定し、
型が変更されたシンボル変数を用いて、前記パス条件を充足するテストデータが生成されていないパス条件について、再度テストデータを生成する
ことを含む処理を実行させるテストデータ生成プログラムを記憶した記憶媒体。
(Appendix 13)
On the computer,
For the program to be tested, symbolic execution using symbol variables extracts path conditions and generates test data that satisfies the extracted path conditions.
Of the extracted path conditions, based on a path condition for which test data that satisfies the path condition is not generated, a type of the symbol variable included in the path condition is changed, and
A storage medium storing a test data generation program for executing processing including generating test data again for a path condition for which test data that satisfies the path condition is not generated using a symbol variable whose type has been changed .
10 テストデータ生成装置
11 シンボリック実行部
12 決定部
13 ドライバ・スタブ生成部
15 シンボル変数型集合
22A、22B、22C ドライバ
31 テスト対象プログラム
35 テストデータ
40 コンピュータ
41 CPU
42 メモリ
43 記憶部
49 記録媒体
50 テストデータ生成プログラム
DESCRIPTION OF
42
Claims (6)
前記生成部により抽出されたパス条件のうち、該パス条件を充足するテストデータが生成されていないパス条件に基づいて、該パス条件に含まれるシンボル変数の変更後の型を決定する決定部と、
前記決定部により型が変更されたシンボル変数を用いて、前記パス条件を充足するテストデータが生成されていないパス条件について、再度テストデータを生成するように前記生成部を制御する制御部と、
を含むテストデータ生成装置。 For the test target program, a symbolic execution using a symbol variable extracts a path condition and generates a test data that satisfies the extracted path condition;
A determination unit that determines a changed type of a symbol variable included in the path condition based on a path condition for which test data that satisfies the path condition is not generated among the path conditions extracted by the generation unit; ,
Using a symbol variable whose type has been changed by the determination unit, a control unit that controls the generation unit to generate test data again for a path condition for which test data that satisfies the path condition is not generated;
Test data generation device including
テスト対象のプログラムに対して、シンボル変数を用いたシンボリック実行により、パス条件を抽出すると共に、抽出したパス条件を充足するテストデータを生成し、
抽出されたパス条件のうち、該パス条件を充足するテストデータが生成されていないパス条件に基づいて、該パス条件に含まれるシンボル変数の変更後の型を決定し、
型が変更されたシンボル変数を用いて、前記パス条件を充足するテストデータが生成されていないパス条件について、再度テストデータを生成する
ことを含む処理を実行させるテストデータ生成方法。 On the computer,
For the program to be tested, symbolic execution using symbol variables extracts path conditions and generates test data that satisfies the extracted path conditions.
Of the extracted path conditions, based on a path condition for which test data that satisfies the path condition is not generated, a type of the symbol variable included in the path condition is changed, and
A test data generation method that executes processing including generating test data again for a path condition for which test data that satisfies the path condition is not generated using a symbol variable whose type has been changed.
テスト対象のプログラムに対して、シンボル変数を用いたシンボリック実行により、パス条件を抽出すると共に、抽出したパス条件を充足するテストデータを生成し、
抽出されたパス条件のうち、該パス条件を充足するテストデータが生成されていないパス条件に基づいて、該パス条件に含まれるシンボル変数の変更後の型を決定し、
型が変更されたシンボル変数を用いて、前記パス条件を充足するテストデータが生成されていないパス条件について、再度テストデータを生成する
ことを含む処理を実行させるテストデータ生成プログラム。 On the computer,
For the program to be tested, symbolic execution using symbol variables extracts path conditions and generates test data that satisfies the extracted path conditions.
Of the extracted path conditions, based on a path condition for which test data that satisfies the path condition is not generated, a type of the symbol variable included in the path condition is changed, and
A test data generation program for executing a process including generating test data again for a path condition for which test data that satisfies the path condition is not generated using a symbol variable whose type has been changed.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2015164052A JP6497271B2 (en) | 2015-08-21 | 2015-08-21 | Test data generation apparatus, method, and program |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2015164052A JP6497271B2 (en) | 2015-08-21 | 2015-08-21 | Test data generation apparatus, method, and program |
Publications (2)
Publication Number | Publication Date |
---|---|
JP2017041197A true JP2017041197A (en) | 2017-02-23 |
JP6497271B2 JP6497271B2 (en) | 2019-04-10 |
Family
ID=58203534
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2015164052A Active JP6497271B2 (en) | 2015-08-21 | 2015-08-21 | Test data generation apparatus, method, and program |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP6497271B2 (en) |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2012068869A (en) * | 2010-09-22 | 2012-04-05 | Fujitsu Ltd | Repeated symbolic execution method, program and device |
US20140143762A1 (en) * | 2012-11-21 | 2014-05-22 | Fujitsu Limited | Symbolic execution of dynamic programming languages |
JP2014186728A (en) * | 2013-03-15 | 2014-10-02 | Fujitsu Ltd | Method for improving efficiency of software program and processor |
-
2015
- 2015-08-21 JP JP2015164052A patent/JP6497271B2/en active Active
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2012068869A (en) * | 2010-09-22 | 2012-04-05 | Fujitsu Ltd | Repeated symbolic execution method, program and device |
US20140143762A1 (en) * | 2012-11-21 | 2014-05-22 | Fujitsu Limited | Symbolic execution of dynamic programming languages |
JP2014186728A (en) * | 2013-03-15 | 2014-10-02 | Fujitsu Ltd | Method for improving efficiency of software program and processor |
Non-Patent Citations (1)
Title |
---|
片山 朝子 外6名: "「業務システムを対象としたシンボリック実行による検証試行」", 情報処理学会 シンポジウム ソフトウェアエンジニアリングシンポジウム 2013 [ONLINE], JPN6019004470, 2 September 2013 (2013-09-02), pages pp.1−6 * |
Also Published As
Publication number | Publication date |
---|---|
JP6497271B2 (en) | 2019-04-10 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
Pei et al. | Can large language models reason about program invariants? | |
US20110145799A1 (en) | Path-sensitive dataflow analysis including path refinement | |
JP2016115175A (en) | Software test apparatus and software test program | |
JP2007034584A (en) | High order composition device, automatic high order composition method, high order composition program, and gate net list automatic verifying method | |
JP2016004576A (en) | Method for verification of model of gui-based application and computer readable memory medium | |
JP2016009344A (en) | Test case generation program, test case generation method, and test case generation device | |
Mao et al. | User behavior pattern mining and reuse across similar Android apps | |
JP2020067697A (en) | Dead code analysis program, dead code analysis method, and dead code analysis device | |
JP5440287B2 (en) | Symbolic execution support program, method and apparatus | |
US11487641B1 (en) | Micro services recommendation system for identifying code areas at risk | |
JP6451417B2 (en) | Debug support device, debug support system, debug support method, and debug support program | |
JP6497271B2 (en) | Test data generation apparatus, method, and program | |
JP6512032B2 (en) | Stub target determination apparatus, method, and program | |
JP5163172B2 (en) | Software test item editing support apparatus and software test item editing support method | |
US20130311164A1 (en) | Dynamic generation of test segments | |
JP5265318B2 (en) | Logic verification device | |
JP5755861B2 (en) | Test case generation apparatus, test case generation method, and test case generation program | |
JP2007257397A (en) | Contention state detection process additional program, contention state detection process adding apparatus and contention state detection process adding method | |
JP2013145443A (en) | Test code generation device, test code generation method and test code generation program | |
JP6330490B2 (en) | Test case generation program, test case generation apparatus, and test case generation method | |
JP6547345B2 (en) | Test case generation program, test case generation method and test case generation apparatus | |
JP2017041085A (en) | Program specification estimation device, estimation method and estimation program | |
M'zah et al. | Deterministic microcode machine generation | |
JP6599053B1 (en) | Information processing apparatus, information processing method, and information processing program | |
JP7210917B2 (en) | Verification information generation device, verification information generation method, and verification information generation program |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20180514 |
|
A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20190123 |
|
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: 20190212 |
|
A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20190225 |
|
R150 | Certificate of patent or registration of utility model |
Ref document number: 6497271 Country of ref document: JP Free format text: JAPANESE INTERMEDIATE CODE: R150 |