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

Test data generation device, program and method Download PDF

Info

Publication number
JP2014021686A
JP2014021686A JP2012159258A JP2012159258A JP2014021686A JP 2014021686 A JP2014021686 A JP 2014021686A JP 2012159258 A JP2012159258 A JP 2012159258A JP 2012159258 A JP2012159258 A JP 2012159258A JP 2014021686 A JP2014021686 A JP 2014021686A
Authority
JP
Japan
Prior art keywords
test data
path
route
condition information
information
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
JP2012159258A
Other languages
Japanese (ja)
Other versions
JP5900212B2 (en
Inventor
Kazuki Munakata
一樹 宗像
Tadahiro Uehara
忠弘 上原
Yoshiharu Maeda
芳晴 前田
Shoichiro Fujiwara
翔一朗 藤原
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 JP2012159258A priority Critical patent/JP5900212B2/en
Publication of JP2014021686A publication Critical patent/JP2014021686A/en
Application granted granted Critical
Publication of JP5900212B2 publication Critical patent/JP5900212B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Debugging And Monitoring (AREA)

Abstract

PROBLEM TO BE SOLVED: To reduce the costs of a test posterior to program correction by using test resources prior to program correction.SOLUTION: A test data generation device acquires first test data to be used for the test of a pre-correction program and path condition information showing path conditions expressing an execution path shown by the combination of processing paths to be branched and made to pass under conditions included in the source code of a post-correction program by a logical formula, and stores the acquired first test data in a test data storage section, and stores the acquired path condition information in a path condition storage section, and extracts the path condition information which is not logically the same value as the first test data stored in the test data storage section from the path condition information stored in the path condition storage section, and generates second test data satisfying the path conditions shown by the extracted path condition information.

Description

本技術は、プログラムの動作をテストするためのテストデータを生成する技術に関する。   The present technology relates to a technology for generating test data for testing the operation of a program.

業務システムが仕様通りに設計されているかを検証するためにテストが行われる。そのようなテストは、業務仕様(業務として意味のある項目間の関係や変化)に関するチェックや、境界値テスト等のプログラムのエラーがデータの境界で起こりやすいという経験則からのチェックなど、様々な観点より行われる。そのため、チェック内容に応じて、1つの業務仕様に対して複数のテストデータが用意される。   A test is performed to verify that the business system is designed as specified. Such tests include various checks, such as checks related to business specifications (relationships and changes between items that have meaning as business), and rules of thumb that program errors such as boundary value tests are likely to occur at data boundaries. It is done from the viewpoint. Therefore, a plurality of test data is prepared for one business specification according to the check contents.

業務仕様からテストデータを自動的に生成するための技術として、テストしたい状況が表現された制約式(画面、データベース(DB)項目やプログラム変数を用いた論理式)の充足可能性判定問題を解くことで充足値をテストデータとして用いる技術がある。そのようなプログラムのテストを行う際のテストデータを作成する技術の1つに、シンボリック実行(symbolic execution)がある。シンボリック実行とは、変数を具体的な値としてではなく、シンボル値という値を1つに特定しないで実行する仕組みをいう。シンボリック実行では、ある一連の遷移についてその遷移を流れることになるテストデータを、そのプログラムが取り得る一連の遷移の各々について作成することができる。   As a technology for automatically generating test data from business specifications, it solves the satisfiability determination problem of constraint expressions (logical expressions using screens, database (DB) items and program variables) that express the situation to be tested. Therefore, there is a technique that uses the sufficiency value as test data. One technique for creating test data for testing such a program is symbolic execution. Symbolic execution refers to a mechanism in which a variable is not specified as a specific value but executed without specifying a single symbol value. In symbolic execution, test data that will flow through a certain series of transitions can be created for each of the series of transitions that the program can take.

ところで、既存のプログラムを改修した際は、そのプログラムのテストを行う。テストでは、テスト対象の処理に与えるデータ(入力データ)と、そのデータが与えられた際にプログラムが処理をして得られる値(出力データ)とを準備しておく。そして、その入力データをそのテスト対象の処理に与えた場合に、仕様の上で、処理によって得られる値と、準備していた出力データを対比することで、そのプログラムが仕様の通りの処理を実行しているかを判断する。   By the way, when an existing program is modified, the program is tested. In the test, data (input data) to be given to the processing to be tested and values (output data) obtained by processing by the program when the data is given are prepared. Then, when the input data is given to the test target process, the program performs the process according to the specification by comparing the value obtained by the process with the prepared output data. Determine if it is running.

また、プログラムのテストを行う際に、全ての処理フローを網羅したテストが出来るように、プログラムの開始から終了までを処理で用いられる変数の値を変更して、1〜複数回、テストを実行することがある。   Also, when testing the program, change the value of the variable used in the process from the start to the end of the program and execute the test one or more times so that the test can cover all processing flows There are things to do.

このような、ソフトウェア開発では、実装されたプログラムの動作テストを効率よく行うため、例えば、次のようなソフトウェア試験支援技術がある。   In such software development, for example, the following software test support technology is available in order to efficiently perform an operation test of the installed program.

第1の技術としては、入力された状態変数に基づいて、ソースコードの解析結果から状態遷移情報を抽出し、試験シナリオによって提供される設計情報に基づく状態遷移情報との比較により、両者の異同を検出する技術がある。   As a first technique, state transition information is extracted from the analysis result of the source code based on the input state variable, and the difference between the two is compared with the state transition information based on the design information provided by the test scenario. There is technology to detect.

第2の技術としては、次の技術がある。ユーザ端末より、UMLクラス図とアクティビティ図のみで記述した設計モデルを読み込み、設計モデルからアクティビティ図をテスト対象として抽出し、テスト対象から実行経路を抽出する。抽出された各実行経路の制約条件に基づいて、テストデータ仕様を更新する。テストデータ仕様を読み込み、因子毎に、「水準」を生成し、因子と水準の組み合わせである「入力」に対する実行経路を取得する。「入力」が実行経路にとって許容する入力である正常入力、または、該実行経路にとって許容しない入力である異常入力のいずれであるか、及び、実行経路中に事後条件が含まれるか否かにより期待値を求め、「入力」に該期待値を付与したテストデータを生成する。   The second technique includes the following technique. A design model described only by a UML class diagram and an activity diagram is read from the user terminal, an activity diagram is extracted from the design model as a test target, and an execution path is extracted from the test target. The test data specification is updated based on the extracted constraint condition of each execution path. The test data specification is read, a “level” is generated for each factor, and an execution path for “input” which is a combination of the factor and the level is acquired. Expected depending on whether "input" is a normal input that is allowed for the execution path or an abnormal input that is not allowed for the execution path, and whether or not a post-condition is included in the execution path A value is obtained, and test data in which the expected value is assigned to “input” is generated.

第3の技術としては、過去に行われたテストのテストケースについての情報を保存しておき、その情報と対象プログラムを解析して得られた依存関係を組み合わせることによりテストを行うリグレッションシステムがある。   As a third technique, there is a regression system in which information about test cases of tests performed in the past is stored, and the test is performed by combining the information and the dependency obtained by analyzing the target program. .

特開2005−316710号公報JP 2005-316710 A 特開2010−267023号公報JP 2010-267023 A 特開2008−204405号公報JP 2008-204405 A

修正をしたプログラムについて、シンボリック実行で網羅的にテストをする際に、そのプログラムについて新たにシンボリック実行を行い、得られたテストケースに対応するテストデータを用いてテストをする。   When the modified program is comprehensively tested by symbolic execution, new symbolic execution is performed on the program, and the test data corresponding to the obtained test case is tested.

このとき、そのテストケースでそのテストデータが与えられた際に、前述の仕様の上で得られるべき値(出力値)については、手計算で求めているので、工数が掛かる。
しかしながら、得られたテストケースには、修正の影響を受けないものもあり、そのようなテストケースに対応するテストデータ及びその出力値を再度生成することは工数的に無駄である。
At this time, when the test data is given in the test case, the value (output value) that should be obtained based on the above-mentioned specifications is obtained by manual calculation, and therefore it takes time.
However, some of the obtained test cases are not affected by modification, and it is wasteful to generate test data and output values corresponding to such test cases again.

そこで、プログラムの修正前のテスト資産を利用して、プログラム修正後のテストのコストを削減する技術を提供する。   Therefore, a technique is provided for reducing the cost of testing after program modification by using test assets before program modification.

本実施形態の1つの側面にかかるテストデータ生成装置は、入力情報取得部、テストデータ格納部、経路条件格納部、抽出部、生成部を含む。入力情報取得部は、第1のテストデータと、経路条件情報とを取得する。第1のテストデータは、修正前のプログラムのテストで用いる。経路条件情報は、修正後の該プログラムのソースコードに含まれる条件により分岐されて通過する処理経路の組み合わせで示される実行経路を論理式により表した経路条件を示す。テストデータ格納部は、取得した第1のテストデータを格納する。経路条件情納部は、取得した経路条件情報を格納する。抽出部は、経路条件格納部に格納した経路条件情報から、テストデータ格納部に格納した第1のテストデータと論理的に同値でない経路条件情報を抽出する。生成部は、抽出した経路条件情報が示す経路条件を充足する第2のテストデータを生成する。   A test data generation device according to one aspect of the present embodiment includes an input information acquisition unit, a test data storage unit, a path condition storage unit, an extraction unit, and a generation unit. The input information acquisition unit acquires first test data and route condition information. The first test data is used for testing the program before correction. The route condition information indicates a route condition in which an execution route indicated by a combination of processing routes branched and passed by the condition included in the source code of the program after correction is expressed by a logical expression. The test data storage unit stores the acquired first test data. The route condition information storage unit stores the acquired route condition information. The extraction unit extracts route condition information that is not logically equivalent to the first test data stored in the test data storage unit from the route condition information stored in the route condition storage unit. The generation unit generates second test data that satisfies the route condition indicated by the extracted route condition information.

本実施形態の1つの観点によればプログラムの修正前のテスト資産を利用して、プログラム修正後のテストのコストを削減することができる。   According to one aspect of the present embodiment, it is possible to reduce the cost of testing after program correction by using test assets before program correction.

ソースコードの一例である。It is an example of source code. シンボリック実行によるテストケース生成を説明するための図である。It is a figure for demonstrating the test case production | generation by symbolic execution. プログラムの修正に伴う再テストについて説明するための図(その1)である。It is FIG. (1) for demonstrating the retest accompanying correction of a program. プログラムの修正に伴う再テストについて説明するための図(その2)である。It is FIG. (2) for demonstrating the retest accompanying correction of a program. 修正前後のパスコンディションの対応付けについて説明するための図である。It is a figure for demonstrating matching of the path condition before and behind correction. 本実施形態におけるテストデータ生成装置の一例を示す。1 shows an example of a test data generation apparatus according to the present embodiment. 本実施形態(実施例1)におけるテストデータ生成装置の構成の一例を示す。1 shows an example of a configuration of a test data generation apparatus according to the present embodiment (Example 1). 本実施形態(実施例1)における入力データを説明するための図である。It is a figure for demonstrating the input data in this embodiment (Example 1). 本実施形態(実施例1)におけるテストデータ条件テーブルの一例を示す。An example of the test data condition table in this embodiment (Example 1) is shown. 本実施形態(実施例1)におけるパスコンディションテーブルの一例を示す。An example of the path condition table in this embodiment (Example 1) is shown. 本実施形態(実施例1)におけるマッチング部の処理について説明するための図である。It is a figure for demonstrating the process of the matching part in this embodiment (Example 1). 図10のパスコンディションテーブルにデータ項目「マッチフラグ」を追加した一例を示す。An example in which the data item “match flag” is added to the path condition table of FIG. 10 is shown. 図12に示すパスコンディションテーブルから、マッチフラグが付与されていないパスコンディションを抽出して得られたパスコンディション情報の一例を示す。13 shows an example of path condition information obtained by extracting a path condition to which no match flag is assigned from the path condition table shown in FIG. 本実施形態(実施例1)において、生成されるテストデータの一例を示す。In this embodiment (Example 1), an example of the test data generated is shown. 本実施形態(実施例1)におけるテストデータ生成フロー(その1)の一例を示す。An example of a test data generation flow (part 1) in the present embodiment (Example 1) is shown. 本実施形態(実施例1)におけるテストデータ生成フロー(その2)の一例を示す。An example of a test data generation flow (part 2) in the present embodiment (Example 1) will be described. 本実施形態(実施例1)におけるテストデータ生成フロー(その3)の一例を示す。An example of a test data generation flow (part 3) in the present embodiment (Example 1) will be described. 本実施形態(実施例2)におけるテストデータ生成装置の構成の一例を示す。An example of a configuration of a test data generation apparatus according to the present embodiment (Example 2) will be described. 図12のパスコンディションテーブル19において、マッチフラグが付与されたパスコンディションがテーブルの先頭側になるように並べ替えた様子を示す。In the path condition table 19 of FIG. 12, the rearrangement is performed so that the path condition to which the match flag is assigned is at the head of the table. 本実施形態(実施例2)におけるテストケース選択部の処理内容を説明するための図である。It is a figure for demonstrating the processing content of the test case selection part in this embodiment (Example 2). 本実施形態(実施例2)のテストケース選択処理を説明するための図である。It is a figure for demonstrating the test case selection process of this embodiment (Example 2). 本実施形態(実施例2)における原子論理式テーブルの一例を示す。An example of an atomic logical formula table in this embodiment (Example 2) is shown. 図22の原子論理式テーブルにデータ項目「選択」513を追加した一例を示す。An example in which the data item “selection” 513 is added to the atomic formula table of FIG. 22 is shown. 本実施形態(実施例2)における目標論理式テーブルの一例を示す。An example of the target logical expression table in this embodiment (Example 2) is shown. 本実施形態(実施例2)における選択パスコンディションテーブルの一例を示す。An example of the selection path condition table in this embodiment (Example 2) is shown. 本実施形態(実施例2)における選択パスコンディションテーブルに格納されたパスコンディションと、マッチフラグが付与されたパスコンディションとの差分について説明するための図である。It is a figure for demonstrating the difference of the path condition stored in the selection path condition table in this embodiment (Example 2), and the path condition to which the match flag was provided. 本実施形態(実施例2)におけるデータ生成部15の処理を説明するための図である。It is a figure for demonstrating the process of the data generation part 15 in this embodiment (Example 2). 本実施形態(実施例2)におけるテストデータ生成フロー(その1)の一例を示す。An example of a test data generation flow (part 1) in the present embodiment (Example 2) will be shown. 本実施形態(実施例2)におけるテストデータ生成フロー(その2)の一例を示す。An example of a test data generation flow (part 2) in the present embodiment (Example 2) will be shown. 本実施形態(実施例2)におけるテストデータ生成フロー(その3)の一例を示す。An example of a test data generation flow (part 3) in the present embodiment (Example 2) will be shown. 本実施形態(実施例2)におけるテストケース選択フロー(その1)の一例を示す。An example of a test case selection flow (part 1) in the present embodiment (Example 2) will be described. 本実施形態(実施例2)におけるテストケース選択フロー(その2)の一例を示す。An example of a test case selection flow (part 2) in the present embodiment (Example 2) will be described. 本実施形態(実施例2)におけるテストケース選択フロー(その3)の一例を示す。An example of a test case selection flow (part 3) in the present embodiment (Example 2) will be shown. 本実施形態を適用したコンピュータのハードウェア環境の構成ブロック図である。It is a block diagram of a hardware environment of a computer to which this embodiment is applied.

上述したように、プログラムを解析し、実行可能なパスを抽出する技術として、シンボリック実行がある。実行可能なパスとは、ソースコードについてシンボリック実行を行った場合に、条件判定に応じてそれぞれの遷移先へ分岐する実行経路のことである。シンボリック実行が抽出した各パスは、パスコンディションと呼ばれるプログラム変数に関する条件式(変数が関わる分岐条件や、代入式等に関する条件式)を保持しており、このパスコンディションからテストケース(テストデータ)を生成することができる。ここで、図1及び図2を用いて、シンボリック実行について説明する。   As described above, symbolic execution is a technique for analyzing a program and extracting executable paths. An executable path is an execution path that branches to each transition destination according to a condition determination when symbolic execution is performed on the source code. Each path extracted by symbolic execution holds a conditional expression related to a program variable called a path condition (a conditional expression related to a branch condition involving a variable, an assignment expression, etc.), and a test case (test data) is obtained from this path condition. Can be generated. Here, symbolic execution will be described with reference to FIGS. 1 and 2.

図1は、ソースコードの一例である。図2は、シンボリック実行によるテストケース生成を説明するための図である。シンボリック実行は、そのプログラムに含まれる変数に具体的な数値を入力する代わりに、数値を代表するシンボルでプログラムを模擬的に実行し、その結果を評価する技術である。プログラムにおいてシンボル値が分岐等の判定条件に利用された場合、シンボリック実行を行うと、論理的に可能なシンボル値の組み合わせを加味しながらプログラムが実行される(シンボリック実行ツリーの生成)。   FIG. 1 is an example of source code. FIG. 2 is a diagram for explaining test case generation by symbolic execution. Symbolic execution is a technique in which, instead of inputting specific numerical values into variables included in the program, the program is simulated with symbols representing the numerical values, and the results are evaluated. When symbol values are used in a determination condition such as branching in a program, when symbolic execution is performed, the program is executed while taking into account combinations of logically possible symbol values (generation of symbolic execution trees).

例えば、図1に示すようなソースコードをシンボリック実行する場合を考える。図1のソースコードでは、2つのif文が記述されている。図1のソースコードについてシンボリック実行を行う。すると、変数a、b、cの値に対応するシンボル値Sa、Sb、Scについて、図2に示すように、シンボリック実行ツリーが生成される。例えば、図1に記述されたコード「a >= 0 & a <= 5」は、「Sa >= 0 ∧ Sa <= 5」で表される。また、図1に記述されたコード「b>0 & c > 0」は、「Sb>0 ∧ Sc > 0」で表される。   For example, consider a case where the source code shown in FIG. 1 is symbolically executed. In the source code of FIG. 1, two if statements are described. Symbolic execution is performed on the source code of FIG. Then, a symbolic execution tree is generated for the symbol values Sa, Sb, Sc corresponding to the values of the variables a, b, c as shown in FIG. For example, the code “a> = 0 & a <= 5” described in FIG. 1 is represented by “Sa> = 0 ∧ Sa <= 5”. Further, the code “b> 0 & c> 0” described in FIG. 1 is represented by “Sb> 0∧Sc> 0”.

シンボリック実行ツリーにおいて判定条件より分岐する経路は、シンボリック実行で代入文や条件文などを通過したときに満たすべき論理的な制約(すなわちパスコンディション)を表している。シンボリック実行では、パスコンディションを代入文や条件文などを通過する毎に積み上げる処理を行う。   A path that branches from the determination condition in the symbolic execution tree represents a logical constraint (that is, a path condition) that should be satisfied when an assignment statement or a conditional statement is passed through symbolic execution. In symbolic execution, the path condition is accumulated every time an assignment statement or conditional statement is passed.

シンボリック実行ツリー内の根(ルート)から葉(リーフ)までの経路を実行パスという。実行パスは、各シンボルに対する条件(パスコンディション)を有している。例えば、図2のシンボリックツリーにおいて、実行パスPのパスコンディション(破線で囲まれた部分)は、「Sa >= 0 ∧ Sa <= 5 ∧ Sb>0 ∧ Sc > 0」で示される。   The path from the root (root) to the leaf (leaf) in the symbolic execution tree is called an execution path. The execution path has a condition (path condition) for each symbol. For example, in the symbolic tree of FIG. 2, the path condition of the execution path P (the part surrounded by a broken line) is represented by “Sa> = 0∧Sa <= 5∧Sb> 0∧Sc> 0”.

このようなシンボリック実行の後に、パスコンディションを充足する値があるか否かの判定は、すなわち、論理式が矛盾していないことを示すための判定は、論理式全体を真とするような各部分論理式の真偽時の組み合わせが存在することを示せばよい。論理式の無矛盾性を調べる処理として、論理式を充足可能であるか(真に成り得るか)否かを判定するためには充足可能性判定処理器、すなわち、SAT(satisfiability)又はSMT(satisfiability modulo theory)ソルバ等の制約ソルバが利用される。制約ソルバは、複数の変数を含む数式を制約条件とし、制約条件の範囲内で目標値を得るための解の組み合わせを求めることができる。なお、シンボリック実行は、JPF(Java(登録商標) Path Finder)などのモデル検査エンジンと組み合わせて使用される場合もある。   After such symbolic execution, whether or not there is a value satisfying the path condition, that is, the determination to show that the logical expression is not inconsistent is to make each logical expression true. It is only necessary to show that a combination of partial logical expressions is true or false. In order to determine whether or not a logical expression can be satisfied (can be true) as a process for checking consistency of logical expressions, a satisfiability determination processor, that is, SAT (satisfiability) or SMT (satisfiability) A constraint solver such as a modulo theory solver is used. The constraint solver can obtain a combination of solutions for obtaining a target value within the range of the constraint condition using a mathematical expression including a plurality of variables as the constraint condition. Note that symbolic execution may be used in combination with a model checking engine such as JPF (Java (registered trademark) Path Finder).

ここで、実行パスは、テストケースとして示すことができる。また、パスコンディション内のシンボル値の充足値は、テストデータとして示すことができる。このように、シンボリック実行を用いることにより、論理的に可能なパスコンディションの組み合わせの範囲でテストケースのバリエーションを生成することができる。   Here, the execution path can be shown as a test case. In addition, the sufficiency value of the symbol value in the path condition can be shown as test data. Thus, by using symbolic execution, test case variations can be generated within a range of combinations of logically possible path conditions.

そこで、シンボリック実行では、条件分岐においてその充足可能な全ての実行パスを自動的に発生させて、プログラムの網羅的な実行を可能としている。このとき、主に冗長で膨大になりがちなテストケース自動生成技術により生成されたテストケースから、ある観点・価値(コードカバレッジ、類似性等)に基づきテストケースを選択し、テストケース数を削減することが要求される。   Therefore, in symbolic execution, all the execution paths that can be satisfied in the conditional branch are automatically generated to enable comprehensive execution of the program. At this time, the number of test cases is reduced by selecting test cases based on a certain viewpoint and value (code coverage, similarity, etc.) from test cases generated mainly by test case automatic generation technology that tends to be redundant and enormous. It is required to do.

コードカバレッジには、たとえば、ステートメントカバレッジ、ブランチカバレッジ、条件カバレッジ、マルチ条件カバレッジ、パスカバレッジ等がある。シンボリック実行により生成されるテストケースはパスカバレッジに基づくものである。   Examples of code coverage include statement coverage, branch coverage, condition coverage, multi-condition coverage, and path coverage. Test cases generated by symbolic execution are based on path coverage.

ところで、開発が完了しているプログラムの修正を行った場合は、プログラムの再テストが行われる。再テストにおいては、プログラムが変更されなかった部分については、それまでの機能がそのまま同様に動作することを確認し、プログラムが変更された部分については、変更された機能についてテスト仕様書を作成して、テストすることが要求される。   By the way, when a program that has been developed is corrected, the program is retested. In the retest, check that the functions that have been changed work in the same way for the part where the program has not been changed, and create a test specification for the changed function for the part where the program has been changed. To be tested.

そこで、このシンボリック実行技術を利用して、プログラムが変更された部分についてテストをするための差分テストケース(テストデータ)を抽出する方法が考えられる。具体的には、プログラムの修正前後のパスコンディションを生成し、修正前のパスコンディションに一致しない修正後のパスコディションを差分と捉え、追加テストケースを生成するという方法が考えられる。   Therefore, a method of extracting a differential test case (test data) for testing a portion where the program has been changed using this symbolic execution technique can be considered. Specifically, it is possible to generate a path condition before and after the correction of the program, and to consider a path condition after correction that does not match the path condition before correction as a difference and generate an additional test case.

図3及び図4は、プログラムの修正に伴う再テストについて説明するための図である。図3(A)は、修正前のプログラムの実行パスを示し、図3(B)は、その実行パスに対応するテストケースを示す。図3において、実行パスは4つ存在する(No.1, No.2, No.3, No.4)。   FIG. 3 and FIG. 4 are diagrams for explaining the retest accompanying the correction of the program. FIG. 3A shows an execution path of the program before correction, and FIG. 3B shows a test case corresponding to the execution path. In FIG. 3, there are four execution paths (No. 1, No. 2, No. 3, No. 4).

テストケースNo.1のテストデータは「a=-1, b=0, c=0, d=null」である。テストケースNo.2のテストデータは「a=0, b=5, c=0, d=null」である。テストケースNo.3のテストデータは「a=0, b=5, c=1, d=””」である。テストケースNo.4のテストデータは「a=0, b=4, c=0, d=null」である。図3のプログラムは、これらのテストケース(ブランチカバレッジ)を用いて、既にテストが完了しているものとする。   The test data of test case No. 1 is “a = -1, b = 0, c = 0, d = null”. The test data of test case No. 2 is “a = 0, b = 5, c = 0, d = null”. The test data of test case No. 3 is “a = 0, b = 5, c = 1, d =” ””. The test data of test case No. 4 is “a = 0, b = 4, c = 0, d = null”. The program of FIG. 3 is assumed to have already been tested using these test cases (branch coverage).

図4(A)は、図3の修正後のプログラムを示し、図4(B)は、その実行パスに対応するテストケースを示す。図3において、条件「b>=5」「b<=5」が、図4では、条件「b>=10」「b<=10」と変更されている。また、図3と比較して、図4では、条件「d.length<5」、「d.length>=5」が追加されている。ここで、テストケースNo.1〜No.4については再利用することができる。この場合、テストケースNo.1〜No.4でカバーされないパス(星印)を通過するテストケースを追加することが要求される。   FIG. 4A shows the modified program of FIG. 3, and FIG. 4B shows a test case corresponding to the execution path. In FIG. 3, the conditions “b> = 5” and “b <= 5” are changed to the conditions “b> = 10” and “b <= 10” in FIG. Compared to FIG. 3, the conditions “d.length <5” and “d.length> = 5” are added in FIG. 4. Here, test cases No. 1 to No. 4 can be reused. In this case, it is required to add a test case that passes a path (star) that is not covered by test cases No. 1 to No. 4.

このように、開発が完了しているプログラムの修正を新たに行った場合は、その修正部分について再テストする必要がある。このとき、修正前プログラムに対するテストケースに対して、新たに追加すべきテストケースを特定して再テストするのが効率的である。   In this way, when a program that has been completely developed is corrected, it is necessary to retest the corrected portion. At this time, it is efficient to specify a test case to be newly added and retest the test case for the pre-correction program.

そこで、修正プログラムに対して追加テストケースを生成するためには、修正前後のパスコンディションを生成し、修正前のパスコンディションに対応付かない修正後のパスコディションを差分と捉え、追加テストケースを生成するという方法が考えられる。しかしながら、図5で説明するように、再利用可能なテストケースを対応づけることができないことが考えられる。   Therefore, in order to generate an additional test case for the correction program, a path condition before and after correction is generated, and a path condition after correction that does not correspond to the path condition before correction is regarded as a difference, and an additional test case is generated. The method of doing is considered. However, as will be described with reference to FIG. 5, it is conceivable that reusable test cases cannot be associated.

図5は、修正前後のパスコンディションの対応付けについて説明するための図である。図5に示すように、修正前後のパスコンディションにおいて、文字列が同一なもの同士については対応付けすることができる。しかしながら、修正前後のパスコンディションにおいて、文字列が同一でないもの同士の対応づけは容易ではない。例えば、パスコンディションPC2(テストデータ: a=-1, b=0, c=0, d=“”)は、文字列の比較でPC’2, PC’3と部分的に対応していると判断可能である。しかし、パスコンディションPC2がPC’2, PC’3のどちらのパスコンディションに対応するかまではパスコンディションの比較では判断することはできない。   FIG. 5 is a diagram for explaining the association of path conditions before and after correction. As shown in FIG. 5, in the pass conditions before and after the correction, the same character strings can be associated with each other. However, in the path conditions before and after correction, it is not easy to associate the character strings that are not the same. For example, the path condition PC2 (test data: a = -1, b = 0, c = 0, d = “”) partially corresponds to PC'2 and PC'3 in the character string comparison. Judgment is possible. However, it cannot be determined by comparing the path conditions until the path condition PC2 corresponds to either PC'2 or PC'3.

また、実際には修正前後のパスコンディション間で対応しているにも関わらず、文字列の比較によっては対応付けができなかったパスコンディションを新たにテストケースとして追加すると、既存のテストケースを追加することとなり、テストの効率が悪くなる。   In addition, when a path condition that could not be matched due to character string comparison is added as a new test case even though the path conditions before and after correction are actually supported, an existing test case is added. This will make the test less efficient.

そこで、本実施形態では、プログラムの修正前のテスト資産を利用して、プログラムが変更された部分についてテストするための差分テストケース(テストデータ)を生成する技術を説明する。   Therefore, in the present embodiment, a technique for generating a differential test case (test data) for testing a portion where the program has been changed using test assets before the program is modified will be described.

図6は、本実施形態におけるテストデータ生成装置の一例を示す。テストデータ生成装置1は、入力情報取得部1−1、抽出部1−2、生成部1−3、テストデータ格納部1−8、経路条件格納部1−9を含む。   FIG. 6 shows an example of a test data generation apparatus in the present embodiment. The test data generation device 1 includes an input information acquisition unit 1-1, an extraction unit 1-2, a generation unit 1-3, a test data storage unit 1-8, and a path condition storage unit 1-9.

入力情報取得部1−1は、第1のテストデータ2と、経路条件情報3とを取得する。第1のテストデータ2は、修正前のプログラムのテストで用いるデータである。経路条件情報3は、修正後の該プログラムのソースコードに含まれる条件により分岐されて通過する処理経路の組み合わせで示される実行経路を論理式により表した経路条件(パスコンディション)を示す。入力情報取得部1−1は、修正前のソースコードに含まれる条件により分岐されて通過する処理経路の組み合わせで示される実行経路を論理式により表した経路条件を充足する第1のテストデータを取得する。入力情報取得部1−1の一例としては、取得部13が挙げられる。   The input information acquisition unit 1-1 acquires the first test data 2 and the route condition information 3. The first test data 2 is data used in the test of the program before correction. The route condition information 3 indicates a route condition (path condition) that expresses an execution route represented by a combination of processing routes branched and passed by a condition included in the source code of the program after correction by a logical expression. The input information acquisition unit 1-1 receives first test data that satisfies a path condition that expresses an execution path indicated by a combination of processing paths that are branched and passed by a condition included in the source code before the correction by a logical expression. get. An example of the input information acquisition unit 1-1 is the acquisition unit 13.

テストデータ格納部1−8は、取得した第1のテストデータを格納する。テストデータ格納部1−8の一例としては、テストデータ条件テーブル18が挙げられる。   The test data storage unit 1-8 stores the acquired first test data. An example of the test data storage unit 1-8 is the test data condition table 18.

経路条件格納部1−9は、取得した経路条件情報を格納する。経路条件格納部1−9の一例としては、パスコンディションテーブル19が挙げられる。   The route condition storage unit 1-9 stores the acquired route condition information. An example of the route condition storage unit 1-9 is a path condition table 19.

抽出部1−2は、経路条件格納部1−9に格納した経路条件情報から、テストデータ格納部1−8に格納した第1のテストデータと論理的に同値でない経路条件情報を抽出する。抽出部1−2の一例としては、マッチング部14が挙げられる。   The extraction unit 1-2 extracts route condition information that is not logically equivalent to the first test data stored in the test data storage unit 1-8 from the route condition information stored in the route condition storage unit 1-9. An example of the extracting unit 1-2 is the matching unit 14.

生成部1−3は、抽出した経路条件情報が示す経路条件を充足する第2のテストデータ4を生成する。   The generation unit 1-3 generates second test data 4 that satisfies the route condition indicated by the extracted route condition information.

このように構成することにより、プログラムの修正前のテスト資産を利用して、プログラムが変更された部分についてテストするための差分テストケース(テストデータ)を生成することができる。その結果、シンボリック実行で得られた全テストケースのうち、その差分テストデータに対応する出力値を用意すればよいので、出力値を生成する工数を節約することができる。よって、プログラムの修正前のテスト資産を利用して、プログラム修正後のテストのコストを削減することができる。   With this configuration, it is possible to generate a differential test case (test data) for testing a portion where the program has been changed, using test assets before the program is modified. As a result, it is only necessary to prepare an output value corresponding to the difference test data among all the test cases obtained by symbolic execution, so that the man-hour for generating the output value can be saved. Therefore, it is possible to reduce the cost of the test after the program correction by using the test assets before the program correction.

また、抽出部は、経路条件格納部1−9に格納した経路条件情報が第1のテストデータ2と論理的に同値である第1の経路条件情報であるかを判定する。このとき、テストデータ生成装置1は、さらに、分解部1−4、目標論理式取得部1−5、選択部1−6、差分取得部1−7を含む。   Further, the extraction unit determines whether the route condition information stored in the route condition storage unit 1-9 is first route condition information that is logically equivalent to the first test data 2. At this time, the test data generation device 1 further includes a decomposition unit 1-4, a target logical expression acquisition unit 1-5, a selection unit 1-6, and a difference acquisition unit 1-7.

分解部1−4は、経路条件格納部1−9に格納された経路条件情報を、論理的に同値である情報、同値でない情報の順に並び替える。それから、分解部1−4は、並び替えた経路条件情報を、1以上の原子論理式を含む論理式である目標論理式に、分解する。分解部1−4の一例としては、分解部41が挙げられる。   The decomposition unit 1-4 rearranges the route condition information stored in the route condition storage unit 1-9 in the order of logically equivalent information and non-equivalent information. Then, the decomposing unit 1-4 decomposes the rearranged path condition information into a target logical expression that is a logical expression including one or more atomic logical expressions. An example of the decomposition unit 1-4 includes the decomposition unit 41.

分解格納部1−10は、分解された目標論理式を経路条件情報毎に関係付けた情報である経路分解情報を格納する。分解格納部1−10の一例としては、原子論理式テーブルが挙げられる。   The decomposition storage unit 1-10 stores path decomposition information that is information relating the decomposed target logical expression for each piece of route condition information. An example of the decomposition storage unit 1-10 is an atomic logical expression table.

目標論理式格納部1−11は、目標論理式を格納する。目標論理式格納部1−11の一例としては、目標論理式テーブル52が挙げられる。   The target logical expression storage unit 1-11 stores the target logical expression. An example of the target logical expression storage unit 1-11 is a target logical expression table 52.

目標論理式取得部1−5は、分解格納部1−10から経路分解情報を取得する。それから、目標論理式取得部1−5は、取得した経路分解情報が目標論理式格納部1−11に格納された目標論理式以外の目標論理式である差分の論理式を含む場合、差分の論理式を抽出して目標論理式格納部1−11に格納する。目標論理式取得部1−5の一例としては、抽出部42が挙げられる。   The target logical expression acquisition unit 1-5 acquires path decomposition information from the decomposition storage unit 1-10. Then, the target logical expression acquisition unit 1-5, when the acquired path decomposition information includes a differential logical expression that is a target logical expression other than the target logical expression stored in the target logical expression storage unit 1-11, A logical expression is extracted and stored in the target logical expression storage unit 1-11. An example of the target logical expression acquisition unit 1-5 is the extraction unit 42.

選択部1−6は、取得した経路条件情報から、差分の論理式が抽出された経路分解情報に対応する第2の経路条件情報を選択する。選択部1−6の一例としては、選択部43が挙げられる。   The selection unit 1-6 selects second route condition information corresponding to the route decomposition information from which the logical expression of the difference is extracted from the acquired route condition information. An example of the selection unit 1-6 is the selection unit 43.

差分取得部1−7は、選択された第2の経路条件情報と第1の経路条件情報との差分を取得する。差分取得部の一例としては、差分取得部44が挙げられる。   The difference acquisition unit 1-7 acquires a difference between the selected second route condition information and the first route condition information. An example of the difference acquisition unit is the difference acquisition unit 44.

生成部1−3は、差分として取得した経路条件情報から、第2のテストデータ4を生成する。   The generation unit 1-3 generates the second test data 4 from the path condition information acquired as the difference.

このように構成することにより、追加すべきテストケース(パスコンディション)のうち、目標論理式格納部1−11内に含まれる原子論理式から構成されるテストケースを選択しないようにすることができる。これにより、冗長なテストケースを排除することができる。   By configuring in this way, it is possible not to select a test case composed of an atomic logical expression included in the target logical expression storage unit 1-11 among test cases (path conditions) to be added. . Thereby, redundant test cases can be eliminated.

以下に、本実施形態(実施例1)について詳述する。
(実施例1)
図7は、本実施形態(実施例1)におけるテストデータ生成装置の構成の一例を示す。テストデータ生成装置11は、制御部12、記憶部17を含む。記憶部17は、テストデータ条件テーブル18、パスコンディションテーブル19、抽出パスコンディションテーブル20を含む。
The embodiment (Example 1) will be described in detail below.
Example 1
FIG. 7 shows an example of the configuration of the test data generation apparatus according to the present embodiment (Example 1). The test data generation device 11 includes a control unit 12 and a storage unit 17. The storage unit 17 includes a test data condition table 18, a path condition table 19, and an extracted path condition table 20.

テストデータ条件テーブル18には、修正前のプログラムのテストで用いたテストケース毎に、そのテストケースに含まれるテストデータ(条件)が格納される。パスコンディションテーブル19には、修正したプログラムのソースコードについてシンボリック実行を行うことにより得られた実行パスの組み合わせ、すなわちパスコンディションの組み合わせ(テストケース)が格納される。抽出パスコンディションテーブル20には、パスコンディションテーブル19に含まれるパスコンディションのうち、データ生成部15により抽出されたパスコンディションが格納される。   The test data condition table 18 stores test data (conditions) included in the test case for each test case used in the test of the program before correction. The path condition table 19 stores combinations of execution paths obtained by performing symbolic execution on the source code of the modified program, that is, combinations of path conditions (test cases). In the extracted path condition table 20, path conditions extracted by the data generation unit 15 among the path conditions included in the path condition table 19 are stored.

制御部12は、取得部13、マッチング部14、データ生成部15、出力部16を含む。取得部13は、入力装置(不図示)により、テストデータ31、パスコンディション情報(テストケース)34を取得し、それぞれ、テストデータ条件テーブル18、パスコンディションテーブル19に格納する。テストデータ31は、修正前のプログラムのテストで用いたテストケース毎のテストデータである。パスコンディション情報34は、修正したプログラムのソースコードについてシンボリック実行を行うことにより得られた実行パスの組み合わせ、すなわちパスコンディションの組み合わせ(テストケース)を含む情報である。   The control unit 12 includes an acquisition unit 13, a matching unit 14, a data generation unit 15, and an output unit 16. The acquisition unit 13 acquires test data 31 and path condition information (test case) 34 by an input device (not shown), and stores them in the test data condition table 18 and the path condition table 19, respectively. The test data 31 is test data for each test case used in the test of the program before correction. The path condition information 34 is information including combinations of execution paths obtained by performing symbolic execution on the source code of the modified program, that is, combinations of path conditions (test cases).

マッチング部14は、パスコンディションテーブル19から、各テストデータ条件と論理的同値の関係にあるパスコンディションを選択し、その選択したパスコンディションにマッチフラグを付与する。論理的同値の関係については後述する。   The matching unit 14 selects a path condition that is logically equivalent to each test data condition from the path condition table 19, and assigns a match flag to the selected path condition. The relation of logical equivalence will be described later.

データ生成部15は、パスコンディションテーブル19から、マッチフラグが立っていないパスコンディションを抽出し、抽出パスコンディションテーブル20に格納する。データ生成部15は、制約ソルバを用いて、抽出パスコンディションテーブル20に格納されたパスコンディションから、テストケース35を生成する。   The data generation unit 15 extracts a path condition for which no match flag is set from the path condition table 19 and stores the extracted path condition in the extracted path condition table 20. The data generation unit 15 generates a test case 35 from the path condition stored in the extracted path condition table 20 using a constraint solver.

出力部16は、生成されたテストケース35をディスプレイ、プリンタ等の出力装置に出力する。テストケース35は、修正後のプログラムのテストについて、新たに追加すべきテストケースである。   The output unit 16 outputs the generated test case 35 to an output device such as a display or a printer. The test case 35 is a test case to be newly added for the test of the program after correction.

図8は、本実施形態(実施例1)における入力データを説明するための図である。テストデータ生成装置11に対する入力データとして、テストデータ31と、パスコンディション34を用いる。テストデータ31は、修正前のプログラム32のテストで用いたテストデータであり、ブランチカバレッジを確保している。ここで、修正したプログラム33は、例えば、図3(A)で示すプログラムである。テストケース1(TC1:a=-1, b=0, c=0, d=null)は、プログラム32の実行パスNo.01(図3(A))を通過させるためのテストデータである。テストケース2(TC2:a=0, b=5, c=0, d=null)は、プログラム32の実行パスNo.02(図3(A))を通過させるためのテストデータである。テストケース3(TC3:a=0, b=5, c=1, d=“”)は、プログラム32の実行パスNo.03(図3(A))を通過させるためのテストデータである。テストケース4(TC4:a=0, b=4, c=0, d=null)は、プログラム32の実行パスNo.04(図3(A))を通過させるためのテストデータである。   FIG. 8 is a diagram for explaining input data in the present embodiment (Example 1). Test data 31 and a pass condition 34 are used as input data to the test data generation device 11. The test data 31 is test data used in the test of the program 32 before correction, and ensures branch coverage. Here, the corrected program 33 is, for example, the program shown in FIG. Test case 1 (TC1: a = -1, b = 0, c = 0, d = null) is test data for passing the execution path No. 01 (FIG. 3A) of the program 32. Test case 2 (TC2: a = 0, b = 5, c = 0, d = null) is test data for passing the execution path No. 02 (FIG. 3A) of the program 32. Test case 3 (TC3: a = 0, b = 5, c = 1, d = “”) is test data for passing the execution path No. 03 (FIG. 3A) of the program 32. Test case 4 (TC4: a = 0, b = 4, c = 0, d = null) is test data for passing the execution path No. 04 (FIG. 3A) of the program 32.

パスコンディション情報34は、プログラム32を修正したプログラム33についてシンボリック実行を行うことにより得られる。ここで、修正したプログラム33は、例えば、図4(A)で示すプログラムである。パスコンディション情報34には、パスコンディション1〜12(PC1〜PC12)で示される12個のパスコンディション情報が含まれる。パスコンディション情報34において、PC1〜PC12は、パスコンディションを識別する識別情報である。   The path condition information 34 is obtained by performing symbolic execution on the program 33 obtained by modifying the program 32. Here, the corrected program 33 is, for example, the program shown in FIG. The path condition information 34 includes 12 path condition information indicated by path conditions 1 to 12 (PC1 to PC12). In the path condition information 34, PC1 to PC12 are identification information for identifying the path condition.

図9は、本実施形態(実施例1)におけるテストデータ条件テーブルの一例を示す。テストデータ条件テーブル18は、取得部13により、テストデータ31の各テストケースに含まれるテストデータの条件(論理式)を論理積∧で連結した式が格納される。   FIG. 9 shows an example of a test data condition table in the present embodiment (Example 1). The test data condition table 18 stores an expression obtained by concatenating the test data conditions (logical expressions) included in each test case of the test data 31 with a logical product by the acquisition unit 13.

テストデータ条件テーブル18は、データ項目「No.」181、「テストデータ条件」182を含む。「No.」181には、テストデータ条件を識別する情報に対応するNo.が格納される。「テストデータ」182には、「No.」191に格納されたNo.に対応するテストデータ条件情報が格納される。   The test data condition table 18 includes data items “No.” 181 and “test data conditions” 182. “No.” 181 stores a No. corresponding to information for identifying the test data condition. “Test data” 182 stores test data condition information corresponding to the No. stored in “No.” 191.

図10は、本実施形態(実施例1)におけるパスコンディションテーブルの一例を示す。パスコンディション情報34は、取得部13によりパスコンディションテーブル19に格納されたパスコンディション集合である。なお、図10では、パスコンディションに含まれる原子論理式間を連結する記号が、論理積「∧」で示されている。ここで、原子論理式とは、論理式の最小単位(単独の条件)またはその否定である。論理式とは、条件(事前条件または事後条件)を表す式である。論理式の否定とは、論理式にNOTを結合した論理式である。   FIG. 10 shows an example of a path condition table in the present embodiment (Example 1). The path condition information 34 is a set of path conditions stored in the path condition table 19 by the acquisition unit 13. In FIG. 10, the symbol that connects the atomic logical expressions included in the path condition is indicated by a logical product “∧”. Here, the atomic logical formula is the minimum unit (single condition) of the logical formula or its negation. A logical expression is an expression that represents a condition (precondition or postcondition). The negation of a logical expression is a logical expression obtained by combining NOT with a logical expression.

パスコンディションテーブル19は、データ項目「No.」191、「パスコンディション」192を含む。「No.」191には、パスコンディションを識別する情報に対応するNo.が格納される。「パスコンディション」192には、「No.」191に格納されたNo.に対応するパスコンディション情報が格納される。   The path condition table 19 includes data items “No.” 191 and “path condition” 192. “No.” 191 stores a No. corresponding to information for identifying a path condition. In the “pass condition” 192, the path condition information corresponding to the No. stored in the “No.” 191 is stored.

図11は、本実施形態(実施例1)におけるマッチング部の処理について説明するための図である。マッチング部14は、テストデータ条件テーブル18から、1つのテストケース(例えば、「(a==-1)∧(b==0)∧(c==0)∧(d==null)」)を取り出す(S1)。   FIG. 11 is a diagram for explaining the processing of the matching unit in the present embodiment (Example 1). The matching unit 14 determines from the test data condition table 18 one test case (for example, “(a == − 1) ∧ (b == 0) ∧ (c == 0) ∧ (d == null)”). Is taken out (S1).

次に、マッチング部14は、パスコンディションテーブル19内の1つのパスコンディション(例えば、「(a<0)∧(d==null)」)を取り出す。マッチング部14は、制約ソルバを用いて、取り出したテストデータ条件と、取り出したパスコンディションとが論理的に同値であるか否かを判定する(S2)。ここで、論理式Aと論理式Bが論理的に同値であるとは、「(AならばB)かつ(BならばA)が成り立つ」ことを表す。したがって、上記の例の場合、「(a==-1)∧(b==0)∧(c==0)∧(d==null) → (a<0)∧(d==null) ∧ (a<0)∧(d==null) → (a==-1)∧(b==0)∧(c==0)∧(d==null)」の要件を充足するかが判定される。   Next, the matching unit 14 extracts one path condition (for example, “(a <0) ∧ (d == null)”) in the path condition table 19. Using the constraint solver, the matching unit 14 determines whether or not the extracted test data condition and the extracted path condition are logically equivalent (S2). Here, the logical expression A and the logical expression B are logically equivalent means that “(A if B) and (B if A) hold”). Therefore, in the above example, `` (a ==-1) = (b == 0) ∧ (c == 0) ∧ (d == null) → (a <0) ∧ (d == null) ∧ (a <0) ∧ (d == null) → (a ==-1) ∧ (b == 0) = 0 (c == 0) ∧ (d == null) '' Determined.

テストデータ条件とパスコンディションとが論理的に同値となる要件を充足可能であると判定した場合、マッチング部14は、パスコンディションテーブル19内の対応するパスコンディションに、マッチしたことを示すマッチフラグを付与する(S3)。テストデータ条件とパスコンディションとが論理的に同値となる要件を充足不能であると判定した場合、マッチング部14は、パスコンディションテーブル19から、次のパスコンディションを取り出す。   When it is determined that the requirement that the test data condition and the path condition are logically equivalent can be satisfied, the matching unit 14 displays a match flag indicating that the test condition and the corresponding path condition in the path condition table 19 are matched. (S3). When it is determined that the requirement that the test data condition and the path condition are logically equivalent cannot be satisfied, the matching unit 14 extracts the next path condition from the path condition table 19.

図12は、図10のパスコンディションテーブルにデータ項目「マッチフラグ」193を追加した一例を示す。図11で説明したように、マッチング部14は、テストデータ条件テーブル18から取り出したテストデータ条件と、パスコンディションテーブル19から取り出したパスコンディションとが論理的に同値であるか否かを判定する。その結果、論理的に同値となる要件を充足可能であると判定した場合、マッチング部14は、図12に示すように、パスコンディションテーブル19において、対応するパスコンディションに、マッチしたことを示すマッチフラグを付与する。   FIG. 12 shows an example in which a data item “match flag” 193 is added to the path condition table of FIG. As described with reference to FIG. 11, the matching unit 14 determines whether the test data condition retrieved from the test data condition table 18 and the path condition retrieved from the path condition table 19 are logically equivalent. As a result, if it is determined that the logically equivalent requirement can be satisfied, the matching unit 14 matches the corresponding path condition in the path condition table 19 as shown in FIG. Give a flag.

図12では、テストケースTC01と、パスコンディション01とがマッチしたことにより、No.1のパスコンディションにマッチフラグが付与されている。また、テストケースTC02,TC04と、パスコンディション10とがマッチしたことにより、No.10のパスコンディションにマッチフラグが付与されている。また、マッチフラグに基づいて、テストケースTC03とパスコンディション11とがマッチしたことにより、No.11のパスコンディションにマッチフラグが付与されている。   In FIG. 12, the match flag is assigned to the No. 1 path condition because the test case TC01 and the path condition 01 match. In addition, since the test cases TC02 and TC04 and the path condition 10 are matched, a match flag is assigned to the No. 10 path condition. Further, because the test case TC03 and the pass condition 11 are matched based on the match flag, the match flag is assigned to the No. 11 pass condition.

図13は、抽出パスコンディションテーブルの1一例を示す。抽出パスコンディションテーブルには、図12に示すパスコンディションテーブルから、マッチフラグが付与されていないパスコンディションを抽出して得られたパスコンディション情報が格納される。データ生成部15は、図12に示すパスコンディションテーブルから、マッチフラグが付与されていないパスコンディションを抽出する。図12の場合、No.02〜09,12で示すパスコンディションが抽出される。その抽出結果が、図13である。   FIG. 13 shows an example of the extraction path condition table. The extracted path condition table stores path condition information obtained by extracting a path condition to which no match flag is assigned from the path condition table shown in FIG. The data generation unit 15 extracts a path condition to which no match flag is assigned from the path condition table shown in FIG. In the case of FIG. The path conditions indicated by 02 to 09 and 12 are extracted. The extraction result is shown in FIG.

図14は、本実施形態(実施例1)において、生成されるテストデータの一例を示す。データ生成部15は、制約ソルバを用いて、図13において抽出されたパスコンディションからテストデータ35を生成する。テストデータ35は、修正後のプログラムのテストにおいて、修正前のプログラムのテストで用いたデータの他に、新たに追加されるテストデータである。ここで、パスコンディションに現れない変数については、予め決められたデフォルト値とする。例えば、図13の1つ目のパスコンディションには「b」と「c」が現れないので、予め決められたデフォルト値0が設定されることとなる。   FIG. 14 shows an example of test data generated in the present embodiment (Example 1). The data generation unit 15 generates test data 35 from the path condition extracted in FIG. 13 using a constraint solver. The test data 35 is newly added test data in addition to the data used in the test of the program before correction in the test of the program after correction. Here, variables not appearing in the path condition are set to predetermined default values. For example, since “b” and “c” do not appear in the first path condition in FIG. 13, a predetermined default value 0 is set.

図15−図17は、本実施形態(実施例1)におけるテストケース選択フローの一例を示す。ユーザは、修正前プログラムのテストで用いたテストデータ31、修正後のプログラムのソースコードに対して行ったシンボリック実行により得られたパスコンディション情報34を、入力装置を用いて、テストデータ生成装置11に入力する。   15 to 17 show an example of a test case selection flow in the present embodiment (Example 1). The user uses the input device to input the test data 31 used in the test of the pre-correction program and the path condition information 34 obtained by the symbolic execution performed on the source code of the post-correction program using the input device. To enter.

取得部13は、テストデータ31から1レコードのテストケースのテストデータを取り出す(S11,S12)。取得部13は、テストデータの条件(論理式)を論理積∧で連結した論理式(テストデータ条件式)に変換し(S13)、テストデータ条件テーブル18に格納する(S14)。取得部13は、入力されたテストデータ31に含まれるテストケースのテストデータについてS11〜S14の処理を繰り返す。   The acquisition unit 13 extracts the test data of one record test case from the test data 31 (S11, S12). The acquisition unit 13 converts the test data condition (logical expression) into a logical expression (test data conditional expression) concatenated by logical conjunction (S13), and stores it in the test data condition table 18 (S14). The acquisition unit 13 repeats the processing of S11 to S14 for the test data of the test case included in the input test data 31.

取得部13は、入力されたパスコンディション情報をパスコンディションテーブル19に格納する(S15)。   The acquiring unit 13 stores the input path condition information in the path condition table 19 (S15).

次に、マッチング部14は、テストデータ条件テーブル18から1レコードのテストデータ条件式を取り出す(S16で「Yes」,S17)。また、マッチング部14は、パスコンディションテーブル19から1レコードのパスコンディションを取り出す(S18で「Yes」、S19)。   Next, the matching unit 14 extracts one record of the test data conditional expression from the test data condition table 18 (“Yes” in S16, S17). In addition, the matching unit 14 extracts one record of the path condition from the path condition table 19 (“Yes” in S18, S19).

マッチング部14は、取り出したテストデータ条件式と、取り出したパスコンディションから、図11で説明したように、両者が論理的に同値であるかを判定する判定式を作成する(S20)。   As described with reference to FIG. 11, the matching unit 14 creates a determination expression for determining whether or not both are logically equivalent from the extracted test data conditional expression and the extracted path condition (S20).

マッチング部14は、制約ソルバを用いて、S20で作成した判定式から、そのテストデータ条件式とパスコンディションが論理的に同値であるかを判定する(S21)。そのテストデータ条件式とパスコンディションが論理的に同値でない場合(S21で「No」)、マッチング部14は、パスコンディションテーブル19から次のパスコンディションのレコードを取り出し(S18)、S19−S21の処理を行う。パスコンディションテーブル19に、未処理のパスコンディションがない場合(S18で「No」)、マッチング部14は、テストデータ条件テーブル18から次のテストデータ条件式のレコードを取り出し(S16で「Yes」,S17)、S18以降の処理を行う。   The matching unit 14 uses the constraint solver to determine whether the test data conditional expression and the path condition are logically equivalent from the determination expression created in S20 (S21). When the test data conditional expression and the path condition are not logically equivalent (“No” in S21), the matching unit 14 takes out the record of the next path condition from the path condition table 19 (S18), and performs the processing of S19 to S21. I do. When there is no unprocessed path condition in the path condition table 19 (“No” in S18), the matching unit 14 extracts the record of the next test data conditional expression from the test data condition table 18 (“Yes” in S16, S17), the process after S18 is performed.

そのテストデータ条件式とパスコンディションが論理的に同値である場合(S21で「Yes」)、マッチング部14は、図12で説明したように、パスコンディションテーブル19において、対応するパスコンディションにマッチフラグを付与する(S22)。その後、マッチング部14は、テストデータ条件テーブル18から次のテストデータ条件式のレコードを取り出し(S16で「Yes」,S17)、S18以降の処理を行う。   When the test data conditional expression and the path condition are logically equivalent (“Yes” in S21), the matching unit 14 matches the corresponding path condition in the path condition table 19 as described in FIG. (S22). Thereafter, the matching unit 14 takes out the record of the next test data conditional expression from the test data condition table 18 (“Yes” in S16, S17), and performs the processes after S18.

テストデータ条件テーブル18に含まれる全テストデータ条件式について、S17−S22の処理が終了した場合(S16で「No」)、S23の処理へ進む。   When the processing of S17 to S22 is completed for all the test data conditional expressions included in the test data condition table 18 ("No" in S16), the process proceeds to S23.

データ生成部15は、パスコンディションテーブル19から1つのパスコンディションのレコードを選択する(S23で「Yes」、S24)。選択したパスコンディションにマッチフラグが付与されている場合(S25で「No」)、データ生成部15は、パスコンディションテーブル19から次のパスコンディションのレコードを選択する(S23で「Yes」、S24)。選択したパスコンディションにマッチフラグが付与されていない場合(S25で「Yes」)、データ生成部15は、そのパスコンディションを抽出し、抽出パスコンディションテーブル20へ格納する(S26)。   The data generation unit 15 selects a record of one path condition from the path condition table 19 (“Yes” in S23, S24). When a match flag is given to the selected path condition (“No” in S25), the data generation unit 15 selects a record of the next path condition from the path condition table 19 (“Yes” in S23, S24). . If no match flag is given to the selected path condition (“Yes” in S25), the data generating unit 15 extracts the path condition and stores it in the extracted path condition table 20 (S26).

テストデータ条件テーブル18に含まれる全テストデータ条件式について、S24−S26の処理が終了した場合(S23で「No」)、データ生成部15は、次の処理を行う。すなわち、データ生成部15は、抽出パスコンディションテーブル20に格納されたパスコンディションを、制約ソルバに入力する(S27)。   When the processing of S24 to S26 is completed for all the test data conditional expressions included in the test data condition table 18 (“No” in S23), the data generation unit 15 performs the following processing. That is, the data generation unit 15 inputs the path condition stored in the extracted path condition table 20 to the constraint solver (S27).

すると、データ生成部15は、制約ソルバからパスコンディションの充足値(テストデータ35)を取得する(S28)。ここで、得られたテストデータ34は、修正後のプログラムのテストデータであって、修正前のプログラムのテストケースで用いたテストデータに対して追加すべきテストデータである。   Then, the data generation unit 15 acquires a satisfaction value (test data 35) of the path condition from the constraint solver (S28). Here, the obtained test data 34 is test data of the program after correction, and is test data to be added to the test data used in the test case of the program before correction.

本実施形態(実施例1)によれば、修正/変更後のプログラムのソースコードについてのシンボリック実行から得られるパスコンディションと修正前に用いたテストデータとのマッチングを行う。これにより、テスト資産内の再利用可能なテストケースを特定することができる。すなわち、本実施形態(実施例1)によれば、修正/変更後の差分に対応するテストケース(テストデータ)が抽出され、再テストのコスト削減の効果が得られる。   According to this embodiment (Example 1), matching is performed between the path condition obtained from the symbolic execution of the source code of the corrected / changed program and the test data used before the correction. Thereby, the reusable test case in the test asset can be specified. That is, according to the present embodiment (Example 1), test cases (test data) corresponding to the corrected / changed differences are extracted, and an effect of reducing the cost of retesting can be obtained.

(実施例2)
実施例1では、修正後のプログラムのソースコードについてシンボリック実行を行って得られたパスコンディションのうち、修正前のプログラムのテストデータでは対応できない部分を補完できるテストデータを追加した。
(Example 2)
In the first embodiment, test data that can complement a portion of the path condition obtained by performing symbolic execution on the source code of the corrected program that cannot be handled by the test data of the program before the correction is added.

しかしながら、シンボリック実行は、実行可能な全てのパスコンディションを生成するため、パスコンディションの組み合わせが膨大になる。その結果、パスカバレッジに基づくテストケースの数も膨大になる。   However, symbolic execution generates all path conditions that can be executed, resulting in an enormous number of combinations of path conditions. As a result, the number of test cases based on path coverage also becomes enormous.

この場合、それらのテストケースには、コードカバレッジの観点から、冗長なテストケースを多く含む可能性がある。
そこで、実施例2では、実施例1において追加すべきテストケースとして判定されたテストケースのうち、コードカバレッジを確保しながら、冗長なテストケースを排除した、テストケースを選択することについて説明する。
In this case, these test cases may include many redundant test cases from the viewpoint of code coverage.
Therefore, in the second embodiment, a description will be given of selecting a test case that excludes redundant test cases while ensuring code coverage among the test cases determined as test cases to be added in the first embodiment.

本実施形態(実施例2)では、実施例1でシンボリック実行により生成されるパスコンディション(テストケース)を原子論理式に分解して、パスコンディションに含まれる全種類の原子論理式を実行できるようにパスコンディション(テストケース)を選択する。このとき、テストケースの選択に際して、既に選択したいずれのパスコンディションにも含まれていない原子論理式を含むパスコンディションを選択する。この選択したパスコンディションと、実施例1でマッチフラグが付与されていないパスコンディションとの差分のパスコンディションを抽出する。制約ソルバを用いて、この差分のパスコンディションから追加すべきテストデータが得られる。   In this embodiment (Example 2), the path conditions (test cases) generated by symbolic execution in Example 1 are decomposed into atomic logical expressions so that all types of atomic logical expressions included in the path conditions can be executed. Select a pass condition (test case). At this time, when selecting a test case, a path condition including an atomic logical formula that is not included in any of the already selected path conditions is selected. A differential path condition between the selected path condition and a path condition to which no match flag is assigned in the first embodiment is extracted. Using the constraint solver, test data to be added is obtained from the path condition of the difference.

図18は、本実施形態(実施例2)におけるテストデータ生成装置の構成の一例を示す。図18のテストデータ生成装置11は、図7のテストデータ生成装置11に、テストケース選択部40、原子論理式テーブル51、目標論理式テーブル52、選択パスコンディションテーブル53を追加したものである。   FIG. 18 shows an example of the configuration of the test data generation apparatus according to the present embodiment (Example 2). The test data generation device 11 in FIG. 18 is obtained by adding a test case selection unit 40, an atomic logical formula table 51, a target logical formula table 52, and a selected path condition table 53 to the test data generation device 11 in FIG.

図18のテストデータ生成装置11は、制御部12、記憶部17を含む。記憶部17は、テーブルデータ条件テーブル18、パスコンディションテーブル19、抽出パスコンディションテーブル20、原子論理式テーブル51、目標論理式テーブル52、選択パスコンディションテーブル53を含む。   The test data generation device 11 in FIG. 18 includes a control unit 12 and a storage unit 17. The storage unit 17 includes a table data condition table 18, a path condition table 19, an extracted path condition table 20, an atomic logical formula table 51, a target logical formula table 52, and a selected path condition table 53.

テーブルデータ条件テーブル18、パスコンディションテーブル19、抽出パスコンディションテーブル20は、実施例1で説明しているので、その説明を省略する。   Since the table data condition table 18, the path condition table 19, and the extracted path condition table 20 have been described in the first embodiment, description thereof will be omitted.

原子論理式テーブル51には、パスコンディション毎に、パスコンディションに含まれる原子論理式が格納される。目標論理式テーブル52には、パスコンディションを構成する原子論理式が種類毎に格納される。選択パスコンディションテーブル53には、パスコンディションテーブル19に含まれるパスコンディションのうち、選択部43により選択されたパスコンディションが格納される。   The atomic logical formula table 51 stores the atomic logical formula included in the path condition for each path condition. In the target logical expression table 52, the atomic logical expressions constituting the path condition are stored for each type. The selected path condition table 53 stores the path conditions selected by the selection unit 43 among the path conditions included in the path condition table 19.

制御部12は、取得部13、マッチング部14、テストケース選択部40、データ生成部15、出力部16を含む。取得部13は、入力装置(不図示)により、テストデータ31、パスコンディション情報(テストケース)34を取得し、それぞれ、テストデータ条件テーブル18、パスコンディションテーブル19に格納する。テストデータ31は、修正前のプログラムのテストで用いたテストケース毎のテストデータである。パスコンディション情報34は、修正したプログラムのソースコードについてシンボリック実行を行うことにより得られた実行パスの組み合わせ、すなわちパスコンディションの組み合わせ(テストケース)を含む情報である。   The control unit 12 includes an acquisition unit 13, a matching unit 14, a test case selection unit 40, a data generation unit 15, and an output unit 16. The acquisition unit 13 acquires test data 31 and path condition information (test case) 34 by an input device (not shown), and stores them in the test data condition table 18 and the path condition table 19, respectively. The test data 31 is test data for each test case used in the test of the program before correction. The path condition information 34 is information including combinations of execution paths obtained by performing symbolic execution on the source code of the modified program, that is, combinations of path conditions (test cases).

マッチング部14は、パスコンディションテーブル19から、各テストデータ条件と論理的同値の関係にあるパスコンディションを選択し、その選択したパスコンディションにマッチフラグを付与する。   The matching unit 14 selects a path condition that is logically equivalent to each test data condition from the path condition table 19, and assigns a match flag to the selected path condition.

テストケース選択部40は、分解部41、抽出部42、選択部43、差分取得部44を含む。分解部41は、パスコンディションテーブル19において、マッチフラグが付与されたパスコンディションがテーブルの先頭側になるようにソートする。分解部41は、ソート処理が終わったパスコンディションテーブル19に格納した各パスコンディションを原子論理式に分解する。分解部41は、その原子論理式を、パスコンディション毎に、原子論理式テーブル51に格納する。   The test case selection unit 40 includes a decomposition unit 41, an extraction unit 42, a selection unit 43, and a difference acquisition unit 44. The decomposing unit 41 sorts the path condition table 19 so that the path condition to which the match flag is assigned is at the head of the table. The decomposition unit 41 decomposes each path condition stored in the path condition table 19 after the sorting process into an atomic logical expression. The decomposition unit 41 stores the atomic logical formula in the atomic logical formula table 51 for each path condition.

抽出部42は、原子論理式テーブル51において、着目しているパスコンディションの原子論理式から、目標論理式テーブル52にそれまでに保持した原子論理式以外の原子論理式を抽出する。抽出部42は、その抽出した原子論理式を目標論理式テーブル52に格納する。また、抽出部42は、その抽出された原子論理式を含んでいたパスコンディションを特定するために、原子論理式テーブル51において、そのパスコンディションに選択フラグを立てる。   The extraction unit 42 extracts an atomic logical expression other than the atomic logical expressions held so far in the target logical expression table 52 from the atomic logical expressions of the focused path condition in the atomic logical expression table 51. The extraction unit 42 stores the extracted atomic logical formula in the target logical formula table 52. Further, the extraction unit 42 sets a selection flag for the path condition in the atomic logic formula table 51 in order to specify the path condition that includes the extracted atomic logic formula.

選択部43は、原子論理式テーブル51から、選択フラグの立っているパスコンディションを検出する。選択部43は、パスコンディションテーブル19から、その検出したパスコンディションに対応するパスコンディションを選択し、選択パスコンディションテーブル53に格納する。   The selection unit 43 detects a path condition in which a selection flag is set from the atomic logic formula table 51. The selection unit 43 selects a path condition corresponding to the detected path condition from the path condition table 19 and stores it in the selected path condition table 53.

差分取得部44は、パスコンディションテーブル19において、マッチフラグが付与されたパスコンディションと、選択パスコンディションテーブル53に格納したパスコンディションとの差分を取得し、抽出パスコンディションテーブル20に格納する。   The difference acquisition unit 44 acquires the difference between the path condition to which the match flag is assigned in the path condition table 19 and the path condition stored in the selected path condition table 53 and stores the difference in the extracted path condition table 20.

データ生成部15は、データ生成部15は、制約ソルバを用いて、抽出パスコンディションテーブル20に格納されたパスコンディションから、テストケース35を生成する。   The data generation unit 15 generates a test case 35 from the path condition stored in the extracted path condition table 20 using a constraint solver.

出力部16は、生成されたテストケース35をディスプレイ、プリンタ等の出力装置に出力する。テストケース35は、修正後のプログラムのテストについて、新たに追加すべきテストケースである。   The output unit 16 outputs the generated test case 35 to an output device such as a display or a printer. The test case 35 is a test case to be newly added for the test of the program after correction.

分解部41、抽出部42、選択部43、差分取得部44の機能について、以下に詳述する。
図19は、図12のパスコンディションテーブル19において、マッチフラグが付与されたパスコンディションがテーブルの先頭側になるように並べ替えた様子を示す。上述したように、分解部41は、マッチフラグが付与されたパスコンディションがパスコンディションテーブル19の先頭側にくるようにソートする。
The functions of the decomposition unit 41, the extraction unit 42, the selection unit 43, and the difference acquisition unit 44 will be described in detail below.
FIG. 19 shows how the path condition table 19 shown in FIG. 12 is rearranged so that the path condition to which the match flag is assigned is at the head of the table. As described above, the disassembling unit 41 sorts so that the path condition to which the match flag is assigned comes to the head of the path condition table 19.

図20は、本実施形態(実施例2)におけるテストケース選択部の処理内容を説明するための図である。テストケース選択部40は、マッチフラグの有無によって、ソートされたパスコンディション(図19)からコードカバレッジを確保したパスコンディションを選択する。   FIG. 20 is a diagram for explaining the processing contents of the test case selection unit in the present embodiment (Example 2). The test case selection unit 40 selects a path condition that ensures code coverage from the sorted path conditions (FIG. 19) depending on the presence or absence of the match flag.

図21は、本実施形態(実施例2)のテストケース選択処理を説明するための図である。テストケース選択部40は、各テストケースが有するパスコンディションを解析することで、テストケースを実際に実行することなく、全テストケースから、あるカバレッジを満たすテストケースを探す。すなわち、テストケース選択部40は、パスコンディションに含まれる原子論理式をプログラム上の条件式として、各パスコンディションが全種類の原子論理式(もしくはその組み合わせ)のうちどれだけの原子論理式を充足したかをパスコンディション上で解析する。コードカバレッジは、プログラム中の条件式内の原子条件と密接な関係がある。ここで、原子条件とは、原子論理式に対応するソースコード上の条件である。   FIG. 21 is a diagram for describing test case selection processing according to the present embodiment (Example 2). The test case selection unit 40 searches for a test case satisfying a certain coverage from all test cases without actually executing the test case by analyzing the path condition of each test case. That is, the test case selection unit 40 satisfies the atomic logical expressions included in the path conditions as conditional expressions on the program, and how many atomic logical expressions among all kinds of atomic logical expressions (or combinations thereof) are satisfied for each path condition. It is analyzed on the pass condition. Code coverage is closely related to atomic conditions in conditional expressions in the program. Here, the atomic condition is a condition on the source code corresponding to the atomic logical expression.

図21の表は、マッチフラグの有無によってソートされたパスコンディション(テストケース)を、原子論理式に分解してテーブル化したものである。図21の表の列方向には、パスコンディション上の原子論理式が並べられている。No.01のパスコンディションが「(a<0)∧(d==null)」であると、図21の表では、「a<0」、「d==null」に「〇」が付されている。   The table of FIG. 21 is a table in which path conditions (test cases) sorted according to the presence or absence of a match flag are decomposed into atomic logical expressions. In the column direction of the table of FIG. 21, atomic logical expressions on the path condition are arranged. When the path condition of No. 01 is “(a <0) ∧ (d == null)”, “o” is added to “a <0” and “d == null” in the table of FIG. ing.

まず、No.01のパスコンディションを選択する。No.01のパスコンディションは、上述の通り、原子論理式「a<0」、「d==null」を含む。   First, select the path condition No.01. The path condition of No. 01 includes the atomic logical expressions “a <0” and “d == null” as described above.

次にNo.10のパスコンディションに着目する。No.10のパスコンディションは、No.01のパスコンディションに含まれない原子論理式「a>=0」、「b<10」を含むので、No.10のパスコンディションを選択する。   Next, pay attention to No.10 pass condition. The path condition of No. 10 includes the atomic logical expressions “a> = 0” and “b <10” that are not included in the path condition of No. 01. Therefore, the path condition of No. 10 is selected.

次にNo.11のパスコンディションに着目する。No.11のパスコンディションは、No.01及びNo.10のパスコンディションのいずれにも含まれない原子論理式「d!=null」「d.length<5」を含むので、No.11のパスコンディションを選択する。   Next, pay attention to No.11 pass condition. The No. 11 path condition includes the atomic logical formulas “d! = Null” and “d.length <5” that are not included in either the No. 01 or No. 10 path condition. Select a condition.

次にNo.02のパスコンディションに着目する。No.02のパスコンディションに含まれる原子論理式はいずれも、No.01,No.10,No11のパスコンディションのいずれかに含まれるものなので、No.02のパスコンディションについては選択しない。   Next, focus on No.02 pass condition. Since all of the atomic logical expressions included in the No. 02 path condition are included in any of the No. 01, No. 10, and No. 11 path conditions, the No. 02 path condition is not selected.

次にNo.03のパスコンディションに着目する。No.03のパスコンディションは、No.01,No.10,No11, No.02のパスコンディションのいずれにも含まれない原子論理式「d.length>=5」を含むので、No.03のパスコンディションを選択する。   Next, focus on the No.03 pass condition. The path condition of No.03 includes the atomic logical formula “d.length> = 5” that is not included in any of the path conditions of No.01, No.10, No11, and No.02. Select a pass condition.

No.04のパスコンディション以降についても同様に、着目しているパスコンディションがそれまでに選択したパスコンディションに含まれる原子論理式と異なる原子論理式を含む場合に、その着目しているパスコンディションを選択する。そうすると、図21の表の場合には、12個のテストケースから6個のNo.01, No.10, No.11, No.03, No.04, No.07のパスコンディションが選択される。これにより、No.01, No.10, No.11, No.03, No.04, No.07のパスコンディションを用いれば、全パスコンディションの原子論理式を全て充足することができるテストを実行することができる。   Similarly, after the path condition of No. 04, if the target path condition includes an atomic logical formula different from the atomic logical formula included in the path condition selected so far, the target path condition is changed. select. Then, in the case of the table of FIG. 21, six No. 01, No. 10, No. 11, No. 03, No. 04, and No. 07 path conditions are selected from 12 test cases. . As a result, using the path conditions No.01, No.10, No.11, No.03, No.04, and No.07, a test that can satisfy all the atomic logical expressions of all path conditions is executed. can do.

図22は、本実施形態(実施例2)における原子論理式テーブルの一例を示す。原子論理式テーブル51は、データ項目「No.」511、「原子論理式」512を含む。「No.」51には、パスコンディションの識別情報に対応するNo.が格納される。「原子論理式」512には、「No.」51に格納されたNo.に対応するパスコンディション情報に含まれる原子論理式が格納される。   FIG. 22 shows an example of an atomic logical expression table in the present embodiment (Example 2). The atomic logical formula table 51 includes data items “No.” 511 and “atomic logical formula” 512. “No.” 51 stores a No. corresponding to the identification information of the path condition. The “atomic logical expression” 512 stores an atomic logical expression included in the path condition information corresponding to the No. stored in the “No.” 51.

ここで、原子論理式テーブル51に関する分解部41の動作について説明する。分解部41は、マッチフラグの有無によって、ソートされたパスコンディションテーブル19(図19)からパスコンディション情報を読み出し、読み出したパスコンディション情報を原子論理式に分解する。分解部41は、その原子論理式を、パスコンディション毎に、原子論理式テーブル51に格納する。   Here, the operation of the decomposition unit 41 related to the atomic logic formula table 51 will be described. The decomposition unit 41 reads path condition information from the sorted path condition table 19 (FIG. 19) depending on the presence or absence of a match flag, and decomposes the read path condition information into an atomic logical expression. The decomposition unit 41 stores the atomic logical formula in the atomic logical formula table 51 for each path condition.

図23は、図22の原子論理式テーブルにデータ項目「選択」513を追加した一例を示す。図24は、本実施形態(実施例2)における目標論理式テーブルの一例を示す。目標論理式テーブル52には、原子論理式テーブル51において、着目しているパスコンディションに含まれる原子論理式のうち、それまでに保持した原子論理式以外の原子論理式が保持される。これにより、目標論理式テーブル52には、最終的に、原子論理式テーブル51に含まれる全ての種類の原子論理式が格納される。すなわち、目標論理式テーブル52には、最終的に、全パスコンディションに含まれる原子論理式が種類毎に格納される。   FIG. 23 shows an example in which the data item “selection” 513 is added to the atomic logical expression table of FIG. FIG. 24 shows an example of the target logical expression table in the present embodiment (Example 2). The target logical formula table 52 holds atomic logical formulas other than the atomic logical formulas held so far among the atomic logical formulas included in the focused path condition in the atomic logical formula table 51. As a result, all types of atomic logical expressions included in the atomic logical expression table 51 are finally stored in the target logical expression table 52. That is, in the target logical expression table 52, finally, atomic logical expressions included in all path conditions are stored for each type.

ここで、目標論理式テーブル52に関する抽出部42の動作について説明する。抽出部42は、原子論理式テーブル51において、着目しているパスコンディションの原子論理式から、目標論理式テーブル52に保持されていない原子論理式を抽出する。抽出部42は、その抽出した原子論理式を目標論理式テーブル52に格納する。また、抽出部42は、原子論理式テーブル51において、その抽出された原子論理式を含んでいたパスコンディションに対応する「選択」513にフラグ(選択フラグ)を立てる。   Here, the operation of the extraction unit 42 regarding the target logical expression table 52 will be described. The extraction unit 42 extracts an atomic logical expression that is not held in the target logical expression table 52 from the atomic logical expression of the focused path condition in the atomic logical expression table 51. The extraction unit 42 stores the extracted atomic logical formula in the target logical formula table 52. Further, the extraction unit 42 sets a flag (selection flag) in the “selection” 513 corresponding to the path condition including the extracted atomic logical formula in the atomic logical formula table 51.

図25は、本実施形態(実施例2)における選択パスコンディションテーブルの一例を示す。選択部43は、原子論理式テーブル51から、フラグの立っているパスコンディションを検出する。選択部43は、パスコンディションテーブル19から、その検出したパスコンディションに対応するパスコンディションを選択し、選択パスコンディションテーブル53に格納する。   FIG. 25 shows an example of the selected path condition table in the present embodiment (Example 2). The selection unit 43 detects the flag condition in which the flag is set from the atomic logic formula table 51. The selection unit 43 selects a path condition corresponding to the detected path condition from the path condition table 19 and stores it in the selected path condition table 53.

図26は、本実施形態(実施例2)における選択パスコンディションテーブルに格納されたパスコンディションと、マッチフラグが付与されたパスコンディションとの差分について説明するための図である。選択パスコンディションテーブル53に格納されたパスコンディションは、No.=01, 10, 11, 03, 04, 07である。マッチフラグが付与されたパスコンディションは、No.=01, 10, 11である。差分取得部44は、選択パスコンディションテーブル53に格納されたパスコンディションと、マッチフラグが付与されたパスコンディションとの差分No.=03, 04, 07のパスコンディション(差分パスコンディション)を取得する。差分取得部44は、その差分パスコンディションを、抽出パスコンディションテーブル20に格納する。   FIG. 26 is a diagram for explaining the difference between the path condition stored in the selected path condition table and the path condition to which a match flag is assigned in the present embodiment (example 2). The path conditions stored in the selected path condition table 53 are No. = 01, 10, 11, 03, 04, 07. The path conditions to which the match flag is assigned are No. = 01, 10, 11. The difference acquisition unit 44 acquires a path condition (difference path condition) of difference No. = 03, 04, 07 between the path condition stored in the selected path condition table 53 and the path condition to which the match flag is assigned. The difference acquisition unit 44 stores the difference path condition in the extraction path condition table 20.

図27は、本実施形態(実施例2)におけるデータ生成部15の処理を説明するための図である。データ生成部15は、制約ソルバを用いて、抽出パスコンディションテーブル20に格納された差分パスコンディションからテストデータ35を生成する。   FIG. 27 is a diagram for explaining the processing of the data generation unit 15 in the present embodiment (Example 2). The data generation unit 15 generates test data 35 from the differential path condition stored in the extracted path condition table 20 using a constraint solver.

図28−図30は、本実施形態(実施例2)におけるテストデータ生成フローの一例を示す。図15、図16の処理後に、図28−図30の処理が行われる。   28 to 30 show an example of a test data generation flow in the present embodiment (Example 2). After the processes in FIGS. 15 and 16, the processes in FIGS. 28 to 30 are performed.

テストケース選択部40(分解部41)は、マッチフラグが付与されたパスコンディションがパスコンディションテーブル19の先頭側にくるようにソートする(S31)。テストケース選択部40は、テストケース選択処理を行う(S32)。S32の処理については、図31−図33を用いて詳述する。これにより、選択パスコンディションテーブル53(図25)に、ブランチカバレッジが確保されたパスコンディション(テストケース)が格納される。   The test case selection unit 40 (decomposition unit 41) sorts so that the path condition to which the match flag is assigned is at the head of the path condition table 19 (S31). The test case selection unit 40 performs a test case selection process (S32). The process of S32 will be described in detail with reference to FIGS. As a result, a path condition (test case) in which branch coverage is secured is stored in the selected path condition table 53 (FIG. 25).

差分取得部44は、選択パスコンディションテーブル53から1レコードのパスコンディション(「対象パスコンディションT1」と呼ぶ)を取り出す(S33で「Yes」、S34)。   The difference acquisition unit 44 extracts a path condition of one record (referred to as “target path condition T1”) from the selected path condition table 53 (“Yes” in S33, S34).

差分取得部44は、パスコンディションテーブル19から1レコードのパスコンディション(「対象パスコンディションT2」と呼ぶ)を取り出す(S35で「Yes」、S36)。   The difference acquisition unit 44 extracts a path condition of one record (referred to as “target path condition T2”) from the path condition table 19 (“Yes” in S35, S36).

差分取得部44は、対象パスコンディションT1と対象パスコンディションT2が同一の式で、かつ対象パスコンディションT2のマッチフラグが立っていないかを判定する(S37)。   The difference acquisition unit 44 determines whether the target path condition T1 and the target path condition T2 are the same expression and the match flag of the target path condition T2 is not set (S37).

対象パスコンディションT1と対象パスコンディションT2が同一の式でないか、または対象パスコンディションT2のマッチフラグが立っている場合(S37で「No」)、差分取得部44は、次の処理を行う。すなわち、差分取得部44は、パスコンディションテーブル19から次のパスコンディションを取り出し、S36以降の処理を行う。パスコンディションテーブル19に未処理のパスコンディションがない場合、S33の処理へ戻る。   If the target path condition T1 and the target path condition T2 are not the same expression, or the match flag of the target path condition T2 is set (“No” in S37), the difference acquisition unit 44 performs the following process. That is, the difference acquisition unit 44 retrieves the next path condition from the path condition table 19 and performs the processes after S36. If there is no unprocessed path condition in the path condition table 19, the process returns to S33.

対象パスコンディションT1と対象パスコンディションT2が同一の式で、かつ対象パスコンディションT2のマッチフラグが立っていない場合、差分取得部44は、パスコンディションテーブル内の対象パスコンディションT2に差分フラグを立てる(S38)。その後、S35の処理へ戻る。   When the target path condition T1 and the target path condition T2 are the same expression and the match flag of the target path condition T2 is not set, the difference acquisition unit 44 sets a difference flag in the target path condition T2 in the path condition table ( S38). Thereafter, the process returns to S35.

選択パスコンディションテーブル53に格納された全パスコンディションについてS34〜S38の処理が完了した場合(S33で「No」)、S39の処理へ進む。   When the processes of S34 to S38 are completed for all the path conditions stored in the selected path condition table 53 ("No" in S33), the process proceeds to S39.

データ生成部15は、パスコンディションテーブル19から1レコードのパスコンディションを選択する(S39で「Yes」、S40)。選択したパスコンディションに差分フラグが付与されていない場合(S41で「No」)、データ生成部15は、パスコンディションテーブル19から次のパスコンディションを選択する(S39で「Yes」、S40)。選択したパスコンディションに差分フラグが付与されている場合(S41で「Yes」)、データ生成部15は、そのパスコンディションを抽出し、抽出パスコンディションテーブル20へ格納する(S42)。   The data generation unit 15 selects a path condition of one record from the path condition table 19 (“Yes” in S39, S40). When the difference flag is not given to the selected path condition (“No” in S41), the data generation unit 15 selects the next path condition from the path condition table 19 (“Yes” in S39, S40). When a difference flag is given to the selected path condition (“Yes” in S41), the data generation unit 15 extracts the path condition and stores it in the extracted path condition table 20 (S42).

パスコンディションテーブル19に含まれる全パスコンディションについて、S40−S42の処理が終了した場合(S39で「No」)、データ生成部15は、次の処理を行う。すなわち、データ生成部15は、抽出パスコンディションテーブル20に格納されたパスコンディションを、制約ソルバに入力する(S43)。   When the processes of S40 to S42 are completed for all the path conditions included in the path condition table 19 (“No” in S39), the data generation unit 15 performs the following process. That is, the data generation unit 15 inputs the path condition stored in the extracted path condition table 20 to the constraint solver (S43).

すると、データ生成部15は、制約ソルバからパスコンディションの充足値(テストデータ)を取得する(S28)。ここで、得られたテストデータは、修正後のプログラムのテストデータであって、修正前のプログラムのテストケースで用いたテストデータに対して追加すべきテストデータである。   Then, the data generation unit 15 acquires a satisfaction value (test data) of the path condition from the constraint solver (S28). Here, the obtained test data is test data of the program after correction, and is test data to be added to the test data used in the test case of the program before correction.

図31−図33は、本実施形態(実施例2)におけるテストケース選択フローの一例を示す。図31−図33は、図28のS32の詳細なフローを示す。   FIGS. 31 to 33 show an example of a test case selection flow in the present embodiment (Example 2). 31 to 33 show a detailed flow of S32 of FIG.

分解部41は、パスコンディションテーブル19からレコードを読み出す(S51で「Yes」、S52)。分解部41は、読み出したレコードのパスコンディションに原子論理式が存在するか否かを判定する(S53)。読み出したレコードのパスコンディションに原子論理式が存在する場合(S53で「Yes」)、分解部41はそのレコードのパスコンディションに含まれる原子論理式を取り出し、原子論理式テーブル51に格納する(S54)。そのレコードのパスコンディションから全ての原子論理式を取り出し終わるまで、分解部41はS54の処理を繰り返す。   The disassembling unit 41 reads a record from the path condition table 19 (“Yes” in S51, S52). The decomposition unit 41 determines whether an atomic logical expression exists in the path condition of the read record (S53). If an atomic logical expression exists in the path condition of the read record (“Yes” in S53), the decomposition unit 41 extracts the atomic logical expression included in the path condition of the record and stores it in the atomic logical expression table 51 (S54). ). The decomposition unit 41 repeats the process of S54 until all the atomic logical expressions are extracted from the path condition of the record.

読み出したレコードのパスコンディションに原子論理式が存在しない場合(S53で「No」)、パスコンディションテーブル19に未処理のレコードが存在すれば(S51で「Yes」)、分解部41は、次の処理を行う。すなわち、分解部41は、パスコンディションテーブル19から次のレコードを読み出し、S53〜S54の処理を行う。パスコンディションテーブル19に未処理のレコードが存在しなければ(S51で「No」)、図30のS55の処理へ処理が遷移する。   If there is no atomic logical expression in the path condition of the read record (“No” in S53), and there is an unprocessed record in the path condition table 19 (“Yes” in S51), the decomposition unit 41 Process. That is, the decomposition unit 41 reads the next record from the path condition table 19 and performs the processes of S53 to S54. If there is no unprocessed record in the path condition table 19 (“No” in S51), the process transitions to the process of S55 in FIG.

次に、抽出部42は、原子論理式テーブル51からレコードを読み出す(S55で「Yes」、S56)。抽出部42は、S56で読み出したレコードに含まれる原子論理式のうち、目標論理式テーブル52に存在しない原子論理式が存在するか否かを判定する(S57)。   Next, the extraction unit 42 reads a record from the atomic logical formula table 51 (“Yes” in S55, S56). The extraction unit 42 determines whether there is an atomic logical expression that does not exist in the target logical expression table 52 among the atomic logical expressions included in the record read in S56 (S57).

S56で読み出したレコードに含まれる原子論理式のうち、目標論理式テーブル52に存在しない原子論理式(差分)が存在する場合、抽出部42は、その差分の原子論理式を目標論理式テーブル52に追加する(S58)。このとき、抽出部42は、原子論理式テーブル51において、読み出したレコードのデータ項目「選択」513にフラグを立てる。   When there is an atomic logical formula (difference) that does not exist in the target logical formula table 52 among the atomic logical formulas included in the record read in S56, the extraction unit 42 sets the differential atomic logical formula in the target logical formula table 52. (S58). At this time, the extraction unit 42 sets a flag in the data item “selection” 513 of the read record in the atomic logical formula table 51.

一方、S57において、読み出したレコードに含まれる全ての原子論理式が目標論理式テーブル52に存在する場合(S57で「No」)、または、S59の処理が終了した場合、処理がS55へ戻る。原子論理式テーブル51に未処理のレコードが存在する間(S55で「Yes」)、抽出部42は、原子論理式テーブル51から次のレコードを読み出し、S56〜S59の処理を行う。原子論理式テーブル51に未処理のレコードが存在しない間(S55で「No」)、図32のS60の処理へ処理が遷移する。   On the other hand, in S57, when all the atomic logical expressions included in the read record exist in the target logical expression table 52 (“No” in S57), or when the process of S59 ends, the process returns to S55. While there is an unprocessed record in the atomic logical formula table 51 (“Yes” in S55), the extraction unit 42 reads the next record from the atomic logical formula table 51 and performs the processing of S56 to S59. While there is no unprocessed record in the atomic logic formula table 51 (“No” in S55), the process transitions to the process of S60 in FIG.

次に、選択部43は、原子論理式テーブル51からレコードを読み出す(S60で「Yes」、S61)。選択部43は、その読み出したレコードの選択フラグが立っているか否かを判定する(S62)。   Next, the selection unit 43 reads a record from the atomic logical formula table 51 (“Yes” in S60, S61). The selection unit 43 determines whether or not the selection flag of the read record is set (S62).

S13において、その読み出したレコードの選択フラグが立っていると判定した場合(S62で「Yes」)、選択部43は、パスコンディションテーブル19から、選択フラグの立っているレコードと同じNo.のパスコンディションを取得する。選択部43は、その取得したパスコンディションを選択パスコンディションテーブル53に追加する(S63)。   In S13, when it is determined that the selection flag of the read record is set (“Yes” in S62), the selection unit 43 determines from the path condition table 19 the path of the same No. as the record with the selection flag set. Get the condition. The selection unit 43 adds the acquired path condition to the selected path condition table 53 (S63).

S62において、対象レコードの選択フラグが立っていないと判定した場合(S62で「No」)、または、S63の処理が終了した場合、処理がS60へ戻る。原子論理式テーブル51にS61〜S63の処理について未処理のレコードが存在する間(S60で「Yes」)、抽出部42は、原子論理式テーブル51から次のレコードを読み出し(S61)、S62〜S63の処理を行う。原子論理式テーブル51の全レコードについて処理が完了すれば(S60で「No」)、本フローは終了する。   In S62, when it is determined that the selection flag of the target record is not set (“No” in S62), or when the process of S63 is completed, the process returns to S60. While there are unprocessed records for the processes of S61 to S63 in the atomic formula table 51 (“Yes” in S60), the extraction unit 42 reads the next record from the atomic formula table 51 (S61), and S62 to S62. The process of S63 is performed. If the processing is completed for all the records in the atomic formula table 51 (“No” in S60), this flow ends.

本実施形態(実施例2)によれば、実施例1において追加すべきテストケース(パスコンディション)のうち、目標論理式テーブル内に含まれる原子論理式から構成されるテストケースを選択しないようにすることができる。これにより、冗長なテストケースを排除することができる。そのため、目標論理式テーブル内に含まれる原子論理式から構成されるテストケースが多いほど、テストケースを1つずつ実行しながらカバレッジ測定する方法よりもテストケース数を削減することができる。つまり、実施例1において追加すべきテストケースに着目すれば、追加すべきテストケース数が多いほど、テストケース数の削減率が向上する。その結果、プログラムの修正前のテスト資産を利用して、プログラム修正後のテストのコストを削減することができる。   According to the present embodiment (Example 2), among the test cases (path conditions) to be added in Example 1, a test case composed of the atomic formulas included in the target formula table is not selected. can do. Thereby, redundant test cases can be eliminated. Therefore, the more test cases that are configured from the atomic logical expressions included in the target logical expression table, the more test cases can be reduced than the method of measuring coverage while executing the test cases one by one. In other words, focusing on the test cases to be added in the first embodiment, the number of test cases to be added increases as the number of test cases to be added increases. As a result, it is possible to reduce the cost of the test after the program correction by using the test assets before the program correction.

また、本実施形態(実施例2)によれば、修正前のテストケースに対応するパスコンディションの選択優先順位を高くする。これにより、修正後プログラムのあるカバレッジに即したテストケース選択において、既存のテストケースを最大限に再利用しつつカバレッジも保証するための追加すべきテストケースが得られる。   Further, according to the present embodiment (Example 2), the selection priority of the path condition corresponding to the test case before correction is increased. As a result, in the test case selection in accordance with the coverage of the corrected program, it is possible to obtain a test case to be added for ensuring the coverage while reusing the existing test case to the maximum extent.

図34は、本実施形態を適用したコンピュータのハードウェア環境の構成ブロック図である。コンピュータ60は、本実施形態(実施例1または2)の処理(図15〜図17、図28〜図33)を行うプログラムを読み込むことにより、テストデータ生成装置11として機能する。   FIG. 34 is a block diagram showing the hardware environment of a computer to which this embodiment is applied. The computer 60 functions as the test data generation device 11 by reading a program for performing the processing (FIGS. 15 to 17 and FIGS. 28 to 33) of the present embodiment (Example 1 or 2).

コンピュータ60は、出力I/F61、CPU62、ROM63、通信I/F64、入力I/F65、RAM66、記憶装置67、読み取り装置68、バス69を含む。コンピュータ60は、出力機器71、及び入力機器72と接続可能である。   The computer 60 includes an output I / F 61, a CPU 62, a ROM 63, a communication I / F 64, an input I / F 65, a RAM 66, a storage device 67, a reading device 68, and a bus 69. The computer 60 can be connected to an output device 71 and an input device 72.

ここで、CPUは、中央演算装置を示す。ROMは、リードオンリメモリを示す。RAMは、ランダムアクセスメモリを示す。I/Fは、インターフェースを示す。バス69には、出力I/F61、CPU62、ROM63、通信I/F64、入力I/F65、RAM66、記憶装置67、読み取り装置68が接続されている。読み取り装置68は、可搬型記録媒体を読み出す装置である。出力機器71は、出力I/F61に接続されている。入力機器72は、入力I/F65に接続されている。   Here, CPU indicates a central processing unit. ROM indicates a read-only memory. RAM indicates random access memory. I / F indicates an interface. An output I / F 61, a CPU 62, a ROM 63, a communication I / F 64, an input I / F 65, a RAM 66, a storage device 67, and a reading device 68 are connected to the bus 69. The reading device 68 is a device that reads a portable recording medium. The output device 71 is connected to the output I / F 61. The input device 72 is connected to the input I / F 65.

記憶装置67としては、ハードディスクドライブ、フラッシュメモリ装置、磁気ディスク装置など様々な形式の記憶装置を使用することができる。
記憶装置67またはROM63には、例えば、本実施形態で説明した処理を実現するプログラムが格納されている。または、記憶装置67またはROM63には、テストデータ条件テーブル18、パスコンディションテーブル19、抽出パスコンディションテーブル20、原子論理式テーブル51、目標論理式テーブル52、選択パスコンディションテーブル53が格納されている。
As the storage device 67, various types of storage devices such as a hard disk drive, a flash memory device, and a magnetic disk device can be used.
For example, the storage device 67 or the ROM 63 stores a program that realizes the processing described in the present embodiment. Alternatively, the test data condition table 18, the path condition table 19, the extracted path condition table 20, the atomic logic formula table 51, the target logic formula table 52, and the selected path condition table 53 are stored in the storage device 67 or the ROM 63.

CPU62は、記憶装置67等に格納した本実施形態(実施例1または2)で説明した処理を実現するプログラムを読み出し、当該プログラムを実行する。具体的には、CPU62は、当該プログラムを実行することにより、制御部12(取得部13、マッチング部14、テストデータ選択部40、データ生成部15、出力部16)として機能する。   The CPU 62 reads a program that realizes the processing described in the present embodiment (Example 1 or 2) stored in the storage device 67 and executes the program. Specifically, the CPU 62 functions as the control unit 12 (the acquisition unit 13, the matching unit 14, the test data selection unit 40, the data generation unit 15, and the output unit 16) by executing the program.

本実施形態で説明した処理を実現するプログラムは、プログラム提供者側から通信ネットワーク70、および通信I/F64を介して、例えば記憶装置67に格納してもよい。また、本実施形態で説明した処理を実現するプログラムは、市販され、流通している可搬型記憶媒体に格納されていてもよい。この場合、この可搬型記憶媒体は読み取り装置68にセットされて、CPU62によってそのプログラムが読み出されて、実行されてもよい。可搬型記憶媒体としてはCD−ROM、フレキシブルディスク、光ディスク、光磁気ディスク、IC(integrated circuit)カード、USB(Universal Serial Bus)メモリ装置など様々な形式の記憶媒体を使用することができる。このような記憶媒体に格納されたプログラムが読み取り装置68によって読み取られる。   A program for realizing the processing described in the present embodiment may be stored in the storage device 67, for example, via the communication network 70 and the communication I / F 64 from the program provider side. Moreover, the program which implement | achieves the process demonstrated by this embodiment may be stored in the portable storage medium marketed and distribute | circulated. In this case, the portable storage medium may be set in the reading device 68 and the program read by the CPU 62 and executed. As the portable storage medium, various types of storage media such as a CD-ROM, a flexible disk, an optical disk, a magneto-optical disk, an IC (integrated circuit) card, and a USB (Universal Serial Bus) memory device can be used. The program stored in such a storage medium is read by the reading device 68.

また、入力機器72には、キーボード、マウス、電子カメラ、ウェブカメラ、マイク、スキャナ、センサ、タブレット、タッチパネルなどを用いることが可能である。また、出力機器71には、ディスプレイ、プリンタ、スピーカなどを用いることが可能である。また、ネットワーク70は、インターネット、LAN、WAN、専用線、有線、無線等の通信網であってよい。   As the input device 72, a keyboard, mouse, electronic camera, web camera, microphone, scanner, sensor, tablet, touch panel, or the like can be used. The output device 71 can be a display, a printer, a speaker, or the like. The network 70 may be a communication network such as the Internet, a LAN, a WAN, a dedicated line, a wired line, and a wireless line.

なお、本実施形態は、以上に述べた実施の形態に限定されるものではなく、本実施形態の要旨を逸脱しない範囲内で種々の構成または実施形態を取ることができる。   In addition, this embodiment is not limited to embodiment described above, A various structure or embodiment can be taken in the range which does not deviate from the summary of this embodiment.

1 テストデータ生成装置
1−1 入力情報取得部
1−2 抽出部
1−3 生成部
1−4 分解部
1−5 目標論理式取得部
1−6 選択部
1−7 差分取得部
1−8 テストデータ格納部
1−9 経路条件格納部
2 第1のテストデータ
3 経路条件情報
4 第2のテストデータ
11 テストデータ生成装置
12 制御部
13 取得部
14 マッチング部
15 データ生成部
16 出力部
17 記憶部
18 テストデータ条件テーブル
19 パスコンディションテーブル
20 抽出パスコンディションテーブル
40 テストケース選択部
41 分解部
42 抽出部
43 選択部
44 差分取得部
51 原子論理式テーブル
52 目標論理式テーブル
53 選択パスコンディションテーブル
1 Test Data Generation Device 1-1 Input Information Acquisition Unit 1-2 Extraction Unit 1-3 Generation Unit 1-4 Decomposition Unit 1-5 Target Logical Formula Acquisition Unit 1-6 Selection Unit 1-7 Difference Acquisition Unit 1-8 Test Data storage unit 1-9 Path condition storage unit 2 First test data 3 Path condition information 4 Second test data 11 Test data generation device 12 Control unit 13 Acquisition unit 14 Matching unit 15 Data generation unit 16 Output unit 17 Storage unit 18 Test Data Condition Table 19 Path Condition Table 20 Extracted Path Condition Table 40 Test Case Selection Unit 41 Decomposition Unit 42 Extraction Unit 43 Selection Unit 44 Difference Acquisition Unit 51 Atom Logical Formula Table 52 Target Logical Formula Table 53 Selected Path Condition Table

Claims (7)

修正前のプログラムのテストで用いる第1のテストデータと、修正後の該プログラムのソースコードに含まれる条件により分岐されて通過する処理経路の組み合わせで示される実行経路を論理式により表した経路条件を示す経路条件情報とを取得する入力情報取得部と、
取得した前記第1のテストデータを格納するテストデータ格納部と、
取得した前記経路条件情報を格納する経路条件格納部と、
前記経路条件格納部に格納した経路条件情報から、前記テストデータ格納部に格納した第1のテストデータと論理的に同値でない経路条件情報を抽出する抽出部と、
抽出した前記経路条件情報が示す経路条件を充足する第2のテストデータを生成する生成部と、
を備えることを特徴とするテストデータ生成装置。
A path condition that expresses, by a logical expression, an execution path indicated by a combination of the first test data used in the test of the program before correction and the processing path branched and passed by the condition included in the source code of the program after correction An input information acquisition unit for acquiring route condition information indicating
A test data storage unit for storing the acquired first test data;
A route condition storage unit for storing the acquired route condition information;
An extraction unit that extracts route condition information that is not logically equivalent to the first test data stored in the test data storage unit from the route condition information stored in the route condition storage unit;
A generating unit that generates second test data that satisfies the route condition indicated by the extracted route condition information;
A test data generation device comprising:
前記入力情報取得部は、修正前のソースコードに含まれる条件により分岐されて通過する処理経路の組み合わせで示される実行経路を論理式により表した経路条件を充足する前記第1のテストデータを取得する
ことを特徴とする請求項1に記載のテストデータ生成装置。
The input information acquisition unit acquires the first test data that satisfies a path condition that expresses an execution path indicated by a combination of processing paths that are branched and passed by a condition included in the source code before correction by a logical expression. The test data generation device according to claim 1, wherein:
前記抽出部は、前記経路条件格納部に格納した経路条件情報が前記第1のテストデータと論理的に同値である第1の経路条件情報であるかを判定し、
前記テストデータ生成装置は、さらに、
前記経路条件格納部に格納された経路条件情報を、前記論理的に同値である情報、同値でない情報の順に並び替え、該並び替えた経路条件情報を、1以上の原子論理式を含む論理式である目標論理式に、分解する分解部と、
分解された前記目標論理式を前記経路条件情報毎に関係付けた情報である経路分解情報を格納する分解格納部と、
前記目標論理式を格納する目標論理式格納部と、
前記分解格納部から前記経路分解情報を取得し、該取得した経路分解情報が前記目標論理式格納部に格納された前記目標論理式以外の目標論理式である差分の論理式を含む場合、該差分の論理式を抽出して前記目標論理式格納部に格納する目標論理式取得部と、
前記取得した経路条件情報から、前記差分の論理式が抽出された前記経路分解情報に対応する第2の経路条件情報を選択する選択部と、
選択された前記第2の経路条件情報と前記第1の経路条件情報との差分を取得する差分取得部と、
を備え、
前記生成部は、前記差分として取得した経路条件情報から、前記第2のテストデータを生成する
ことを特徴とする請求項1または2に記載のテストデータ生成装置。
The extraction unit determines whether the route condition information stored in the route condition storage unit is first route condition information that is logically equivalent to the first test data;
The test data generation device further includes:
The route condition information stored in the route condition storage unit is rearranged in the order of the logically equivalent information and the non-equivalent information, and the rearranged route condition information is a logical expression including one or more atomic logical expressions. A decomposition part to be decomposed into a target logical formula,
A decomposition storage unit that stores route decomposition information that is information relating the decomposed target logical expression for each of the route condition information;
A target logical expression storage unit for storing the target logical expression;
When the route decomposition information is acquired from the decomposition storage unit and the acquired route decomposition information includes a difference logical expression that is a target logical expression other than the target logical expression stored in the target logical expression storage unit, A target logical expression acquisition unit that extracts a logical expression of the difference and stores it in the target logical expression storage unit;
A selection unit that selects second route condition information corresponding to the route decomposition information from which the logical expression of the difference is extracted from the acquired route condition information;
A difference acquisition unit for acquiring a difference between the selected second route condition information and the first route condition information;
With
The test data generation device according to claim 1, wherein the generation unit generates the second test data from path condition information acquired as the difference.
コンピュータに、
修正前のプログラムのテストで用いる第1のテストデータと、修正後の該プログラムのソースコードに含まれる条件により分岐されて通過する処理経路の組み合わせで示される実行経路を論理式により表した経路条件を示す経路条件情報とを取得し、
取得した前記第1のテストデータをテストデータ格納部に格納し、
取得した前記経路条件情報を経路条件格納部に格納し、
前記経路条件格納部に格納した経路条件情報から、前記テストデータ格納部に格納した第1のテストデータと論理的に同値でない経路条件情報を抽出し、
抽出した前記経路条件情報が示す経路条件を充足する第2のテストデータを生成する、
処理を実行させることを特徴とするテストデータ生成プログラム。
On the computer,
A path condition that expresses, by a logical expression, an execution path indicated by a combination of the first test data used in the test of the program before correction and the processing path branched and passed by the condition included in the source code of the program after correction And route condition information indicating
Storing the acquired first test data in a test data storage unit;
The acquired route condition information is stored in a route condition storage unit,
Extracting route condition information that is not logically equivalent to the first test data stored in the test data storage unit from the route condition information stored in the route condition storage unit;
Generating second test data that satisfies the route condition indicated by the extracted route condition information;
A test data generation program characterized by causing a process to be executed.
前記経路条件情報の取得において、修正前のソースコードに含まれる条件により分岐されて通過する処理経路の組み合わせで示される実行経路を論理式により表した経路条件を充足する前記第1のテストデータを取得する
ことを特徴とする請求項4に記載のテストデータ生成プログラム。
In the acquisition of the route condition information, the first test data satisfying a route condition that expresses an execution route represented by a combination of processing routes that are branched by the condition included in the source code before correction and expressed by a logical expression. The test data generation program according to claim 4, wherein the test data generation program is acquired.
前記経路条件情報の抽出において、前記経路条件格納部に格納した経路条件情報が前記第1のテストデータと論理的に同値である第1の経路条件情報であるかを判定し、
前記コンピュータは、さらに、
前記経路条件格納部に格納された経路条件情報を、前記論理的に同値である情報、同値でない情報の順に並び替え、該並び替えた経路条件情報を、1以上の原子論理式を含む論理式である目標論理式に、分解し、
前記分解された目標論理式を前記経路条件情報毎に関係付けた情報である経路分解情報を分解格納部に格納し、
前記分解格納部から前記経路分解情報を取得し、該取得した経路分解情報が前記目標論理式が格納された目標論理式格納部に格納された前記目標論理式以外の目標論理式である差分の論理式を含む場合、該差分の論理式を抽出して前記目標論理式格納部に格納し、
前記取得した経路条件情報から、前記差分の論理式が抽出された前記経路分解情報に対応する経路条件情報を選択し、
選択された前記第2の経路条件情報と前記第1の経路条件情報との差分を取得する
処理を実行させ、
前記テストデータの生成において、前記差分として取得した経路条件情報から、前記第2のテストデータを生成する
ことを特徴とする請求項4または5に記載のテストデータ生成プログラム。
In the extraction of the route condition information, it is determined whether the route condition information stored in the route condition storage unit is first route condition information that is logically equivalent to the first test data;
The computer further includes:
The route condition information stored in the route condition storage unit is rearranged in the order of the logically equivalent information and the non-equivalent information, and the rearranged route condition information is a logical expression including one or more atomic logical expressions. Is broken down into a target formula that is
Path decomposition information, which is information relating the decomposed target logical expression for each of the path condition information, is stored in the decomposition storage unit;
The route decomposition information is acquired from the decomposition storage unit, and the acquired route decomposition information is a target logical expression other than the target logical expression stored in the target logical expression storage unit in which the target logical expression is stored. If a logical expression is included, the logical expression of the difference is extracted and stored in the target logical expression storage unit;
From the acquired route condition information, select the route condition information corresponding to the route decomposition information from which the logical expression of the difference is extracted,
A process of acquiring a difference between the selected second route condition information and the first route condition information;
The test data generation program according to claim 4 or 5, wherein, in the generation of the test data, the second test data is generated from the path condition information acquired as the difference.
コンピュータにより実行されるテストデータ生成方法であって、
前記コンピュータは、
修正前のプログラムのテストで用いる第1のテストデータと、修正後の該プログラムのソースコードに含まれる条件により分岐されて通過する処理経路の組み合わせで示される実行経路を論理式により表した経路条件を示す経路条件情報とを取得し、
取得した前記第1のテストデータをテストデータ格納部に格納し、
取得した前記経路条件情報を経路条件格納部に格納し、
前記経路条件格納部に格納した経路条件情報から、前記テストデータ格納部に格納した第1のテストデータと論理的に同値でない経路条件情報を抽出し、
抽出した前記経路条件情報が示す経路条件を充足する第2のテストデータを生成する、
処理を実行させるテストデータ生成方法。
A test data generation method executed by a computer,
The computer
A path condition that expresses, by a logical expression, an execution path indicated by a combination of the first test data used in the test of the program before correction and the processing path branched and passed by the condition included in the source code of the program after correction And route condition information indicating
Storing the acquired first test data in a test data storage unit;
The acquired route condition information is stored in a route condition storage unit,
Extracting route condition information that is not logically equivalent to the first test data stored in the test data storage unit from the route condition information stored in the route condition storage unit;
Generating second test data that satisfies the route condition indicated by the extracted route condition information;
A test data generation method that executes processing.
JP2012159258A 2012-07-18 2012-07-18 Test data generation apparatus, program, and method Active JP5900212B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2012159258A JP5900212B2 (en) 2012-07-18 2012-07-18 Test data generation apparatus, program, and method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2012159258A JP5900212B2 (en) 2012-07-18 2012-07-18 Test data generation apparatus, program, and method

Publications (2)

Publication Number Publication Date
JP2014021686A true JP2014021686A (en) 2014-02-03
JP5900212B2 JP5900212B2 (en) 2016-04-06

Family

ID=50196503

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2012159258A Active JP5900212B2 (en) 2012-07-18 2012-07-18 Test data generation apparatus, program, and method

Country Status (1)

Country Link
JP (1) JP5900212B2 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2016009344A (en) * 2014-06-25 2016-01-18 富士通株式会社 Test case generation program, test case generation method, and test case generation device
US11960862B2 (en) 2021-06-18 2024-04-16 Hitachi, Ltd. Source code correction assistance apparatus and source code correction assistance method

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH0210443A (en) * 1988-06-29 1990-01-16 Hitachi Ltd Reset case selecting system
JPH08272650A (en) * 1995-03-29 1996-10-18 Nec Corp Retest path selection system
JPH09128266A (en) * 1995-10-31 1997-05-16 Fujitsu Ltd Device and method for retrieving source program route
JP2007041804A (en) * 2005-08-02 2007-02-15 Sharp Corp Program generation device, program verification device, and verification program
JP2011248887A (en) * 2010-05-24 2011-12-08 Fujitsu Ltd Software module test method and system
JP2012059202A (en) * 2010-09-13 2012-03-22 Nec Commun Syst Ltd Test case generation device, test case generation method and test case generation program

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH0210443A (en) * 1988-06-29 1990-01-16 Hitachi Ltd Reset case selecting system
JPH08272650A (en) * 1995-03-29 1996-10-18 Nec Corp Retest path selection system
JPH09128266A (en) * 1995-10-31 1997-05-16 Fujitsu Ltd Device and method for retrieving source program route
JP2007041804A (en) * 2005-08-02 2007-02-15 Sharp Corp Program generation device, program verification device, and verification program
JP2011248887A (en) * 2010-05-24 2011-12-08 Fujitsu Ltd Software module test method and system
JP2012059202A (en) * 2010-09-13 2012-03-22 Nec Commun Syst Ltd Test case generation device, test case generation method and test case generation program

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
山崎 晃嗣 外4名: "「限定モデル検査を用いた高位設計向けテストパタン生成手法」", DAシンポジウム 2009, JPN6016004309, 19 August 2009 (2009-08-19), pages 31 - 36, ISSN: 0003247747 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2016009344A (en) * 2014-06-25 2016-01-18 富士通株式会社 Test case generation program, test case generation method, and test case generation device
US11960862B2 (en) 2021-06-18 2024-04-16 Hitachi, Ltd. Source code correction assistance apparatus and source code correction assistance method

Also Published As

Publication number Publication date
JP5900212B2 (en) 2016-04-06

Similar Documents

Publication Publication Date Title
US11714611B2 (en) Library suggestion engine
US20240004644A1 (en) Automating Identification of Code Snippets for Library Suggestion Models
US11494181B2 (en) Automating generation of library suggestion engine models
US11740876B2 (en) Method and system for arbitrary-granularity execution clone detection
US20220253308A1 (en) Library Model Addition
Bavota et al. The impact of api change-and fault-proneness on the user ratings of android apps
US8589884B2 (en) Method and system for identifying regression test cases for a software
US7340475B2 (en) Evaluating dynamic expressions in a modeling application
JP6256115B2 (en) Operation search program, operation search method, and operation search device
US20210405980A1 (en) Long method autofix engine
JP2020135171A (en) Machine learning program verification apparatus and machine learning program verification method
US9582270B2 (en) Effective feature location in large legacy systems
JP5164920B2 (en) Test data generation method, apparatus and program
JP5900212B2 (en) Test data generation apparatus, program, and method
Makady et al. Validating pragmatic reuse tasks by leveraging existing test suites
JP5758311B2 (en) Test code generation device, test code generation method, test code generation program
JP5900197B2 (en) Route condition selection apparatus, program, and method
Weißleder et al. Automated test design for boundaries of product line variants
JPWO2014045554A1 (en) Process database, process management device, process database creation method, process database search method, and program
Kakarontzas et al. OPEN-SME-Component Certification for Open Source Reuse.

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20150406

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20160128

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: 20160209

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20160222

R150 Certificate of patent or registration of utility model

Ref document number: 5900212

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150