JP2017194894A - Test data generation program and test data generation method - Google Patents

Test data generation program and test data generation method Download PDF

Info

Publication number
JP2017194894A
JP2017194894A JP2016085942A JP2016085942A JP2017194894A JP 2017194894 A JP2017194894 A JP 2017194894A JP 2016085942 A JP2016085942 A JP 2016085942A JP 2016085942 A JP2016085942 A JP 2016085942A JP 2017194894 A JP2017194894 A JP 2017194894A
Authority
JP
Japan
Prior art keywords
test
test data
branch
branch result
scenario
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
JP2016085942A
Other languages
Japanese (ja)
Other versions
JP6572168B2 (en
Inventor
利行 倉林
Toshiyuki Kurabayashi
利行 倉林
暁晶 張
Xiao Jing Zhang
暁晶 張
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.)
Nippon Telegraph and Telephone Corp
Original Assignee
Nippon Telegraph and Telephone Corp
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 Nippon Telegraph and Telephone Corp filed Critical Nippon Telegraph and Telephone Corp
Priority to JP2016085942A priority Critical patent/JP6572168B2/en
Publication of JP2017194894A publication Critical patent/JP2017194894A/en
Application granted granted Critical
Publication of JP6572168B2 publication Critical patent/JP6572168B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Debugging And Monitoring (AREA)

Abstract

PROBLEM TO BE SOLVED: To efficiently generate a set of test data having high condition coverage.SOLUTION: Provided is a test data generation program for generating test data for a designated test scenario, said program having the following realized by a computer: a code insertion function for inserting, into a program to be tested, a code that outputs a branch result including an evaluation value for quantitatively evaluating the determination of branching; a first test data generation function for generating test data for a designated test scenario, and generating a branch result outputted by the inserted code; and a second test data generation function for generating a target branch result that matches the generated branch result in path up to the middle, and generating test data that satisfies the target branch result, using first test data that matches the target branch result in path, except for a final determination branch, and second test data having a branch result of the final determination branch in a genetic algorithm.SELECTED DRAWING: Figure 3

Description

本発明は、テストデータ生成プログラム及びテストデータ生成方法に関し、特に、SBST(Search-Based Software Testing)の遺伝的アルゴリズムにおいて特性の異なるテストデータを組み合わせて新しいテストデータを生成する技術(以降、特性別交叉法と呼ぶ)に関する。   The present invention relates to a test data generation program and a test data generation method, and more particularly to a technique for generating new test data by combining test data having different characteristics in a genetic algorithm of SBST (Search-Based Software Testing) Called the crossover method).

ソフトウェア開発工程におけるテストでは、プログラムが設計通りに実行するか否かを確認するため、テストケースが必要となる。人手に代わり、自動でテストケースを準備できれば、開発コスト改善につながる。   In the test in the software development process, a test case is necessary to confirm whether or not the program is executed as designed. If test cases can be prepared automatically instead of manually, development costs can be improved.

テストケースはテストの手順を表すテストシナリオと、テストシナリオを実現するための具体的なデータであるテストデータから構成されている。   The test case is composed of a test scenario representing a test procedure and test data which is specific data for realizing the test scenario.

テストケースを生成するために、プログラムの設計に基づきテストシナリオやテストデータを自動的に生成する手法が検討されている。   In order to generate test cases, methods for automatically generating test scenarios and test data based on program design are being studied.

非特許文献1では、入力値定義及び処理フロー図を入力とし、テストシナリオとテストデータ(整数型、文字列型)を生成することが提案されている。   Non-Patent Document 1 proposes to generate a test scenario and test data (integer type, character string type) with input value definition and processing flow diagram as input.

また、非特許文献2では、SBSTの探索アルゴリズムとして遺伝的アルゴリズムを用いてテストデータを生成することが提案されている。   Non-Patent Document 2 proposes to generate test data using a genetic algorithm as a search algorithm for SBST.

また、非特許文献3では、Concolic TestingとSBSTとを組み合わせたテストデータ生成技術が提案されている。   Non-Patent Document 3 proposes a test data generation technique that combines Concolic Testing and SBST.

張暁晶,星野隆,"設計モデルを用いたテスト項目抽出とテストデータ生成手法",信学技報,第109巻,SS2009-7,pp.37-42,2009年Akira Zhang and Takashi Hoshino, "Test Item Extraction and Test Data Generation Method Using Design Model", IEICE Tech. Volume 109, SS2009-7, pp.37-42, 2009 "Evolutionary Generation of Whole Test Suites",2011 11th International Conference on Quality Software,pp.31-40,2011年"Evolutionary Generation of Whole Test Suites", 2011 11th International Conference on Quality Software, pp.31-40, 2011 "A Hybrid Directed Test Suite Augmentation Technique",2011 22nd International Symposium on Software Reliability Engineering,pp.150-159,2011年"A Hybrid Directed Test Suite Augmentation Technique", 2011 22nd International Symposium on Software Reliability Engineering, pp.150-159, 2011

プログラムが設計通りに実行するか否かを確認するためには、どのような手順でテストを実行するかというテストシナリオと、テストシナリオで用いられる具体的な入力値であるテストデータとの双方が必要となる。更に、プログラム内の分岐がテストされた割合である分岐網羅率と、プログラム内の条件がテストされた割合である条件網羅率とを高める必要がある。   In order to confirm whether or not the program is executed as designed, both the test scenario for the test execution procedure and the test data that is the specific input value used in the test scenario Necessary. Furthermore, it is necessary to increase the branch coverage rate, which is the rate at which branches in the program are tested, and the condition coverage rate, which is the rate at which conditions in the program are tested.

非特許文献1の技術によれば、入力値定義や処理フロー図を人手で作成する必要があるため、テストシナリオ及びテストデータを効率的に生成することは困難である。   According to the technique of Non-Patent Document 1, since it is necessary to manually create an input value definition and a processing flow diagram, it is difficult to efficiently generate a test scenario and test data.

また、非特許文献2の技術によれば、分岐網羅率の高いテストデータを自動的に生成することができるが、条件網羅率を高めることはできない。   Further, according to the technique of Non-Patent Document 2, test data having a high branch coverage can be automatically generated, but the condition coverage cannot be increased.

また、非特許文献3の技術によれば、Concolic Testing及びSBSTの2つの手法が順番に実行されるだけであるため、テストデータの生成に時間がかかる。   Further, according to the technique of Non-Patent Document 3, it takes time to generate test data because the two methods of Concolic Testing and SBST are only executed in order.

本発明は、あるテストシナリオが与えられたときに、条件網羅率の高いテストデータの集合を効率的に生成することを目的とする。   An object of the present invention is to efficiently generate a set of test data having a high condition coverage when a certain test scenario is given.

本発明の一形態に係るテストデータ生成プログラムは、
指定のテストシナリオに対するテストデータを生成するテストデータ生成プログラムであって、コンピュータに、
テスト対象のプログラムに、分岐の判定を定量的に評価するための評価値を含む分岐結果を出力するコードを挿入するコード挿入機能と、
指定のテストシナリオに対するテストデータを生成すると共に、前記挿入されたコードが出力した分岐結果を生成する第1テストデータ生成機能と、
前記生成された分岐結果に対して途中まで経路一致する目標分岐結果を生成し、当該目標分岐結果に対して最終判定分岐を除き経路一致する第1のテストデータと、当該最終判定分岐の分岐結果を有する第2のテストデータとを遺伝的アルゴリズムにおいて用いて、当該目標分岐結果を満たすテストデータを生成する第2テストデータ生成機能と、
を実現させることを特徴とする。
A test data generation program according to an aspect of the present invention includes:
A test data generation program that generates test data for a specified test scenario.
A code insertion function for inserting a code that outputs a branch result including an evaluation value for quantitatively evaluating the determination of branching into a test target program;
A first test data generation function for generating test data for a specified test scenario and generating a branch result output by the inserted code;
A target branch result whose path is partially matched with the generated branch result is generated, the first test data whose path is matched with respect to the target branch result except for the final determination branch, and the branch result of the final determination branch A second test data generating function for generating test data satisfying the target branch result using the second test data having
It is characterized by realizing.

また、本発明の一形態に係るテストデータ生成方法は、
指定のテストシナリオに対するテストデータを生成するテストデータ生成装置におけるテストデータ生成方法であって、
前記テストデータ生成装置が、テスト対象のプログラムに、分岐の判定を定量的に評価するための評価値を含む分岐結果を出力するコードを挿入するステップと、
前記テストデータ生成装置が、指定のテストシナリオに対するテストデータを生成すると共に、前記挿入されたコードが出力した分岐結果を生成するステップと、
前記テストデータ生成装置が、前記生成された分岐結果に対して途中まで経路一致する目標分岐結果を生成し、当該目標分岐結果に対して最終判定分岐を除き経路一致する第1のテストデータと、当該最終判定分岐の分岐結果を有する第2のテストデータとを遺伝的アルゴリズムにおいて用いて、当該目標分岐結果を満たすテストデータを生成するステップと、
を有することを特徴とする。
A test data generation method according to an aspect of the present invention includes:
A test data generation method in a test data generation device for generating test data for a specified test scenario,
The test data generation device inserts a code that outputs a branch result including an evaluation value for quantitatively evaluating branch determination into a test target program; and
The test data generation device generates test data for a specified test scenario, and generates a branch result output by the inserted code;
The test data generation device generates a target branch result that matches the route to the generated branch result halfway, and first test data that matches the path of the target branch result except for a final decision branch; Using the second test data having a branch result of the final decision branch in a genetic algorithm to generate test data that satisfies the target branch result;
It is characterized by having.

本発明によれば、あるテストシナリオが与えられたときに、条件網羅率の高いテストデータの集合を効率的に生成することが可能になる。   According to the present invention, it is possible to efficiently generate a set of test data with a high condition coverage when a certain test scenario is given.

分岐結果の例を示す図Figure showing an example of the branch result 分岐網羅率と条件網羅率との関係を示す図Diagram showing the relationship between branch coverage and condition coverage 本発明の実施例に係るテストケース生成装置の機能ブロック図Functional block diagram of a test case generation apparatus according to an embodiment of the present invention Viewの遷移図とVCシナリオの例を示す図View transition diagram and VC scenario example 状態遷移図に対する所定のカバレッジ基準を示す図A diagram showing the predetermined coverage criteria for state transition diagrams 本発明の実施例に係るテストケース生成装置で用いられる特性別交叉法の概略図Schematic of characteristic-specific crossover method used in test case generation apparatus according to an embodiment of the present invention 本発明の実施例に係るテストケース生成方法の概略フローチャートSchematic flowchart of a test case generation method according to an embodiment of the present invention 図7のステップS001の詳細フローチャートDetailed flowchart of step S001 of FIG. 図7のステップS002の詳細フローチャートDetailed flowchart of step S002 of FIG. 図7のステップS003の詳細フローチャートDetailed flowchart of step S003 of FIG. 図7のステップS005の詳細フローチャートDetailed flowchart of step S005 of FIG. 図7のステップS007の詳細フローチャートDetailed flowchart of step S007 of FIG. 図7のステップS008の詳細フローチャートDetailed flowchart of step S008 of FIG. 図13のステップS205の詳細フローチャートDetailed flowchart of step S205 of FIG. 図14のステップS305の詳細フローチャートDetailed flowchart of step S305 of FIG. 図14のステップS306の詳細フローチャートDetailed flowchart of step S306 in FIG.

以下、図面を参照して本発明の実施例について説明する。   Embodiments of the present invention will be described below with reference to the drawings.

本発明の実施例では、プログラムのテストシナリオ及びテストデータの組み合わせであるテストケースを生成するテストケース生成プログラム及びテストケース生成方法について説明する。なお、テストケース生成プログラムに関する説明の便宜上、プログラムの各機能をコンピュータ上に実現したテストケース生成装置を例に挙げて説明する。   In an embodiment of the present invention, a test case generation program and a test case generation method for generating a test case that is a combination of a test scenario and test data of a program will be described. For convenience of explanation regarding the test case generation program, a test case generation apparatus in which each function of the program is realized on a computer will be described as an example.

以下の実施例ではテストシナリオの生成から説明するが、本発明の実施例は、テストシナリオが指定されたときに、指定のテストシナリオに対するテストデータを生成するテストデータ生成プログラム及びテストデータ生成方法としても実現できる。   The following embodiment will be described from the generation of a test scenario. However, the embodiment of the present invention is a test data generation program and a test data generation method for generating test data for a specified test scenario when the test scenario is specified. Can also be realized.

テストケース生成装置は、Webアプリケーションのようなユーザインタフェースをもつアプリケーションのプログラムをテスト対象として、テストシナリオを生成する。このようなアプリケーションは、MVC(Model View Controller)に従って設計され、少なくともView及びControllerで構成される。Modelは、アプリケーションが扱うデータ及びロジックを表現するための要素であり、Viewは、入出力や表示を行うための要素であり、Controllerは、Viewからの入力に応じて必要なロジックの実行をModelに依頼し、その結果表示をViewに依頼するための要素である。MVCに従って設計されたプログラムでは、Controllerの情報を用いてView間の繋がりが抽出できる。テストケース生成装置は、View間の繋がりを表すViewの遷移図から状態遷移図に対する所定のカバレッジ基準に基づいてView及びControllerの繋がりを表すVCシナリオを生成する。   The test case generation device generates a test scenario using a program of an application having a user interface such as a Web application as a test target. Such an application is designed according to MVC (Model View Controller), and includes at least a view and a controller. Model is an element for expressing the data and logic handled by the application, View is an element for input / output and display, and Controller executes the necessary logic according to the input from View This is an element for requesting View and requesting the result display to View. In a program designed according to MVC, connections between views can be extracted using controller information. The test case generation device generates a VC scenario representing the connection between the view and the controller based on a predetermined coverage standard for the state transition diagram from the view transition diagram representing the connection between the views.

テストケース生成装置は、生成されたVCシナリオを満たすようなテストデータを、テスト対象のプログラムを動かしながら生成する。一方、ViewとControllerの名前の羅列から構成されるVCシナリオの情報だけでは、どういった操作を行えば良いかわからない。そこで、テストケース生成装置は、クローラやユーザ操作等によってVCシナリオにView操作情報を加えることで、テストシナリオを生成する。   The test case generation device generates test data that satisfies the generated VC scenario while moving the test target program. On the other hand, only the VC scenario information that consists of a list of View and Controller names does not tell you what operation to perform. Therefore, the test case generation device generates a test scenario by adding View operation information to the VC scenario by a crawler, a user operation, or the like.

次に、テストケース生成装置は、生成されたテストシナリオのうち1つのシナリオを指定して、以下のようにテストデータを生成する。   Next, the test case generation apparatus specifies one scenario among the generated test scenarios and generates test data as follows.

テストケース生成装置は、分岐に対する評価値を解析することによりテストデータを生成するテストデータ生成手法を用いてテストデータを生成する。このようなテストデータ生成手法の具体的な例は、SBSTである。SBSTとは、分岐の判定を定量的に評価するための評価値を解析することによりテストデータを生成するテストデータ生成手法である。例えば、入力値>0という分岐に対して(0-入力値)という評価関数を設計し、評価関数の評価値を解析することで、分岐条件を満たすテストデータを生成する。   The test case generation device generates test data using a test data generation method that generates test data by analyzing an evaluation value for a branch. A specific example of such a test data generation method is SBST. SBST is a test data generation method for generating test data by analyzing an evaluation value for quantitatively evaluating branch determination. For example, an evaluation function (0−input value) is designed for a branch with an input value> 0, and test data that satisfies the branch condition is generated by analyzing the evaluation value of the evaluation function.

以下では、SBSTを用いた具体例を説明する。   A specific example using SBST will be described below.

SBSTでは、分岐の評価値が用いられるため、まず、テストケース生成装置は、テスト対象のプログラムに、分岐の判定を定量的に評価するための評価値を含む分岐結果を出力するコードを挿入する。そして、テストケース生成装置は、Concolic TestingやSBSTによって、指定のテストシナリオに対するテストデータを生成すると共に、挿入されたコードが出力した分岐結果を生成する。なお、Concolic Testingとは、入力値を記号に置き換えて得られた制約式を解析することによりテストデータを生成するテストデータ生成手法である。例えば、入力値>0という分岐に対して具体的な数値を用いる代わりに、数値を記号xに置き換えてx>0という制約式を解析することにより、分岐条件を満たすテストデータを生成する。   In SBST, branch evaluation values are used. Therefore, first, the test case generation device inserts a code that outputs a branch result including an evaluation value for quantitatively evaluating branch determination into the test target program. . Then, the test case generation apparatus generates test data for a specified test scenario by using Concolic Testing or SBST, and generates a branch result output by the inserted code. Note that “Concolic Testing” is a test data generation method for generating test data by analyzing a constraint equation obtained by replacing input values with symbols. For example, instead of using a specific numerical value for a branch with an input value> 0, test data that satisfies the branch condition is generated by replacing the numerical value with the symbol x and analyzing the constraint expression x> 0.

次に、テストケース生成装置は、生成された分岐結果に対して途中まで経路一致する目標分岐結果を生成し、目標分岐結果を満たすテストデータを生成する。この目標分岐結果を満たすテストデータの探索アルゴリズムとして、遺伝的アルゴリズムを用いる。遺伝的アルゴリズムは、テストデータの集合を遺伝子の集合として考え、遺伝子を選択、交叉及び突然変異によって操作することにより新たなテストデータを生成するものである。テストケース生成装置は、遺伝的アルゴリズムにおいて、特性の異なるテストデータを組み合わせる特性別交叉法によって、新しいテストデータを生成する。具体的には、テストケース生成装置は、目標分岐結果に対して最終判定分岐を除き経路一致する第1のテストデータと、最終判定分岐の分岐結果を有する第2のテストデータという特性の異なるテストデータを用いることで、目標分岐結果を満たすテストデータを生成する。   Next, the test case generation device generates a target branch result that matches the route to the generated branch result halfway, and generates test data that satisfies the target branch result. A genetic algorithm is used as a test data search algorithm that satisfies the target branch result. The genetic algorithm considers a set of test data as a set of genes, and generates new test data by manipulating the genes by selection, crossover, and mutation. The test case generation device generates new test data by a characteristic-specific crossover method that combines test data having different characteristics in a genetic algorithm. Specifically, the test case generation device performs tests with different characteristics such as first test data whose path matches the target branch result except for the final determination branch, and second test data having the branch result of the final determination branch. By using the data, test data that satisfies the target branch result is generated.

ただし、結合テスト対象となる規模のソースコードに対し、Concolic TestingやSBSTを行うと計算爆発が起きるため、指定されたユーザ記述クラスを解析対象としてテストデータを生成してもよい。すなわち、フレームワークやライブラリ等のユーザが記述していない箇所に対しては、カバレッジを向上させるようなテストケースを生成しないことで、計算爆発を回避してもよい。   However, if Concorlic Testing or SBST is performed on the source code of the scale that is the subject of the integration test, a calculation explosion occurs. Therefore, test data may be generated with the specified user description class as the analysis target. In other words, the calculation explosion may be avoided by not generating a test case that improves the coverage for a part not described by the user, such as a framework or a library.

最後に、テストケース生成装置は、テストシナリオ及びテストデータの組み合わせであるテストケースを出力する。   Finally, the test case generation device outputs a test case that is a combination of a test scenario and test data.

<用語の説明>
まず、本発明の実施例において用いられる用語について説明する。
<Explanation of terms>
First, terms used in the embodiments of the present invention will be described.

テストスイートとは、複数のテストケースと、それぞれのテストケースを実行したときの分岐結果から構成される。本発明の実施例における最終的な出力となるテストケースとそのテストケースの分岐結果から構成されるテストスイートを出力テストスイートと呼び、SBSTを実行するために用いられるテストスイートを素材テストスイートと呼ぶ。例えば、テストスイートは、[テストケース1,分岐結果1],[テストケース2,分岐結果2],…として定義される。   The test suite is composed of a plurality of test cases and a branch result when each test case is executed. In the embodiment of the present invention, a test suite composed of a test case as a final output and a branch result of the test case is called an output test suite, and a test suite used for executing SBST is called a material test suite. . For example, the test suite is defined as [test case 1, branch result 1], [test case 2, branch result 2],.

テストケースとは、プログラムのテストを実行するために必要な情報を所持しているものであり、1つのテストシナリオと1つのテストデータから構成される。   A test case possesses information necessary for executing a program test, and is composed of one test scenario and one test data.

テストシナリオとは、テストを実行するための手順を表し、VCシナリオとView操作情報であるステップの集合から構成される。例えば、テストシナリオは、[VCシナリオ],[ステップ1,ステップ2,…]として定義される。   The test scenario represents a procedure for executing a test, and includes a VC scenario and a set of steps as View operation information. For example, the test scenario is defined as [VC scenario], [Step 1, Step 2,...].

テストデータとは、テストシナリオを実現するための具体的な値の集合である。SBSTにおいて、この具体的な値を求めるために遺伝的アルゴリズムが用いられる場合、テストデータは、遺伝子の集合と考えられる。便宜上、Concolic Testing等が用いられる場合であっても、テストデータを遺伝子の集合として定義する。例えば、テストデータは、遺伝子1,遺伝子2, …として定義される。   Test data is a set of specific values for realizing a test scenario. In SBST, when a genetic algorithm is used to determine this specific value, the test data is considered a set of genes. For convenience, test data is defined as a set of genes even when Concolic Testing or the like is used. For example, the test data is defined as gene 1, gene 2,.

Viewの遷移図とは、View間の繋がりを表した遷移図である。MVCに従って設計されたプログラムでは、ControllerはViewからの入力をModelに伝え、Modelの実行結果をViewに伝えるため、Controllerの情報を用いてView間の繋がりであるViewの遷移図が生成できる。   A view transition diagram is a transition diagram showing the connection between views. In a program designed according to MVC, the Controller communicates the input from the View to the Model and the execution result of the Model to the View. Therefore, it is possible to generate a transition diagram of the View that is the connection between the Views using the Controller information.

VCシナリオとは、Viewの遷移図から生成されるView名及びController名の羅列である。VCシナリオは、View名で始まり、View名で終わる。例えば、VCシナリオは、View名→Controller名→View名→…→View名として定義される。   A VC scenario is a list of view names and controller names generated from a view transition diagram. A VC scenario begins with a View name and ends with a View name. For example, a VC scenario is defined as View name → Controller name → View name → ... → View name.

ステップとは、テストを実行するための手順であるテストシナリオの最小単位を表し、Webアプリケーションである場合には、htmlにおけるフォームやボタンに付与されるidと、動作を示すprocから構成される。   A step represents a minimum unit of a test scenario that is a procedure for executing a test. In the case of a Web application, a step is composed of an id assigned to a form or button in html and a proc indicating an operation.

遺伝子とは、テストデータの各要素を表し、Webアプリケーションである場合には、htmlにおけるフォームのidと、具体的な値であるvalueから構成される。   A gene represents each element of test data. In the case of a Web application, a gene is composed of an id of a form in html and a value that is a specific value.

例えば、View1においてIDとPWを入力して、transmitというidが付与されている「ログイン」ボタンを押下するWebアプリケーションをテストする例を考える。この例では、1つのテストケースは、以下のテストシナリオとテストデータの組み合わせで構成される。   For example, consider an example of testing a Web application that inputs an ID and PW in View 1 and presses a “login” button to which “id” is assigned. In this example, one test case includes a combination of the following test scenario and test data.

テストシナリオ:
VCシナリオ:View1→Controller1→…
ステップ1:id="ID", proc="入力"
ステップ2:id="PW", proc="入力"
ステップ3:id="transmit", proc="押下"

テストデータ:
遺伝子1:id="ID", value="aaaa"
遺伝子2:id="PW", value="1234"

すなわち、このテストケースは、(1)View1においてid="ID"となっているフォームに"aaaa"を入力し、(2)id="PW"となっているフォームに"1234"を入力し、(3)id="transmit"となっているボタンを押下することを意味する。
test scenario:
VC scenario: View1 → Controller1 →…
Step 1: id = "ID", proc = "input"
Step 2: id = "PW", proc = "input"
Step 3: id = "transmit", proc = "press"
...
test data:
Gene 1: id = "ID", value = "aaaa"
Gene 2: id = "PW", value = "1234"
...
That is, in this test case, (1) “aaaa” is input to the form with id = “ID” in View1, and (2) “1234” is input to the form with id = “PW”. (3) This means that the button with id = "transmit" is pressed.

分岐結果は、テストケースを実行したときのコード上の各分岐の結果である分岐結果要素から構成される。例えば、分岐結果は、分岐結果要素1,分岐結果要素2,…として定義される。   The branch result is composed of branch result elements that are the result of each branch on the code when the test case is executed. For example, the branch result is defined as a branch result element 1, a branch result element 2,.

分岐結果要素は、判定分岐、判定順番、判定結果、及び評価値から構成される。判定分岐は、判定対象の分岐を示し、すなわち、どの分岐を判定したかを表す。判定順番は、判定分岐がプログラムの中の全分岐の中で何番目に判定されたかを表す。判定結果は、判定分岐の判定結果(True/False)を表す。評価値は、分岐の判定を定量的に表す値を表す。   The branch result element includes a determination branch, a determination order, a determination result, and an evaluation value. The decision branch indicates a decision target branch, that is, which branch is decided. The determination order represents the number of the determination branch determined among all branches in the program. The determination result represents the determination result (True / False) of the determination branch. The evaluation value represents a value that quantitatively represents the determination of branching.

評価値について更に具体的に説明する。評価値は、分岐条件を満たしている度合い又は分岐条件を満たしていない度合いを表し、判定分岐に対して設定された評価関数によって取得できる。例えば、if(x>0)という分岐がある場合、x=1の場合とx=100の場合では同じTrueを返すが、x=100の時の方がx=1の時と比べて0より大きいため、より分岐条件を満たしている度合いは強いと評価することができる。分岐条件を満たしている場合には評価値は負の値を持ち、満たしていない場合には正の値を持つ。評価関数は、分岐に対して設定され、例えば、分岐条件がa==bである場合、評価関数はabs(a-b)として定義されてもよく、分岐条件がa!=bである場合、評価関数は-abs(a-b)として定義されてもよく、分岐条件がa<b又はa<=bである場合、評価関数はa-bとして定義されてもよく、分岐条件がa>b又はa>=bである場合、評価関数はb-aとして定義されてもよい。   The evaluation value will be described more specifically. The evaluation value represents the degree of satisfying the branch condition or the degree of not satisfying the branch condition, and can be acquired by the evaluation function set for the determination branch. For example, if there is a branch of if (x> 0), the same True is returned when x = 1 and x = 100, but when x = 100 is more than 0 when x = 1 Since it is large, it can be evaluated that the degree of satisfying the branch condition is stronger. The evaluation value has a negative value when the branch condition is satisfied, and has a positive value when the branch condition is not satisfied. The evaluation function is set for the branch. For example, if the branch condition is a == b, the evaluation function may be defined as abs (ab), and if the branch condition is a! = B, the evaluation function The function may be defined as -abs (ab), and if the branch condition is a <b or a <= b, the evaluation function may be defined as ab and the branch condition is a> b or a> = If b, the evaluation function may be defined as ba.

最終分岐結果要素とは、ある分岐結果の分岐結果要素のうち、判定順番の値が最も大きい値を持つ分岐結果要素を示す。また、最終分岐結果要素を除いた分岐結果の集合を途中分岐結果と定義する。最終分岐結果要素の判定分岐、判定順番、判定結果、及び評価値を、それぞれ最終判定分岐、最終判定順番、最終判定結果及び最終評価値と定義する。   The final branch result element indicates a branch result element having the largest determination order value among the branch result elements of a certain branch result. A set of branch results excluding the final branch result element is defined as an intermediate branch result. The determination branch, determination order, determination result, and evaluation value of the final branch result element are defined as a final determination branch, a final determination order, a final determination result, and a final evaluation value, respectively.

図1に、分岐結果の例を示す。判定分岐が分岐a、分岐b、分岐cである3つの分岐結果要素から構成される分岐結果αを例に挙げると、最終分岐結果要素は分岐cの分岐結果要素である[c,3,True,-2]であり、途中分岐結果は、分岐a及び分岐bの分岐結果要素である[a,1,True,-1],[b,2,False,1]である。   FIG. 1 shows an example of the branch result. Taking the branch result α consisting of three branch result elements whose decision branches are branch a, branch b, and branch c as an example, the final branch result element is the branch result element of branch c [c, 3, True , -2], and the intermediate branch result is [a, 1, True, -1], [b, 2, False, 1] which are the branch result elements of branch a and branch b.

経路一致とは、分岐結果Aと分岐結果Bが存在するとき、分岐結果Aの各分岐結果要素が全て、分岐結果Bの分岐結果要素のいずれかと、評価値を除いて一致している場合、分岐結果Aは分岐結果Bに対して経路一致していると定義する。   Path match means that when branch result A and branch result B exist, all branch result elements of branch result A match all of the branch result elements of branch result B, except for the evaluation value. It is defined that the branch result A matches the route with respect to the branch result B.

図1に示す分岐結果α、分岐結果β、及び分岐結果γを例に挙げると、分岐結果αの分岐結果要素は、分岐結果βの分岐結果要素のいずれかと、評価値を除いて一致しているため、分岐結果αは分岐結果βに対して経路一致している。また、分岐結果αの分岐結果要素は、分岐結果γのいずれかと、評価値を除いて一致していないため、分岐結果αは分岐結果γに対して経路一致していない。   Taking the branch result α, the branch result β, and the branch result γ shown in FIG. 1 as an example, the branch result element of the branch result α matches one of the branch result elements of the branch result β except for the evaluation value. Therefore, the branch result α matches the path with respect to the branch result β. Since the branch result element of the branch result α does not match any of the branch results γ except for the evaluation value, the branch result α does not match the path with respect to the branch result γ.

カバレッジとは、プログラムのソースコードがテストされた割合を示す。単位は%である。カバレッジの基準は複数存在し、例えば、分岐網羅率及び条件網羅率が存在するが、特に明記しない限り、本発明の実施例では分岐網羅率をカバレッジと呼ぶ。カバレッジの高いテストデータの集合のことを網羅的なテストデータ又は網羅性の高いテストデータと呼ぶ。   Coverage indicates the rate at which the source code of a program is tested. The unit is%. There are a plurality of coverage standards. For example, there are a branch coverage ratio and a condition coverage ratio, but unless otherwise specified, the branch coverage ratio is referred to as coverage in the embodiment of the present invention. A collection of test data with high coverage is called comprehensive test data or test data with high completeness.

図2に、分岐網羅率と条件網羅率との関係を示す。分岐網羅率は、C1カバレッジとも呼ばれ、プログラム内の分岐がテストされた割合を示す。例えば、図2のような2つの分岐A及び分岐Bが存在するプログラムにおいてC1カバレッジを100%とするためには、分岐A=False且つ分岐B=Trueの場合と、分岐A=True且つ分岐B=Falseの場合の2つをテストする必要がある。   FIG. 2 shows the relationship between the branch coverage rate and the condition coverage rate. The branch coverage is also called C1 coverage and indicates the rate at which branches in the program are tested. For example, in order to set C1 coverage to 100% in a program having two branches A and B as shown in FIG. 2, when branch A = False and branch B = True, branch A = True and branch B We need to test two cases of = False.

また、条件網羅率は、C2カバレッジとも呼ばれ、プログラム内の条件がテストされた割合を示す。例えば、図2のような2つの分岐A及び分岐Bが存在するプログラムにおいてC2カバレッジを100%とするためには、分岐A=False且つ分岐B=Trueの場合と、分岐A=True且つ分岐B=Falseの場合と、分岐A=True且つ分岐B=Trueの場合と、分岐A=False且つ分岐B=Falseの場合の4つをテストする必要がある。   The condition coverage rate is also called C2 coverage, and indicates the rate at which the conditions in the program are tested. For example, in a program having two branches A and B as shown in FIG. 2, in order to set C2 coverage to 100%, when branch A = False and branch B = True, branch A = True and branch B It is necessary to test four cases: = False, branch A = True and branch B = True, and branch A = False and branch B = False.

<テストケース生成装置の構成>
次に、本発明の実施例に係るテストケース生成装置の構成について説明する。図3は、本発明の実施例に係るテストケース生成装置100の機能ブロック図である。
<Configuration of test case generator>
Next, the configuration of the test case generation device according to the embodiment of the present invention will be described. FIG. 3 is a functional block diagram of the test case generation apparatus 100 according to the embodiment of the present invention.

テストケース生成装置100は、CPU(Central Processing Unit)等のプロセッサ、RAM(Random Access Memory)やROM(Read Only Memory)等のメモリ装置、ハードディスク等の記憶装置等から構成されたコンピュータでもよい。例えば、テストケース生成装置の機能及び処理は、記憶装置又はメモリ装置に格納されているデータやプログラムをプロセッサが実行することによって実現されてもよい。   The test case generation device 100 may be a computer including a processor such as a CPU (Central Processing Unit), a memory device such as a RAM (Random Access Memory) and a ROM (Read Only Memory), a storage device such as a hard disk, and the like. For example, the function and processing of the test case generation device may be realized by a processor executing data or a program stored in a storage device or a memory device.

テストケース生成装置100は、ソースコードを入力とし、テストシナリオ及びテストデータの組み合わせであるテストケースを出力する。   The test case generation device 100 receives a source code and outputs a test case that is a combination of a test scenario and test data.

テストケース生成装置100は、VCシナリオ生成部101と、テストシナリオ生成部103と、テストデータ生成部105とを有する。なお、本発明の実施例は、VCシナリオ生成部101及びテストシナリオ生成部103を含まず、テストデータ生成部105を含むテストデータ生成装置として実現されてもよい。例えば、処理フロー図等から生成されたテストシナリオが指定され、テストデータ生成装置が指定のテストシナリオに対するテストデータを生成してもよい。   The test case generation device 100 includes a VC scenario generation unit 101, a test scenario generation unit 103, and a test data generation unit 105. The embodiment of the present invention may be realized as a test data generation apparatus including the test data generation unit 105 without including the VC scenario generation unit 101 and the test scenario generation unit 103. For example, a test scenario generated from a process flow diagram or the like may be specified, and the test data generation apparatus may generate test data for the specified test scenario.

VCシナリオ生成部101は、MVCに従って設計されたアプリケーションのプログラムをテスト対象としたときに、ソースコード内のControllerの情報を用いてViewの遷移図を生成する。図4の左側にViewの遷移図の例を示す。遷移図は、状態と、状態同士の関連性を表す線である遷移で構成される。ソースコードにおけるViewは1つの状態と考えられ、Controllerも1つの状態と考えられる。ControllerはViewからの入力をModelに伝え、Modelの実行結果をViewに伝えるため、Controllerの情報を用いてView間の繋がりであるViewの遷移図が抽出できる。更に、VCシナリオ生成部101は、Viewの遷移図から状態遷移図に対する所定のカバレッジ基準に基づいてView及びControllerの繋がりを表すVCシナリオを生成する。図4の左側に示すように、Controller1、Controller2、Controller3によってView1、View2、View3の繋がりであるViewの遷移図が生成できると、図4の右側に示すように、1つのView名から始まり1つのView名で終わる複数のVCシナリオが生成できる。VCシナリオの数は状態の数によって膨大な数となるため、状態遷移図に対する所定のカバレッジ基準に基づいてVCシナリオを生成する。   The VC scenario generation unit 101 generates a View transition diagram using information on the Controller in the source code when an application program designed according to MVC is a test target. An example of a view transition diagram is shown on the left side of FIG. The transition diagram is composed of transitions that are lines representing the relation between states. The view in the source code is considered as one state, and the controller is also considered as one state. Since the controller communicates the input from the view to the model and the execution result of the model to the view, the transition diagram of the view that is the connection between the views can be extracted using the information of the controller. Further, the VC scenario generation unit 101 generates a VC scenario representing the connection between the view and the controller based on a predetermined coverage standard for the state transition diagram from the view transition diagram. As shown on the left side of Fig. 4, when the transition diagram of View, which is the connection of View1, View2, and View3, can be generated by Controller1, Controller2, and Controller3, as shown on the right side of Fig. 4, one view name starts. Multiple VC scenarios that end with the View name can be generated. Since the number of VC scenarios becomes enormous depending on the number of states, VC scenarios are generated based on a predetermined coverage standard for the state transition diagram.

図5は、状態遷移図に対するカバレッジ基準を示す図である。例えば、状態遷移図に対する所定のカバレッジ基準として、All-states、All-transitions、All-transition-pairs、All-loop-free-paths、All-one-loop-paths、All-paths等が存在する。All-statesとは、全状態がどこかのシナリオに含まれるという基準である。例えば、図5に示す状態遷移図を例に挙げると、状態A→状態B→状態D→状態E→状態B→状態Cのシナリオは、All-statesを満たす。All-transitionsとは、全ての長さが1以下のシナリオ(1遷移)がカバーされるという基準である。例えば、図5に示す状態遷移図を例に挙げると、状態A→状態B、状態B→状態C、状態B→状態D、状態D→状態E、状態E→状態Bのシナリオは、All-transitionsを満たす。All-transition-pairsとは、全ての長さが2以下のパス(遷移ペア)がカバーされるという基準である。例えば、図5に示す状態遷移図を例に挙げると、All-transitionsを満たすシナリオに加えて、状態A→状態B→状態C、状態A→状態B→状態D、状態B→状態D→状態E、状態D→状態E→状態B、状態E→状態B→状態D、状態E→状態B→状態Cのシナリオは、All-transition-pairsを満たす。All-loop-free-pathsとは、同じ状態が2回以上現れず、且つ、他のシナリオに部分的に含まれないようなシナリオ(prime pathと呼ばれる)が全てカバーされるという基準である。なお、All-loop-free-pathsはAll-transitionsを保証するものではない。例えば、図5に示す状態遷移図を例に挙げると、状態A→状態B→状態C、状態A→状態B→状態D→状態Eのシナリオは、All-loop-free-pathsを満たす。All-one-loop-pathsとは、All-loop-free-pathsに加えて、ループ1つのみを1回だけ回るシナリオがカバーされるという基準である。例えば、図5に示す状態遷移図を例に挙げると、状態A→状態B→状態C、状態A→状態B→状態D→状態E→状態B→状態Cのシナリオは、All-one-loop-pathsを満たす。All-pathsとは、全てのシナリオがカバーされるという基準である。なお、通常はループが存在するため、All-pathsを満たすシナリオは無限通り存在するため、有用ではない。   FIG. 5 is a diagram showing coverage criteria for the state transition diagram. For example, there are All-states, All-transitions, All-transition-pairs, All-loop-free-paths, All-one-loop-paths, All-paths, etc. as predetermined coverage criteria for the state transition diagram. All-states is a criterion that all states are included in some scenario. For example, taking the state transition diagram shown in FIG. 5 as an example, the scenario of state A → state B → state D → state E → state B → state C satisfies All-states. All-transitions is a standard that covers scenarios with a length of 1 or less (one transition). For example, taking the state transition diagram shown in FIG. 5 as an example, the scenarios of state A → state B, state B → state C, state B → state D, state D → state E, state E → state B are all- Satisfies transitions. All-transition-pairs is a standard that covers all paths (transition pairs) whose length is 2 or less. For example, taking the state transition diagram shown in FIG. 5 as an example, in addition to the scenario that satisfies All-transitions, state A → state B → state C, state A → state B → state D, state B → state D → state The scenario of E, State D → State E → State B, State E → State B → State D, State E → State B → State C satisfies All-transition-pairs. All-loop-free-paths is a standard that covers all scenarios (called prime paths) that do not appear the same state more than once and are not partially included in other scenarios. All-loop-free-paths does not guarantee All-transitions. For example, taking the state transition diagram shown in FIG. 5 as an example, the scenario of state A → state B → state C, state A → state B → state D → state E satisfies All-loop-free-paths. All-one-loop-paths is a standard that covers only one loop once in addition to All-loop-free-paths. For example, taking the state transition diagram shown in FIG. 5 as an example, the scenario of state A → state B → state C, state A → state B → state D → state E → state B → state C is All-one-loop. Satisfies -paths. All-paths is a standard that covers all scenarios. Since there are usually loops, there are an infinite number of scenarios that satisfy All-paths, which is not useful.

テストシナリオ生成部103は、生成されたVCシナリオにView操作情報を追加する。例えば、クローラやユーザ操作等によって、生成されたVCシナリオを満たすようなView操作情報を追加する。View操作情報は、ステップの集合で表される。具体的には、クローラやユーザ操作等によってテスト対象のプログラムを動かすことで、テストシナリオ生成部103は、生成されたVCシナリオと同じ遷移をするView操作情報を取得すると共に、View操作情報を取得したときのテストデータである初期テストデータを取得する。テストシナリオ生成部103は、VCシナリオにView操作情報及び初期テストデータを追加した初期テストケースを生成する。   The test scenario generation unit 103 adds View operation information to the generated VC scenario. For example, view operation information that satisfies the generated VC scenario is added by a crawler, a user operation, or the like. View operation information is represented by a set of steps. Specifically, the test scenario generation unit 103 acquires the View operation information that performs the same transition as the generated VC scenario and the View operation information by moving the test target program by a crawler, a user operation, or the like. The initial test data that is the test data at that time is acquired. The test scenario generation unit 103 generates an initial test case in which View operation information and initial test data are added to the VC scenario.

テストデータ生成部105は、生成されたテストシナリオのうち1つのシナリオを指定してテストデータを生成する。ここでは、最初にConcolic Testingによってテストデータ及び分岐結果を生成し、Concolic Testingによって得られたテストデータ及び分岐結果を用いてSBSTによって新たなテストデータを生成する構成例について説明するが、最初にテストデータ及び分岐結果を生成するためのテストデータ生成手法はConcolic Testingに限定されない。Concolic TestingとSBSTとの組み合わせが用いられる場合、テストデータ生成部105は、コード挿入部111と、Concolic Testing部113と、SBST部115とを有する。   The test data generation unit 105 specifies one scenario among the generated test scenarios and generates test data. Here, a configuration example is described in which test data and branch results are first generated by Concolic Testing, and new test data is generated by SBST using the test data and branch results obtained by Concolic Testing. The test data generation method for generating data and branch results is not limited to Concolic Testing. When a combination of Concolic Testing and SBST is used, the test data generation unit 105 includes a code insertion unit 111, a Concolic Testing unit 113, and an SBST unit 115.

コード挿入部111は、テスト対象のプログラムに、分岐の判定を定量的に評価するための評価値を含む分岐結果を出力するコードを挿入する。このように、コード挿入部111は、Concolic Testingを実行している間にSBSTで必要な情報を予め取得するためのコードを挿入する。コード挿入部111は、解析対象のユーザ記述クラス内における分岐の箇所に、分岐結果を出力するコードを挿入してもよい。コード挿入部111は、解析対象のユーザ記述クラスに対しては、プログラムの分岐を解析するためのコードを挿入してもよいが、フレームワークやライブラリ等のユーザが記述していない箇所は解析対象外とし、プログラムの分岐を解析するためのコードを挿入しなくてもよい。   The code insertion unit 111 inserts into the test target program a code that outputs a branch result including an evaluation value for quantitatively evaluating branch determination. In this manner, the code insertion unit 111 inserts a code for acquiring information necessary for SBST in advance while executing the concolic testing. The code insertion unit 111 may insert a code that outputs a branch result at a branch point in the user description class to be analyzed. The code insertion unit 111 may insert a code for analyzing the branch of the program into the user description class to be analyzed. However, a part not described by the user such as a framework or a library is to be analyzed. It is not necessary to insert the code for analyzing the branch of the program.

Concolic Testing部113は、入力値を記号に置き換えて得られた制約式を解析することによりテストデータを生成すると共に、挿入されたコードが出力した分岐結果を生成する。このように、Concolic Testing部113は、テストデータを生成している間に、SBSTで必要な情報である分岐結果を収集する。すなわち、Concolic Testing部113は、指定のテストシナリオに対してテストデータを生成する過程において、指定のテストシナリオと当該テストデータと分岐結果とを、SBSTを実行するために用いられる素材テストスイートに追加する。素材テストスイートには、経路一致している分岐結果が存在する可能性があるため、Concolic Testing部113は、指定のテストシナリオに対して生成されたテストデータによってカバレッジが向上する場合、指定のテストシナリオと当該テストデータと分岐結果とを出力テストスイートに追加する。   The Concolic Testing unit 113 generates test data by analyzing a constraint equation obtained by replacing input values with symbols, and generates a branch result output by the inserted code. As described above, the concoli testing unit 113 collects branch results, which are information necessary for SBST, while generating test data. That is, the Concolic Testing unit 113 adds the specified test scenario, the test data, and the branch result to the material test suite used for executing SBST in the process of generating test data for the specified test scenario. To do. Since there is a possibility that a branch result that matches the route may exist in the material test suite, the Concolic Testing unit 113 determines that the specified test is performed when the coverage is improved by the test data generated for the specified test scenario. The scenario, the test data, and the branch result are added to the output test suite.

SBST部115は、テストデータを生成するために遺伝的アルゴリズムを用いる。遺伝的アルゴリズムの選択、交叉、及び突然変異をそれぞれ実施するため、SBST部115は、選択部121と、交叉部123と、突然変異部125とを含む。特に、交叉部123は、特性の異なるテストデータを組み合わせる特性別交叉法によって、新しいテストデータを生成する。具体的には、SBST部115は、Concolic Testing部113において生成された分岐結果に対して途中まで経路一致する目標分岐結果を生成し、目標分岐結果に対して最終判定分岐を除き経路一致する第1のテストデータと、最終判定分岐の分岐結果を有する第2のテストデータとを交叉部123において交叉させることにより、目標分岐結果を満たすテストデータを生成する。   The SBST unit 115 uses a genetic algorithm to generate test data. In order to perform selection, crossover, and mutation of the genetic algorithm, the SBST unit 115 includes a selection unit 121, a crossover unit 123, and a mutation unit 125. In particular, the crossover unit 123 generates new test data by a characteristic-specific crossover method that combines test data having different characteristics. Specifically, the SBST unit 115 generates a target branch result that matches the route to the middle of the branch result generated by the Concolic Testing unit 113, and matches the route to the target branch result except for the final decision branch. Test data satisfying the target branch result is generated by crossing the test data of 1 and the second test data having the branch result of the final determination branch at the crossover unit 123.

図6に、特性別交叉法の概略図を示す。まず、分岐A→分岐B→分岐C→分岐D→結果Cという経路を通過するテストデータαが存在すると仮定する。条件網羅率を高めるテストデータとして、分岐A→分岐B→分岐C→分岐D→結果Dという経路を通過するテストデータが必要とされる場合、分岐A→分岐B→分岐C→分岐D→結果Dを目標分岐結果と設定する。この場合、途中まで経路一致するテストデータαをベースに、目標分岐結果の最後の経路を通過するテストデータβと交叉させることで目標分岐結果を満たすテストデータが生成可能になる。なお、テストデータβは、目標分岐結果の最終判定分岐までは、どのような経路を通過していてもよく、また、テストデータβは、目標分岐結果の最終判定分岐の分岐結果を有していれば、目標分岐結果の最終判定結果が異なってもよい。例えば、図6の例において、テストデータβは、分岐Dの分岐結果が必ずしもTrueでなく、Falseでもよい。テストデータβの分岐Dの分岐結果がFalseであっても、テストデータβとして分岐Dの評価値の値によって優秀なテストデータが選択されることになれば、目標分岐結果を満たすテストデータが生成される可能性が高くなる。   FIG. 6 shows a schematic diagram of the characteristic-specific crossover method. First, it is assumed that there is test data α passing through a route of branch A → branch B → branch C → branch D → result C. When test data that passes the path of branch A → branch B → branch C → branch D → result D is required as test data to increase the condition coverage rate, branch A → branch B → branch C → branch D → result Set D as the target branch result. In this case, test data satisfying the target branch result can be generated by crossing with test data β passing through the last path of the target branch result on the basis of the test data α that matches the path halfway. Note that the test data β may pass through any route up to the final determination branch of the target branch result, and the test data β has the branch result of the final determination branch of the target branch result. If so, the final determination result of the target branch result may be different. For example, in the example of FIG. 6, the test data β may be False because the branch result of branch D is not necessarily true. Even if the branch result of the branch D of the test data β is False, if excellent test data is selected as the test data β according to the evaluation value of the branch D, test data that satisfies the target branch result is generated. Is likely to be.

このようにして、SBST部115は、出力テストスイートの分岐結果に対して途中まで経路一致する目標分岐結果を生成し、目標分岐結果と経路一致するテストデータが出力テストスイートに存在しない場合、素材テストスイートを用いて目標分岐結果を満たすテストデータを生成し、出力テストスイートに追加する。また、SBST部115の交叉部123は、目標分岐結果に対して最終判定分岐を除き経路一致する第1のテストデータと、最終判定分岐の分岐結果を有する第2のテストデータだけでは十分なテストデータの生成ができないことを考慮して、素材テストスイートの中から第1のテストデータ及び第2のテストデータを除いた第3のテストデータを使用してもよい。SBST部115は、素材テストスイートの分岐結果を、目標分岐結果の最終判定分岐を持つ分岐結果要素の評価値でソートし、ソートされた素材テストスイートから順に、第1のテストケースと、第2のテストケースと、第3のテストケースとを選択し、第1のテストケース及び第3のテストケースの組み合わせと、第2のテストケース及び第3のテストケースの組み合わせとを交叉部123において交叉させることにより、目標分岐結果を満たすテストデータを生成してもよい。   In this way, the SBST unit 115 generates a target branch result that partially matches the output test suite branch result, and the test data that matches the target branch result does not exist in the output test suite. Test data that satisfies the target branch result is generated using the test suite and added to the output test suite. In addition, the crossover unit 123 of the SBST unit 115 can perform a test with only the first test data whose path matches the target branch result except the final determination branch and the second test data having the branch result of the final determination branch. Considering that data cannot be generated, third test data obtained by removing the first test data and the second test data from the material test suite may be used. The SBST unit 115 sorts the branch results of the material test suite by the evaluation value of the branch result element having the final determination branch of the target branch result, and sequentially selects the first test case and the second test case from the sorted material test suite. And the third test case are selected, and the combination of the first test case and the third test case and the combination of the second test case and the third test case are crossed at the crossover part 123. By doing so, test data satisfying the target branch result may be generated.

<テストケース生成方法の手順>
次に、本発明の実施例に係るテストケース生成方法について説明する。図7は、本発明の実施例に係るテストケース生成方法のフローチャートである。
<Procedure for test case generation method>
Next, a test case generation method according to an embodiment of the present invention will be described. FIG. 7 is a flowchart of a test case generation method according to an embodiment of the present invention.

まず、ステップS001において、VCシナリオ生成部101は、テスト対象のプログラムのソースコードを入力として受け取り、ソースコード内のControllerの情報を用いて、View間の繋がりを表すViewの遷移図を生成する。   First, in step S001, the VC scenario generation unit 101 receives a source code of a test target program as an input, and generates a view transition diagram representing a connection between views using information of a controller in the source code.

ステップS001について図8を参照して更に説明する。   Step S001 will be further described with reference to FIG.

ステップS101において、VCシナリオ生成部101は、テスト対象のプログラムのソースコードを入力として受け取り、ソースコード内のViewを抽出する。   In step S101, the VC scenario generation unit 101 receives the source code of the test target program as an input, and extracts a view in the source code.

ステップS102において、VCシナリオ生成部101は、テスト対象のプログラムのソースコードを入力として受け取り、Controllerの情報を用いてView間の繋がりを検出する。具体的には、VCシナリオ生成部101は、抽出されたViewの1つを対象Viewとして選択し、対象View名で指定されたViewの遷移先のControllerを取得する。そして、取得した遷移先のControllerの遷移先のViewを対象Viewの遷移先のViewとする。ステップS101で抽出した各Viewに上記の処理を繰り返すことで、各対象Viewの全ての遷移先のView名と、これらの間に存在するController名が出力される。   In step S102, the VC scenario generation unit 101 receives the source code of the test target program as an input, and detects the connection between the views using the information of the controller. Specifically, the VC scenario generation unit 101 selects one of the extracted views as the target view, and acquires the controller that is the transition destination of the view specified by the target view name. Then, the transition destination view of the acquired transition destination controller is set as the transition destination view of the target view. By repeating the above process for each view extracted in step S101, all the transition destination view names of each target view and the controller names existing between them are output.

ステップS103において、VCシナリオ生成部101は、各対象Viewの全ての遷移先のView名と、これらの間に存在するController名を入力として受け取り、Viewの遷移図を作成する。Viewの遷移図には、View名だけでなく、Controller名も記録される。Viewの遷移図が生成された場合、図7のステップS002に戻る。   In step S103, the VC scenario generation unit 101 receives, as inputs, all transition destination view names of each target view and a controller name existing therebetween, and creates a view transition diagram. In the View transition diagram, not only the View name but also the Controller name is recorded. When the View transition diagram is generated, the process returns to Step S002 of FIG.

次に、図7のステップS002において、VCシナリオ生成部101は、Viewの遷移図を入力として受け取り、Viewの遷移図に対して、状態遷移図に対する所定のカバレッジ基準に基づいてVCシナリオを生成する。   Next, in step S002 of FIG. 7, the VC scenario generation unit 101 receives a view transition diagram as an input, and generates a VC scenario for the view transition diagram based on a predetermined coverage criterion for the state transition diagram. .

ステップS002について図9を参照して更に説明する。   Step S002 will be further described with reference to FIG.

ステップS104において、VCシナリオ生成部101は、Viewの遷移図を状態遷移図として扱い、All-states等の状態遷移図に対する所定のカバレッジ基準に基づいて、複数のVCシナリオを作成する。VCシナリオが生成された場合、図7のステップS003に戻る。   In step S104, the VC scenario generation unit 101 treats the view transition diagram as a state transition diagram, and creates a plurality of VC scenarios based on a predetermined coverage criterion for the state transition diagram such as All-states. When the VC scenario is generated, the process returns to step S003 in FIG.

次に、図7のステップS003において、テストシナリオ生成部103は、VCシナリオを入力として受け取り、各VCシナリオに対してVCシナリオを満たすテストケースを、クローラ等の技術を用いて生成する。そして、VCシナリオを実現するテストシナリオ及びテストデータを1件のテストケース(初期テストケース)として出力する。   Next, in step S003 of FIG. 7, the test scenario generation unit 103 receives a VC scenario as an input, and generates a test case that satisfies the VC scenario for each VC scenario using a technique such as a crawler. Then, the test scenario and test data for realizing the VC scenario are output as one test case (initial test case).

ステップS003について図10を参照して更に説明する。   Step S003 will be further described with reference to FIG.

ステップS105において、テストシナリオ生成部103は、テスト対象のプログラムとVCシナリオを入力として受け取り、クローラ等によってテスト対象のプログラムを実際に操作し、VCシナリオの先頭のViewが表すhtmlファイルにアクセスするURLに移動する。なお、テスト対象のプログラムの操作は、クローラ等の他にユーザによる操作でも代用可能である。   In step S105, the test scenario generation unit 103 receives the test target program and the VC scenario as input, actually operates the test target program by a crawler or the like, and accesses the html file represented by the top view of the VC scenario. Move to. The operation of the program to be tested can be replaced by a user operation in addition to the crawler.

ステップS106において、テストシナリオ生成部103は、空のテストケースTC0を作成する。空のテストケースTC0には、テストシナリオであるVCシナリオとステップの集合の具体的な値は入っておらず、テストデータも入っていない。   In step S106, the test scenario generation unit 103 creates an empty test case TC0. The empty test case TC0 does not contain specific values for the VC scenario, which is a test scenario, and a set of steps, and does not contain test data.

ステップS107において、テストシナリオ生成部103は、テスト対象のプログラムとテストケースTC0を入力として受け取り、クローラ等によってテスト対象のプログラムを実際に操作し、テスト対象のプログラムを操作したときに入力したフォームのidやその値をテストケースTC0のテストデータに追加し、入力したフォームのidや押下したボタンのid等をテストケースTC0のテストシナリオに追加する。なお、テスト対象のプログラムの操作は、クローラ等の他にユーザによる操作でも代用可能である。また、操作中のViewやControllerの遷移も取得し、テストケースTC0のテストシナリオに追加する。新しいViewに遷移したところで次のステップS108に移行する。   In step S107, the test scenario generation unit 103 receives the test target program and the test case TC0 as inputs, actually operates the test target program by a crawler or the like, and the form input when the test target program is operated. Add the id and its value to the test data of test case TC0, and add the id of the entered form and the id of the pressed button to the test scenario of test case TC0. The operation of the program to be tested can be replaced by a user operation in addition to the crawler. Also, obtain the transition of View or Controller being operated and add it to the test scenario of test case TC0. When transitioning to a new view, the process proceeds to the next step S108.

ステップS108において、テストシナリオ生成部103は、テストケースTC0とVCシナリオを入力として受け取り、VCシナリオのView及びControllerの遷移と、テストケースTC0が途中又は最後まで同じ遷移をしているか否かを判断する。同じ遷移をしていない場合、ステップS109に移行し、同じ遷移をしている場合、ステップS110に移行する。   In step S108, the test scenario generation unit 103 receives the test case TC0 and the VC scenario as inputs, and determines whether the transition of the view and controller of the VC scenario and the test case TC0 have undergone the same transition halfway or the end. To do. When the same transition is not performed, the process proceeds to step S109, and when the same transition is performed, the process proceeds to step S110.

ステップS109において、テストシナリオ生成部103は、テストケースTC0を入力として受け取り、VCシナリオの遷移とテストケースTC0の遷移が異なる場合、テストケースTC0はVCシナリオを満たさないため、テストケースTC0を破棄し、ステップS105に移行する。   In step S109, the test scenario generation unit 103 receives the test case TC0 as an input, and if the transition of the VC scenario and the transition of the test case TC0 are different, the test case TC0 does not satisfy the VC scenario, and thus the test case TC0 is discarded. The process proceeds to step S105.

ステップS110において、テストシナリオ生成部103は、テストケースTC0とVCシナリオを入力として受け取り、VCシナリオのView及びControllerの遷移と、テストケースTC0が最後まで同じ遷移をしているか否かを判断する。最後まで同じ遷移をしていない場合、すなわち、途中までは同じ遷移をしているが、最後まで同じ遷移をしていない場合には、更にテスト対象のプログラムを操作する必要があるため、ステップS107に移行する。同じ遷移をしている場合、ステップS111に移行する。   In step S110, the test scenario generation unit 103 receives the test case TC0 and the VC scenario as inputs, and determines whether the transition of the view and controller of the VC scenario and the test case TC0 have made the same transition to the end. If the same transition has not been made to the end, that is, the same transition has been made to the middle, but the same transition has not been made to the end, it is necessary to further operate the program to be tested, so step S107 Migrate to When the same transition is made, the process proceeds to step S111.

ステップS111において、テストシナリオ生成部103は、テストケースTC0を入力として受け取り、テストケースTC0を初期テストケースとして出力する。初期テストケースが出力された場合、図7のステップS005に戻る。   In step S111, the test scenario generation unit 103 receives the test case TC0 as an input, and outputs the test case TC0 as an initial test case. When the initial test case is output, the process returns to step S005 in FIG.

次に、図7のステップS005において、テストデータ生成部105のコード挿入部111は、テスト対象のプログラムのバイトコードを入力として受け取り、ユーザ記述クラス内のメソッド上のバイトコードに対して、テストデータ生成に必要な情報を取得するためのコードを挿入する。なお、バイトコードの代わりにソースコードを入力として受け取ってもよい。Concolic Testingでは、入力値を記号に置き換えて得られた制約式を解析する必要があるため、入力値を記号に置き換えるためのコードを挿入する。また、コード挿入部111は、Concolic Testingを実行している間にSBSTで必要な情報を予め取得するためのコードを挿入する。SBSTでは、分岐の評価値を解析する必要があるため、分岐に対する評価関数の値を出力するためのコードを挿入する。コード挿入部111は、ユーザ記述クラスにコード挿入されたバイトコードを出力する。   Next, in step S005 of FIG. 7, the code insertion unit 111 of the test data generation unit 105 receives the byte code of the test target program as an input, and performs test data on the byte code on the method in the user description class Insert code to obtain information necessary for generation. A source code may be received as an input instead of a byte code. In Concolic Testing, since it is necessary to analyze the constraint expression obtained by replacing the input value with a symbol, a code for replacing the input value with the symbol is inserted. In addition, the code insertion unit 111 inserts a code for acquiring information necessary for SBST in advance while executing the Concolic Testing. In SBST, since it is necessary to analyze the evaluation value of the branch, a code for outputting the value of the evaluation function for the branch is inserted. The code insertion unit 111 outputs a bytecode inserted into the user description class.

なお、コード挿入部111は、解析対象のユーザ記述クラス名を入力として受け取ってもよく、解析対象外のユーザ記述クラス名を入力として受け取ってもよい。解析対象のユーザ記述クラス名及び解析対象外のユーザ記述クラス名は、ネームスペースで指定されてもよい。この場合、コード挿入部111は、解析対象のユーザ記述クラス内のメソッド上のバイトコードに対して、テストデータ生成に必要な情報を取得するためのコードを挿入する。   The code insertion unit 111 may receive a user description class name to be analyzed as an input, or may receive a user description class name that is not an analysis target as an input. The user description class name to be analyzed and the user description class name not to be analyzed may be specified by a namespace. In this case, the code insertion unit 111 inserts a code for acquiring information necessary for generating test data into the bytecode on the method in the user description class to be analyzed.

ステップS005について図11を参照して更に説明する。   Step S005 will be further described with reference to FIG.

ステップS112において、コード挿入部111は、ユーザにより入力された解析対象のユーザ記述クラス名を入力として受け取ってもよい。また、コード挿入部111は、ユーザにより入力された解析対象外のユーザ記述クラス名を入力として受け取ってもよい。ユーザ記述クラス名がネームスペースで指定された場合、コード挿入部111は、指定されたネームスペースを持つクラスの名前をバイトコードを調べて取得する。ただし、解析対象外のユーザクラス名が存在する場合、コード挿入部111は、解析対象外のユーザクラス名を持つユーザ記述クラスを除外する。   In step S112, the code insertion unit 111 may receive as input the user description class name to be analyzed input by the user. Further, the code insertion unit 111 may receive, as an input, a user description class name that is input by the user and is not to be analyzed. When the user description class name is designated by the name space, the code insertion unit 111 obtains the name of the class having the designated name space by examining the byte code. However, if there is a user class name that is not an analysis target, the code insertion unit 111 excludes a user description class having a user class name that is not an analysis target.

ステップS113において、コード挿入部111は、解析対象のユーザ記述クラス内のメソッド上のバイトコードの各行を調べ、テストデータ生成に必要な情報を取得するためのコードを挿入する。コード挿入部111は、Concolic Testingで必要な情報を取得するために、解析対象のユーザ記述クラス内における入力値に対する演算が施される行及び分岐の行に、入力値を記号に置き換えるためのコードを挿入する。また、コード挿入部111は、SBSTで必要な情報を取得するために、解析対象のユーザ記述クラス内における分岐の箇所に、分岐結果を出力するコードを挿入する。ユーザ記述クラス内のメソッド上でコードを挿入する必要がない行に対しては何も実施しない。コードが挿入された場合、図7のステップS006に戻る。   In step S113, the code insertion unit 111 examines each line of the bytecode on the method in the user description class to be analyzed, and inserts a code for acquiring information necessary for test data generation. The code insertion unit 111 is a code for substituting the input value with a symbol in the line where the operation is performed on the input value in the user description class to be analyzed and the branch line in order to acquire the information necessary for the Concolic Testing. Insert. In addition, the code insertion unit 111 inserts a code that outputs a branch result at a branch point in the user description class to be analyzed in order to acquire information necessary for SBST. Do nothing for lines that do not require code to be inserted on methods in user-written classes. When the code is inserted, the process returns to step S006 in FIG.

次に、初期テストケースの中から1つのテストケースを指定し、以下のようにテストデータを生成する。   Next, one test case is designated from the initial test cases, and test data is generated as follows.

図7のステップS006において、テストデータ生成部105のConcolic Testing部113は、空の出力テストスイートを作成する。空の出力テストスイートには、テストシナリオであるVCシナリオとステップの集合の具体的な値は入っておらず、テストデータも分岐結果も入っていない。   In step S006 of FIG. 7, the concoli testing unit 113 of the test data generation unit 105 creates an empty output test suite. The empty output test suite does not contain specific values for the test scenario VC scenario and the set of steps, and does not contain test data or branch results.

次に、図7のステップS007において、Concolic Testing部113は、コード挿入されたバイトコードと、初期テストケースと、出力テストスイートを入力として受け取り、初期テストケースに基づき、Concolic Testingに従ってテストデータを生成し、得られたテストケースを出力テストスイートに追加する。   Next, in step S007 of FIG. 7, the Concolic Testing unit 113 receives the inserted bytecode, the initial test case, and the output test suite as inputs, and generates test data according to the Concolic Testing based on the initial test case. And add the resulting test case to the output test suite.

ステップS007について図12を参照して更に説明する。   Step S007 will be further described with reference to FIG.

ステップS114において、Concolic Testing部113は、初期テストケースを入力として受け取り、初期テストケースを複製してテストケースTCNと定義する。   In step S114, the concolic testing unit 113 receives the initial test case as an input, duplicates the initial test case, and defines it as a test case TCN.

ステップS115において、Concolic Testing部113は、テストケースTCN及びコード挿入されたバイトコードを入力として受け取り、Concolic Testingに従って新しいテストデータを生成する。Concolic Testingでは、テストケースTCNを実際に実行する必要があるが、テストケースTCNにはView操作情報を含むテストシナリオや、具体的なテストデータが含まれているため、スクリプトを作成し、スクリプトを実行するツールであるSelenium等を利用することにより自動的にConcolic Testingを実行することができる。また、コード挿入部111によってSBSTで必要な情報である分岐結果を出力するコードが挿入されているため、Concolic Testing部113は、テストデータと共に分岐結果を取得することができる。   In step S115, the concolic testing unit 113 receives the test case TCN and the bytecode into which the code has been inserted as input, and generates new test data according to the concolic testing. In Concolic Testing, it is necessary to actually execute the test case TCN. However, since the test case TCN includes the test scenario including the View operation information and specific test data, create a script and execute the script. By using Selenium etc., which is the tool to be executed, it is possible to automatically execute Concolic Testing. Further, since a code for outputting a branch result, which is information necessary for SBST, has been inserted by the code insertion unit 111, the Concolic Testing unit 113 can acquire the branch result together with the test data.

ステップS116において、Concolic Testing部113は、生成したテストデータと初期テストケースを入力として受け取り、生成したテストデータを初期テストケースの中のテストデータと置き換えて、新しいテストケースTCNを出力する。   In step S116, the concoli testing unit 113 receives the generated test data and the initial test case as inputs, replaces the generated test data with the test data in the initial test case, and outputs a new test case TCN.

ステップS117において、Concolic Testing部113は、テストケースTCNと分岐結果と素材テストスイートを入力として受け取り、テストケースTCNと分岐結果を素材テストスイートに追加する。   In step S117, the concolic testing unit 113 receives the test case TCN, the branch result, and the material test suite as inputs, and adds the test case TCN and the branch result to the material test suite.

ステップS118において、Concolic Testing部113は、テストケースTCNと出力テストスイートを入力として受け取り、テストケースTCNを出力テストスイートに加えることでカバレッジが向上するか否かを判断する。カバレッジが向上する場合、ステップS119に移行し、カバレッジが向上しない場合、ステップS120に移行する。   In step S118, the concolic testing unit 113 receives the test case TCN and the output test suite as inputs, and determines whether the coverage is improved by adding the test case TCN to the output test suite. If the coverage is improved, the process proceeds to step S119. If the coverage is not improved, the process proceeds to step S120.

ステップS119において、Concolic Testing部113は、テストケースTCNと分岐結果と出力テストケースを入力として受け取り、テストケースTCNと分岐結果を出力テストスイートに追加する。   In step S119, the concolic testing unit 113 receives the test case TCN, the branch result, and the output test case as inputs, and adds the test case TCN and the branch result to the output test suite.

ステップS120において、Concolic Testing部113は、解析が終わっていない場合、ステップS115に移行し、テストデータの生成を繰り返す。解析が終わった場合、図7のステップS008に戻る。   In step S120, if the analysis has not been completed, the concolic testing unit 113 proceeds to step S115 and repeats generation of test data. When the analysis is completed, the process returns to step S008 in FIG.

次に、図7のステップS008において、テストデータ生成部105のSBST部115は、SBSTで必要な情報である分岐結果を出力するコードが挿入されたバイトコードと出力テストスイートと素材テストスイートを入力として受け取る。SBST部115は、コードが挿入されたバイトコードに対し、テストデータの各遺伝子を入力としてテスト対象のプログラムを実際に動かして解析するSBSTを実行し、Concolic Testing部113で生成したテストデータが通過することのできない分岐を通過するようなテストデータを生成する。SBST部115は、このようにカバレッジを向上させるテストデータを出力テストスイートに追加して出力テストスイートを強化する。なお、SBST部115で用いるテストデータは、素材テストスイートから選択される。   Next, in step S008 of FIG. 7, the SBST unit 115 of the test data generation unit 105 inputs the byte code, the output test suite, and the material test suite into which the code for outputting the branch result, which is information necessary for SBST, is inserted. Receive as. The SBST unit 115 executes SBST for analyzing the program by actually moving the test target program with each gene of the test data as input for the byte code into which the code is inserted, and the test data generated by the Concolic Testing unit 113 passes. Test data that passes through a branch that cannot be generated is generated. The SBST unit 115 strengthens the output test suite by adding test data for improving the coverage to the output test suite. Note that the test data used in the SBST unit 115 is selected from the material test suite.

ステップS008について図13を参照して更に説明する。   Step S008 will be further described with reference to FIG.

ステップS201において、SBST部115は、出力テストスイートの各分岐結果BR0に対して、分岐結果BR0の分岐結果要素の数をnとする。   In step S201, the SBST unit 115 sets the number of branch result elements of the branch result BR0 to n for each branch result BR0 of the output test suite.

ステップS202において、SBST部115は、分岐結果BR0を入力として受け取り、分岐結果BR0に対し、判定順番の値がnより大きい分岐結果要素を全て削除した新しい分岐結果BRを作成する。   In step S202, the SBST unit 115 receives the branch result BR0 as an input, and creates a new branch result BR in which all branch result elements having a determination order value greater than n are deleted from the branch result BR0.

ステップS203において、SBST部115は、分岐結果BRを入力として受け取り、分岐結果BRに対し、最終判定結果を反転した新しい分岐結果を作成し、目標分岐結果とする。例えば、分岐結果BRの最終判定結果がTrueである場合、その最終判定結果をFalseとし、分岐結果BRの最終判定結果がFalseである場合、その最終判定結果をTrueとする。   In step S203, the SBST unit 115 receives the branch result BR as an input, creates a new branch result obtained by inverting the final determination result with respect to the branch result BR, and sets it as the target branch result. For example, when the final determination result of the branch result BR is True, the final determination result is False, and when the final determination result of the branch result BR is False, the final determination result is True.

ステップS204において、SBST部115は、目標分岐結果と経路一致する分岐結果が出力テストスイートに存在するか否かを判断する。図1を参照して説明した通り、ここでは分岐結果の経路一致を判断するため、評価値は異なってもよい。目標分岐結果と経路一致する分岐結果が出力テストスイートに存在しない場合、ステップS205に移行し、存在する場合、ステップS206に移行する。   In step S <b> 204, the SBST unit 115 determines whether a branch result whose path matches the target branch result exists in the output test suite. As described with reference to FIG. 1, the evaluation value may be different in this case in order to determine the route match of the branch result. When the branch result that matches the path with the target branch result does not exist in the output test suite, the process proceeds to step S205, and when it exists, the process proceeds to step S206.

ステップS205において、SBST部115は、素材テストスイートと目標分岐結果を入力として受け取り、目標分岐結果を満たすようなテストデータをSBSTによって生成する。   In step S205, the SBST unit 115 receives the material test suite and the target branch result as inputs, and generates test data that satisfies the target branch result using SBST.

ステップS205について、図14を参照して更に説明する。   Step S205 will be further described with reference to FIG.

ステップS301において、遺伝的アルゴリズムを用いてSBSTを実行するときの最大世代数をGとし、現在の世代gを1とする。   In step S301, G is the maximum number of generations when executing SBST using a genetic algorithm, and 1 is the current generation g.

ステップS302において、SBST部115は、素材テストスイートと目標分岐結果を入力として受け取り、素材テストスイートの各分岐結果に対し、目標分岐結果の最終判定分岐を持つ分岐結果要素の評価値でソートする。例えば、目標分岐結果の最終判定分岐がTrueである場合、評価値の値が小さいほど優秀であると判断し、目標分岐結果の最終判定分岐がFalseである場合、評価値の値が大きいほど優秀であると判断する。ただし、目標分岐結果の最終判定分岐を持たない分岐結果は、最も優秀でないと判断する。SBST部115は、優秀であると判断された分岐結果と、それに対応するテストケースを上から順番に並べてソートする。   In step S302, the SBST unit 115 receives the material test suite and the target branch result as inputs, and sorts each branch result of the material test suite by the evaluation value of the branch result element having the final determination branch of the target branch result. For example, if the final decision branch of the target branch result is True, the smaller the evaluation value, the better the decision. If the final decision branch of the target branch result is False, the higher the evaluation value, the better It is judged that. However, the branch result that does not have the final decision branch of the target branch result is judged to be the least excellent. The SBST unit 115 sorts the branch results determined to be excellent and the corresponding test cases in order from the top.

ステップS303において、SBST部115は、空のテストスイートTSを生成する。空のテストスイートTSには、テストケースの具体的な値は入っておらず、分岐結果も入っていない。   In step S303, the SBST unit 115 generates an empty test suite TS. The empty test suite TS does not contain specific values for test cases and does not contain branch results.

ステップS304において、SBST部115の選択部121は、ソートされた素材テストスイートとテストスイートTSとを入力として受け取り、ソートされた素材テストスイートの上から順番に複数のテストケースを選択する。選択されるテストケースの個数は、予め決められた定数とする。選択部121は、選択されたテストケースの遺伝子を操作したテストケースを生成する。例えば、選択部121は、選択されたテストケースが持つ1つの遺伝子に対し、int型であればランダムで1を加えてもよく、1を引いてもよい。例えば、選択部121は、選択されたテストケースが持つ1つの遺伝子に対し、String型であればランダムで1文字を追加してもよく、1文字を削除してもよい。選択部121は、この動作を全ての遺伝子に対して実施することで、1つのテストケースに対し、遺伝子の数だけ新しいテストケースを生成し、新しいテストケースをテストスイートTSに追加する。   In step S304, the selection unit 121 of the SBST unit 115 receives the sorted material test suite and the test suite TS as inputs, and selects a plurality of test cases in order from the sorted material test suite. The number of test cases to be selected is a predetermined constant. The selection unit 121 generates a test case obtained by manipulating the gene of the selected test case. For example, the selection unit 121 may randomly add 1 or subtract 1 for one gene of a selected test case if it is an int type. For example, the selection unit 121 may randomly add one character or delete one character as long as it is a String type for one gene of the selected test case. The selection unit 121 performs this operation for all genes, thereby generating new test cases for each test case by the number of genes, and adding new test cases to the test suite TS.

ステップS305において、SBST部115の交叉部123は、ソートされた素材テストスイートとテストスイートTSとを入力として受け取り、素材テストスイートを目標分岐結果に対する分岐結果の特性によって3つのテストスイートに分類し、特性別交叉法によって、特性の異なるテストケースの遺伝子を配合した新しいテストケースを生成する。   In step S305, the crossover unit 123 of the SBST unit 115 receives the sorted material test suite and the test suite TS as inputs, classifies the material test suite into three test suites according to the branch result characteristics with respect to the target branch result, and A new test case in which genes of test cases with different characteristics are mixed is generated by the crossover method according to characteristics.

ステップS305について、図15を参照して更に説明する。   Step S305 will be further described with reference to FIG.

ステップS401において、交叉部123は、空のテストスイートTS1、TS2、TS3をそれぞれ作成する。空のテストスイートTS1、TS2、TS3には、テストケースの具体的な値は入っておらず、分岐結果も入っていない。   In step S401, the crossover unit 123 creates empty test suites TS1, TS2, and TS3, respectively. The empty test suites TS1, TS2, and TS3 do not contain specific values for test cases and do not contain branch results.

ステップS402において、交叉部123は、ソートされた素材テストスイート内の各分岐結果に対して、目標分岐結果の途中分岐結果が経路一致するか否かを判断する。経路一致する場合には、ステップS403に移行し、経路一致しない場合には、ステップS404に移行する。   In step S402, the crossover unit 123 determines whether or not the intermediate branch result of the target branch result matches the path for each branch result in the sorted material test suite. If the route matches, the process proceeds to step S403. If the route does not match, the process proceeds to step S404.

ステップS403において、交叉部123は、素材テストスイートとテストスイートTS1とを入力として受け取り、素材テストスイート内の分岐結果が目標分岐結果の途中分岐結果が経路一致する場合、素材テストスイート内の分岐結果及び対応するテストケースをテストスイートTS1に追加する。   In step S403, the crossover unit 123 receives the material test suite and the test suite TS1 as inputs, and when the branch result in the material test suite matches the intermediate branch result of the target branch result, the branch result in the material test suite is obtained. And the corresponding test case is added to the test suite TS1.

ステップS404において、交叉部123は、ソートされた素材テストスイート内の各分岐結果に対して、目標分岐結果の最終判定分岐が存在するか否かを判断する。最終判定分岐が存在する場合には、ステップS405に移行し、経路一致しない場合には、ステップS406に移行する。   In step S404, the crossover unit 123 determines whether or not a final determination branch of the target branch result exists for each branch result in the sorted material test suite. If there is a final determination branch, the process proceeds to step S405, and if the path does not match, the process proceeds to step S406.

ステップS405において、交叉部123は、素材テストスイートとテストスイートTS2とを入力として受け取り、素材テストスイート内の分岐結果が目標分岐結果の最終判定分岐を有する場合、素材テストスイート内の分岐結果及び対応するテストケースをテストスイートTS2に追加する。   In step S405, the crossover unit 123 receives the material test suite and the test suite TS2 as inputs, and when the branch result in the material test suite has the final determination branch of the target branch result, the branch result in the material test suite and the correspondence Add a test case to test suite TS2.

ステップS406において、交叉部123は、素材テストスイートとテストスイートTS3とを入力として受け取り、残りの分岐結果及び対応するテストケースをテストスイートTS3に追加する。   In step S406, the crossover unit 123 receives the material test suite and the test suite TS3 as inputs, and adds the remaining branch results and corresponding test cases to the test suite TS3.

ステップS407において、交叉部123は、テストスイートTS1、TS2、TS3を入力として受け取り、テストスイートTS1、TS2、TS3の各分岐結果に対し、目標分岐結果の最終判定分岐を持つ分岐結果要素の評価値でソートする。例えば、目標分岐結果の最終判定分岐がTrueである場合、評価値の値が小さいほど優秀であると判断し、目標分岐結果の最終判定分岐がFalseである場合、評価値の値が大きいほど優秀であると判断する。ただし、目標分岐結果の最終判定分岐を持たない分岐結果は、最も優秀でないと判断する。交叉部123は、優秀であると判断された分岐結果と、それに対応するテストケースを上から順番に並べてソートする。   In step S407, the crossover unit 123 receives the test suites TS1, TS2, and TS3 as inputs, and for each branch result of the test suites TS1, TS2, and TS3, the evaluation value of the branch result element having the final determination branch of the target branch result Sort by. For example, if the final decision branch of the target branch result is True, the smaller the evaluation value, the better the decision. If the final decision branch of the target branch result is False, the higher the evaluation value, the better It is judged that. However, the branch result that does not have the final decision branch of the target branch result is judged to be the least excellent. The crossover unit 123 sorts the branch results determined to be excellent and the corresponding test cases in order from the top.

ステップS408において、交叉部123は、ソートされたテストスイートTS1、TS2、TS3を入力として受け取り、テストスイートTS1とテストスイートTS3を結合した新しいテストスイートTS1'を生成し、また、テストスイートTS2とテストスイートTS3を結合した新しいテストスイートTS2'を生成する。ここで、テストスイートTS1とテストスイートTS3との結合とは、テストスイートTS1の下にテストスイートTS3をそのまま追加することを意味し、テストスイートTS2とテストスイートTS3との結合とは、テストスイートTS2の下にテストスイートTS3をそのまま追加することを意味する。   In step S408, the crossover unit 123 receives the sorted test suites TS1, TS2, and TS3 as inputs, generates a new test suite TS1 ′ that combines the test suite TS1 and the test suite TS3, and also tests the test suite TS2 and the test suite TS2. A new test suite TS2 ′ is generated by combining the suite TS3. Here, combining test suite TS1 and test suite TS3 means adding test suite TS3 directly under test suite TS1, and combining test suite TS2 and test suite TS3 is test suite TS2. This means that the test suite TS3 is added as is.

ステップS409において、特性別交叉法によって遺伝子操作する回数nを0とする。   In step S409, the number n of gene manipulations by the characteristic crossover method is set to zero.

ステップS410において、交叉部123は、テストスイートTS1'、TS2'を入力として受け取り、テストスイートTS1'、TS2'の上から順にテストケースを選択し、TS1'から選択したテストケースのテストデータの各遺伝子に対して、TS2'から選択したテストケースのテストデータの中で同じ遺伝子のidを持つ遺伝子を探し、その遺伝子のvalueを代入する。例えば、テストスイートTS1'から選択したテストケースの1つの遺伝子が[id=1,value=0]であるとすると、id=1を持つ遺伝子をテストスイートTS2'のテストケースから探し、[id=1,value=10]という遺伝子が見つかった場合、[id=1,value=10]という遺伝子を作成する。その結果、特性別交叉法によって遺伝子操作されたテストケースが生成される。   In step S410, the crossover unit 123 receives the test suites TS1 ′ and TS2 ′ as inputs, selects test cases in order from the top of the test suites TS1 ′ and TS2 ′, and each test data of the test case selected from TS1 ′. For a gene, search for the gene having the same gene id in the test data of the test case selected from TS2 ', and substitute the value of that gene. For example, if one gene of a test case selected from the test suite TS1 ′ is [id = 1, value = 0], a gene having id = 1 is searched from the test case of the test suite TS2 ′, and [id = When a gene of 1, value = 10] is found, a gene of [id = 1, value = 10] is created. As a result, a test case genetically manipulated by the characteristic crossover method is generated.

ステップS411において、交叉部123は、遺伝子操作されたテストケースとテストスイートTSとを入力として受け取り、遺伝子操作されたテストケースをテストスイートTSに追加する。   In step S411, the crossover unit 123 receives the genetically manipulated test case and the test suite TS as inputs, and adds the genetically manipulated test case to the test suite TS.

ステップS412においてnに1を加算し、ステップ413においてnが事前に決定した値に達するまで上記の処理を繰り返す。ステップS413においてnが事前に決定した値に達した場合には、図14のステップS306に戻る。   In step S412, 1 is added to n, and the above process is repeated until n reaches a predetermined value in step 413. If n reaches a value determined in advance in step S413, the process returns to step S306 in FIG.

次に、図14のステップS306において、SBST部115の突然変異部125は、ソートされた素材テストスイートとテストスイートTSとを入力として受け取り、ソートされた素材テストスイートの上から順番に複数のテストケースを選択する。選択されるテストケースの個数は、予め決められた定数とする。突然変異部125は、選択されたテストケースの遺伝子を突然変異した新しいテストケースを生成する。例えば、突然変異部125は、選択されたテストケースが持つそれぞれの遺伝子に対し、一定の確率で新しい値を与えた新しいテストケースを生成する。突然変異部125は、突然変異によって複数の新しいテストケースを生成し、新しいテストケースをテストスイートTSに追加する。   Next, in step S306 of FIG. 14, the mutation unit 125 of the SBST unit 115 receives the sorted material test suite and the test suite TS as inputs, and performs a plurality of tests in order from the sorted material test suite. Select a case. The number of test cases to be selected is a predetermined constant. The mutation unit 125 generates a new test case in which the gene of the selected test case is mutated. For example, the mutation unit 125 generates a new test case in which a new value is given with a certain probability for each gene of the selected test case. The mutation unit 125 generates a plurality of new test cases by mutation and adds new test cases to the test suite TS.

ステップS306について、図16を参照して更に説明する。   Step S306 will be further described with reference to FIG.

ステップS601において、突然変異部125は、ソートされた素材テストスイートを入力として受け取り、ソートされた素材テストスイートの上から順番に複数のテストケースを抽出する。   In step S601, the mutation unit 125 receives the sorted material test suite as an input, and extracts a plurality of test cases in order from the sorted material test suite.

ステップS602において、突然変異部125は、抽出したテストケースを入力として受け取り、テストケースの各テストデータの各遺伝子に対して、遺伝子のvalueの値を一定確率でランダムな値に変更する。例えば、突然変異部125は、遺伝子のvalue="aaa"を一定確率でvalue="hoge"に変更する。変更する値はどのような値でもよい。また、残りの確率で遺伝子の変更を行わない。確率は予め決められた定数とする。   In step S602, the mutation unit 125 receives the extracted test case as an input, and changes the value value of the gene to a random value with a certain probability for each gene of each test data of the test case. For example, the mutation unit 125 changes the value = "aaa" of the gene to value = "hoge" with a certain probability. The value to be changed may be any value. In addition, the gene is not changed with the remaining probability. The probability is a predetermined constant.

ステップS603において、突然変異部125は、遺伝子操作されたテストケースとテストスイートTSを入力として受け取り、遺伝子操作されたテストケースをテストスイートTSに追加する。遺伝子操作されたテストケースがテストスイートTSに追加された場合、図14のステップS307に戻る。   In step S603, the mutation unit 125 receives the genetically manipulated test case and the test suite TS as inputs, and adds the genetically manipulated test case to the test suite TS. When the genetically manipulated test case is added to the test suite TS, the process returns to step S307 in FIG.

次に、テストスイートTSの各テストケースに対し、以下のように出力テストスイートを生成する。   Next, an output test suite is generated for each test case of the test suite TS as follows.

図14のステップS307において、SBST部115は、テストスイートTS内のテストケースを入力として受け取り、テスト対象のプログラムにテストスイートTS内のテストケースを実行させる。コード挿入部111が分岐結果を出力するコードを挿入しているため、テストケースに対し、対応する分岐結果が取得できる。   In step S307 of FIG. 14, the SBST unit 115 receives the test case in the test suite TS as an input, and causes the test target program to execute the test case in the test suite TS. Since the code insertion unit 111 has inserted the code for outputting the branch result, the corresponding branch result can be acquired for the test case.

ステップS309において、SBST部115は、テストスイートTS内のテストケースと、対応する分岐結果と、素材テストスイートを入力として受け取り、テストケースと、対応する分岐結果を素材テストスイートに追加する。   In step S309, the SBST unit 115 receives the test case in the test suite TS, the corresponding branch result, and the material test suite as inputs, and adds the test case and the corresponding branch result to the material test suite.

ステップS310において、SBST部115は、テストスイートTS内のテストケースと、対応する分岐結果と、出力テストスイートを入力として受け取り、SBST部115がテストケースを実行して得られた分岐結果と経路一致する分岐結果が出力テストスイートに存在するか否かを判断する。存在しない場合、ステップS311に移行し、存在する場合、ステップS307に戻り、次のテストケースに対する処理を実施し、全てのテストケースに対する処理が終了した場合、ステップS313に移行する。   In step S310, the SBST unit 115 receives the test case in the test suite TS, the corresponding branch result, and the output test suite as input, and the path match with the branch result obtained by the SBST unit 115 executing the test case. It is determined whether or not a branch result to be present exists in the output test suite. If it does not exist, the process proceeds to step S311. If it exists, the process returns to step S307, the process for the next test case is performed, and if the process for all test cases is completed, the process proceeds to step S313.

ステップS311において、SBST部115は、テストスイートTS内のテストケースと、対応する分岐結果と、出力テストスイートを入力として受け取り、テストケースと、対応する分岐結果を出力テストスイートに追加する。   In step S311, the SBST unit 115 receives the test case in the test suite TS, the corresponding branch result, and the output test suite as inputs, and adds the test case and the corresponding branch result to the output test suite.

ステップS312において、SBST部115は、SBST部115がテストケースを実行して得られた分岐結果が目標分岐結果と経路一致しているか否かを判断する。経路一致していない場合、ステップS313に移行し、経路一致している場合、図13のステップS206に戻る。   In step S312, the SBST unit 115 determines whether or not the branch result obtained by the SBST unit 115 executing the test case matches the path of the target branch result. If the routes do not match, the process proceeds to step S313. If the routes match, the process returns to step S206 in FIG.

ステップS313においてg=g+1として、ステップS314においてgが最大世代数GになるまでステップS302に戻り、上記の処理を繰り返す。gが最大世代数になった場合、図13のステップS206に戻る。   In step S313, g = g + 1 is set, and in step S314, the process returns to step S302 until g reaches the maximum generation number G, and the above processing is repeated. When g reaches the maximum number of generations, the process returns to step S206 in FIG.

次に、図13のステップS206においてn=n-1として、ステップS207においてnが0になるまでステップS202に戻り、上記の処理を繰り返す。nが0になった場合、ステップS201に戻り、次の分岐結果に対する処理を実施し、全ての分岐結果に対する処理が終了した場合、図7のステップS009に戻る。   Next, n = n-1 is set in step S206 in FIG. 13, and the process returns to step S202 until n becomes 0 in step S207, and the above processing is repeated. When n becomes 0, the process returns to step S201, the process for the next branch result is performed, and when the process for all the branch results is completed, the process returns to step S009 of FIG.

次に、図7のステップS009において、テストデータ生成部105は、出力テストスイートの中の全てのテストケースをファイル等に出力する。   Next, in step S009 of FIG. 7, the test data generation unit 105 outputs all the test cases in the output test suite to a file or the like.

以上の手順により、テストケース生成装置100は、テストシナリオ及びテストデータの組み合わせであるテストケースを出力することができる。
<本発明の実施例の効果>
本発明の実施例によれば、あるテストシナリオが与えられたときに、条件網羅率の高いテストデータの集合を効率的に生成することが可能になる。
With the above procedure, the test case generation device 100 can output a test case that is a combination of a test scenario and test data.
<Effect of the embodiment of the present invention>
According to the embodiment of the present invention, it is possible to efficiently generate a set of test data having a high condition coverage when a certain test scenario is given.

特に、特性の異なるテストデータを組み合わせることで、分岐の組み合わせを考慮した条件網羅率の高いテストデータが生成可能になる。その結果、分岐の組み合わせに起因するバグの検出能力が向上する。   In particular, by combining test data having different characteristics, it is possible to generate test data having a high condition coverage rate considering the combination of branches. As a result, the ability to detect bugs resulting from the combination of branches is improved.

また、Concolic Testing及びSBSTの性質の異なる2つの手法を組み合わせることで、よりカバレッジの高いテストデータが生成できる。ただし、2つの手法を順番に実行すると、テストデータの生成にかなりの時間を要するため、Concolic Testingを実行している間にSBSTで必要な情報を予め取得することで、SBSTにおけるテストデータの効率的な探索を可能としている。その結果、プログラムの構造的欠陥によるバグの検出能力が向上する。   In addition, test data with higher coverage can be generated by combining two methods having different properties of Concolic Testing and SBST. However, if the two methods are executed in sequence, it takes a considerable amount of time to generate the test data. Therefore, by acquiring the necessary information in advance while executing Concolic Testing, the efficiency of the test data in SBST can be obtained. Search is possible. As a result, the ability to detect bugs due to structural defects in the program is improved.

また、テストシナリオをViewの遷移図から生成することにより、Webアプリケーションにおける画面遷移に対する網羅性の高いテストケースが自動生成できる。WebアプリケーションにおけるViewは画面に非常に近い粒度を持つため、Viewの遷移図に対して状態遷移図に対する所定のカバレッジ基準を用いてテストシナリオを抽出することで、画面遷移の粒度に近く、また、画面遷移に対する網羅性の高いテストシナリオを自動生成できる。   In addition, by generating test scenarios from View transition diagrams, it is possible to automatically generate test cases with high completeness for screen transitions in Web applications. Since the view in the Web application has a granularity very close to the screen, by extracting the test scenario using the predetermined coverage criteria for the state transition diagram for the view transition diagram, it is close to the granularity of the screen transition, Test scenarios with high completeness for screen transitions can be automatically generated.

更に、Concolic TestingやSBSTによってテストデータを生成するときに、フレームワークやライブラリ等のユーザが記述していない箇所に対して分岐を解析しないことで、計算爆発を回避することができ、従って、結合テストレベルのテストケースも生成できる。フレームワークやライブラリ等のユーザが記述していない箇所に対してカバレッジを向上させるようなテストケースを生成せず、その代わりに、解析対象のユーザ記述クラスに対するカバレッジの高いテストケース生成に計算リソースを割り当てることができる。   Furthermore, when generating test data using Concolic Testing or SBST, it is possible to avoid computational explosions by not analyzing branches at locations not specified by the user, such as frameworks and libraries. Test level test cases can also be generated. Instead of generating test cases that improve coverage for places that the user does not describe, such as frameworks and libraries, instead of using computational resources to generate test cases with high coverage for the user-written classes to be analyzed Can be assigned.

説明の便宜上、本発明の実施例に係るテストケース生成装置は機能的なブロック図を用いて説明しているが、本発明の実施例に係るテストケース生成装置は、ハードウェア、ソフトウェア又はそれらの組み合わせで実現されてもよい。例えば、本発明の実施例は、コンピュータに対して本発明の実施例に係るテストケース生成装置の各機能を実現させるプログラム、コンピュータに対して本発明の実施例に係るテストケース生成方法の各手順を実行させるプログラム等により、実現されてもよい。また、各機能部が必要に応じて組み合わせて使用されてもよい。また、本発明の実施例に係るテストケース生成方法は、実施例に示す順序と異なる順序で実施されてもよい。   For convenience of explanation, the test case generation device according to the embodiment of the present invention is described using a functional block diagram. However, the test case generation device according to the embodiment of the present invention may be hardware, software, or their It may be realized in combination. For example, the embodiment of the present invention is a program for causing a computer to realize each function of the test case generation apparatus according to the embodiment of the present invention, and each procedure of the test case generation method according to the embodiment of the present invention for the computer. It may be realized by a program that executes In addition, the functional units may be used in combination as necessary. Further, the test case generation method according to the embodiment of the present invention may be performed in an order different from the order shown in the embodiment.

以上、あるテストシナリオが与えられたときに、条件網羅率の高いテストデータの集合を効率的に生成するための手法について説明したが、本発明は、上記の実施例に限定されることなく、特許請求の範囲内において、種々の変更・応用が可能である。   As described above, the method for efficiently generating a set of test data having a high condition coverage when a certain test scenario is given has been described, but the present invention is not limited to the above embodiment, Various modifications and applications are possible within the scope of the claims.

100 テストケース生成装置
101 VCシナリオ生成部
103 テストシナリオ生成部
105 テストデータ生成部
111 コード挿入部
113 Concolic Testing部
115 SBST部
121 選択部
123 交叉部
125 突然変異部
DESCRIPTION OF SYMBOLS 100 Test case production | generation apparatus 101 VC scenario production | generation part 103 Test scenario production | generation part 105 Test data production | generation part 111 Code insertion part 113 Concolic Testing part 115 SBST part 121 Selection part 123 Crossover part 125 Mutation part

Claims (5)

指定のテストシナリオに対するテストデータを生成するテストデータ生成プログラムであって、コンピュータに、
テスト対象のプログラムに、分岐の判定を定量的に評価するための評価値を含む分岐結果を出力するコードを挿入するコード挿入機能と、
指定のテストシナリオに対するテストデータを生成すると共に、前記挿入されたコードが出力した分岐結果を生成する第1テストデータ生成機能と、
前記生成された分岐結果に対して途中まで経路一致する目標分岐結果を生成し、当該目標分岐結果に対して最終判定分岐を除き経路一致する第1のテストデータと、当該最終判定分岐の分岐結果を有する第2のテストデータとを遺伝的アルゴリズムにおいて用いて、当該目標分岐結果を満たすテストデータを生成する第2テストデータ生成機能と、
を実現させるためのテストデータ生成プログラム。
A test data generation program that generates test data for a specified test scenario.
A code insertion function for inserting a code that outputs a branch result including an evaluation value for quantitatively evaluating the determination of branching into a test target program;
A first test data generation function for generating test data for a specified test scenario and generating a branch result output by the inserted code;
A target branch result whose path is partially matched with the generated branch result is generated, the first test data whose path is matched with respect to the target branch result except for the final determination branch, and the branch result of the final determination branch A second test data generating function for generating test data satisfying the target branch result using the second test data having
Test data generation program for realizing
前記第1テストデータ生成機能は、指定のテストシナリオに対してテストデータを生成する過程において、指定のテストシナリオと当該テストデータと分岐結果とを素材テストスイートに追加し、指定のテストシナリオに対して生成されたテストデータによってカバレッジが向上する場合、指定のテストシナリオと当該テストデータと分岐結果とを出力テストスイートに追加し、
前記第2テストデータ生成機能は、前記出力テストスイートの分岐結果に対して途中まで経路一致する目標分岐結果を生成し、当該目標分岐結果と経路一致するテストデータが前記出力テストスイートに存在しない場合、前記素材テストスイートを用いて当該目標分岐結果を満たすテストデータを生成し、前記出力テストスイートに追加する、請求項1に記載のテストデータ生成プログラム。
In the process of generating test data for a specified test scenario, the first test data generation function adds the specified test scenario, the test data, and the branch result to the material test suite, and adds the specified test scenario to the specified test scenario. If the test data generated by the test results in improved coverage, add the specified test scenario, the test data, and the branch result to the output test suite.
The second test data generation function generates a target branch result that partially matches the branch result of the output test suite, and the test data that matches the target branch result does not exist in the output test suite The test data generation program according to claim 1, wherein test data that satisfies the target branch result is generated using the material test suite and added to the output test suite.
前記第2テストデータ生成機能は、前記素材テストスイートの分岐結果を、前記目標分岐結果の最終判定分岐を持つ分岐結果要素の評価値でソートし、当該ソートされた素材テストスイートの中から順に、前記目標分岐結果に対して最終判定分岐を除き経路一致する第1のテストケースと、当該最終判定分岐の分岐結果を有する第2のテストケースと、残りの第3のテストケースとを選択し、前記第1のテストケース及び前記第3のテストケースの組み合わせと、前記第2のテストケース及び前記第3のテストケースの組み合わせとを交叉させることにより、前記目標分岐結果を満たすテストデータを生成する、請求項2に記載のテストデータ生成プログラム。   The second test data generation function sorts the branch results of the material test suite by the evaluation values of the branch result elements having the final determination branch of the target branch result, and sequentially from the sorted material test suite, Selecting a first test case whose path matches with the target branch result except a final decision branch, a second test case having a branch result of the final decision branch, and a remaining third test case; Test data satisfying the target branch result is generated by crossing the combination of the first test case and the third test case with the combination of the second test case and the third test case. The test data generation program according to claim 2. テスト対象のプログラムが少なくともView及びControllerで構成される場合、
コンピュータに、
Controllerの情報を用いてViewの遷移図を生成し、当該Viewの遷移図から状態遷移図に対する所定のカバレッジ基準に基づいてView及びControllerの繋がりを表すVCシナリオを生成するVCシナリオ生成機能と、
前記生成されたVCシナリオにView操作情報を追加したテストシナリオを生成するテストシナリオ生成機能と、
を更に実現させ、
前記指定のテストシナリオは、前記テストシナリオ生成機能により生成されたテストシナリオから選択される、請求項1乃至3のうちいずれか1項に記載のテストデータ生成プログラム。
If the program to be tested consists of at least View and Controller,
On the computer,
A VC scenario generation function that generates a transition diagram of a view using controller information, and generates a VC scenario that represents a connection between the view and the controller based on a predetermined coverage standard for the state transition diagram from the transition diagram of the view,
A test scenario generation function for generating a test scenario in which View operation information is added to the generated VC scenario;
Further realized,
The test data generation program according to any one of claims 1 to 3, wherein the designated test scenario is selected from test scenarios generated by the test scenario generation function.
指定のテストシナリオに対するテストデータを生成するテストデータ生成装置におけるテストデータ生成方法であって、
前記テストデータ生成装置が、テスト対象のプログラムに、分岐の判定を定量的に評価するための評価値を含む分岐結果を出力するコードを挿入するステップと、
前記テストデータ生成装置が、指定のテストシナリオに対するテストデータを生成すると共に、前記挿入されたコードが出力した分岐結果を生成するステップと、
前記テストデータ生成装置が、前記生成された分岐結果に対して途中まで経路一致する目標分岐結果を生成し、当該目標分岐結果に対して最終判定分岐を除き経路一致する第1のテストデータと、当該最終判定分岐の分岐結果を有する第2のテストデータとを遺伝的アルゴリズムにおいて用いて、当該目標分岐結果を満たすテストデータを生成するステップと、
を有するテストデータ生成方法。
A test data generation method in a test data generation device for generating test data for a specified test scenario,
The test data generation device inserts a code that outputs a branch result including an evaluation value for quantitatively evaluating branch determination into a test target program; and
The test data generation device generates test data for a specified test scenario, and generates a branch result output by the inserted code;
The test data generation device generates a target branch result that matches the route to the generated branch result halfway, and first test data that matches the path of the target branch result except for a final decision branch; Using the second test data having a branch result of the final decision branch in a genetic algorithm to generate test data that satisfies the target branch result;
A test data generation method comprising:
JP2016085942A 2016-04-22 2016-04-22 Test data generation program and test data generation method Active JP6572168B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2016085942A JP6572168B2 (en) 2016-04-22 2016-04-22 Test data generation program and test data generation method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2016085942A JP6572168B2 (en) 2016-04-22 2016-04-22 Test data generation program and test data generation method

Publications (2)

Publication Number Publication Date
JP2017194894A true JP2017194894A (en) 2017-10-26
JP6572168B2 JP6572168B2 (en) 2019-09-04

Family

ID=60155680

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2016085942A Active JP6572168B2 (en) 2016-04-22 2016-04-22 Test data generation program and test data generation method

Country Status (1)

Country Link
JP (1) JP6572168B2 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112699052A (en) * 2020-08-03 2021-04-23 徐州工程学院 Software test case evolution generation method based on relevant input variables

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH07219754A (en) * 1994-01-31 1995-08-18 Toshiba Corp Request definition support device using screen transition diagram
JP2007109033A (en) * 2005-10-14 2007-04-26 Hitachi Software Eng Co Ltd Screen transition management device and screen transition management program

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH07219754A (en) * 1994-01-31 1995-08-18 Toshiba Corp Request definition support device using screen transition diagram
JP2007109033A (en) * 2005-10-14 2007-04-26 Hitachi Software Eng Co Ltd Screen transition management device and screen transition management program

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
TOKUMOTO, S ET AL: ""Enhancing Symbolic Execution to Test the Compatibility of Re-engineered Industrial Software"", PROCEEDINGS OF THE 19TH ASIA-PACIFIC SOFTWARE ENGINEERING CONFERENCE (APSEC), JPN6019016455, 2012, pages 314 - 317, XP032332321, ISSN: 0004030829, DOI: 10.1109/APSEC.2012.102 *
XU, Z ET AL: ""A Hybrid Directed Test Suite Augmentation Technique"", 2011 IEEE 22ND INTERNATIONAL SYMPOSIUM ON SOFTWARE RELIABILITY ENGINEERING, JPN6019016450, 2011, pages 150 - 159, XP032098983, ISSN: 0004030827, DOI: 10.1109/ISSRE.2011.21 *
張暁晶 ほか: "設計モデルを用いたテスト項目抽出とテストデータ生成手法", 電子情報通信学会技術研究報告, vol. 第109巻,第41号, JPN6019016452, 14 May 2009 (2009-05-14), JP, pages 37 - 42, ISSN: 0004030828 *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112699052A (en) * 2020-08-03 2021-04-23 徐州工程学院 Software test case evolution generation method based on relevant input variables

Also Published As

Publication number Publication date
JP6572168B2 (en) 2019-09-04

Similar Documents

Publication Publication Date Title
JP6533484B2 (en) Test data generation program and test data generation method
Hildebrandt et al. On using surrogates with genetic programming
Walsh Search in a small world
Malik et al. Logic verification using binary decision diagrams in a logic synthesis environment
Marappan et al. Solution to graph coloring using genetic and tabu search procedures
CN109948641A (en) Anomaly groups recognition methods and device
Hierons et al. Many-objective test suite generation for software product lines
JP4418591B2 (en) Method and apparatus for comparing a preset characteristic of a technical system with a first characteristic
Zhang et al. Analysis of security of split manufacturing using machine learning
JP4334061B2 (en) A variable order determination method for sampling-based ordered binary decision graphs
US11204860B2 (en) Methods and apparatuses for generating smart contract test case
CN110458875B (en) Abnormal point pair detection method, image splicing method, corresponding device and equipment
JP2017194892A (en) Test case production program and test case production method
JP6572168B2 (en) Test data generation program and test data generation method
US8266573B2 (en) Method and system for test point insertion
Parada et al. Evolution of new algorithms for the binary knapsack problem
JP6572167B2 (en) Test data generation program and test data generation method
Gajewski et al. Detecting hidden layers from spreading dynamics on complex networks
Censor-Hillel Distributed subgraph finding: progress and challenges
Lamalem et al. Enumeration of the minimal node cutsets based on necessary minimal paths
EP3109773A1 (en) Relatedness graph evaluation system
CN106294127B (en) Object-oriented software test case generation method based on cluster
Ukrop Usage of evolvable circuit for statistical testing of randomness
Ukrop Randomness analysis in authenticated encryption systems
Ceylan et al. GraphDCA--a Framework for Node Distribution Comparison in Real and Synthetic Graphs

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20180213

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20190514

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20190704

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

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20190809

R150 Certificate of patent or registration of utility model

Ref document number: 6572168

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150