JP5900197B2 - Route condition selection apparatus, program, and method - Google Patents

Route condition selection apparatus, program, and method Download PDF

Info

Publication number
JP5900197B2
JP5900197B2 JP2012151737A JP2012151737A JP5900197B2 JP 5900197 B2 JP5900197 B2 JP 5900197B2 JP 2012151737 A JP2012151737 A JP 2012151737A JP 2012151737 A JP2012151737 A JP 2012151737A JP 5900197 B2 JP5900197 B2 JP 5900197B2
Authority
JP
Japan
Prior art keywords
information
logical expression
path
route
atomic
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
JP2012151737A
Other languages
Japanese (ja)
Other versions
JP2013178729A (en
Inventor
忠弘 上原
忠弘 上原
一樹 宗像
一樹 宗像
前田 芳晴
芳晴 前田
翔一朗 藤原
翔一朗 藤原
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 JP2012151737A priority Critical patent/JP5900197B2/en
Publication of JP2013178729A publication Critical patent/JP2013178729A/en
Application granted granted Critical
Publication of JP5900197B2 publication Critical patent/JP5900197B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Description

本技術は、プログラムの動作をテストするためのテストケースを選択する技術に関する。   The present technology relates to a technology for selecting a test case 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)項目やプログラム変数を用いた論理式)の充足可能性判定問題を解くことで充足値をテストデータとして用いる技術がある。   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.

ところで、プログラムのテストを行う際のテストデータを作成する技術の1つに、シンボリック実行(symbolic execution)がある。シンボリック実行とは、変数を具体的な値としてではなく、シンボル値という値を1つに特定しないで実行する仕組みをいう。シンボリック実行では、ある一連の遷移についてその遷移を流れることになるテストデータを、そのプログラムが取り得る一連の遷移の各々について作成することができる。   Incidentally, symbolic execution is one of the techniques for creating test data when testing a program. 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.

特開2011−13797号公報JP 2011-13797 A 特開2011−81653号公報JP 2011-81653 A 特開2011−85967号公報JP 2011-85967 A 特開平10−320190号公報JP-A-10-320190 特開2009−032133号公報JP 2009-032133 A 特開2003−202985号公報JP 2003-202985 A

しかしながら、テストにおいて、前段の処理経路とは関係なく、処理経路の確認を行えばよい場合でも、全ての処理経路を実行するまで、テストケースを逐次実行している。例えば、テストケース1とテストケース2とを行うことで、テストケース3で実行される処理経路を全て通るので、テスト内容によっては、テストケース3を行なわなくてもよい場合がある。しかし、そのような場合でも、テストケース1とテストケース2とを行うだけでなく、テストケース3をも逐次実行していた。   However, in the test, the test cases are sequentially executed until all the processing paths are executed even if the processing paths need only be confirmed regardless of the processing path in the previous stage. For example, by performing the test case 1 and the test case 2, all the processing paths executed in the test case 3 are passed. Therefore, depending on the test contents, the test case 3 may not be performed. However, even in such a case, not only test case 1 and test case 2 are performed, but also test case 3 is sequentially executed.

そこで、シンボリック実行により生成されるテストケースから冗長なくテストケースを選択する技術を提供する。   Therefore, a technique for selecting a test case without redundancy from test cases generated by symbolic execution is provided.

経路条件選択装置は、取得部、分解部、分解格納部、目標論理式格納部、抽出部、選択部を含む。取得部は、ソースコードに含まれる条件により分岐されて通過する処理経路の組み合わせで示される実行経路を、原子論理式を論理積で連結して形成される論理式により表した情報である経路条件情報を取得する。分解部は、経路条件情報を、1以上の原子論理式を含む論理式である目標論理式に、分解する。分解格納部は、分解された目標論理式を経路条件情報毎に関係付けた情報である経路分解情報を格納する。目標論理式格納部は、目標論理式を格納する。抽出部は、分解格納部から経路分解情報を取得する。抽出部は、取得した経路分解情報が目標論理式格納部に格納された目標論理式以外の目標論理式である差分の論理式を含む場合、差分の論理式を抽出して目標論理式格納部に格納する。選択部は、取得した経路条件情報から、差分の論理式が抽出された経路分解情報に対応する経路条件情報を選択する。   The path condition selection device includes an acquisition unit, a decomposition unit, a decomposition storage unit, a target logical expression storage unit, an extraction unit, and a selection unit. The acquisition unit is a path condition that is information that represents an execution path indicated by a combination of processing paths branched and passed by a condition included in the source code by a logical expression formed by connecting atomic logical expressions with logical products. Get information. The decomposition unit decomposes the path condition information into target logical expressions that are logical expressions including one or more atomic logical expressions. The decomposition storage unit stores path decomposition information that is information relating the decomposed target logical expression for each piece of path condition information. The target logical expression storage unit stores the target logical expression. The extraction unit acquires route decomposition information from the decomposition storage unit. 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, the extraction unit extracts the differential logical expression and extracts the target logical expression storage unit To store. The selection unit selects 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.

本実施形態の1つの観点によれば、シンボリック実行により生成されるテストケースから冗長なくテストケースを選択することができる。   According to one aspect of the present embodiment, a test case can be selected without redundancy from test cases generated by symbolic execution.

ソースコードの一例である。It is an example of source code. シンボリック実行によるテストケース生成を説明するための図である。It is a figure for demonstrating the test case production | generation by symbolic execution. 本実施形態における経路条件選択装置の一例を示す。An example of the route condition selection apparatus in this embodiment is shown. 第1の実施形態を説明するための図である。It is a figure for demonstrating 1st Embodiment. 第1の実施形態におけるテストケース選択装置の構成の一例を示す。1 shows an example of a configuration of a test case selection device according to a first embodiment. 図1のソースコードに対してシンボリック実行をした結果得られた、入力情報としてのパスコンディション情報の一例を示す。An example of path condition information as input information obtained as a result of performing symbolic execution on the source code of FIG. 1 is shown. 第1の実施形態におけるパスコンディションテーブルの一例を示す。An example of the path condition table in 1st Embodiment is shown. 第1の実施形態における原子論理式テーブルの一例を示す。An example of an atomic logical expression table in the first embodiment is shown. 図8の原子論理式テーブルにデータ項目「選択」193を追加した一例を示す。An example in which the data item “selection” 193 is added to the atomic formula table of FIG. 8 is shown. 第1の実施形態における目標論理式テーブルの一例を示す。An example of the target logical expression table in the first embodiment is shown. 第1の実施形態における選択パスコンディションテーブルの一例を示す。An example of the selection path | pass condition table in 1st Embodiment is shown. 第1の実施形態におけるテストケース選択フロー(その1)の一例を示す。An example of the test case selection flow (the 1) in a 1st embodiment is shown. 第1の実施形態におけるテストケース選択フロー(その2)の一例を示す。An example of the test case selection flow (part 2) in the first embodiment is shown. 第1の実施形態におけるテストケース選択フロー(その3)の一例を示す。An example of the test case selection flow (the 3) in a 1st embodiment is shown. 第2の実施形態を説明するための図(その1)である。It is FIG. (1) for demonstrating 2nd Embodiment. 第2の実施形態を説明するための図(その2)である。It is FIG. (2) for demonstrating 2nd Embodiment. 第2の実施形態におけるテストケース選択装置の構成の一例を示す。An example of the structure of the test case selection apparatus in 2nd Embodiment is shown. 第2の実施形態におけるソースコードの一例を示す。An example of the source code in the second embodiment is shown. 図18のソースコードに対してシンボリック実行をした結果得られた、入力情報としてのパスコンディション情報の一例を示す。An example of path condition information as input information obtained as a result of performing symbolic execution on the source code of FIG. 18 is shown. 第2の実施形態におけるパスコンディションテーブルの一例を示す。An example of the path condition table in 2nd Embodiment is shown. 第2の実施形態における行番号テーブルを示す。The line number table in 2nd Embodiment is shown. 第2の実施形態における組み合わせテーブルの一例を示す。An example of the combination table in 2nd Embodiment is shown. 図22の組み合わせテーブルにデータ項目「選択」323を追加した一例を示す。An example in which the data item “selection” 323 is added to the combination table of FIG. 第2の実施形態における目標論理式テーブルの一例を示す。An example of the target logical expression table in 2nd Embodiment is shown. 第2の実施形態における選択パスコンディションテーブルの一例を示す。An example of the selection path condition table in a 2nd embodiment is shown. 第2の実施形態におけるテストケース選択フロー(その1)の一例を示す。An example of the test case selection flow (the 1) in a 2nd embodiment is shown. 第2の実施形態におけるテストケース選択フロー(その2)の一例を示す。An example of the test case selection flow (the 2) in a 2nd embodiment is shown. 第2の実施形態におけるテストケース選択フロー(その3)の一例を示す。An example of the test case selection flow (the 3) in a 2nd embodiment is shown. 第2の実施形態におけるテストケース選択フロー(その4)の一例を示す。An example of the test case selection flow (the 4) in a 2nd embodiment is shown. 第2の実施形態におけるテストケース選択フロー(その5)の一例を示す。An example of the test case selection flow (the 5) in a 2nd embodiment is shown. テスト対象プログラムのソースコードの一例を示す。An example of the source code of the test target program is shown. 図31のテスト対象プログラムのフローチャートを示す。FIG. 32 is a flowchart of the test target program in FIG. 31. FIG. (A)シンボリック実行により得られるテストケース、(B)第1の実施形態を用いて選択されたテストケースを示す。(A) A test case obtained by symbolic execution, (B) A test case selected using the first embodiment. 第3の実施形態(実施例1)におけるテストケース選択装置の構成の一例を示す。An example of the configuration of a test case selection device according to the third mode for embodying the present invention (embodiment 1) will be described. 第3の実施形態(実施例1)におけるドライバ変更部の処理を説明するための図である。It is a figure for demonstrating the process of the driver change part in 3rd Embodiment (Example 1). 第3の実施形態(実施例1)におけるシンボリック実行により得られるテストケース(パスコンディション)の一例を示す。An example of a test case (pass condition) obtained by symbolic execution in the third mode (Example 1) is shown. 第3の実施形態(実施例1)におけるテストケース調整部の処理を説明するための図である。It is a figure for demonstrating the process of the test case adjustment part in 3rd Embodiment (Example 1). 第3の実施形態(実施例1)における選択パスコンディションテーブルの一例を示す。An example of the selection path condition table in the 3rd mode (example 1) is shown. 第3の実施形態(実施例1)におけるテストケース選択フローの一例を示す。An example of a test case selection flow in the third mode for embodying the present invention (embodiment 1) will be described. 第3の実施形態(実施例2)におけるテストケース選択装置の構成の一例を示す。An example of the configuration of a test case selection device according to the third mode for embodying the present invention (embodiment 2) is shown. 第3の実施形態(実施例2)における原子論理式テーブルの一例を示す。An example of an atomic logic formula table in a 3rd embodiment (example 2) is shown. 第3の実施形態(実施例2)におけるテストケース選択フローの一例を示す。An example of the test case selection flow in the third mode (Example 2) will be described. 第1〜第3の実施形態を適用したコンピュータのハードウェア環境の構成ブロック図である。It is a block diagram of the hardware environment of a computer to which the first to third embodiments are applied.

図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 the path condition can be satisfied is determined using, for example, a SAT (satisfiability) or SMT (satisfiability modulo theory) solver. 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.

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

したがって、より現実的なケース数となるようにテストケースを選択することが求められる。あるコードカバレッジを満たすようなテストケースを選択するためには、テストケースを1つずつ実際に実行しながら、カバレッジ測定装置を用いてあるカバレッジを満たした時点のテストケースの集合を選択したケースとする方法が考えられる。   Therefore, it is required to select test cases so that the number of cases is more realistic. In order to select a test case that satisfies a certain code coverage, the test case is actually executed one by one, and a set of test cases at the time when a certain coverage is satisfied using the coverage measurement device is selected. A way to do this is considered.

ところが、その方法では、テストケースを1つずつ実際に実行してみないとカバレッジを測定することができないため、テストケースを絞り込んでおくことが望まれる。このように、テストケースの絞込みの精度が実際に実行する順番に大きく依存する。つまり、その絞り込んだテストケースの集合には、冗長なテストケースを多く含む可能性があり、十分なテストケースの削減をすることが難しい。
そこで、冗長なテストケースを排除して、テストケースを選択するテストケース選択技術を提供する。
However, in this method, since coverage cannot be measured unless the test cases are actually executed one by one, it is desirable to narrow down the test cases. In this way, the accuracy of narrowing down test cases greatly depends on the actual execution order. In other words, the narrowed collection of test cases may include many redundant test cases, and it is difficult to sufficiently reduce the number of test cases.
Therefore, a test case selection technique for eliminating a redundant test case and selecting a test case is provided.

図3は、本実施形態における経路条件選択装置の一例を示す。経路条件選択装置1は、取得部2、分解部3、抽出部4、選択部5、分解格納部6、目標論理式格納部7を含む。
取得部2は、経路条件情報(パスコンディション)を取得する。経路条件情報は、ソースコードに含まれる条件により分岐されて通過する処理経路の組み合わせで示される実行経路を、原子論理式を論理積で連結して形成される論理式により表した情報である。取得部2の一例としては、取得部13が挙げられる。
FIG. 3 shows an example of a route condition selection device in the present embodiment. The path condition selection device 1 includes an acquisition unit 2, a decomposition unit 3, an extraction unit 4, a selection unit 5, a decomposition storage unit 6, and a target logical expression storage unit 7.
The acquisition unit 2 acquires route condition information (path condition). The path condition information is information representing an execution path indicated by a combination of processing paths branched and passed by a condition included in the source code by a logical expression formed by connecting atomic logical expressions with logical products. An example of the acquisition unit 2 is the acquisition unit 13.

分解部3は、経路条件情報を、1以上の原子論理式を含む論理式である目標論理式に、分解する。分解部3の一例としては、分解部14,14aが挙げられる。
分解格納部6は、分解された目標論理式を経路条件情報毎に関係付けた情報である経路分解情報を格納する。分解格納部6の一例としては、原子論理式テーブル19、組み合わせテーブル32が挙げられる。
The decomposition unit 3 decomposes the 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 3 includes decomposition units 14 and 14a.
The decomposition storage unit 6 stores path decomposition information that is information relating the decomposed target logical expression for each piece of path condition information. As an example of the decomposition storage unit 6, an atomic logical formula table 19 and a combination table 32 are given.

目標論理式格納部7は、目標論理式を格納する。目標論理式格納部7の一例としては、目標論理式テーブル20,33が挙げられる。
抽出部4は、分解格納部6から経路分解情報を取得する。抽出部4は、取得した経路分解情報が目標論理式格納部7に格納された目標論理式以外の目標論理式である差分の論理式を含む場合、差分の論理式を抽出して目標論理式格納部7に格納する。抽出部4の一例としては、抽出部15,15aが挙げられる。
The target logical expression storage unit 7 stores the target logical expression. Examples of the target logical expression storage unit 7 include target logical expression tables 20 and 33.
The extraction unit 4 acquires route decomposition information from the decomposition storage unit 6. 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 7, the extraction unit 4 extracts the differential logical expression and extracts the target logical expression Store in the storage unit 7. Examples of the extraction unit 4 include extraction units 15 and 15a.

選択部5は、取得した経路条件情報から、差分の論理式が抽出された経路分解情報に対応する経路条件情報を選択する。選択部5の一例としては、選択部16が挙げられる。   The selection unit 5 selects 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 5 is a selection unit 16.

ここで、目標論理式が原子論理式である場合、次の処理が行われる。分解部3は、取得した経路条件情報を、原子論理式毎に分解する。分解格納部6は、分解された原子論理式を経路条件情報毎に関係付けた情報である経路分解情報を格納する。目標論理式格納部7は、目標論理式として原子論理式を格納する。抽出部4は、分解格納部から経路分解情報を取得する。抽出部4は、取得した経路分解情報に含まれる第1の原子論理式と、目標論理式格納部に格納された第2の原子論理式とを照合する。抽出部4は、第1の原子論理式が目標論理式格納部7に格納された第2の原子論理式以外の原子論理式である場合、第1の原子論理式を抽出して目標論理式格納部7に格納する。選択部5は、取得した経路条件情報から、第1の原子論理式が抽出された経路分解情報に対応する経路条件情報を選択する。   Here, when the target logical expression is an atomic logical expression, the following processing is performed. The decomposition unit 3 decomposes the acquired path condition information for each atomic logical expression. The decomposition storage unit 6 stores path decomposition information, which is information relating the decomposed atomic logical expression for each path condition information. The target logical expression storage unit 7 stores an atomic logical expression as a target logical expression. The extraction unit 4 acquires route decomposition information from the decomposition storage unit. The extraction unit 4 collates the first atomic logical expression included in the acquired path decomposition information with the second atomic logical expression stored in the target logical expression storage unit. When the first atomic formula is an atomic formula other than the second atomic formula stored in the target formula storage unit 7, the extraction unit 4 extracts the first atomic formula and extracts the target formula Store in the storage unit 7. The selection unit 5 selects route condition information corresponding to the route decomposition information from which the first atomic logical expression is extracted from the obtained route condition information.

このように構成することにより、コンディションカバレッジに関するテストのために、シンボリック実行により生成されるテストケースから、冗長のないテストケースを選択することができる。   By configuring in this way, a test case without redundancy can be selected from the test cases generated by symbolic execution for a test related to condition coverage.

また、処理経路が複数の条件により決定される処理経路であってもよい。この場合、取得される経路条件情報は、該経路条件情報に含まれる原子論理式に、ソースコードにおける、原子論理式に対応する条件が記述された位置を示す位置情報を含む。分解部3は、取得した経路条件情報に含まれる論理式を、位置情報毎に分解して原子論理式の組み合わせを得て、原子論理式の組み合わせと位置情報とを関係付ける。分解格納部6は、位置情報を関係付けた原子論理式の組み合わせを経路条件情報毎に関係付けた情報である経路分解情報を格納する。目標論理式格納部7は、目標論理式として位置情報を関係付けた原子論理式の組み合わせを格納する。抽出部4は、分解格納部6から経路分解情報を取得する。抽出部4は、取得した経路分解情報に含まれる原子論理式の組み合わせを示す第1の組み合わせと、目標論理式格納部に格納された原子論理式の組み合わせを示す第2の組み合わせを照合する。ここで、該第2の組み合わせは、第1の組み合わせの位置情報と一致する位置情報と関係付けられた原子論理式の組み合わせである。抽出部4は、第1の組み合わせが目標論理式格納部7に格納された第2の組み合わせ以外の原子論理式の組み合わせである場合、第1の組み合わせを抽出して目標論理式格納部7に格納する。選択部5は、取得した経路条件情報から、第1の組み合わせが抽出された経路分解情報に対応する経路条件情報を選択する。   Further, the processing path may be a processing path determined by a plurality of conditions. In this case, the acquired route condition information includes position information indicating a position where a condition corresponding to the atomic logical expression in the source code is described in the atomic logical expression included in the route condition information. The decomposition unit 3 decomposes the logical expression included in the acquired path condition information for each position information to obtain a combination of atomic logical expressions, and associates the combination of atomic logical expressions with the positional information. The decomposition storage unit 6 stores path decomposition information, which is information related to a combination of atomic logical expressions related to position information for each path condition information. The target logical expression storage unit 7 stores a combination of atomic logical expressions associated with positional information as target logical expressions. The extraction unit 4 acquires route decomposition information from the decomposition storage unit 6. The extraction unit 4 collates the first combination indicating the combination of the atomic logical expressions included in the acquired path decomposition information with the second combination indicating the combination of the atomic logical expressions stored in the target logical expression storage unit. Here, the second combination is a combination of atomic formulas associated with position information that matches the position information of the first combination. When the first combination is a combination of atomic logical formulas other than the second combination stored in the target logical formula storage unit 7, the extraction unit 4 extracts the first combination and stores it in the target logical formula storage unit 7. Store. The selection unit 5 selects route condition information corresponding to the route decomposition information from which the first combination is extracted from the acquired route condition information.

このように構成することにより、マルチコンディションカバレッジに関するテストのために、シンボリック実行により生成されるテストケースから、冗長のないテストケースを選択することができる。   By configuring in this way, a test case without redundancy can be selected from test cases generated by symbolic execution for a test related to multi-condition coverage.

経路条件選択装置1は、さらに、生成部8を含む。生成部8は、ソースコードから経路条件情報を生成する。これと共に、生成部8は、ソースコードに含まれる実行経路に応じて設定される変数に基づいて、実行経路が特定の実行経路であるかを判定する。生成部8は、実行経路が該特定の実行経路であると判定された場合、実行経路が特定の実行経路であるか否かを示す特定経路判定情報を、生成した経路条件情報に付与する。生成部8の一例としては、ソースコード40について、ドライバ変更部42により上記所定のコードが組み込まれたシンボリック実行用のドライバを用いて、シンボリック実行を行うテストケース生成部43が挙げられる。   The route condition selection device 1 further includes a generation unit 8. The generation unit 8 generates route condition information from the source code. At the same time, the generation unit 8 determines whether the execution path is a specific execution path based on a variable set according to the execution path included in the source code. When it is determined that the execution path is the specific execution path, the generation unit 8 adds specific path determination information indicating whether or not the execution path is the specific execution path to the generated path condition information. As an example of the generation unit 8, there is a test case generation unit 43 that performs symbolic execution on the source code 40 using the symbolic execution driver in which the predetermined code is incorporated by the driver change unit 42.

この場合、抽出部4は、分解格納部6から特定の実行経路であることを示す特定経路判定情報を有する経路分解情報を取得する。抽出部4は、取得した経路分解情報が目標論理式格納部7に格納された目標論理式以外の目標論理式である差分の論理式を含む場合、差分の論理式を抽出して目標論理式格納部7に格納する。その後、抽出部4は、分解格納部6から特定の実行経路でないことを示す特定経路判定情報を有する経路分解情報を取得する。抽出部4は、取得した経路分解情報が目標論理式格納部7に格納された目標論理式以外の目標論理式である差分の論理式を含む場合、差分の論理式を抽出して目標論理式格納部7に格納する。   In this case, the extraction unit 4 acquires route decomposition information having specific route determination information indicating that the route is a specific execution route from the decomposition storage unit 6. 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 7, the extraction unit 4 extracts the differential logical expression and extracts the target logical expression Store in the storage unit 7. Thereafter, the extraction unit 4 acquires route decomposition information having specific route determination information indicating that the route is not a specific execution route from the decomposition storage unit 6. 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 7, the extraction unit 4 extracts the differential logical expression and extracts the target logical expression Store in the storage unit 7.

このように構成することにより、シンボリック実行により生成されるテストケースから、特定のテストケースを選択しつつ、冗長なくテストケースを選択することができる。   With this configuration, it is possible to select a test case without redundancy while selecting a specific test case from test cases generated by symbolic execution.

<第1の実施形態>
第1の実施形態では、シンボリック実行により生成されるパスコンディション(テストケース)を原子論理式に分解して、パスコンディションに含まれる全種類の原子論理式を実行できるようにパスコンディション(テストケース)を選択する。このとき、テストケースの選択に際して、既に選択したいずれのパスコンディションにも含まれていない原子論理式を含むパスコンディションを選択する。ここで、原子論理式とは、論理式の最小単位(単独の条件)またはその否定である。論理式とは、条件(事前条件または事後条件)を表す式である。論理式の否定とは、論理式にNOTを結合した論理式である。
<First Embodiment>
In the first embodiment, path conditions (test cases) generated by symbolic execution are decomposed into atomic logical expressions, and all types of atomic logical expressions included in the path conditions can be executed. Select. 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. 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.

図4は、第1の実施形態を説明するための図である。テストケース選択装置は、各テストケースが有するパスコンディションを解析することで、テストケースを実際に実行することなく、全テストケースから、あるカバレッジを満たすテストケースを探す。すなわち、テストケース選択装置は、パスコンディションに含まれる原子論理式をプログラム上の条件式として、各パスコンディションが全種類の原子論理式(もしくはその組み合わせ)のうちどれだけの原子論理式を充足したかをパスコンディション上で解析する。コードカバレッジは、プログラム中の条件式内の原子条件と密接な関係がある。ここで、原子条件とは、原子論理式に対応するソースコード上の条件である。   FIG. 4 is a diagram for explaining the first embodiment. The test case selection device 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. In other words, the test case selection device satisfies the atomic logical expression included in the path condition as a conditional expression on the program and how many atomic logical expressions (or combinations thereof) are satisfied for each path condition. Is analyzed on the path 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.

図4の表は、シンボリック実行により得られたパスコンディション(テストケース)を原子論理式に分解してテーブル化したものである。図4の表の列方向には、パスコンディション上の原子論理式が並べられている。例えば、原子論理式「Sa≧0」は、図1のソースコード上の原子条件「a >= 0」に対応する。テストケース1が「Sa ≧ 0 Sa≦5∧ Sb>0 ∧ Sc > 0」であると、図4の表では、テストケース1に対応する「Sa ≧ 0」、「Sa≦5」、「Sb>0」、「Sc > 0」に「〇」が付されている。   The table of FIG. 4 is a table in which path conditions (test cases) obtained by symbolic execution are decomposed into atomic logical expressions. In the column direction of the table of FIG. 4, atomic logical expressions on the path condition are arranged. For example, the atomic logical expression “Sa ≧ 0” corresponds to the atomic condition “a> = 0” on the source code of FIG. If the test case 1 is “Sa ≧ 0 Sa ≦ 5∧Sb> 0∧Sc> 0”, in the table of FIG. 4, “Sa ≧ 0”, “Sa ≦ 5”, “Sb” corresponding to the test case 1 are obtained. “0” is added to “> 0” and “Sc> 0”.

まず、テストケース1を選択する。テストケース1には、上述の通り、原子論理式「Sa ≧ 0」、「Sa≦5」、「Sb>0」、「Sc > 0」を含む。
次にテストケース2に着目する。テストケース2では、テストケース1に含まれない原子論理式「¬(Sb > 0)」を含むので、テストケース2を選択する。
First, test case 1 is selected. As described above, the test case 1 includes the atomic logical expressions “Sa ≧ 0”, “Sa ≦ 5”, “Sb> 0”, and “Sc> 0”.
Next, focus on test case 2. Since test case 2 includes an atomic logical expression “¬ (Sb> 0)” that is not included in test case 1, test case 2 is selected.

次にテストケース3に着目する。テストケース3では、テストケース1及び2のいずれにも含まれない原子論理式「¬(Sc > 0)」を含むので、テストケース3を選択する。
次にテストケース4に着目する。テストケース4に含まれる原子論理式はいずれも、テストケース1,2,3のいずれかに含まれるものなので、テストケース4については選択しない。
Next, attention is paid to test case 3. Since the test case 3 includes the atomic logical expression “¬ (Sc> 0)” that is not included in any of the test cases 1 and 2, the test case 3 is selected.
Next, attention is paid to test case 4. Since all of the atomic logical expressions included in the test case 4 are included in any of the test cases 1, 2, and 3, the test case 4 is not selected.

次にテストケース5に着目する。テストケース5では、テストケース1〜4のいずれにも含まれない原子論理式「¬(Sa ≧ 0)」を含むので、テストケース5を選択する。
テストケース6以降についても同様に、着目しているテストケースがそれまでに選択したテストケースに含まれる原子論理式と異なる原子論理式を含む場合に、その着目しているテストケースを選択する。そうすると、図4の表の場合には、12個のテストケースから5個のテストケース1,2,3,5,9が選択される。これにより、テストケース1,2,3,5,9を用いれば、全パスコンディションの原子論理式を全て充足することができるテストを実行することができる。
Next, attention is paid to test case 5. Since the test case 5 includes the atomic logical expression “¬ (Sa ≧ 0)” that is not included in any of the test cases 1 to 4, the test case 5 is selected.
Similarly, for the test cases 6 and later, when the test case of interest includes an atomic logical formula different from the atomic logical formula included in the test cases selected so far, the test case of interest is selected. Then, in the case of the table of FIG. 4, five test cases 1, 2, 3, 5, and 9 are selected from the 12 test cases. Thereby, if the test cases 1, 2, 3, 5, and 9 are used, a test that can satisfy all the atomic logical expressions of all the path conditions can be executed.

図5は、第1の実施形態におけるテストケース選択装置の構成の一例を示す。テストケース選択装置11は、制御部12、記憶部22を含む。記憶部22は、パスコンディションテーブル18、原子論理式テーブル19、目標論理式テーブル20、選択パスコンディションテーブル21を含む。   FIG. 5 shows an example of the configuration of the test case selection device according to the first embodiment. The test case selection device 11 includes a control unit 12 and a storage unit 22. The storage unit 22 includes a path condition table 18, an atomic logic formula table 19, a target logic formula table 20, and a selected path condition table 21.

パスコンディションテーブル18には、ソースコードについてシンボリック実行を行うことにより得られた実行パスの組み合わせ、すなわちパスコンディションの組み合わせ(テストケース)が格納される。原子論理式テーブル19には、パスコンディション毎に、パスコンディションに含まれる原子論理式が格納される。目標論理式テーブル20には、パスコンディションを構成する原子論理式が種類毎に格納される。選択パスコンディションテーブル21には、パスコンディションテーブル15に含まれるパスコンディションのうち、選択部16により選択されたパスコンディションが格納される。   The path condition table 18 stores combinations of execution paths obtained by performing symbolic execution on the source code, that is, combinations of path conditions (test cases). The atomic logical formula table 19 stores an atomic logical formula included in the path condition for each path condition. In the target logical expression table 20, the atomic logical expressions constituting the path condition are stored for each type. The selected path condition table 21 stores path conditions selected by the selection unit 16 among the path conditions included in the path condition table 15.

制御部12は、取得部13、分解部14、抽出部15、選択部16、出力部17を含む。取得部13は、入力装置(不図示)により、ソースコードに対してシンボリック実行を行うことにより得られたパスコンディション情報(テストケース)10を取得し、パスコンディションテーブル18に格納する。   The control unit 12 includes an acquisition unit 13, a decomposition unit 14, an extraction unit 15, a selection unit 16, and an output unit 17. The acquisition unit 13 acquires path condition information (test case) 10 obtained by performing symbolic execution on the source code with an input device (not shown), and stores it in the path condition table 18.

分解部14は、パスコンディションテーブル18に格納した各パスコンディションを原子論理式に分解する。分解部14は、その原子論理式を、パスコンディション毎に、原子論理式テーブル19に格納する。   The decomposition unit 14 decomposes each path condition stored in the path condition table 18 into an atomic logical expression. The decomposition unit 14 stores the atomic logical formula in the atomic logical formula table 19 for each path condition.

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

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

出力部17は、選択パスコンディションテーブル21に格納したパスコンディション10aをディスプレイ、プリンタ等の出力装置に出力する。
取得部13、分解部14、抽出部15、選択部16の機能について、図6〜図11を用いてさらに詳述する。
The output unit 17 outputs the path condition 10a stored in the selected path condition table 21 to an output device such as a display or a printer.
The functions of the acquisition unit 13, the decomposition unit 14, the extraction unit 15, and the selection unit 16 will be described in detail with reference to FIGS.

図6は、図1のソースコードに対してシンボリック実行をした結果得られた、入力情報としてのパスコンディション情報の一例を示す。図6では、図2で説明したように、シンボリック実行により、パスコンディション1〜12(pc1〜pc12)で示される12個のパスコンディション情報10が得られたとする。パスコンディション情報10において、pc1〜pc12は、パスコンディションを識別する識別情報である。   FIG. 6 shows an example of path condition information as input information obtained as a result of performing symbolic execution on the source code of FIG. In FIG. 6, as described with reference to FIG. 2, it is assumed that twelve path condition information 10 indicated by path conditions 1 to 12 (pc1 to pc12) are obtained by symbolic execution. In the path condition information 10, pc1 to pc12 are identification information for identifying path conditions.

図7は、第1の実施形態におけるパスコンディションテーブルの一例を示す。パスコンディションテーブル18は、データ項目「No.」181、「パスコンディション」182を含む。「No.」181には、パスコンディションを識別する情報に対応するNo.が格納される。「パスコンディション」102には、「No.」181に格納されたNo.に対応するパスコンディション情報が格納される。   FIG. 7 shows an example of a path condition table in the first embodiment. The path condition table 18 includes data items “No.” 181 and “pass condition” 182. “No.” 181 stores a No. corresponding to information for identifying the path condition. In the “pass condition” 102, path condition information corresponding to the No. stored in the “No.” 181 is stored.

ここで、パスコンディションテーブル18に関する取得部13の動作について説明する。取得部13は、入力装置により入力されたパスコンディション情報10を取得し、パスコンディションテーブル18に格納する。   Here, the operation of the acquisition unit 13 related to the path condition table 18 will be described. The acquisition unit 13 acquires the path condition information 10 input by the input device and stores it in the path condition table 18.

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

ここで、原子論理式テーブル19に関する分解部14の動作について説明する。分解部14は、パスコンディションテーブル18からパスコンディション情報を読み出し、読み出したパスコンディション情報を原子論理式に分解する。分解部14は、その原子論理式を、パスコンディション毎に、原子論理式テーブル19に格納する。   Here, the operation of the decomposition unit 14 related to the atomic logic formula table 19 will be described. The decomposition unit 14 reads path condition information from the path condition table 18 and decomposes the read path condition information into an atomic logical expression. The decomposition unit 14 stores the atomic logical formula in the atomic logical formula table 19 for each path condition.

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

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

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

図12−図14は、第1の実施形態におけるテストケース選択フローの一例を示す。ユーザは、シンボリック実行により得られたパスコンディションを、入力装置を用いて、テストケース選択装置11に入力する。取得部13は、その入力されたパスコンディションを取得し、パスコンディションテーブル18に格納する(S1)。   12 to 14 show an example of a test case selection flow in the first embodiment. The user inputs the path condition obtained by the symbolic execution to the test case selection device 11 using the input device. The acquisition unit 13 acquires the input path condition and stores it in the path condition table 18 (S1).

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

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

次に、原子論理式テーブル19に、S7〜S10の処理について未処理のレコードが存在する場合、抽出部15は、原子論理式テーブル19からレコードを読み出す(S7)。抽出部15は、S7で読み出したレコードに含まれる原子論理式のうち、目標論理式テーブル20に存在しない原子論理式が存在するか否かを判定する(S8)。   Next, when there is an unprocessed record for the processes of S7 to S10 in the atomic logical formula table 19, the extraction unit 15 reads the record from the atomic logical formula table 19 (S7). The extraction unit 15 determines whether there is an atomic logical expression that does not exist in the target logical expression table 20 among the atomic logical expressions included in the record read in S7 (S8).

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

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

次に、原子論理式テーブル19にS12〜S14について未処理のレコードが存在する場合、選択部16は、原子論理式テーブル19からレコードを読み出す(S12)。選択部16は、その読み出したレコードの選択フラグが立っているか否かを判定する(S13)。   Next, when there are unprocessed records for S12 to S14 in the atomic formula table 19, the selection unit 16 reads the records from the atomic formula table 19 (S12). The selection unit 16 determines whether or not the selection flag of the read record is set (S13).

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

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

本実施形態によれば、テストケースの選択において、目標論理式テーブル内に含まれる原子論理式(全パスコンディションを構成する全ての原子論理式の種類の集合)から構成されるテストケースを選択しないようにすることができる。これにより、冗長なテストケースを排除することができる。そのため、目標論理式テーブル内に含まれる原子論理式から構成されるテストケースが多いほど、テストケースを1つずつ実行しながらカバレッジ測定する方法よりもテストケース数を削減することができる。つまり、シンボリック実行により得られたテストケース数が多いほど、テストケース数の削減率が向上する。   According to the present embodiment, in selecting a test case, a test case composed of atomic logical expressions (a set of all atomic logical expression types constituting all path conditions) included in the target logical expression table is not selected. Can be. 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. That is, as the number of test cases obtained by symbolic execution increases, the reduction rate of the number of test cases improves.

<第2の実施形態>
第1の実施形態では、パスコンディションを全てAND部分で分割して原子論理式に分解し、パスコンディションの選択の際、既に選択したパスコンディションに含まれていない原子論理式を含むパスコンディションを選択した。それに対して、第2の実施形態では、一定の論理式については複数の原子論理式の集合(部分論理式)で取り扱い、パスコンディションの選択の際、既に選択したパスコンディションに含まれていない部分論理式を含むパスコンディションを選択する。ここで、部分論理式は、プログラムの変数に関係演算を適用した項(プログラム変数に関する述語)を論理的に組み合わせた論理式である。部分論理式の一例としては、図1の「a >= 0 & a <= 5」が挙げられる。部分論理式「a >= 0 & a <= 5」は、「a >= 0」の項と「a <= 5」の項とを論理的に組み合わせた論理式である。
<Second Embodiment>
In the first embodiment, all path conditions are divided into AND logical parts by dividing them into AND parts, and when a path condition is selected, a path condition including an atomic logical expression that is not included in the already selected path condition is selected. did. On the other hand, in the second embodiment, a certain logical expression is handled by a set (partial logical expression) of a plurality of atomic logical expressions, and a portion that is not included in the already selected path condition when selecting a path condition. Select a path condition that includes a logical expression. Here, the partial logical expression is a logical expression that logically combines terms (predicates relating to program variables) obtained by applying a relational operation to program variables. As an example of the partial logical expression, “a> = 0 & a <= 5” in FIG. The partial logical expression “a> = 0 & a <= 5” is a logical expression obtained by logically combining the term “a> = 0” and the term “a ≦ = 5”.

1つの変数の値によって分岐先を決定するのではなく、複数の変数の組み合わせで分岐先が決まることをマルチ条件という。プログラムの分岐条件がマルチ条件である場合、その分岐条件の要素の条件を個別に判定をできるようにするために、次の処理が行われる。つまり、分岐の判断となる「一連の条件」に関しては、AND部分があっても分割をしないようにする。ここで、「一連の条件」となるかの判断は、一連の条件は元のプログラムのソースコードで同じ行など近接に記載をされることから、例えば、行番号から判断をすることができる。行番号は、シンボリック実行においてパスコンディションに、元プログラムのソースコードにおける行番号を付与して出力を行うことにより取得することができる。   Rather than determining the branch destination based on the value of one variable, the branch destination is determined by a combination of a plurality of variables. When the branch condition of the program is a multi-condition, the following processing is performed so that the conditions of the elements of the branch condition can be individually determined. In other words, regarding the “series of conditions” that are the judgments of branching, even if there is an AND part, it is not divided. Here, the determination of whether or not the “series of conditions” is satisfied can be determined from, for example, the line numbers because the series of conditions are described in the vicinity of the same line in the source code of the original program. The line number can be obtained by assigning the line number in the source code of the original program to the path condition in symbolic execution and performing output.

図15及び図16は、第2の実施形態を説明するための図である。第2の実施形態では、達成したいコードカバレッジに応じた、テストケースが充足すべき目標となる部分論理式の集合を抽出し、その部分論理式を有するパスコンディションを選択する。全種類の部分論理式を充足するまでパスコンディションが選択される。ただし、パスコンディションの選択の際、既に選択したパスコンディションに含まれていない部分論理式を含むパスコンディションが選択される。   15 and 16 are diagrams for explaining the second embodiment. In the second embodiment, a set of partial logical expressions that is a target to be satisfied by the test case according to the code coverage to be achieved is extracted, and a path condition having the partial logical expression is selected. Path conditions are selected until all types of partial logical expressions are satisfied. However, when selecting a path condition, a path condition including a partial logical expression that is not included in the already selected path condition is selected.

図15(A)は、シンボリック実行により生成されたパスコンディションの集合(テストケースの集合)を示す。図15(B)は、テストケースが充足すべき目標となる部分論理式の集合(目標部分論理式集合)であるとする。   FIG. 15A shows a set of path conditions (set of test cases) generated by symbolic execution. FIG. 15B is a set of partial logical expressions (target partial logical expression set) that is a target to be satisfied by the test case.

図16の表は、シンボリック実行により得られたテストケース毎のパスコンディションを目標部分論理式毎に分解してテーブル化したものである。図16の表の列方向には、パスコンディション上の目標部分論理式集合が並べられている。   The table of FIG. 16 is a table in which path conditions for each test case obtained by symbolic execution are decomposed for each target partial logical expression. In the column direction of the table of FIG. 16, target partial logical expression sets on the path condition are arranged.

まず、テストケース1を選択する。テストケース1には、目標部分論理式「(Sa ≧ 0)∧(Sa ≦ 5)」、「(Sb > 0) ∧ (Sc > 0)」を含む。
次にテストケース2に着目する。テストケース2では、テストケース1に含まれない目標部分論理式「¬(Sb > 0) ∧ (Sc > 0)」を含むので、テストケース2を選択する。
First, test case 1 is selected. Test case 1 includes target partial logical expressions “(Sa ≧ 0) ∧ (Sa ≦ 5)” and “(Sb> 0) ∧ (Sc> 0)”.
Next, focus on test case 2. Since test case 2 includes a target partial logical expression “¬ (Sb> 0) ∧ (Sc> 0)” that is not included in test case 1, test case 2 is selected.

次にテストケース3に着目する。テストケース3では、テストケース1及び2のいずれにも含まれない目標部分論理式「(Sb > 0) ∧ ¬(Sc > 0)」を含むので、テストケース3を選択する。   Next, attention is paid to test case 3. Since test case 3 includes a target partial logical expression “(Sb> 0) ∧¬ (Sc> 0)” that is not included in either of test cases 1 and 2, test case 3 is selected.

次にテストケース4に着目する。テストケース4では、テストケース1〜3のいずれにも含まれない目標部分論理式「¬(Sb > 0) ∧ ¬(Sc > 0)」を含むので、テストケース4を選択する。   Next, attention is paid to test case 4. Since test case 4 includes the target partial logical expression “¬ (Sb> 0)) (Sc> 0)” that is not included in any of test cases 1 to 3, test case 4 is selected.

次にテストケース5に着目する。テストケース5では、テストケース1〜4のいずれにも含まれない目標部分論理式「¬ (Sa ≧ 0) ∧(Sa ≦ 5)」を含むので、テストケース5を選択する。   Next, attention is paid to test case 5. Since test case 5 includes a target partial logical expression “¬ (Sa ≧ 0) ∧ (Sa ≦ 5)” that is not included in any of test cases 1 to 4, test case 5 is selected.

次にテストケース6に着目する。テストケース6の目標部分論理式はいずれも、テストケース1〜5のいずれかに含まれるものなので、テストケース6については選択しない。
テストケース7以降についても同様に、着目しているテストケースの目標部分論理式が、それまでに選択したテストケースに含まれる目標部分論理式と異なる場合に、その着目しているテストケースを選択する。そうすると、図16の表の場合には、12個のテストケースから6個のテストケース1,2,3,4,5,9が選択される。これにより、テストケース1,2,3,4,5,9を用いれば、パスコンディション内の目標部分論理式を全て充足するテストを実行することができる。
Next, attention is paid to the test case 6. Since all the target partial logical expressions of the test case 6 are included in any of the test cases 1 to 5, the test case 6 is not selected.
Similarly, for test case 7 and later, if the target partial logical expression of the target test case is different from the target partial logical expression included in the test case selected so far, select the target test case. To do. Then, in the case of the table of FIG. 16, six test cases 1, 2, 3, 4, 5, 9 are selected from the 12 test cases. Thereby, if the test cases 1, 2, 3, 4, 5, and 9 are used, it is possible to execute a test that satisfies all the target partial logical expressions in the path condition.

図17は、第2の実施形態におけるテストケース選択装置の構成の一例を示す。テストケース選択装置11は、制御部12、記憶部22を含む。記憶部22は、パスコンディションテーブル31、組み合わせテーブル32、目標論理式テーブル33、選択パスコンディションテーブル34、行番号テーブル35を含む。   FIG. 17 shows an example of the configuration of the test case selection device according to the second embodiment. The test case selection device 11 includes a control unit 12 and a storage unit 22. The storage unit 22 includes a path condition table 31, a combination table 32, a target logical expression table 33, a selected path condition table 34, and a line number table 35.

パスコンディションテーブル31には、ソースコードに対してシンボリック実行を行うことにより得られた実行パスの組み合わせ、すなわちパスコンディションの組み合わせ(テストケース)が格納される。なお、本実施形態では、パスコンディションに含まれる原子論理式には、後述するように、ソースコード上において、その原子論理式に対応する条件が記述されている位置を示す情報(例えば、行の番号)が付与されている。   The path condition table 31 stores combinations of execution paths obtained by performing symbolic execution on the source code, that is, combinations of path conditions (test cases). In the present embodiment, as will be described later, the atomic logical expression included in the path condition includes information (for example, a line number) indicating a position where a condition corresponding to the atomic logical expression is described in the source code. Number).

組み合わせテーブル32には、パスコンディション毎に、パスコンディションに含まれる、付与された行番号毎に分解された原子論理式の組み合わせ、すなわちパスコンディションに含まれる論理式(部分論理式)が格納される。   The combination table 32 stores, for each path condition, a combination of atomic logical expressions decomposed for each assigned line number included in the pass condition, that is, a logical expression (partial logical expression) included in the path condition. .

目標論理式テーブル33には、パスコンディションを構成する行番号毎に分解された原子論理式の組み合わせ(部分論理式)が、行番号に応じて格納される。
選択パスコンディションテーブル34には、パスコンディションテーブル31に含まれるパスコンディションのうち、選択部16により選択されたパスコンディションが格納される。
In the target logical expression table 33, combinations (partial logical expressions) of atomic logical expressions decomposed for each line number constituting the path condition are stored according to the line numbers.
In the selected path condition table 34, path conditions selected by the selection unit 16 among the path conditions included in the path condition table 31 are stored.

制御部12は、取得部13、分解部14a、抽出部15a、選択部16、出力部17を含む。第1の実施形態と動作が異なるのは、分解部14a、抽出部15aである。取得部13は、入力装置(不図示)により、ソースコードに対してシンボリック実行を行うことにより得られたパスコンディションの組み合わせであるパスコンディション情報(テストケース)30を取得し、パスコンディションテーブル18に格納する。   The control unit 12 includes an acquisition unit 13, a decomposition unit 14 a, an extraction unit 15 a, a selection unit 16, and an output unit 17. The operation differs from the first embodiment in the disassembling unit 14a and the extracting unit 15a. The acquisition unit 13 acquires path condition information (test case) 30 that is a combination of path conditions obtained by performing symbolic execution on the source code with an input device (not shown), and stores the path condition information 18 in the path condition table 18. Store.

分解部14aは、パスコンディションテーブル31の全てのパスコンディションに存在する全ての行番号を抽出し、行番号テーブル35に格納する。それから、分解部14aは、パスコンディションテーブル31内の各パスコンディションを行番号毎に分解して部分論理式を取得する。分解部14aは、行番号毎に分解して得た原子論理式の組み合わせを、パスコンディション毎に、組み合わせテーブル32に格納する。   The decomposing unit 14 a extracts all the line numbers existing in all the path conditions in the path condition table 31 and stores them in the line number table 35. Then, the decomposition unit 14a disassembles each path condition in the path condition table 31 for each row number, and acquires a partial logical expression. The decomposition unit 14a stores combinations of atomic logical expressions obtained by decomposition for each row number in the combination table 32 for each path condition.

抽出部15aは、組み合わせテーブル32に含まれる原子論理式の組み合わせ(部分論理式)を、行番号に応じた目標論理式テーブル33へ格納する。ただし、抽出部15aは、既に目標論理式テーブル33にある原子論理式の組み合わせ(部分論理式)を格納しない。このとき、抽出部15aは、目標論理式テーブル33に格納した原子論理式の組み合わせ(部分論理式)を有するパスコンディションについては、組み合わせテーブル32において、そのパスコンディションにフラグ(選択フラグ)を立てる。   The extraction unit 15a stores the combination of the atomic logical expressions (partial logical expressions) included in the combination table 32 in the target logical expression table 33 corresponding to the row number. However, the extraction unit 15a does not store the combination of atomic formulas (partial formulas) already in the target formula table 33. At this time, the extraction unit 15 a sets a flag (selection flag) for the path condition in the combination table 32 for the path condition having the combination of the atomic logical expressions (partial logical expressions) stored in the target logical expression table 33.

選択部16は、組み合わせテーブル32から、選択フラグの立っているパスコンディションを検出する。選択部16は、パスコンディションテーブル31から、その検出したパスコンディションに対応するパスコンディションを選択し、選択パスコンディションテーブル34に格納する。   The selection unit 16 detects a path condition in which a selection flag is set from the combination table 32. The selection unit 16 selects a path condition corresponding to the detected path condition from the path condition table 31 and stores the selected path condition in the selected path condition table 34.

出力部17は、選択パスコンディションテーブル21に格納したパスコンディションをディスプレイ、プリンタ等の出力装置に出力する。   The output unit 17 outputs the path condition stored in the selected path condition table 21 to an output device such as a display or a printer.

図18は、第2の実施形態におけるソースコードの一例を示す。図18において、「a >=0 & a <= 5」の条件がソースコードの第1行目に記述されているとする。また。「b > 0 &c > 0」の条件がソースコードの第2行目に記述されているとする。   FIG. 18 shows an example of the source code in the second embodiment. In FIG. 18, it is assumed that the condition “a> = 0 & a <= 5” is described in the first line of the source code. Also. It is assumed that the condition “b> 0 & c> 0” is described in the second line of the source code.

図19は、図18のソースコードに対してシンボリック実行をした結果得られた、入力情報としてのパスコンディション情報の一例を示す。図6と比べて、図19では、シンボリック実行においてパスコンディションに元プログラムにおける行番号を併せて出力を行う機能を用いている。そのため、パスコンディションに含まれる各原子論理式には、ソースコード上の行番号が付されている。例えば、(l1,(Sa ≧ 0))は、ソースコードの第1行目に「Sa ≧ 0」に相当する条件が記述されていることを示す。   FIG. 19 shows an example of path condition information as input information obtained as a result of performing symbolic execution on the source code of FIG. Compared with FIG. 6, FIG. 19 uses a function of outputting the line condition in the original program together with the path condition in symbolic execution. Therefore, each atomic logical expression included in the path condition is given a line number on the source code. For example, (l1, (Sa ≧ 0)) indicates that a condition corresponding to “Sa ≧ 0” is described in the first line of the source code.

図20は、第2の実施形態におけるパスコンディションテーブルの一例を示す。パスコンディションテーブル31は、データ項目「No.」311、「パスコンディション」312を含む。「No.」311には、パスコンディションを識別する情報に対応するNo.が格納される。「パスコンディション」312には、「No.」311に格納されたNo.に対応するパスコンディション情報が格納される。   FIG. 20 shows an example of a path condition table in the second embodiment. The path condition table 31 includes data items “No.” 311 and “path condition” 312. “No.” 311 stores a No. corresponding to information for identifying the path condition. In the “pass condition” 312, path condition information corresponding to the No. stored in the “No.” 311 is stored.

ここで、パスコンディションテーブル31に関する取得部13の動作について説明する。取得部13は、入力装置により入力されたパスコンディション情報30を取得し、パスコンディションテーブル31に格納する。   Here, the operation of the acquisition unit 13 related to the path condition table 31 will be described. The acquisition unit 13 acquires the path condition information 30 input by the input device and stores it in the path condition table 31.

図21は、第2の実施形態における行番号テーブルを示す。行番号テーブル35には、パスコンディションに含まれる原子論理式に付与された行番号が格納される。
ここで、行番号テーブル35に関する分解部14aの動作について説明する。分解部14aは、パスコンディションテーブル31の全てのパスコンディションに存在する全ての行番号を抽出し、行番号テーブル35に格納する。
FIG. 21 shows a line number table in the second embodiment. The line number table 35 stores the line numbers assigned to the atomic logical expressions included in the path condition.
Here, the operation of the disassembling unit 14a regarding the line number table 35 will be described. The decomposing unit 14 a extracts all the line numbers existing in all the path conditions in the path condition table 31 and stores them in the line number table 35.

図22は、第2の実施形態における組み合わせテーブルの一例を示す。組み合わせテーブル32は、データ項目「No.」321、「行番号毎の原子論理式の組み合わせ」322を含む。「No.」321には、パスコンディションの識別情報に対応するNo.が格納される。「原子論理式の組み合わせ」322には、「No.」321に格納されたNo.に対応するパスコンディション情報に含まれる、行番号毎の原子論理式の組み合わせが格納される。たとえば、組み合わせテーブル32のレコード(No.01)には、行番号1の原子論理式の組み合わせ「(l1,(Sa ≧ 0) ) ∧ (l1, (Sa ≦5))」と、行番号1の原子論理式の組み合わせ「(l2, (Sb > 0)) ∧ (l2, (Sc > 0))」が格納されている。   FIG. 22 shows an example of a combination table in the second embodiment. The combination table 32 includes data items “No.” 321 and “combinations of atomic logical expressions for each row number” 322. “No.” 321 stores a No. corresponding to the identification information of the path condition. “Atom logical formula combination” 322 stores a combination of atomic logical formulas for each row number included in the path condition information corresponding to No. stored in “No.” 321. For example, in the record (No. 01) of the combination table 32, the combination of atomic formulas of line number 1 “(l1, (Sa ≧ 0)) (l1, (Sa ≦ 5))” and line number 1 The combination of atomic formulas of “(l2, (Sb> 0)) ∧ (l2, (Sc> 0))” is stored.

ここで、組み合わせテーブル32に関する分解部14aの動作について説明する。分解部14aは、パスコンディションテーブル31内のパスコンディションを行番号毎に分解した、原子論理式の組み合わせを取得する。分解部14aは、行番号毎に分解して得た原子論理式の組み合わせを、パスコンディション毎に、組み合わせテーブル32に格納する。   Here, the operation of the disassembling unit 14a regarding the combination table 32 will be described. The decomposition unit 14a acquires a combination of atomic logical formulas obtained by disassembling the path conditions in the path condition table 31 for each row number. The decomposition unit 14a stores combinations of atomic logical expressions obtained by decomposition for each row number in the combination table 32 for each path condition.

図23は、図22の組み合わせテーブル32にデータ項目「選択」323を追加した一例を示す。目標論理式テーブル33には、組み合わせテーブル32において、着目しているパスコンディションに含まれる原子論理式の組み合わせのうち、それまでに保持した原子論理式の組み合わせ以外の原子論理式の組み合わせが、行番号毎に、保持される。   FIG. 23 shows an example in which the data item “selection” 323 is added to the combination table 32 of FIG. In the target logical formula table 33, combinations of atomic logical formulas other than the combinations of atomic logical formulas held so far among the combinations of atomic logical formulas included in the focused path condition in the combination table 32 are stored in the target logical formula table 33. It is held for each number.

図24は、第2の実施形態における目標論理式テーブルの一例を示す。図24(A)は、行番号1(l1)の原子論理式の組み合わせについての目標論理式テーブル331を示す。目標論理式テーブル331には、図23の組み合わせテーブル32において、下線で示した行番号1(l1)の原子論理式の組み合わせが格納される。図24(B)は、行番号2(l2)の原子論理式の組み合わせについての目標論理式テーブル332を示す。目標論理式テーブル332には、図23の組み合わせテーブル32において、斜体で示した行番号2(l2)の原子論理式の組み合わせが格納される。これにより、目標論理式テーブル33には、最終的に、行番号毎に、組み合わせテーブル32に含まれる全ての種類の原子論理式の組み合わせが格納される。   FIG. 24 shows an example of the target logical expression table in the second embodiment. FIG. 24A shows a target logical expression table 331 for a combination of atomic logical expressions of line number 1 (l1). In the target logical expression table 331, the combination of the atomic logical expressions of the line number 1 (l1) indicated by the underline in the combination table 32 of FIG. 23 is stored. FIG. 24B shows a target logical expression table 332 for the combination of atomic logical expressions in line number 2 (l2). The target logical expression table 332 stores a combination of atomic logical expressions of line number 2 (l2) shown in italics in the combination table 32 of FIG. Thereby, the target logical expression table 33 finally stores combinations of all types of atomic logical expressions included in the combination table 32 for each row number.

ここで、目標論理式テーブル33に関する抽出部15aの動作について説明する。抽出部15aは、組み合わせテーブル32に含まれる原子論理式の組み合わせを、行番号に応じた目標論理式テーブル33へ格納する。ただし、抽出部15aは、既に目標論理式テーブル33にある原子論理式の組み合わせを格納しない。このとき、抽出部15aは、目標論理式テーブル33に格納した原子論理式の組み合わせを有するパスコンディションについては、図23に示すように、組み合わせテーブル32において、そのパスコンディションにフラグ(選択フラグ)を立てる。   Here, the operation of the extraction unit 15a regarding the target logical expression table 33 will be described. The extraction unit 15a stores the combination of atomic logical expressions included in the combination table 32 in the target logical expression table 33 corresponding to the row number. However, the extraction unit 15a does not store a combination of atomic logical expressions already in the target logical expression table 33. At this time, the extracting unit 15a sets a flag (selection flag) for the path condition in the combination table 32 as shown in FIG. 23 for the path condition having the combination of the atomic logical expressions stored in the target logical expression table 33. Stand up.

図25は、第2の実施形態における選択パスコンディションテーブルの一例を示す。選択部16は、組み合わせテーブル32から、選択フラグの立っているパスコンディションを検出する。選択部16は、パスコンディションテーブル31から、その検出したパスコンディションに対応するパスコンディションを選択し、選択パスコンディションテーブル24に格納する。   FIG. 25 shows an example of the selected path condition table in the second embodiment. The selection unit 16 detects a path condition in which a selection flag is set from the combination table 32. The selection unit 16 selects a path condition corresponding to the detected path condition from the path condition table 31 and stores it in the selected path condition table 24.

図26−図30は、第2の実施形態におけるテストケース選択フローの一例を示す。ユーザは、シンボリック実行により得られた、各原子論理式に行番号が付与されたパスコンディションを、入力装置を用いて、テストケース選択装置11に入力する。取得部13は、その入力されたパスコンディションを取得し、パスコンディションテーブル31に格納する(S21)。   26 to 30 show an example of a test case selection flow in the second embodiment. The user inputs a path condition in which a line number is assigned to each atomic logical expression obtained by symbolic execution to the test case selection device 11 using the input device. The acquisition unit 13 acquires the input path condition and stores it in the path condition table 31 (S21).

分解部14aは、パスコンディションテーブル31からレコードを読み出す(S23)。分解部14aは、読み出したレコードのパスコンディションに原子論理式が存在するか否かを判定する(S24)。読み出したレコードのパスコンディションに原子論理式が存在する場合(S24で「Yes」)、分解部14aはそのレコードのパスコンディションの先頭の原子論理式と、その原子論理式に付与された行番号とを取り出する(S25)。   The decomposition unit 14a reads a record from the path condition table 31 (S23). The decomposition unit 14a determines whether an atomic logical expression exists in the path condition of the read record (S24). When an atomic logical formula exists in the path condition of the read record (“Yes” in S24), the decomposition unit 14a determines the first atomic logical formula of the path condition of the record, the line number assigned to the atomic logical formula, Is taken out (S25).

分解部14aは、取り出した行番号が行番号テーブル35に存在するか否かを判定する(S26)。取り出した行番号が行番号テーブル35に存在しない場合(S26で「No」)、分解部14aは、その行番号を行番号テーブル35に格納する(S27)。   The decomposition unit 14a determines whether or not the extracted line number exists in the line number table 35 (S26). When the extracted line number does not exist in the line number table 35 (“No” in S26), the disassembling unit 14a stores the line number in the line number table 35 (S27).

S26において取り出した行番号が行番号テーブル35に存在する場合(S26で「Yes」)、または、S27の処理後、処理がS24へ戻る。分解部14aは、S23で読み出したコンディション内にある各原子論理式についてS25〜S27の処理を行う。   If the line number retrieved in S26 exists in the line number table 35 (“Yes” in S26), or after the process of S27, the process returns to S24. The decomposition unit 14a performs the processing of S25 to S27 for each atomic logical expression in the condition read in S23.

S23で読み出したパスコンディション内にある全原子論理式についてS25〜S27の処理が終了すると(S24で「No」)、分解部14aは、パスコンディションテーブル31から次のパスコンディションを読み出す(S22で「Yes」、S23)。分解部14aは、パスコンディションテーブル31内にある全パスコンディションについて、S23〜27の処理を行う。   When the processing of S25 to S27 is completed for all atomic logical expressions in the path condition read in S23 (“No” in S24), the decomposition unit 14a reads the next path condition from the path condition table 31 (“S22” Yes ", S23). The decomposition unit 14a performs the processing of S23 to S27 for all the path conditions in the path condition table 31.

パスコンディションテーブル31内にある全パスコンディションについて、S23〜27の処理が終了すると(S22で「No」)、分解部14aは、再び、パスコンディションテーブル31の先頭からパスコンディションを読み出す(S29)。分解部14aは、行番号テーブル35から行番号を取り出す(S31)。分解部14aは、S29で読み出したパスコンディションに、取り出した行番号を有する原子論理式が存在するか否かを判定する(S32)。   When the processing of S23 to S27 is completed for all the path conditions in the path condition table 31 (“No” in S22), the disassembling unit 14a reads the path condition from the head of the path condition table 31 again (S29). The decomposition unit 14a extracts the line number from the line number table 35 (S31). The decomposition unit 14a determines whether or not an atomic logical expression having the extracted row number exists in the path condition read in S29 (S32).

S32において、S29で読み出したパスコンディションに、その取り出した行番号を有する原子論理式が存在する場合(S32で「Yes」)、分解部14aは、次の処理を行う。すなわち、分解部14aは、論理積∧で接続された、その行番号を有する原子論理式同士の組み合わせを、組み合わせテーブル32に追加する(S33)。分解部14aは、S29で読み出したパスコンディション内において、その取り出した行番号を有する全原子論理式についてS33の処理を行う。   In S32, if the path condition read in S29 includes an atomic logical expression having the extracted row number (“Yes” in S32), the decomposing unit 14a performs the following process. That is, the decomposing unit 14a adds a combination of atomic logical expressions having the row number connected by logical conjunction to the combination table 32 (S33). The decomposing unit 14a performs the process of S33 for all atomic logical expressions having the extracted row numbers in the path condition read out in S29.

S29で読み出したパスコンディション内において、その取り出した行番号を有する全原子論理式についてS33の処理が終了すると(S32で「No」)、S30へ処理が戻る。分解部14aは、行番号テーブル35に格納されている各行番号について、S31〜S33の処理を行う。行番号テーブル35に格納されている各行番号について、S31〜S33の処理が終了すると、S28へ処理が戻る。   When the processing of S33 is completed for all atomic logical expressions having the extracted row numbers in the path condition read out in S29 (“No” in S32), the processing returns to S30. The disassembling unit 14a performs the processing of S31 to S33 for each row number stored in the row number table 35. When the processes of S31 to S33 are completed for each line number stored in the line number table 35, the process returns to S28.

分解部14aは、パスコンディションテーブル31内にある全パスコンディションについて、S29〜33の処理を行う。
パスコンディションテーブル31内にある全パスコンディションについてS29〜333の処理が終わると(S28で「No」)、抽出部15aは、行番号テーブル35に格納されている行番号に対応する目標論理式テーブル33を作成する(S34、S35)。
The disassembling unit 14a performs the processes of S29 to 33 for all the path conditions in the path condition table 31.
When the processing of S29 to 333 is completed for all the path conditions in the path condition table 31 (“No” in S28), the extraction unit 15a uses the target logical expression table corresponding to the line numbers stored in the line number table 35. 33 is created (S34, S35).

行番号テーブル35に格納されている行番号に対応する目標論理式テーブルが作成されると、抽出部15aは、組み合わせテーブル32から1つのレコードを読み出す(S37)。   When the target logical expression table corresponding to the line number stored in the line number table 35 is created, the extraction unit 15a reads one record from the combination table 32 (S37).

抽出部15aは、読み出したレコードから原子論理式の組み合わせを取り出す(S39)。抽出部15aは、取り出した原子論理式の組み合わせに付与された行番号に対応する目標論理式テーブル33に、同じ原子論理式の組み合わせが存在するか否かを判定する(S40)。   The extraction unit 15a extracts a combination of atomic logical expressions from the read record (S39). The extraction unit 15a determines whether or not the same combination of atomic formulas exists in the target logical formula table 33 corresponding to the row number assigned to the extracted combination of atomic formulas (S40).

取り出した原子論理式の組み合わせに付与された行番号に対応する目標論理式テーブルに、同じ原子論理式の組み合わせが存在しない場合(S40で「No」)、抽出部15aは、その目標論理式テーブル33に、その原子論理式の組み合わせを追加する(S41)。このとき、抽出部15aは、S37で読み出したレコードに選択フラグを立てる(S42)。その後、処理がS38へ戻る。   If there is no combination of the same atomic logical formulas in the target logical formula table corresponding to the row number assigned to the combination of the extracted atomic logical formulas (“No” in S40), the extracting unit 15a A combination of the atomic logical formulas is added to 33 (S41). At this time, the extraction unit 15a sets a selection flag for the record read in S37 (S42). Thereafter, the process returns to S38.

取り出した原子論理式の組み合わせに付与された行番号に対応する目標論理式テーブルに、同じ原子論理式の組み合わせが存在する場合(S40で「Yes」)、処理がS38へ戻る。   If the same combination of atomic logical formulas exists in the target logical formula table corresponding to the line number assigned to the extracted combination of atomic logical formulas (“Yes” in S40), the process returns to S38.

抽出部15aは、S37で読み出したレコード内に含まれる全原子論理式の組み合わせについてS39〜S42の処理を行う(S38で「Yes」)。S37で読み出したレコード内に含まれる全原子論理式の組み合わせについてS39〜S42の処理が終了すると(S38で「No」)、処理がS36へ戻る。抽出部15aは、組み合わせテーブル32内にある全レコードについて、S37〜42の処理を行う(S36で「Yes」)。組み合わせテーブル32内にある全レコードについてS37〜42の処理が終了すると(S36で「No」)、選択部16は、組み合わせテーブル32からレコードを読み出す(S44)。選択部16は、そのレコードの選択フラグが立っているか否かを判定する(S45)。   The extraction unit 15a performs the processing of S39 to S42 for the combination of all atomic logical formulas included in the record read out in S37 (“Yes” in S38). When the processing of S39 to S42 is completed for the combination of all atomic formulas included in the record read in S37 (“No” in S38), the processing returns to S36. The extraction unit 15a performs the processing of S37 to 42 for all the records in the combination table 32 (“Yes” in S36). When the processing of S37 to 42 is completed for all the records in the combination table 32 (“No” in S36), the selection unit 16 reads records from the combination table 32 (S44). The selection unit 16 determines whether or not the record selection flag is set (S45).

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

S45において、そのレコードの選択フラグが立っていないと判定した場合(S13で「No」)、または、S46の処理が終了した場合、処理がS43へ戻る。
選択部16は、組み合わせテーブル32内にある全レコードについて、S44〜46の処理を行う。組み合わせテーブル32内にある全レコードについて、S44〜46の処理が終了すると(S43で「No」)、本フローは終了する。
In S45, when it is determined that the selection flag of the record is not set (“No” in S13), or when the process of S46 is completed, the process returns to S43.
The selection unit 16 performs the processes of S44 to S46 for all the records in the combination table 32. When the processes of S44 to 46 are completed for all the records in the combination table 32 (“No” in S43), this flow ends.

本実施形態によれば、マルチコンディションカバレッジに応じたテストケースを選択することができる。   According to this embodiment, it is possible to select a test case corresponding to multi-condition coverage.

<第3の実施形態>
第1の実施形態では、テストケースの選択において、目標論理式テーブル内にまだ格納されていない原子論理式を含むテストケースを選択するようにした。しかしながら、この方法でテストを選択すると、特定の原子論理式の組み合わせを含むテストケースを選択することができない。その結果、選択されたテストケースから、例えば、正常系(エラーの起こらないケース)と呼ばれる利用頻度の高いパスコンディション(テストケース)等の特定のテストケースが漏れてしまう可能性がある。これについて、図31−図33を用いて説明する。
<Third Embodiment>
In the first embodiment, when selecting a test case, a test case including an atomic logical formula that is not yet stored in the target logical formula table is selected. However, when a test is selected by this method, a test case including a specific combination of atomic formulas cannot be selected. As a result, there is a possibility that a specific test case such as a pass condition (test case) having a high usage frequency called a normal system (case where no error occurs) is leaked from the selected test case. This will be described with reference to FIGS.

図31は、テスト対象プログラムのソースコードの一例を示す。図32は、図31のテスト対象プログラムのフローチャートを示す。図33(A)は、シンボリック実行により得られるテストケースを示す。図33(B)は、第1の実施形態を用いて選択されたテストケースを示す。なお、図33(A)(B)に示すテストケースには、「No.」、「パスコンディション」、「入力」が含まれる。「入力」は、テストデータとしての入力情報を示す。   FIG. 31 shows an example of the source code of the test target program. FIG. 32 shows a flowchart of the test target program of FIG. FIG. 33A shows a test case obtained by symbolic execution. FIG. 33B shows a test case selected using the first embodiment. Note that the test cases shown in FIGS. 33A and 33B include “No.”, “pass condition”, and “input”. “Input” indicates input information as test data.

図31のテスト対象プログラムについてシンボリック実行を行った場合、図33(A)で示すように、No.1〜No.4のパスコンディションが得られたとする。No.1〜No.4のパスコンディションについて第1の実施形態を適用し、No.2及びNo.3で示すテストケースが選択されたとする(図33(B))。この場合、No.2及びNo.3で示すテストケースには、No.1〜No.4のパスコンディションに含まれる全ての種類の原子論理式が存在するので、No.1及びNo.4のパスコンディションは選択されない。この場合、図32に示すように、正常系のテストケース(エラーが起こらないケース)として、No.4で示すパスコンディションが選択されない。   When symbolic execution is performed on the test target program of FIG. 31, it is assumed that path conditions No. 1 to No. 4 are obtained as shown in FIG. It is assumed that the first embodiment is applied to the path conditions No. 1 to No. 4 and the test cases indicated by No. 2 and No. 3 are selected (FIG. 33B). In this case, the test cases indicated by No. 2 and No. 3 include all types of atomic logical expressions included in the path conditions No. 1 to No. 4, so that No. 1 and No. 4 The pass condition is not selected. In this case, as shown in FIG. 32, the path condition indicated by No. 4 is not selected as a normal test case (a case where no error occurs).

そこで、第3の実施形態では、シンボリック実行により生成されるテストケースから、特定のテストケースを優先的に選択しつつ、冗長なくテストケースを選択するテストケース選択技術について説明する。なお、第3の実施形態では、第1または第2の実施形態で説明した構成、機能、または処理と同じものについては、第1または第2の実施形態と同一の符号を付し、その説明を省略する。   Therefore, in the third embodiment, a test case selection technique for selecting a test case without redundancy while preferentially selecting a specific test case from test cases generated by symbolic execution will be described. Note that in the third embodiment, the same components, functions, or processes as those described in the first or second embodiment are denoted by the same reference numerals as those in the first or second embodiment, and the description thereof is omitted. Is omitted.

(実施例1)
図34は、第3の実施形態(実施例1)におけるテストケース選択装置の構成の一例を示す。テストケース選択装置11では、図5のテストケース選択装置11の制御部12に、ソースコード読取部41、ドライバ変更部42、テストケース生成部43、テストケース調整部44が追加されている。なお、第3の実施形態では、取得部13、分解部14、抽出部15、選択部16、及び出力部17を選択制御部45と称する。また、記憶部22には、パスコンディションテーブル18、原子論理式テーブル19、目標論理式テーブル20、選択パスコンディションテーブル21、正常系パス判定式51、シンボリック実行用のドライバ52が格納されている。
(Example 1)
FIG. 34 shows an example of the configuration of the test case selection device according to the third mode for embodying the present invention (embodiment 1). In the test case selection device 11, a source code reading unit 41, a driver change unit 42, a test case generation unit 43, and a test case adjustment unit 44 are added to the control unit 12 of the test case selection device 11 of FIG. In the third embodiment, the acquisition unit 13, the decomposition unit 14, the extraction unit 15, the selection unit 16, and the output unit 17 are referred to as a selection control unit 45. The storage unit 22 also stores a path condition table 18, an atomic logical formula table 19, a target logical formula table 20, a selected path condition table 21, a normal path determination formula 51, and a symbolic execution driver 52.

ソースコード読取部41は、テスト対象プログラムのソースコード40を読み取り、RAM(Random Access Memory)等の記憶装置へ記憶する。ソースコード40の一例は、図31で示されている。ソースコード40には、テスト対象プログラムが正常に実行された場合(正常系パスが実行された場合)には、例えば、所定の変数に、所定の値が入力される(または入力されない)ようにコーディングされている。   The source code reading unit 41 reads the source code 40 of the test target program and stores it in a storage device such as a RAM (Random Access Memory). An example of the source code 40 is shown in FIG. In the source code 40, when the test target program is executed normally (when the normal path is executed), for example, a predetermined value is input (or is not input) to a predetermined variable. It is coded.

ドライバ変更部42は、シンボリック実行用のドライバ52に対して、読み取ったソースコード40中の所定の変数の値に基づいてテスト対象プログラムの実行結果が正常(正常系パス)であるか否かを判定する正常系パス判定式51のコードを組み込む。ドライバ変更部42は、さらに、シンボリック実行用のドライバ52に対して、その判定した結果を、後述するシンボリック実行により得られたパスコンディションに反映するコードを組み込む。ここで、シンボリック実行用のドライバ52とは、テスト対象プログラムのソースコード40について、所定の実行パターンに従って、テストケース生成部43にシンボリック実行を行わせるためのドライバコードである。   The driver changing unit 42 determines whether or not the execution result of the test target program is normal (normal path) based on the value of a predetermined variable in the read source code 40 with respect to the symbolic execution driver 52. The code of the normal system path determination formula 51 for determination is incorporated. Further, the driver changing unit 42 incorporates into the symbolic execution driver 52 a code that reflects the determination result in a path condition obtained by symbolic execution described later. Here, the symbolic execution driver 52 is driver code for causing the test case generation unit 43 to perform symbolic execution according to a predetermined execution pattern for the source code 40 of the test target program.

テストケース生成部43は、ソースコード40について、ドライバ変更部42により上記所定のコードが組み込まれたシンボリック実行用のドライバを用いて、シンボリック実行を行う。これにより、ソースコード40についての実行パスの組み合わせ、すなわちパスコンディションの組み合わせ(テストケース)が得られ、記憶部22に格納される。ここで得られる各パスコンディションには、正常系パスであるか否かの情報が付与されている。   The test case generation unit 43 performs symbolic execution on the source code 40 using the symbolic execution driver in which the predetermined code is incorporated by the driver changing unit 42. Thereby, a combination of execution paths for the source code 40, that is, a combination of path conditions (test case) is obtained and stored in the storage unit 22. Each path condition obtained here is given information on whether or not it is a normal path.

テストケース調整部44は、シンボリック実行により生成されたテストケース群を、正常系パスに関するテストケース(パスコンディション)群と、正常系パス以外の実行パス(異常系パス)に関するテストケース(パスコンディション)群とに分類する。また、テストケース調整部44は、パスコンディションテーブル18、原子論理式テーブル19、目標論理式テーブル20、選択パスコンディションテーブル21の内容を初期化する。   The test case adjustment unit 44 includes test cases generated by symbolic execution as test cases (path conditions) related to normal paths and test cases (path conditions) related to execution paths other than normal paths (abnormal paths). Group into groups. In addition, the test case adjustment unit 44 initializes the contents of the path condition table 18, the atomic logical expression table 19, the target logical expression table 20, and the selected path condition table 21.

テストケース調整部44は、正常系パスに関するパスコンディション群について、取得部13、分解部14、抽出部15、選択部16にそれぞれ、第1の実施形態で説明した処理を実行させる。次に、テストケース調整部44は、異常系パスに関するパスコンディション群について、取得部13、分解部14、抽出部15、選択部16にそれぞれ、第1の実施形態で説明した処理を実行させる。   The test case adjustment unit 44 causes the acquisition unit 13, the decomposition unit 14, the extraction unit 15, and the selection unit 16 to execute the processing described in the first embodiment for the path condition group related to the normal path. Next, the test case adjustment unit 44 causes the acquisition unit 13, the decomposition unit 14, the extraction unit 15, and the selection unit 16 to execute the processing described in the first embodiment for the path condition group related to the abnormal path.

取得部13は、テストケース調整部44により分類された正常系パスまたは異常系パスに関するパスコンディション情報(テストケース)を取得し、パスコンディションテーブル18に格納する。   The acquisition unit 13 acquires path condition information (test cases) related to normal paths or abnormal paths classified by the test case adjustment unit 44 and stores the path condition information in the path condition table 18.

分解部14は、パスコンディションテーブル18に格納した各パスコンディションを原子論理式に分解する。分解部14は、その原子論理式を、パスコンディション毎に、原子論理式テーブル19に格納する。   The decomposition unit 14 decomposes each path condition stored in the path condition table 18 into an atomic logical expression. The decomposition unit 14 stores the atomic logical formula in the atomic logical formula table 19 for each path condition.

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

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

出力部17は、選択パスコンディションテーブル21に格納したパスコンディション40aをディスプレイ、プリンタ等の出力装置に出力する。   The output unit 17 outputs the path condition 40a stored in the selected path condition table 21 to an output device such as a display or a printer.

図35は、第3の実施形態(実施例1)におけるドライバ変更部の処理を説明するための図である。前提として、テスト対象プログラムのソースコード40では、プログラムが正常に実行されない場合(異常系パスが実行された場合)、message変数に“ERROR”が設定されるようになっている。すなわち、ソースコード40では、プログラムが正常に実行された場合(正常系パスが実行された場合)には、message変数に“ERROR”が設定されないようになっている。   FIG. 35 is a diagram for explaining processing of the driver changing unit according to the third mode for embodying the present invention (embodiment 1). As a premise, in the source code 40 of the test target program, “ERROR” is set in the message variable when the program is not executed normally (when an abnormal path is executed). That is, in the source code 40, when the program is executed normally (when the normal path is executed), “ERROR” is not set in the message variable.

正常系パス判定式51は、読み取ったソースコード40中の所定の変数の値に基づいてテスト対象プログラムの実行結果が正常(正常系パス)であるか否かを判定する式の一例である。正常系パス判定式51は、第3の実施形態では、テスト対象プログラムが実行された結果、message変数に“ERROR”等の所定の文字が含まれていないことを判定するために用いられる。   The normal system path determination formula 51 is an example of a formula that determines whether or not the execution result of the test target program is normal (normal system path) based on the value of a predetermined variable in the read source code 40. In the third embodiment, the normal system path determination formula 51 is used to determine that a predetermined character such as “ERROR” is not included in the message variable as a result of execution of the test target program.

なお、本実施形態では、正常系パス判定式51を用いたが、ソースコードに特定の実行パスを通過したことを判別するチェックポイントを1以上挿入しておき、そのチェックポイントを判定することにより、特定の実行パスが実行されたことを検出してもよい。   In this embodiment, the normal system path determination formula 51 is used. However, one or more checkpoints for determining that a specific execution path has been passed are inserted into the source code, and the checkpoint is determined by determining the checkpoint. It may be detected that a specific execution path has been executed.

ドライバ変更部42は、記憶部22から正常系パス判定式51とシンボリック実行用のドライバ52を読み出す。ドライバ変更部42は、ドライバ52に対して、正常系パス判定式51のコードと、正常系パス判定式51による判定結果をパスコンディションに反映するコードとを組み込むことにより、ドライバ52aを生成する。   The driver change unit 42 reads the normal path determination formula 51 and the symbolic execution driver 52 from the storage unit 22. The driver changing unit 42 generates the driver 52a by incorporating the code of the normal path determination formula 51 and the code reflecting the determination result of the normal path determination formula 51 in the path condition into the driver 52.

図35に示すドライバ52aは、ドライバ変更部42により所定のコードが組み込まれたシンボリック実行用のドライバの一例である。ドライバ変更部42は、シンボリック実行用のドライバ52のmain関数の最後に、コード53、及びコード54を挿入する。   The driver 52a illustrated in FIG. 35 is an example of a symbolic execution driver in which predetermined code is incorporated by the driver changing unit 42. The driver changing unit 42 inserts the code 53 and the code 54 at the end of the main function of the symbolic execution driver 52.

コード53は、message変数に“ERROR”という文字が含まれていなかったら、「SisNormal=true」(正常系)と判定し、message変数に“ERROR”という文字が含まれていたら、「SisNormal=false」(異常系)と判定することを示す。ここで、SisNormalは、シンボル変数である。   The code 53 determines that “SisNormal = true” (normal system) if the message variable does not include “ERROR”, and if the message variable includes “ERROR”, “SisNormal = false”. "(Abnormal system). Here, SisNormal is a symbol variable.

コード54は、シンボリック実行により得られた各パスコンディションに、SisNormalの条件を反映するコードである。これにより、図36で説明するように、シンボリック実行により得られた各パスコンディションに、「SisNormal=true」または「SisNormal=false」を付加することができる。   The code 54 is a code that reflects the SisNormal condition in each path condition obtained by symbolic execution. As a result, as described in FIG. 36, “SisNormal = true” or “SisNormal = false” can be added to each path condition obtained by symbolic execution.

図36は、第3の実施形態(実施例1)におけるシンボリック実行により得られるテストケース(パスコンディション)の一例を示す。テストケース生成部43は、変更されたドライバ52aを用いて、ソースコード40についてシンボリック実行を行う。これにより、テストケース(パスコンディション)55が得られる。得られた、テストケース(パスコンディション)55は、記憶部22に格納される。各パスコンディション55は、テスト対象プログラムのソースコード40に含まれる条件に基づく実行パスに、コード53,54に基づいて付与された条件式(「SisNormal=true」または「SisNormal=false」)を含む。   FIG. 36 shows an example of a test case (path condition) obtained by symbolic execution in the third mode for embodying the present invention (embodiment 1). The test case generation unit 43 performs symbolic execution on the source code 40 using the changed driver 52a. Thereby, a test case (pass condition) 55 is obtained. The obtained test case (pass condition) 55 is stored in the storage unit 22. Each path condition 55 includes a conditional expression (“SisNormal = true” or “SisNormal = false”) assigned to the execution path based on the conditions included in the source code 40 of the test target program based on the codes 53 and 54. .

図37は、第3の実施形態(実施例1)におけるテストケース調整部の処理を説明するための図である。まず、テストケース調整部44は、ソースコード40についてシンボリック実行を行うことにより得られたテストケース55から、SisNormal=trueを含むテストケース(パスコンディション)を抽出する。テストケース調整部44は、抽出したパスコンディションについて、順に、取得部13、分解部14、抽出部15、選択部16に、第1の実施形態の処理を実行させる。   FIG. 37 is a diagram for explaining processing of the test case adjustment unit in the third mode for embodying the present invention (embodiment 1). First, the test case adjustment unit 44 extracts a test case (path condition) including SisNormal = true from the test case 55 obtained by performing symbolic execution on the source code 40. The test case adjustment unit 44 causes the acquisition unit 13, the decomposition unit 14, the extraction unit 15, and the selection unit 16 to sequentially execute the processing of the first embodiment for the extracted path condition.

具体的には、取得部13は、テストケース調整部44によって抽出されたパスコンディション(SisNormal=trueを含むパスコンディション)をパスコンディションテーブル18に格納する。分解部14は、パスコンディションテーブル18に格納された各パスコンディションを原子論理式に分解する。分解部14は、その原子論理式を、パスコンディション毎に、原子論理式テーブル19に格納する。   Specifically, the acquiring unit 13 stores the path condition (path condition including SisNormal = true) extracted by the test case adjusting unit 44 in the path condition table 18. The decomposition unit 14 decomposes each path condition stored in the path condition table 18 into an atomic logical expression. The decomposition unit 14 stores the atomic logical formula in the atomic logical formula table 19 for each path condition.

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

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

図36の場合、テストケース調整部44は、SisNormal=trueを含むパスコンディションとして、No.4のパスコンディションを選択する。No.4のパスコンディションは、原子論理式「¬(Sa<0)」「¬(Sb<0)」を含むので、抽出部15は、目標論理式テーブル20に原子論理式「¬(Sa<0)」「¬(Sb<0)」を格納する(図37(A))。この場合、抽出部15は、原子論理式テーブル19において、No.4のパスコンディションにフラグを立てる。選択部16は、原子論理式テーブル19からそのフラグを有するNo.4のパスコンディションを検出し、そのパスコンディションを選択パスコンディションテーブル21に格納する。   In the case of FIG. 36, the test case adjustment unit 44 selects the No. 4 path condition as the path condition including SisNormal = true. Since the path condition of No. 4 includes the atomic logical expressions “¬ (Sa <0)” and “¬ (Sb <0)”, the extraction unit 15 stores the atomic logical expression “¬ (Sa <0 < 0) ”and“ ¬ (Sb <0) ”are stored (FIG. 37A). In this case, the extraction unit 15 sets a flag for the No. 4 path condition in the atomic logic formula table 19. The selection unit 16 detects the No. 4 path condition having the flag from the atomic logic formula table 19 and stores the path condition in the selected path condition table 21.

次に、テストケース調整部44は、ソースコード40についてシンボリック実行を行うことにより得られたテストケース55から、SisNormal=falseを含むテストケース(パスコンディション)を抽出する。テストケース調整部44は、抽出したパスコンディションについて、順に、取得部13、分解部14、抽出部15、選択部16に、第1の実施形態の処理を実行させる。なお、パスコンディションテーブル18、原子論理式テーブル19の内容はテストケース調整部44によりクリアされて、初期化されている。また、目標論理式テーブル20には、上記で抽出した原子論理式が保持されている。また、選択パスコンディションテーブル21には、上記で格納したパスコンディションが格納されている。   Next, the test case adjustment unit 44 extracts a test case (path condition) including SisNormal = false from the test case 55 obtained by performing symbolic execution on the source code 40. The test case adjustment unit 44 causes the acquisition unit 13, the decomposition unit 14, the extraction unit 15, and the selection unit 16 to sequentially execute the processing of the first embodiment for the extracted path condition. The contents of the path condition table 18 and the atomic logical formula table 19 are cleared and initialized by the test case adjustment unit 44. The target logical expression table 20 holds the atomic logical expressions extracted above. The selected path condition table 21 stores the path conditions stored above.

具体的には、取得部13は、テストケース調整部44によって抽出されたパスコンディション(SisNormal=falseを含むパスコンディション)をパスコンディションテーブル18に格納する。分解部14は、パスコンディションテーブル18に格納された各パスコンディションを原子論理式に分解する。分解部14は、その原子論理式を、パスコンディション毎に、原子論理式テーブル19に格納する。   Specifically, the acquiring unit 13 stores the path condition (path condition including SisNormal = false) extracted by the test case adjusting unit 44 in the path condition table 18. The decomposition unit 14 decomposes each path condition stored in the path condition table 18 into an atomic logical expression. The decomposition unit 14 stores the atomic logical formula in the atomic logical formula table 19 for each path condition.

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

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

図36の場合、テストケース調整部44は、SisNormal=falseを含むパスコンディションとして、No.1〜No.3のパスコンディションを抽出する。抽出されたパスコンディションのうち、No.1のパスコンディションは、目標論理式テーブル20にまだ格納されていない原子論理式「Sa<0」「Sb<0」を含む。この場合、抽出部15は、目標論理式テーブル20に原子論理式「Sa<0」「Sb<0」を格納する(図37(B))。抽出部15は、原子論理式テーブル19において、No.1のパスコンディションにフラグを立てる。No.2〜No.3のパスコンディションに含まれる原子論理式は、目標論理式テーブル20に既に格納されているから、No.2〜No.3のパスコンディションにはフラグは付与されない。選択部16は、原子論理式テーブル19からそのフラグを有するNo.1のパスコンディションを検出して、No.1のパスコンディションを選択パスコンディションテーブル21に格納する。   In the case of FIG. 36, the test case adjustment unit 44 extracts the No. 1 to No. 3 path conditions as the path conditions including SisNormal = false. Among the extracted path conditions, the No. 1 path condition includes atomic logical expressions “Sa <0” and “Sb <0” that are not yet stored in the target logical expression table 20. In this case, the extraction unit 15 stores the atomic logical expressions “Sa <0” and “Sb <0” in the target logical expression table 20 (FIG. 37B). The extraction unit 15 sets a flag for the No. 1 path condition in the atomic logical formula table 19. Since the atomic logical expressions included in the No. 2 to No. 3 path conditions are already stored in the target logical expression table 20, no flags are given to the No. 2 to No. 3 path conditions. The selection unit 16 detects the No. 1 path condition having the flag from the atomic logic formula table 19 and stores the No. 1 path condition in the selected path condition table 21.

図38は、第3の実施形態(実施例1)における選択パスコンディションテーブルの一例を示す。図37(A)(B)を用いて説明したように、選択パスコンディションテーブル21には、No.1、No.4のパスコンディションが格納されている。   FIG. 38 shows an example of the selected path condition table in the third mode for embodying the present invention (embodiment 1). As described with reference to FIGS. 37A and 37B, the selected path condition table 21 stores No. 1 and No. 4 path conditions.

図39は、第3の実施形態(実施例1)におけるテストケース選択フローの一例を示す。ユーザは、テスト対象プログラムのソースコード40を、入力装置を用いて、テストケース選択装置11に入力する。ソースコード読取部41は、その入力されたソースコード40を読み込む(S51)。   FIG. 39 shows an example of a test case selection flow in the third mode for embodying the present invention (embodiment 1). The user inputs the source code 40 of the test target program to the test case selection device 11 using the input device. The source code reading unit 41 reads the input source code 40 (S51).

ドライバ変更部42は、シンボリック実行用ドライバ52のmain関数の最後に、正常系パス判定式51を含むコードを挿入する(S52)。
テストケース生成部43は、ソースコード40について、ドライバ変更部42により上記所定のコードが組み込まれたシンボリック実行用のドライバ52aを用いて、シンボリック実行を行う。これにより、ソースコード40についての実行パスの組み合わせ、すなわちパスコンディションの組み合わせ(テストケース55)が得られる(S53)。ここで得られる各パスコンディションには、正常系パスであるか否かの情報(SisNormal=trueまたはSisNormal=false)が付与されている。
The driver changing unit 42 inserts a code including the normal path determination formula 51 at the end of the main function of the symbolic execution driver 52 (S52).
The test case generation unit 43 performs symbolic execution on the source code 40 using the symbolic execution driver 52a in which the predetermined code is incorporated by the driver changing unit 42. As a result, a combination of execution paths for the source code 40, that is, a combination of path conditions (test case 55) is obtained (S53). Each path condition obtained here is given information (SisNormal = true or SisNormal = false) indicating whether the path is a normal path.

テストケース調整部44は、生成されたテストケース群55を、パスコンディションにSisNormal=trueを含むテストケース群と、パスコンディションにSisNormal=falseを含むテストケース群とに分類する(S54)。   The test case adjustment unit 44 classifies the generated test case group 55 into a test case group including SisNormal = true in the path condition and a test case group including SisNormal = false in the path condition (S54).

テストケース調整部44は、初期化のために、パスコンディションテーブル18、原子論理式テーブル19、目標論理式テーブル20、選択パスコンディションテーブル21の内容をクリアする(S55)。   The test case adjustment unit 44 clears the contents of the path condition table 18, the atomic logical expression table 19, the target logical expression table 20, and the selected path conditional table 21 for initialization (S55).

テストケース調整部44は、まず、パスコンディションにSisNormal=trueを含むテストケース群について、取得部13、分解部14、抽出部15、選択部16に、図12‐図14の処理を実行させる(S56)。その後、テストケース調整部44は、初期化のために、パスコンディションテーブル18、原子論理式テーブル19の内容をクリアする(S57)。   First, the test case adjustment unit 44 causes the acquisition unit 13, the decomposition unit 14, the extraction unit 15, and the selection unit 16 to execute the processes of FIGS. 12 to 14 for a test case group including SisNormal = true in the path condition ( S56). Thereafter, the test case adjustment unit 44 clears the contents of the path condition table 18 and the atomic logical expression table 19 for initialization (S57).

次に、テストケース調整部44は、パスコンディションにSisNormal=falseを含むテストケース群について、取得部13、分解部14、抽出部15、選択部16に、図12‐図14の処理を実行させる(S58)。その後、選択部16は、選択パスコンディションテーブル21に格納された各パスコンディションから、条件式SisNormalを削除する(S59)。   Next, the test case adjustment unit 44 causes the acquisition unit 13, the decomposition unit 14, the extraction unit 15, and the selection unit 16 to execute the processes of FIGS. 12 to 14 for the test case group including SisNormal = false in the path condition. (S58). Thereafter, the selection unit 16 deletes the conditional expression SisNormal from each path condition stored in the selected path condition table 21 (S59).

これにより、シンボリック実行により生成されるテストケースから、所定のテストケースを優先的に選択しつつ、冗長なくテストケースを選択することができる。   Thereby, it is possible to select a test case without redundancy while preferentially selecting a predetermined test case from test cases generated by symbolic execution.

(実施例2)
次に、第3の実施形態の実施例2について説明する。第3の実施形態(実施例1)では、SisNormal=trueを含むテストケース群、SisNormal=falseを含むテストケース群それぞれについて第1の実施形態を適用した。これに対して、第3の実施形態(実施例2)では、第1の実施形態において、原子論理式テーブルに格納されているレコードを正常系パス、異常系パスの順にソートして、処理を行うことについて説明する。
(Example 2)
Next, Example 2 of the third embodiment will be described. In the third embodiment (Example 1), the first embodiment is applied to each of the test case group including SisNormal = true and the test case group including SisNormal = false. On the other hand, in the third embodiment (Example 2), in the first embodiment, the records stored in the atomic logical expression table are sorted in the order of normal path and abnormal path, and processing is performed. Describe what to do.

図40は、第3の実施形態(実施例2)におけるテストケース選択装置の構成の一例を示す。図40のテストケース選択装置11では、図34のテストケース選択装置11の制御部12からテストケース調整部44が削除され、選択制御部45にソート部61が追加されている。ソースコード読取部41、ドライバ変更部42、テストケース生成部43による処理は、上述した処理と同じである。   FIG. 40 shows an example of the configuration of the test case selection device according to the third mode for embodying the present invention (embodiment 2). In the test case selection device 11 of FIG. 40, the test case adjustment unit 44 is deleted from the control unit 12 of the test case selection device 11 of FIG. 34, and a sorting unit 61 is added to the selection control unit 45. The processing by the source code reading unit 41, the driver changing unit 42, and the test case generation unit 43 is the same as the processing described above.

取得部13は、テストケース生成部43により生成されたパスコンディション情報(テストケース)55を取得し、パスコンディションテーブル18に格納する。
分解部14は、パスコンディションテーブル18に格納した各パスコンディションを原子論理式に分解する。分解部14は、その原子論理式を、パスコンディション毎に、原子論理式テーブル19aに格納する。
The acquisition unit 13 acquires the path condition information (test case) 55 generated by the test case generation unit 43 and stores it in the path condition table 18.
The decomposition unit 14 decomposes each path condition stored in the path condition table 18 into an atomic logical expression. The decomposition unit 14 stores the atomic logical formula in the atomic logical formula table 19a for each path condition.

ソート部61は、原子論理式テーブル19aに格納されているパスコンディションを、正常系パスを示す条件式を有するか否かに応じて、ソートする。具体的には、ソート部61は、原子論理式テーブル19aにおいて、正常系パスに関するパスコンディションがテーブルの先頭側にくるようにソートする。   The sorting unit 61 sorts the path conditions stored in the atomic logical expression table 19a according to whether or not the conditional condition indicating the normal system path is included. Specifically, the sorting unit 61 sorts the path condition related to the normal path in the atomic logical formula table 19a so that the path condition is on the head side of the table.

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

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

出力部17は、選択パスコンディションテーブル21に格納したパスコンディション40aをディスプレイ、プリンタ等の出力装置に出力する。
図41は、第3の実施形態(実施例2)における原子論理式テーブルの一例を示す。図41(A)は、ソート処理前の原子論理式テーブル19aを示す。図41(B)は、ソート処理後の原子論理式テーブル19aを示す。
The output unit 17 outputs the path condition 40a stored in the selected path condition table 21 to an output device such as a display or a printer.
FIG. 41 shows an example of an atomic logical expression table in the third mode for embodying the present invention (embodiment 2). FIG. 41A shows the atomic logical expression table 19a before the sorting process. FIG. 41B shows the atomic logical expression table 19a after the sorting process.

分解部14は、パスコンディションテーブル18に格納した各パスコンディションを原子論理式に分解した後、図41(A)に示すように、その原子論理式を、パスコンディション毎に、原子論理式テーブル19aに格納する。このとき、条件式SisNormal(SisNormal=true/false)については、原子論理式テーブル19aの項目「SisNormal」に格納される。   After decomposing each path condition stored in the path condition table 18 into an atomic logical expression, the decomposing unit 14 converts the atomic logical expression into an atomic logical expression table 19a for each path condition as shown in FIG. To store. At this time, the conditional expression SisNormal (SisNormal = true / false) is stored in the item “SisNormal” of the atomic logical expression table 19a.

それから、ソート部61は、図41(B)に示すように、原子論理式テーブル19aにおいて、正常系パスに関するパスコンディションが先頭側にくるようにソートする。
これ以降は、第1の実施形態と同様に、抽出部15、選択部16、出力部17による処理が行われる。
Then, as shown in FIG. 41 (B), the sorting unit 61 sorts the atomic condition table 19a so that the path condition related to the normal path is on the top side.
Thereafter, processing by the extraction unit 15, the selection unit 16, and the output unit 17 is performed as in the first embodiment.

図42は、第3の実施形態(実施例2)におけるテストケース選択フローの一例を示す。第3の実施形態の変形例におけるテストケース選択フローは、第1の実施形態のフロー(図12−図14)の図13に、S61の処理を追加したフローである。S61において、ソート部61は、原子論理式テーブル19aに格納されているレコードを、項目「SisNormal」に基づいて、正常系パス、異常系パスの順にソートする。S61以外の処理は、図12−図14と同様なので、その説明を省略する。   FIG. 42 shows an example of a test case selection flow in the third mode for embodying the present invention (embodiment 2). The test case selection flow in the modification of the third embodiment is a flow in which the process of S61 is added to FIG. 13 of the flow (FIGS. 12 to 14) of the first embodiment. In S61, the sorting unit 61 sorts the records stored in the atomic logical formula table 19a in the order of normal path and abnormal path based on the item “SisNormal”. Processes other than S61 are the same as those in FIGS.

これにより、シンボリック実行により生成されるテストケースを、抽出部15において所定のテストケースが優先的に選択されるようにソートを行う。これにより、シンボリック実行により生成されるテストケースから、特定のテストケースを優先的に選択しつつ、冗長なくテストケースを選択する冗長なくテストケースを選択することができる。   As a result, the test cases generated by the symbolic execution are sorted so that the extraction unit 15 preferentially selects a predetermined test case. As a result, it is possible to select a test case without redundancy by selecting a test case without redundancy while preferentially selecting a specific test case from test cases generated by symbolic execution.

図43は、第1〜第3の実施形態を適用したコンピュータのハードウェア環境の構成ブロック図である。コンピュータ70は、第1〜第3の実施形態の処理(図12〜図14、図26〜図30)を行うプログラムを読み込むことにより、テストケース選択装置11として機能する。   FIG. 43 is a configuration block diagram of a hardware environment of a computer to which the first to third embodiments are applied. The computer 70 functions as the test case selection device 11 by reading a program for performing the processes of the first to third embodiments (FIGS. 12 to 14 and FIGS. 26 to 30).

コンピュータ70は、出力I/F71、CPU72、ROM73、通信I/F74、入力I/F75、RAM76、記憶装置77、読み取り装置78、バス79を含む。コンピュータ70は、出力機器81、及び入力機器82と接続可能である。   The computer 70 includes an output I / F 71, a CPU 72, a ROM 73, a communication I / F 74, an input I / F 75, a RAM 76, a storage device 77, a reading device 78, and a bus 79. The computer 70 can be connected to an output device 81 and an input device 82.

ここで、CPUは、中央演算装置を示す。ROMは、リードオンリメモリを示す。RAMは、ランダムアクセスメモリを示す。I/Fは、インターフェースを示す。バス79には、出力I/F71、CPU72、ROM73、通信I/F74、入力I/F75、RAM76、記憶装置77、読み取り装置78が接続されている。読み取り装置78は、可搬型記録媒体を読み出す装置である。出力機器81は、出力I/F71に接続されている。入力機器82は、入力I/F75に接続されている。   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 71, CPU 72, ROM 73, communication I / F 74, input I / F 75, RAM 76, storage device 77, and reading device 78 are connected to the bus 79. The reading device 78 is a device that reads a portable recording medium. The output device 81 is connected to the output I / F 71. The input device 82 is connected to the input I / F 75.

記憶装置77としては、ハードディスクドライブ、フラッシュメモリ装置、磁気ディスク装置など様々な形式の記憶装置を使用することができる。
記憶装置77またはROM73には、例えば、第1〜第3の実施形態で説明した処理を実現するプログラムが格納されている。または、記憶装置77またはRAM76には、パスコンディションテーブル18、原子論理式テーブル19,19a、目標論理式テーブル20、選択パスコンディションテーブル21が格納されている。または、記憶装置77またはRAM76には、パスコンディションテーブル31、組み合わせテーブル32、目標論理式テーブル33、選択パスコンディションテーブル34、行番号テーブル35が格納されている。また、記憶装置77またはRAM76には、読み込まれたソースコード、正常系パス判定式51のコード、シンボリック実行用のドライバ52が格納されている。
As the storage device 77, 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 77 or the ROM 73 stores a program that realizes the processing described in the first to third embodiments. Alternatively, the storage device 77 or the RAM 76 stores a path condition table 18, atomic logical formula tables 19 and 19 a, a target logical formula table 20, and a selected path condition table 21. Alternatively, the storage device 77 or the RAM 76 stores a path condition table 31, a combination table 32, a target logical expression table 33, a selected path condition table 34, and a line number table 35. The storage device 77 or the RAM 76 stores the read source code, the normal path determination formula 51 code, and the symbolic execution driver 52.

CPU72は、記憶装置77等に格納した第1〜第3の実施形態で説明した処理を実現するプログラムを読み出し、当該プログラムを実行する。
具体的には、CPU72は、当該プログラムを実行することにより、制御部12(取得部13、分解部14,14a、抽出部15,15a、選択部16、出力部17)として機能する。さらに、CPU72は、制御部12(ソースコード読取部41、ドライバ変更部42、テストケース生成部43、テストケース調整部44、ソート部61)として機能する。
CPU72 reads the program which implement | achieves the process demonstrated in the 1st-3rd embodiment stored in the memory | storage device 77 etc., and runs the said program.
Specifically, the CPU 72 functions as the control unit 12 (acquisition unit 13, decomposition units 14 and 14a, extraction units 15 and 15a, selection unit 16, and output unit 17) by executing the program. Further, the CPU 72 functions as the control unit 12 (source code reading unit 41, driver changing unit 42, test case generating unit 43, test case adjusting unit 44, sorting unit 61).

第1〜第3の実施形態で説明した処理を実現するプログラムは、プログラム提供者側から通信ネットワーク80、および通信I/F74を介して、例えば記憶装置77に格納してもよい。また、第1〜第3の実施形態で説明した処理を実現するプログラムは、市販され、流通している可搬型記憶媒体に格納されていてもよい。この場合、この可搬型記憶媒体は読み取り装置78にセットされて、CPU72によってそのプログラムが読み出されて、実行されてもよい。可搬型記憶媒体としてはCD−ROM、フレキシブルディスク、光ディスク、光磁気ディスク、IC(integrated circuit)カード、USB(Universal Serial Bus)メモリ装置など様々な形式の記憶媒体を使用することができる。このような記憶媒体に格納されたプログラムが読み取り装置78によって読み取られる。   The program that realizes the processing described in the first to third embodiments may be stored, for example, in the storage device 77 via the communication network 80 and the communication I / F 74 from the program provider side. Moreover, the program which implement | achieves the process demonstrated in the 1st-3rd 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 78 and the program read by the CPU 72 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 78.

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

なお、第1〜第3の実施形態は、以上に述べた実施の形態に限定されるものではなく、本実施形態の要旨を逸脱しない範囲内で種々の構成または実施形態を取ることができる。   The first to third embodiments are not limited to the above-described embodiments, and can take various configurations or embodiments without departing from the gist of the present embodiments.

1 経路条件選択装置
2 取得部
3 分解部
4 抽出部
5 選択部
6 分解格納部
7 目標論理式格納部
8 生成部
10 パスコンディション情報
11 テストケース選択装置
12 制御部
13 取得部
14,14a 分解部
15,15a 抽出部
16 選択部
17 出力部
18 パスコンディションテーブル
19,19a 原子論理式テーブル
20 目標論理式テーブル
21 選択パスコンディションテーブル
22 記憶部
30 パスコンディション情報
31 パスコンディションテーブル
32 組み合わせテーブル
33 目標論理式テーブル
34 選択パスコンディションテーブル
35 行番号テーブル
41 ソースコード読取部
42 ドライバ変更部
43 テストケース生成部
44 テストケース調整部
45 選択制御部
61 ソート部
DESCRIPTION OF SYMBOLS 1 Path condition selection apparatus 2 Acquisition part 3 Decomposition part 4 Extraction part 5 Selection part 6 Decomposition storage part 7 Target logical expression storage part 8 Generation part 10 Path condition information 11 Test case selection apparatus 12 Control part 13 Acquisition part 14, 14a Decomposition part DESCRIPTION OF SYMBOLS 15,15a Extraction part 16 Selection part 17 Output part 18 Path condition table 19, 19a Atomic logical expression table 20 Target logical expression table 21 Selected path conditional table 22 Storage part 30 Path condition information 31 Path condition table 32 Combination table 33 Target logical expression Table 34 Selection path condition table 35 Line number table 41 Source code reading unit 42 Driver change unit 43 Test case generation unit 44 Test case adjustment unit 45 Selection control unit 61 Sort unit

Claims (12)

ソースコードに含まれる条件により分岐されて通過する処理経路の組み合わせで示される実行経路を、原子論理式を論理積で連結して形成される論理式により表した情報である経路条件情報を取得する取得部と、
前記経路条件情報を、1以上の原子論理式を含む論理式である目標論理式に、分解する分解部と、
前記分解された目標論理式を前記経路条件情報毎に関係付けた情報である経路分解情報を格納する分解格納部と、
前記目標論理式を格納する目標論理式格納部と、
前記分解格納部から前記経路分解情報を取得し、該取得した経路分解情報が前記目標論理式格納部に格納された前記目標論理式以外の目標論理式である差分の論理式を含む場合、該差分の論理式を抽出して前記目標論理式格納部に格納する抽出部と、
前記取得した経路条件情報から、前記差分の論理式が抽出された前記経路分解情報に対応する経路条件情報を選択する選択部と、
を備えることを特徴とする経路条件選択装置。
Obtain path condition information, which is information expressed by a logical expression formed by concatenating atomic logical expressions with logical products of execution paths indicated by combinations of processing paths branched and passed by conditions included in the source code. An acquisition unit;
A decomposition unit that decomposes the path condition information into a target logical expression that is a logical expression including one or more atomic logical expressions;
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, An extraction unit that extracts a logical expression of the difference and stores it in the target logical expression storage unit;
A selection unit for selecting 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 path condition selection device comprising:
前記目標論理式は、原子論理式であり、
前記分解部は、前記取得した経路条件情報を、原子論理式毎に分解し、
前記分解格納部は、前記分解された原子論理式を前記経路条件情報毎に関係付けた情報である経路分解情報を格納し、
前記目標論理式格納部は、前記目標論理式として前記原子論理式を格納し、
前記抽出部は、前記分解格納部から前記経路分解情報を取得し、該取得した経路分解情報に含まれる第1の原子論理式と、前記目標論理式格納部に格納された第2の原子論理式とを照合し、該第1の原子論理式が前記目標論理式格納部に格納された前記第2の原子論理式以外の原子論理式である場合、該第1の原子論理式を抽出して前記目標論理式格納部に格納し、
前記選択部は、前記取得した経路条件情報から、前記第1の原子論理式が抽出された前記経路分解情報に対応する経路条件情報を選択する
ことを特徴とする請求項1に記載の経路条件選択装置。
The target logical formula is an atomic logical formula,
The decomposition unit decomposes the acquired path condition information for each atomic logical expression,
The decomposition storage unit stores path decomposition information, which is information relating the decomposed atomic logic formula for each of the path condition information,
The target logical formula storage unit stores the atomic logical formula as the target logical formula,
The extraction unit acquires the path decomposition information from the decomposition storage unit, and includes a first atomic logical expression included in the acquired path decomposition information and a second atomic logic stored in the target logical expression storage unit And when the first atomic logical formula is an atomic logical formula other than the second atomic logical formula stored in the target logical formula storage unit, the first atomic logical formula is extracted. Stored in the target logical expression storage unit,
The route condition according to claim 1, wherein the selection unit selects route condition information corresponding to the route decomposition information from which the first atomic logical expression is extracted from the acquired route condition information. Selection device.
前記処理経路は、複数の条件により決定される処理経路であり、
取得される前記経路条件情報は、該経路条件情報に含まれる前記原子論理式に、前記ソースコードにおける、該原子論理式に対応する前記条件が記述された位置を示す位置情報を含み、
前記分解部は、前記取得した経路条件情報に含まれる前記論理式を、前記位置情報毎に分解して前記原子論理式の組み合わせを得て、該原子論理式の組み合わせと該位置情報とを関係付け、
前記分解格納部は、前記位置情報を関係付けた原子論理式の組み合わせを前記経路条件情報毎に関係付けた情報である経路分解情報を格納し、
前記目標論理式格納部は、前記目標論理式として前記位置情報を関係付けた原子論理式の組み合わせを格納し、
前記抽出部は、前記分解格納部から前記経路分解情報を取得し、該取得した経路分解情報に含まれる原子論理式の組み合わせを示す第1の組み合わせと、前記目標論理式格納部に格納された原子論理式の組み合わせを示す第2の組み合わせであって該第1の組み合わせの位置情報と一致する位置情報と関係付けられた該第2の組み合わせとを照合し、該第1の組み合わせが前記目標論理式格納部に格納された前記第2の組み合わせ以外の原子論理式の組み合わせである場合、該第1の組み合わせを抽出して前記目標論理式格納部に格納し、
前記選択部は、前記取得した経路条件情報から、前記第1の組み合わせが抽出された経路分解情報に対応する経路条件情報を選択する
ことを特徴とする請求項1に記載の経路条件選択装置。
The processing path is a processing path determined by a plurality of conditions,
The acquired route condition information includes position information indicating a position where the condition corresponding to the atomic logical expression is described in the source code in the atomic logical expression included in the route conditional information,
The decomposition unit decomposes the logical expression included in the acquired path condition information for each position information to obtain a combination of the atomic logical expressions, and relates the combination of the atomic logical expressions and the positional information. With
The decomposition storage unit stores path decomposition information, which is information related to each path condition information with a combination of atomic logical expressions related to the position information,
The target logical expression storage unit stores a combination of atomic logical expressions related to the position information as the target logical expression,
The extraction unit acquires the path decomposition information from the decomposition storage unit, and stores the first combination indicating a combination of atomic logical expressions included in the acquired path decomposition information and the target logical expression storage unit A second combination that represents a combination of atomic logic formulas, the second combination associated with position information that matches the position information of the first combination is collated, and the first combination is the target If the combination is an atomic logical expression other than the second combination stored in the logical expression storage unit, the first combination is extracted and stored in the target logical expression storage unit;
The route condition selection device according to claim 1, wherein the selection unit selects route condition information corresponding to route decomposition information from which the first combination is extracted from the acquired route condition information.
前記経路条件選択装置は、さらに、
前記ソースコードから前記経路条件情報を生成すると共に、前記ソースコードに含まれる前記実行経路に応じて設定される変数に基づいて、該実行経路が特定の実行経路であるかを判定し、該実行経路が該特定の実行経路であると判定された場合、該実行経路が該特定の実行経路であるか否かを示す特定経路判定情報を、生成した該経路条件情報に付与する生成部と、
を備え、
前記抽出部は、前記分解格納部から前記特定の実行経路であることを示す前記特定経路判定情報を有する前記経路分解情報を取得し、取得した該経路分解情報が前記目標論理式格納部に格納された前記目標論理式以外の目標論理式である差分の論理式を含む場合、該差分の論理式を抽出して前記目標論理式格納部に格納した後、前記分解格納部から前記特定の実行経路でないことを示す前記特定経路判定情報を有する前記経路分解情報を取得し、該取得した経路分解情報が前記目標論理式格納部に格納された前記目標論理式以外の目標論理式である差分の論理式を含む場合、該差分の論理式を抽出して前記目標論理式格納部に格納する
ことを特徴とする請求項1に記載の経路条件選択装置。
The route condition selection device further includes:
Generating the path condition information from the source code, determining whether the execution path is a specific execution path based on a variable set according to the execution path included in the source code, and executing the execution A generation unit that adds specific route determination information indicating whether or not the execution route is the specific execution route to the generated route condition information when it is determined that the route is the specific execution route;
With
The extraction unit acquires the route decomposition information having the specific route determination information indicating the specific execution route from the decomposition storage unit, and stores the acquired route decomposition information in the target logical expression storage unit If a differential logical expression that is a target logical expression other than the target logical expression is included, the differential logical expression is extracted and stored in the target logical expression storage unit, and then the specific execution is performed from the decomposition storage unit. The route decomposition information having the specific route determination information indicating that it is not a route is acquired, 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. The path condition selection device according to claim 1, wherein when a logical expression is included, the logical expression of the difference is extracted and stored in the target logical expression storage unit.
コンピュータに、
ソースコードに含まれる条件により分岐されて通過する処理経路の組み合わせで示される実行経路を、原子論理式を論理積で連結して形成される論理式により表した情報である経路条件情報を取得し、
前記経路条件情報を、1以上の原子論理式を含む論理式である目標論理式に、分解し、
前記分解された目標論理式を前記経路条件情報毎に関係付けた情報である経路分解情報を分解格納部に格納し、
前記分解格納部から前記経路分解情報を取得し、該取得した経路分解情報が前記目標論理式が格納された目標論理式格納部に格納された前記目標論理式以外の目標論理式である差分の論理式を含む場合、該差分の論理式を抽出して前記目標論理式格納部に格納し、
前記取得した経路条件情報から、前記差分の論理式が抽出された前記経路分解情報に対応する経路条件情報を選択する
処理を実行させる経路条件選択プログラム。
On the computer,
Obtain path condition information, which is information that represents an execution path indicated by a combination of processing paths that are branched and passed by the conditions included in the source code by a logical expression formed by concatenating atomic logical expressions with logical products. ,
Decomposing the path condition information into a target logical expression that is a logical expression including one or more atomic logical expressions;
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;
A route condition selection program for executing a process of selecting 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.
前記目標論理式は、原子論理式であり、
前記経路条件情報を分解する場合、前記取得した経路条件情報を、原子論理式毎に分解し、該分解した原子論理式を前記経路条件情報毎に関係付けた情報である経路分解情報を前記分解格納部に格納し、
前記差分論理式を抽出する場合、前記分解格納部から前記経路分解情報を取得し、該取得した経路分解情報に含まれる第1の原子論理式と、前記目標論理式として前記原子論理式が格納された目標論理式格納部に格納された第2の原子論理式とを照合し、該第1の原子論理式が前記目標論理式格納部に格納された前記第2の原子論理式以外の原子論理式である場合、該第1の原子論理式を抽出して前記目標論理式格納部に格納し、
前記経路条件情報を選択する場合、前記取得した経路条件情報から、前記第1の原子論理式が抽出された前記経路分解情報に対応する経路条件情報を選択する
ことを特徴とする請求項5に記載の経路条件選択プログラム。
The target logical formula is an atomic logical formula,
When decomposing the path condition information, the acquired path condition information is decomposed for each atomic logical expression, and the path decomposition information, which is information relating the decomposed atomic logical expression for each path condition information, is decomposed. Store in the storage,
When extracting the differential logical expression, the path decomposition information is acquired from the decomposition storage unit, and the first atomic logical expression included in the acquired path decomposition information and the atomic logical expression are stored as the target logical expression The second atomic logical formula stored in the target logical formula storage unit, and the first atomic logical formula is an atom other than the second atomic logical formula stored in the target logical formula storage unit. If it is a logical expression, the first atomic logical expression is extracted and stored in the target logical expression storage unit,
The route condition information corresponding to the route decomposition information from which the first atomic logical expression is extracted is selected from the acquired route condition information when the route condition information is selected. The described route condition selection program.
前記処理経路は、複数の条件により決定される処理経路であり、
取得される前記経路条件情報は、該経路条件情報に含まれる前記原子論理式に、前記ソースコードにおける、該原子論理式に対応する前記条件が記述された位置を示す位置情報を含み、
前記経路条件情報を分解する場合、前記取得した経路条件情報に含まれる前記論理式を、前記位置情報毎に分解して前記原子論理式の組み合わせを得て、該原子論理式の組み合わせと該位置情報とを関係付け、前記位置情報を関係付けた原子論理式の組み合わせを前記経路条件情報毎に関係付けた情報である経路分解情報を前記分解格納部に格納し、
前記差分論理式を抽出する場合、前記分解格納部から前記経路分解情報を取得し、該取得した経路分解情報に含まれる原子論理式の組み合わせを示す第1の組み合わせと、前記目標論理式として前記位置情報を関係付けた原子論理式の組み合わせが格納された目標論理式格納部に格納された原子論理式の組み合わせを示す第2の組み合わせであって該第1の組み合わせの位置情報と一致する位置情報と関係付けられた該第2の組み合わせとを照合し、該第1の組み合わせが前記目標論理式格納部に格納された前記第2の組み合わせ以外の原子論理式の組み合わせである場合、該第1の組み合わせを抽出して前記目標論理式格納部に格納し、
前記経路条件情報を選択する場合、前記取得した経路条件情報から、前記第1の組み合わせが抽出された経路分解情報に対応する経路条件情報を選択する
ことを特徴とする請求項5に記載の経路条件選択プログラム。
The processing path is a processing path determined by a plurality of conditions,
The acquired route condition information includes position information indicating a position where the condition corresponding to the atomic logical expression is described in the source code in the atomic logical expression included in the route conditional information,
When decomposing the path condition information, the logical expression included in the acquired path condition information is decomposed for each position information to obtain a combination of the atomic logical expressions, and the combination of the atomic logical expressions and the position Information related to each other, and path decomposition information, which is information related to each path condition information, a combination of atomic formulas related to the position information is stored in the decomposition storage unit,
When extracting the differential logical expression, the path decomposition information is acquired from the decomposition storage unit, a first combination indicating a combination of atomic logical expressions included in the acquired path decomposition information, and the target logical expression as the target logical expression A second combination indicating a combination of atomic logical formulas stored in a target logical formula storage unit in which a combination of atomic logical formulas associated with positional information is stored, and a position that matches the positional information of the first combination When the second combination associated with the information is collated, and the first combination is a combination of atomic formulas other than the second combination stored in the target formula storage unit, the first combination 1 combination is extracted and stored in the target logical expression storage unit;
6. The route according to claim 5, wherein when selecting the route condition information, route condition information corresponding to route decomposition information from which the first combination is extracted is selected from the acquired route condition information. Condition selection program.
前記コンピュータに、さらに、
前記ソースコードから前記経路条件情報を生成すると共に、前記ソースコードに含まれる前記実行経路に応じて設定される変数に基づいて、該実行経路が特定の実行経路であるかを判定し、該実行経路が該特定の実行経路であると判定された場合、該実行経路が該特定の実行経路であるか否かを示す特定経路判定情報を、生成した該経路条件情報に付与する処理を実行させ、
前記差分論理式を抽出する場合、前記分解格納部から前記特定の実行経路であることを示す前記特定経路判定情報を有する前記経路分解情報を取得し、取得した該経路分解情報が前記目標論理式格納部に格納された前記目標論理式以外の目標論理式である差分の論理式を含む場合、該差分の論理式を抽出して前記目標論理式格納部に格納した後、前記分解格納部から前記特定の実行経路でないことを示す前記特定経路判定情報を有する前記経路分解情報を取得し、該取得した経路分解情報が前記目標論理式格納部に格納された前記目標論理式以外の目標論理式である差分の論理式を含む場合、該差分の論理式を抽出して前記目標論理式格納部に格納する
ことを特徴とする請求項5に記載の経路条件選択プログラム。
In addition to the computer,
Generating the path condition information from the source code, determining whether the execution path is a specific execution path based on a variable set according to the execution path included in the source code, and executing the execution When it is determined that the path is the specific execution path, a process for adding specific path determination information indicating whether or not the execution path is the specific execution path to the generated path condition information is executed. ,
When extracting the differential logical expression, the path decomposition information having the specific path determination information indicating the specific execution path is acquired from the decomposition storage unit, and the acquired path decomposition information is the target logical expression. When a difference logical expression that is a target logical expression other than the target logical expression stored in the storage unit is included, the logical expression of the difference is extracted and stored in the target logical expression storage unit, and then from the decomposition storage unit The route decomposition information having the specific route determination information indicating that it is not the specific execution route is acquired, and the target logical formula other than the target logical formula stored in the target logical formula storage unit is acquired. 6. The path condition selection program according to claim 5, further comprising: extracting a difference logical expression and storing the difference logical expression in the target logical expression storage unit.
コンピュータにより実行される経路条件選択方法であって、
前記コンピュータは、
入力装置により入力された、ソースコードに含まれる条件により分岐されて通過する処理経路の組み合わせで示される実行経路を、原子論理式を論理積で連結して形成される論理式により表した情報である経路条件情報を取得し、
前記経路条件情報を、1以上の原子論理式を含む論理式である目標論理式に、分解し、
前記分解された目標論理式を前記経路条件情報毎に関係付けた情報である経路分解情報を分解格納部に格納し、
前記分解格納部から前記経路分解情報を取得し、該取得した経路分解情報が前記目標論理式が格納された目標論理式格納部に格納された前記目標論理式以外の目標論理式である差分の論理式を含む場合、該差分の論理式を抽出して前記目標論理式格納部に格納し、
前記取得した経路条件情報から、前記差分の論理式が抽出された前記経路分解情報に対応する経路条件情報を選択し、
前記選択した経路条件情報を出力装置に出力する
処理を実行させる経路条件選択方法。
A path condition selection method executed by a computer,
The computer
Information expressed by a logical expression formed by concatenating atomic logical expressions with logical products, which is an execution path indicated by a combination of processing paths that are branched by the conditions included in the source code and passed by the input device. Get some route condition information,
Decomposing the path condition information into a target logical expression that is a logical expression including one or more atomic logical expressions;
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 route condition selection method for executing a process of outputting the selected route condition information to an output device.
前記目標論理式は、原子論理式であり、
前記コンピュータは、
前記経路条件情報を分解する場合、前記取得した経路条件情報を、原子論理式毎に分解し、該分解した原子論理式を前記経路条件情報毎に関係付けた情報である経路分解情報を前記分解格納部に格納し、
前記差分論理式を抽出する場合、前記分解格納部から前記経路分解情報を取得し、該取得した経路分解情報に含まれる第1の原子論理式と、前記目標論理式として前記原子論理式が格納された目標論理式格納部に格納された第2の原子論理式とを照合し、該第1の原子論理式が前記目標論理式格納部に格納された前記第2の原子論理式以外の原子論理式である場合、該第1の原子論理式を抽出して前記目標論理式格納部に格納し、
前記経路条件情報を選択する場合、前記取得した経路条件情報から、前記第1の原子論理式が抽出された前記経路分解情報に対応する経路条件情報を選択する
ことを特徴とする請求項9に記載の経路条件選択方法。
The target logical formula is an atomic logical formula,
The computer
When decomposing the path condition information, the acquired path condition information is decomposed for each atomic logical expression, and the path decomposition information, which is information relating the decomposed atomic logical expression for each path condition information, is decomposed. Store in the storage,
When extracting the differential logical expression, the path decomposition information is acquired from the decomposition storage unit, and the first atomic logical expression included in the acquired path decomposition information and the atomic logical expression are stored as the target logical expression The second atomic logical formula stored in the target logical formula storage unit, and the first atomic logical formula is an atom other than the second atomic logical formula stored in the target logical formula storage unit. If it is a logical expression, the first atomic logical expression is extracted and stored in the target logical expression storage unit,
The route condition information corresponding to the route decomposition information from which the first atomic logical expression is extracted is selected from the acquired route condition information when the route condition information is selected. The described route condition selection method.
前記処理経路は、複数の条件により決定される処理経路であり、
取得される前記経路条件情報は、該経路条件情報に含まれる前記原子論理式に、前記ソースコードにおける、該原子論理式に対応する前記条件が記述された位置を示す位置情報を含み、
前記コンピュータは、
前記経路条件情報を分解する場合、前記取得した経路条件情報に含まれる前記論理式を、前記位置情報毎に分解して前記原子論理式の組み合わせを得て、該原子論理式の組み合わせと該位置情報とを関係付け、前記位置情報を関係付けた原子論理式の組み合わせを前記経路条件情報毎に関係付けた情報である経路分解情報を前記分解格納部に格納し、
前記差分論理式を抽出する場合、前記分解格納部から前記経路分解情報を取得し、該取得した経路分解情報に含まれる原子論理式の組み合わせを示す第1の組み合わせと、前記目標論理式として前記位置情報を関係付けた原子論理式の組み合わせが格納された目標論理式格納部に格納された原子論理式の組み合わせを示す第2の組み合わせであって該第1の組み合わせの位置情報と一致する位置情報と関係付けられた該第2の組み合わせとを照合し、該第1の組み合わせが前記目標論理式格納部に格納された前記第2の組み合わせ以外の原子論理式の組み合わせである場合、該第1の組み合わせを抽出して前記目標論理式格納部に格納し、
前記経路条件情報を選択する場合、前記取得した経路条件情報から、前記第1の組み合わせが抽出された経路分解情報に対応する経路条件情報を選択する
ことを特徴とする請求項9に記載の経路条件選択方法。
The processing path is a processing path determined by a plurality of conditions,
The acquired route condition information includes position information indicating a position where the condition corresponding to the atomic logical expression is described in the source code in the atomic logical expression included in the route conditional information,
The computer
When decomposing the path condition information, the logical expression included in the acquired path condition information is decomposed for each position information to obtain a combination of the atomic logical expressions, and the combination of the atomic logical expressions and the position Information related to each other, and path decomposition information, which is information related to each path condition information, a combination of atomic formulas related to the position information is stored in the decomposition storage unit,
When extracting the differential logical expression, the path decomposition information is acquired from the decomposition storage unit, a first combination indicating a combination of atomic logical expressions included in the acquired path decomposition information, and the target logical expression as the target logical expression A second combination indicating a combination of atomic logical formulas stored in a target logical formula storage unit in which a combination of atomic logical formulas associated with positional information is stored, and a position that matches the positional information of the first combination When the second combination associated with the information is collated, and the first combination is a combination of atomic formulas other than the second combination stored in the target formula storage unit, the first combination 1 combination is extracted and stored in the target logical expression storage unit;
The route according to claim 9, wherein when selecting the route condition information, route condition information corresponding to route decomposition information from which the first combination is extracted is selected from the acquired route condition information. Condition selection method.
前記コンピュータは、さらに、
前記ソースコードから前記経路条件情報を生成すると共に、前記ソースコードに含まれる前記実行経路に応じて設定される変数に基づいて、該実行経路が特定の実行経路であるかを判定し、該実行経路が該特定の実行経路であると判定された場合、該実行経路が該特定の実行経路であるか否かを示す特定経路判定情報を、生成した該経路条件情報に付与する処理を実行し、
前記差分論理式を抽出する場合、前記コンピュータは、前記分解格納部から前記特定の実行経路であることを示す前記特定経路判定情報を有する前記経路分解情報を取得し、取得した該経路分解情報が前記目標論理式格納部に格納された前記目標論理式以外の目標論理式である差分の論理式を含む場合、該差分の論理式を抽出して前記目標論理式格納部に格納した後、前記分解格納部から前記特定の実行経路でないことを示す前記特定経路判定情報を有する前記経路分解情報を取得し、該取得した経路分解情報が前記目標論理式格納部に格納された前記目標論理式以外の目標論理式である差分の論理式を含む場合、該差分の論理式を抽出して前記目標論理式格納部に格納する
ことを特徴とする請求項9に記載の経路条件選択方法。
The computer further includes:
Generating the path condition information from the source code, determining whether the execution path is a specific execution path based on a variable set according to the execution path included in the source code, and executing the execution When it is determined that the route is the specific execution route, a process of adding specific route determination information indicating whether or not the execution route is the specific execution route to the generated route condition information is executed. ,
When extracting the difference logical expression, the computer acquires the route decomposition information having the specific route determination information indicating the specific execution route from the decomposition storage unit, and the acquired route decomposition information is When including a differential logical formula that is a target logical formula other than the target logical formula stored in the target logical formula storage unit, after extracting the differential logical formula and storing it in the target logical formula storage unit, The route decomposition information having the specific route determination information indicating that it is not the specific execution route is acquired from the decomposition storage unit, and the acquired route decomposition information is other than the target logical expression stored in the target logical expression storage unit The path condition selection method according to claim 9, wherein a difference logical expression that is a target logical expression is extracted and stored in the target logical expression storage unit.
JP2012151737A 2012-01-31 2012-07-05 Route condition selection apparatus, program, and method Active JP5900197B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2012151737A JP5900197B2 (en) 2012-01-31 2012-07-05 Route condition selection apparatus, program, and method

Applications Claiming Priority (3)

Application Number Priority Date Filing Date Title
JP2012019266 2012-01-31
JP2012019266 2012-01-31
JP2012151737A JP5900197B2 (en) 2012-01-31 2012-07-05 Route condition selection apparatus, program, and method

Publications (2)

Publication Number Publication Date
JP2013178729A JP2013178729A (en) 2013-09-09
JP5900197B2 true JP5900197B2 (en) 2016-04-06

Family

ID=49270287

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2012151737A Active JP5900197B2 (en) 2012-01-31 2012-07-05 Route condition selection apparatus, program, and method

Country Status (1)

Country Link
JP (1) JP5900197B2 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP6511793B2 (en) * 2014-12-17 2019-05-15 富士通株式会社 Test case generation program, test case generation method and test case generation apparatus

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH09128266A (en) * 1995-10-31 1997-05-16 Fujitsu Ltd Device and method for retrieving source program route
US8479171B2 (en) * 2010-05-24 2013-07-02 Fujitsu Limited Generating test sets using intelligent variable selection and test set compaction
JP5755861B2 (en) * 2010-09-13 2015-07-29 日本電気通信システム株式会社 Test case generation apparatus, test case generation method, and test case generation program

Also Published As

Publication number Publication date
JP2013178729A (en) 2013-09-09

Similar Documents

Publication Publication Date Title
JP5767471B2 (en) Apparatus and method for evaluating test completeness
CN102804147A (en) Code inspection executing system for performing a code inspection of ABAP source codes
JP2005322211A (en) Design support system
CN108763091A (en) Method, apparatus and system for regression test
US20120047490A1 (en) Architecture for state driven testing
Kessentini et al. Automated metamodel/model co-evolution using a multi-objective optimization approach
Salfner et al. Comprehensive logfiles for autonomic systems
Chisholm Exploring data with Rapidminer
JP7059220B2 (en) Machine learning program verification device and machine learning program verification method
JP5618861B2 (en) Information processing apparatus, information processing method, and program
CN112691379B (en) Game resource text auditing method and device, storage medium and computer equipment
JP5164920B2 (en) Test data generation method, apparatus and program
US10719482B2 (en) Data comparison
JP5106447B2 (en) Test case generation apparatus, generation method thereof, and computer program
JP5900197B2 (en) Route condition selection apparatus, program, and method
JP6120607B2 (en) Requirement detection apparatus and requirement detection program
Mashkoor et al. Model-driven engineering of safety and security systems: A systematic mapping study
Corea et al. A taxonomy of business rule organizing approaches in regard to business process compliance
JP2007249826A (en) Test item generation device
JP5900212B2 (en) Test data generation apparatus, program, and method
Gruppi et al. Tell me who your friends are: Using content sharing behavior for news source veracity detection
JP6766103B2 (en) Analytical method and calculator
JP2008269585A (en) Coverage measuring instrument for property description, and program
Trabelsi et al. A new test suite reduction approach based on hypergraph minimal transversal mining
JP2013161182A (en) Test item generation device and test item generation method

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

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150