JP2017041197A - Test data generation device, method, and program - Google Patents

Test data generation device, method, and program Download PDF

Info

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
Application number
JP2015164052A
Other languages
Japanese (ja)
Other versions
JP6497271B2 (en
Inventor
英生 谷田
Hideo Tanida
英生 谷田
忠弘 上原
Tadahiro Uehara
忠弘 上原
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Fujitsu Ltd
Original Assignee
Fujitsu Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Fujitsu Ltd filed Critical Fujitsu Ltd
Priority to JP2015164052A priority Critical patent/JP6497271B2/en
Publication of JP2017041197A publication Critical patent/JP2017041197A/en
Application granted granted Critical
Publication of JP6497271B2 publication Critical patent/JP6497271B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Debugging And Monitoring (AREA)

Abstract

PROBLEM TO BE SOLVED: To generate test data with high comprehensiveness under the consideration of a type of a symbol variable.SOLUTION: A symbolic execution part 11 is configured to extract a path condition by performing symbolic execution using a symbol variable to a test object program, and to generate test data fulfilling the extracted path condition, and a determination part 12 is configured to, on the basis of the path condition for which the test data fulfilling the path condition are not generated among the extracted path conditions, determine a changed type of the symbol variable included in the path condition, and a driver stub generation part 13 is configured to generate a driver and stub for performing symbolic execution to generate the test data again for the path condition for which the test data fulfilling the path condition are not generated by using the symbol variable whose type has been changed.SELECTED DRAWING: Figure 1

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.

特開2013−254412号公報JP 2013-254412 A 特開2014−6643号公報JP 2014-6643 A

しかしながら、例えば、動的に型付けを行う言語で記述されたプログラムや、既定の変数の型が与えられていないか、又は誤った変数の型が与えられたプログラムでは、期待する型とは異なる型の値が入力される場合がある。このような場合には、従来技術では、テストデータを生成することができない。   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.

本実施形態に係るテストデータ生成装置の概略構成を示す機能ブロック図である。It is a functional block diagram which shows schematic structure of the test data generation apparatus which concerns on this embodiment. 変数の型に関するコメントが記述されたプログラムの一例を示す図である。It is a figure which shows an example of the program by which the comment regarding a variable type was described. コメントに基づいて変数の型を定義したドライバ、及びnullを考慮したドライバの一例を示す図である。It is a figure which shows an example of the driver which defined the type of the variable based on the comment, and the driver which considered null. 型の不一致により実行されない条件文を含むプログラムの一例を示す図である。It is a figure which shows an example of the program containing the conditional sentence which is not performed by type mismatch. 本実施形態に係るテストデータ生成装置として機能するコンピュータの概略構成を示す機能ブロック図である。It is a functional block diagram which shows schematic structure of the computer which functions as a test data generation apparatus which concerns on this embodiment. 本実施形態におけるテストデータ生成処理の一例を示すフローチャートである。It is a flowchart which shows an example of the test data generation process in this embodiment. テスト対象プログラムの一例を示す図である。It is a figure which shows an example of a test object program. 初期のドライバ及びテストデータの生成結果を示す図である。It is a figure which shows the production | generation result of an initial driver and test data. シンボル変数の型変更後のドライバ及びテストデータの生成結果を示す図である。It is a figure which shows the production | generation result of the driver and test data after the type change of a symbol variable. シンボル変数の型変更後のドライバ及びテストデータの生成結果を示す図である。It is a figure which shows the production | generation result of the driver and test data after the type change of a 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 test target program 131A as shown in FIG. 2 that the variables s1 and s2 are character strings (String type). A driver 122A as shown in FIG.

しかし、図2に示すテスト対象プログラム131Aでは、変数s1及びs2がnullの場合についても考慮する必要があるが、ドライバ122Aから与えられる変数s1及びs2の型は文字列である。そのため、変数s1及びs2がnullであることを考慮したテストデータを生成することができない。   However, in the test target program 131A shown in FIG. 2, it is necessary to consider the case where the variables s1 and s2 are null, but the types of the variables s1 and s2 given from the driver 122A are character strings. Therefore, it is not possible to generate test data considering that the variables s1 and s2 are null.

この問題に対し、例えば、図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 driver 122B illustrated in the lower part of FIG. In the driver 122B, s? _IsNull is true if true, s if false? It is defined that _body is substituted. Thereby, it is possible to generate test data including a case where the symbol variable is null.

しかし、例えば、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 test target program 131A as shown in FIG. For example, in the test target program 131B shown in FIG. 4, the conditional statement indicated by the broken line Q can be executed only when the variable s2 is a numerical value. However, when the above-described driver 122A is used, since the type of the variable s2 is set as a character string, this conditional statement cannot be executed, and test data that passes this conditional statement is generated. I can't. The driver 122B also defines the symbol variable type in consideration of the null value, but test data can be generated when a value of a type completely different from the expected type is input. Therefore, there will be a path where the test cannot be executed.

そこで、本実施形態では、テストデータが生成されないパス条件に含まれるシンボル変数の型を変更することで、網羅性の高いテストデータを生成する。   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 data generation apparatus 10 according to the present embodiment accepts a test target program 31 as an input, and generates and outputs test data 35 by symbolic execution.

テストデータ生成装置10は、図1に示すように、機能的には、シンボリック実行部11と、決定部12と、ドライバ・スタブ生成部13とを含む。なお、シンボリック実行部11は、開示の技術の生成部の一例であり、ドライバ・スタブ生成部13は、開示の技術の制御部の一例である。   As shown in FIG. 1, the test data generation device 10 functionally includes a symbolic execution unit 11, a determination unit 12, and a driver / stub generation unit 13. The symbolic execution unit 11 is an example of a generation unit of the disclosed technology, and the driver / stub generation unit 13 is an example of a control unit of the disclosed technology.

シンボリック実行部11は、テスト対象プログラム31に対して、ドライバ・スタブ生成部13で生成されたドライバ及びスタブを用いてシンボリック実行を行い、パス条件を抽出して、抽出したパス条件を充足するテストデータを生成する。また、シンボリック実行部11は、テストデータを生成することができなかったパス条件(以下、「未網羅のパス条件」という)を、決定部12に通知する。   The symbolic execution unit 11 performs symbolic execution on the test target program 31 using the driver and stub generated by the driver / stub generation unit 13, extracts the path condition, and satisfies the extracted path condition Generate data. Further, the symbolic execution unit 11 notifies the determination unit 12 of a path condition for which test data could not be generated (hereinafter referred to as “uncovered path condition”).

決定部12は、未網羅のパス条件に基づいて、その未網羅のパス条件に含まれるシンボル変数の変更後の型を決定する。シンボル変数のとりうる型は、シンボル変数型集合15として予め定めておく。本実施形態では、説明を簡単にするため、シンボル変数の取りうる型は、文字列(String型)、数値(Number型)、及びnullの3つである場合について説明する。   The determination unit 12 determines the changed type of the symbol variable included in the uncovered path condition based on the uncovered path condition. The possible types of symbol variables are predetermined as a symbol variable type set 15. In the present embodiment, in order to simplify the description, a case where there are three types of symbol variables, that is, a character string (String type), a numerical value (Number type), and null will be described.

決定部12は、具体的には、未網羅のパス条件に含まれるシンボル変数を、型を変更するシンボル変数として特定する。そして、決定部12は、未網羅のパス条件に含まれるシンボル変数以外の定数の型を、特定したシンボル変数の変更後の型として決定する。例えば、未網羅のパス条件が、「s1==1(数値)」の場合、決定部12は、型を変更するシンボル変数として「s1」を特定し、変更後の型を「数値」に決定する。   Specifically, the determination unit 12 specifies a symbol variable included in an uncovered path condition as a symbol variable whose type is to be changed. Then, the determination unit 12 determines the type of a constant other than the symbol variable included in the uncovered path condition as the changed type of the specified symbol variable. For example, when the uncovered path condition is “s1 == 1 (numerical value)”, the determination unit 12 identifies “s1” as the symbol variable whose type is to be changed, and determines the changed type as “numeric value”. To do.

また、決定部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 determination unit 12 selects one type from the symbol variable type set 15 and repeats the change of the symbol variable type. As the changed type of the selected symbol variable. For example, for the types included in the symbol variable type set 15, the determination unit 12 selects an unselected type according to a predetermined order such as, for example, character string → numerical value → null, and changes the specified symbol variable Later types can be determined. In addition, when a plurality of symbol variables are specified from uncovered path conditions, the determination unit 12 sequentially changes the combination of the types of the symbol variables. For example, when the specified symbol variables are two, s1 and s2, (character string, character string) → (character string, numeric value) → (character string, null) → (numeric value) as (s1 type, s2 type) , Character string) →... → (null, null). Then, the determination unit 12 can select a combination of unselected types according to this order, and determine the type after the change of the identified symbol variable.

また、決定部12は、型を変更するシンボル変数、及び変更後の型を、ドライバ・スタブ生成部13に通知する。   The determination unit 12 notifies the driver / stub generation unit 13 of the symbol variable whose type is to be changed and the changed type.

ドライバ・スタブ生成部13は、テスト対象プログラム31を解析して、テスト対象プログラム31のシンボリック実行に用いるドライバ及びスタブを生成する。また、ドライバ・スタブ生成部13は、決定部12からの通知に基づいて、シンボル変数の型を変更したドライバ及びスタブを生成する。ドライバ・スタブ生成部13は、生成したドライバ及びスタブをシンボリック実行部11へ受け渡す。   The driver / stub generation unit 13 analyzes the test target program 31 and generates a driver and a stub used for symbolic execution of the test target program 31. The driver / stub generation unit 13 generates a driver and a stub in which the symbol variable type is changed based on the notification from the determination unit 12. The driver / stub generation unit 13 delivers the generated driver and stub to the symbolic execution unit 11.

テストデータ生成装置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 data generation device 10 can be realized by, for example, a computer 40 shown in FIG. The computer 40 includes a CPU 41, a memory 42 as a temporary storage area, and a nonvolatile storage unit 43. The computer 40 is connected to an input / output device 44 such as a display device and an input device, a read / write (R / W) unit 45 that controls reading and writing of data with respect to the recording medium 49, and a network such as the Internet. Network I / F 46. The CPU 41, the memory 42, the storage unit 43, the input / output device 44, the R / W unit 45, and the network I / F 46 are connected to each other via a bus 47.

記憶部43は、HDD(Hard Disk Drive)、SSD(solid state drive)、フラッシュメモリ等によって実現できる。記憶媒体としての記憶部43には、コンピュータ40をテストデータ生成装置10として機能させるためのテストデータ生成プログラム50が記憶される。   The storage unit 43 can be realized by a hard disk drive (HDD), a solid state drive (SSD), a flash memory, or the like. A test data generation program 50 for causing the computer 40 to function as the test data generation device 10 is stored in the storage unit 43 as a storage medium.

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 CPU 41 reads the test data generation program 50 from the storage unit 43 and expands it in the memory 42, and sequentially executes the processes included in the test data generation program 50. The test data generation program 50 includes a symbolic execution process 51, a determination process 52, and a driver stub generation process 53. The CPU 41 operates as the symbolic execution unit 11 illustrated in FIG. 1 by executing the symbolic execution process 51. Further, the CPU 41 operates as the determination unit 12 illustrated in FIG. 1 by executing the determination process 52. The CPU 41 operates as the driver / stub generation unit 13 illustrated in FIG. 1 by executing the driver / stub generation process 53. As a result, the computer 40 that has executed the test data generation program 50 functions as the test data generation apparatus 10.

なお、テストデータ生成プログラム50により実現される機能は、例えば半導体集積回路、より詳しくはASIC(Application Specific Integrated Circuit)等で実現することも可能である。   The function realized by the test data generation program 50 can be realized by, for example, a semiconductor integrated circuit, more specifically, an ASIC (Application Specific Integrated Circuit).

次に、本実施形態に係るテストデータ生成装置10の作用について説明する。テストデータ生成装置10にテスト対象プログラム31が入力されると、テストデータ生成装置10において、図6に示すテストデータ生成処理が実行される。なお、ここでは、図7に示すようなテスト対象プログラム31が入力されるものとする。図7に示すテスト対象プログラム31では、変数s1及びs2の型は文字列(String型)である旨のコメントが記述されている(図7中の破線R)。   Next, the operation of the test data generation apparatus 10 according to this embodiment will be described. When the test target program 31 is input to the test data generation apparatus 10, the test data generation process shown in FIG. Here, it is assumed that a test target program 31 as shown in FIG. 7 is input. In the test target program 31 shown in FIG. 7, a comment that the types of the variables s1 and s2 are character strings (String type) is described (broken line R in FIG. 7).

図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 / stub generation unit 13 generates an initial driver and stub d (0) from the test target program 31. Here, based on the comments of the test target program 31, the driver / stub generator 13 defines each of the variables s1 and s2 as a symbol variable of a character string (String type) as shown in the upper part of FIG. A driver 22A is generated. Note that the illustration of the stub is omitted. Then, the driver / stub generation unit 13 delivers the generated initial driver / stub d (0) to the symbolic execution unit 11. The symbolic execution unit 11 performs symbolic execution on the test target program 31 using the initial driver stub d (0), extracts a path condition, and generates test data that satisfies the extracted path condition. .

図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 data generation result 23A by symbolic execution using the driver 22A. As shown in the generation result 23A, four path conditions (Nos. 1 to 4) are extracted from the test target program 31. At this stage, since the type of each of the symbol variables s1 and s2 is a character string, the symbolic execution unit 11 performs No. 2 and no. Test data satisfying each of the three path conditions can be generated. However, no. The path condition of “s2 == 1 (numerical value)” of 1 is a type mismatch because the type of the symbol variable s2 at this stage is a character string, and the symbolic execution unit 11 performs test data that satisfies the path condition. Cannot be generated. Similarly, no. The path condition of “s1 == null” in FIG. 4 is also a type mismatch because the type of the current symbol variable s1 is a character string, and the symbolic execution unit 11 generates test data that satisfies the path condition. I can't. That is, no. 1 and no. Each of the four path conditions becomes an “uncovered path condition”. The symbolic execution unit 11 is No. 1 and no. The determination unit 12 is notified that each of the four path conditions is an uncovered path condition.

なお、図8に示すテストデータの生成結果23Aを、図7に示すテスト対象プログラム31に対応させると、No.2及びNo.3の部分のテストを実行するためのテストデータが生成されたことを示す。一方、No.1及びNo.4の部分のテストを実行するためのテストデータは生成されていないことを示す。   If the test data generation result 23A shown in FIG. 8 is associated with the test target program 31 shown in FIG. 2 and no. 3 shows that test data for executing the test of part 3 has been generated. On the other hand, no. 1 and no. 4 indicates that test data for executing the test of part 4 has not been generated.

次に、ステップS12で、決定部12が、シンボリック実行部11から通知された未網羅のパス条件のうち、後述するシンボル変数の型変更の処理を未実施の未網羅のパス条件が存在するか否かを判定する。シンボル変数の型変更の処理が未実施の未網羅のパス条件が存在する場合には、処理はステップS13へ移行する。   Next, in step S <b> 12, among the uncovered path conditions notified from the symbolic execution section 11, whether there is an uncovered path condition that has not been subjected to symbol variable type change processing, which will be described later. Determine whether or not. If there is an uncovered path condition in which the symbol variable type change process has not been performed, the process proceeds to step S13.

ステップS13では、決定部12が、シンボル変数の型変更の処理が未実施の未網羅のパス条件から1つを処理対象のパス条件として選択する。ここでは、No.1のパス条件が選択されるものとする。次に、ステップS14で、決定部12が、シンボル変数の型の変更回数を示す変数iを0に設定し、次に、ステップS15で、決定部12が、変数iを1インクリメントする。   In step S13, the determination unit 12 selects one of the uncovered path conditions that have not been subjected to the symbol variable type change process as the path condition to be processed. Here, no. Assume that one pass condition is selected. Next, in step S14, the determination unit 12 sets a variable i indicating the number of symbol variable type changes to 0, and then in step S15, the determination unit 12 increments the variable i by one.

次に、ステップS16で、決定部12が、処理対象のパス条件に含まれるシンボル変数を、型を変更するシンボル変数として特定する。ここでは、No.1のパス条件に含まれる「s2」が型を変更するシンボル変数として特定される。そして、決定部12は、処理対象のパス条件に含まれるシンボル変数「s2」以外の定数である「1」の型「数値(Number型)」を、シンボル変数「s2」の変更後の型として決定する。決定部12は、型を変更するシンボル変数、及び決定した変更後の型を、ドライバ・スタブ生成部13に通知する。   Next, in step S16, the determination unit 12 identifies a symbol variable included in the processing target path condition as a symbol variable whose type is to be changed. Here, no. “S2” included in one path condition is specified as a symbol variable whose type is to be changed. Then, the determination unit 12 sets the type “numerical value (Number type)” of “1”, which is a constant other than the symbol variable “s2” included in the path condition to be processed, as the type after the change of the symbol variable “s2”. decide. The determining unit 12 notifies the driver / stub generating unit 13 of the symbol variable whose type is to be changed and the determined changed type.

次に、ステップ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 stub generation unit 13 generates a driver stub d (i) in which the symbol variable type is changed based on the notification from the determination unit 12. Note that d (i) represents a driver stub whose symbol variable type has been changed i times. When j is the number of symbol variables and k is the number of types of symbols that can be taken by the symbol variable (the number of types included in the symbol variable type set 15), i is i = 0, 1,. 1 (N = j × k).

ここでは、ドライバ・スタブ生成部13が、決定部12からの通知に基づいて、図9の上段に示すように、シンボル変数s2の型を、文字列(String型)から数値(Number型)に変更したドライバ22Bを生成する。そして、ドライバ・スタブ生成部13は、生成したドライバ22Bをシンボリック実行部11へ受け渡す。シンボリック実行部11では、ドライバ22Bを用いて、処理対象のパス条件を充足するテストデータを生成する。   Here, based on the notification from the determination unit 12, the driver / stub generation unit 13 changes the type of the symbol variable s2 from a character string (String type) to a numerical value (Number type) as shown in the upper part of FIG. The changed driver 22B is generated. Then, the driver / stub generation unit 13 delivers the generated driver 22B to the symbolic execution unit 11. The symbolic execution unit 11 uses the driver 22B to generate test data that satisfies the processing target path condition.

図9の下段に、ドライバ22Bによるテストデータの生成結果23Bを示す。シンボル変数s2の型を数値に変更したことにより、No.1のパス条件を充足するテストデータが生成できる。これにより、図7に示すテスト対象プログラム31のNo.2及びNo.3の部分に加え、No.1の部分のテストを実行するためのテストデータが生成されたことを示す。   The lower part of FIG. 9 shows a test data generation result 23B by the driver 22B. By changing the type of the symbol variable s2 to a numerical value, No. Test data satisfying one pass condition can be generated. As a result, the test program No. 31 shown in FIG. 2 and no. 3 in addition to No. 3 It shows that test data for executing the test of the part 1 is generated.

次に、ステップ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 symbolic execution unit 11 determines whether or not test data that satisfies the path condition to be processed has been generated. If test data satisfying the processing target path condition is generated, the process returns to step S12. If not generated, the process proceeds to step S19. In step S19, the determination unit 12 determines whether i is smaller than N-1, that is, whether there is a further changeable type. If i <N−1, the process returns to step S15. If i ≧ N−1, the process returns to step S12. Here, the processing target No. Since the test data satisfying the path condition 1 has been generated, the process returns to step S12, and in step S13, no. 4 is selected as the next path condition to be processed.

そして、ステップS16で、決定部12が、処理対象のNo.4のパス条件に含まれる「s1」を、型を変更するシンボル変数として特定し、処理対象のパス条件から、「null」を、シンボル変数「s1」の変更後の型として決定する。決定部12は、型を変更するシンボル変数、及び決定した変更後の型を、ドライバ・スタブ生成部13に通知する。   In step S16, the determination unit 12 determines whether the processing target No. 4 is specified as a symbol variable whose type is to be changed, and “null” is determined as a type after the change of the symbol variable “s1” from the path condition to be processed. The determining unit 12 notifies the driver / stub generating unit 13 of the symbol variable whose type is to be changed and the determined changed type.

次に、ステップS17で、ドライバ・スタブ生成部13が、決定部12からの通知に基づいて、図10の上段に示すように、シンボル変数s1の型を、文字列(String型)からnullに変更したドライバ22Cを生成する。そして、ドライバ・スタブ生成部13は、生成したドライバ22Cをシンボリック実行部11へ受け渡す。シンボリック実行部11では、ドライバ22Cを用いて、処理対象のパス条件を充足するテストデータを生成する。   Next, in step S17, based on the notification from the determination unit 12, the driver / stub generation unit 13 changes the type of the symbol variable s1 from a character string (String type) to null as shown in the upper part of FIG. The changed driver 22C is generated. Then, the driver / stub generation unit 13 delivers the generated driver 22C to the symbolic execution unit 11. The symbolic execution unit 11 uses the driver 22C to generate test data that satisfies the processing target path condition.

図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 data generation result 23C by the driver 22C. By changing the type of the symbol variable s1 to null, no. Test data that satisfies the four pass conditions can be generated. As a result, the test program No. 31 shown in FIG. 1-No. 3 in addition to No. 3 4 shows that test data for executing the test of part 4 has been generated. That is, it indicates that test data covering all the paths included in the test target program 31 has been generated.

ステップS12で否定判定されると、処理はステップS20へ移行し、シンボリック実行部11が、生成されたテストデータ35を出力して、テストデータ生成処理は終了する。   If a negative determination is made in step S12, the process proceeds to step S20, the symbolic execution unit 11 outputs the generated test data 35, and the test data generation process ends.

なお、上記のテストデータ生成処理では、処理対象のパス条件についてテストデータが生成されるまで、シンボル変数がとりうる型の各々への変更を試みる場合について説明したが、これに限定されない。型の変更処理の実施回数を所定回数に制限してもよい。   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 driver 122B shown in FIG. 3, the type of the symbol variable is defined in consideration of whether or not it is null in any case. For this reason, there is a problem that the memory required for symbolic execution, the code of the driver and the stub become large. According to the present embodiment, symbolic execution for each time does not determine whether or not the type of one symbol variable is null, and does not consider a plurality of types according to the determination result. Necessary memory and code size of driver and stub can be suppressed.

また、上記では、テストデータ生成プログラム50が記憶部43に予め記憶(インストール)されている態様を説明したが、これに限定されない。開示の技術に係るプログラムは、CD−ROM、DVD−ROM、USBメモリ等の記録媒体に記録された形態で提供することも可能である。   In the above description, the test data generation program 50 is stored (installed) in the storage unit 43 in advance. However, the present invention is not limited to this. The program according to the disclosed technology can be provided in a form recorded on a recording medium such as a CD-ROM, a DVD-ROM, or a USB memory.

以上の実施形態に関し、更に以下の付記を開示する。   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 appendix 1, wherein the determination unit determines a type of a constant other than a symbol variable included in a path condition for which test data that satisfies the path condition is not generated as a type after the symbol variable is changed. apparatus.

(付記3)
前記決定部は、パス条件を充足するテストデータが生成されるまで、複数種類の型から未選択の型を順次選択して、前記シンボル変数の変更後の型として決定する付記2記載のテストデータ生成装置。
(Appendix 3)
The test data according to supplementary note 2, wherein the determination unit sequentially selects an unselected type from a plurality of types until a test data that satisfies a path condition is generated, and determines the type after the change of the symbol variable. Generator.

(付記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 appendix 10, which is determined as

(付記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 SYMBOLS 10 Test data generation apparatus 11 Symbolic execution part 12 Determination part 13 Driver stub generation part 15 Symbol variable type | mold set 22A, 22B, 22C Driver 31 Test object program 35 Test data 40 Computer 41 CPU
42 Memory 43 Storage 49 Recording medium 50 Test data generation program

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
前記決定部は、前記パス条件を充足するテストデータが生成されていないパス条件に含まれるシンボル変数以外の定数の型を、前記シンボル変数の変更後の型として決定する請求項1記載のテストデータ生成装置。   2. The test data according to claim 1, wherein the determination unit determines a constant type other than the symbol variable included in the path condition for which the test data satisfying the path condition is not generated as the changed type of the symbol variable. Generator. 前記決定部は、パス条件を充足するテストデータが生成されるまで、複数種類の型から未選択の型を順次選択して、前記シンボル変数の変更後の型として決定する請求項2記載のテストデータ生成装置。   3. The test according to claim 2, wherein the determination unit sequentially selects an unselected type from a plurality of types until a test data that satisfies a path condition is generated, and determines the type after the change of the symbol variable. Data generator. 前記制御部は、前記テスト対象のプログラムに対してシンボリック実行を行い、かつ該シンボリック実行の際に、前記決定部で決定された型のシンボル変数を与えるドライバ及びスタブを生成する請求項1〜請求項3のいずれか1項記載のテストデータ生成装置。   The control unit performs symbolic execution on the test target program, and generates a driver and a stub that give a symbol variable of a type determined by the determination unit at the time of the symbolic execution. Item 4. The test data generation device according to any one of Items 3 to 3. コンピュータに、
テスト対象のプログラムに対して、シンボル変数を用いたシンボリック実行により、パス条件を抽出すると共に、抽出したパス条件を充足するテストデータを生成し、
抽出されたパス条件のうち、該パス条件を充足するテストデータが生成されていないパス条件に基づいて、該パス条件に含まれるシンボル変数の変更後の型を決定し、
型が変更されたシンボル変数を用いて、前記パス条件を充足するテストデータが生成されていないパス条件について、再度テストデータを生成する
ことを含む処理を実行させるテストデータ生成方法。
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.
JP2015164052A 2015-08-21 2015-08-21 Test data generation apparatus, method, and program Active JP6497271B2 (en)

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)

* Cited by examiner, † Cited by third party
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

Patent Citations (3)

* Cited by examiner, † Cited by third party
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)

* Cited by examiner, † Cited by third party
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