JPH05210537A - Test item preparing device - Google Patents
Test item preparing deviceInfo
- Publication number
- JPH05210537A JPH05210537A JP4038430A JP3843092A JPH05210537A JP H05210537 A JPH05210537 A JP H05210537A JP 4038430 A JP4038430 A JP 4038430A JP 3843092 A JP3843092 A JP 3843092A JP H05210537 A JPH05210537 A JP H05210537A
- Authority
- JP
- Japan
- Prior art keywords
- test item
- condition
- test
- branch
- source code
- 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.)
- Pending
Links
- 238000000605 extraction Methods 0.000 claims abstract description 25
- 230000014509 gene expression Effects 0.000 claims abstract description 14
- 239000000284 extract Substances 0.000 claims abstract description 7
- 238000000034 method Methods 0.000 claims description 98
- 230000006870 function Effects 0.000 description 9
- 238000000354 decomposition reaction Methods 0.000 description 8
- 238000010586 diagram Methods 0.000 description 8
- 230000007704 transition Effects 0.000 description 5
- 230000006866 deterioration Effects 0.000 description 1
Landscapes
- Debugging And Monitoring (AREA)
- Stored Programmes (AREA)
Abstract
Description
【0001】[0001]
【産業上の利用分野】本発明は、ソフトウェア開発のテ
スト工程で、ソフトウェアの機能を確認するためのテス
ト項目を作成するシステムに関する。BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a system for creating test items for confirming software functions in a software development test process.
【0002】[0002]
【従来の技術】ソフトウェア開発のテスト工程では、ソ
フトウェアの機能を確認するためのテスト項目を作成
し、そのテスト項目に従ってテストを行うのが一般的で
ある。従来、このテスト項目はソースコードを目で追い
ながら全分岐を通過するように人手で作成するか、ある
いはテスト項目の抜けやミスを視覚的に発見しやすいよ
うにグラフ化、図形化する技法を用いたツールによって
作成していた。2. Description of the Related Art In a software development test process, it is common to create a test item for confirming the function of software and perform a test according to the test item. Conventionally, this test item is manually created so that it passes through all branches while following the source code with eyes, or a technique of graphing and graphicalizing it so that missing or mistakes in the test item can be easily found visually. It was created by the tool used.
【0003】[0003]
【発明が解決しようとする課題】しかし、上記のような
作成方法で作成されるテスト項目は個々の作成者のスキ
ルに依存するため、作成者によってはテスト項目の抜け
やミスが発生が見られ、そのテスト項目の抜けやミスが
ソフトウェアの品質低下の原因になるという問題点があ
った。However, since the test items created by the above-described creating method depend on the skill of each creator, some creators may see missing or missing test items. However, there was a problem that omissions or mistakes in the test items could cause deterioration of software quality.
【0004】本発明は上述の問題点に鑑みて、作成者の
スキルに依存しない、ソースコードの全パスを通過する
テスト項目を自動的に作成するテスト項目作成装置を提
供することを目的とするものである。In view of the above problems, it is an object of the present invention to provide a test item creation device that automatically creates test items that pass all paths of a source code without depending on the skill of the creator. It is a thing.
【0005】[0005]
【課題を解決するための手段】本発明のテスト項目作成
装置は、ソースコードを入力するソースコード入力部
と、ソースコードの分岐行を検索する分岐検索部と、上
記分岐行から分岐条件を抽出する分岐条件抽出部と、上
記分岐条件の正否両条件をプログラム入力変数のみで表
した式に表現し、更にその式からテスト項目を抽出する
テスト項目抽出部と、上記テスト項目をテスト項目記憶
部に登録するテスト項目登録部と、上記テスト項目を記
憶するテスト項目記憶部と、上記各部を分岐行ごとに順
次実行する制御部と、上記テスト項目記憶部に記憶され
たテスト項目を出力するテスト項目出力部とを有する。A test item creating apparatus of the present invention includes a source code input section for inputting a source code, a branch search section for searching a branch line of the source code, and a branch condition extraction from the branch line. Branch condition extraction unit, a test item extraction unit that expresses both right and wrong conditions of the branch condition in an expression that is expressed only by program input variables, and further extracts a test item from the expression, and a test item storage unit that stores the test item A test item registration unit to be registered in the test item, a test item storage unit that stores the test item, a control unit that sequentially executes each unit for each branch line, and a test that outputs the test item stored in the test item storage unit. And an item output section.
【0006】[0006]
【作用】上記の構成によれば、ソースコード入力部から
入力したソースコードの分岐行を分岐検索部で検索し
て、分岐条件抽出部において抽出した分岐条件の正否両
条件から、テキスト項目抽出部はプログラムの外側から
値を決定できるプログラム入力変数のみで表わす式に分
解することでテスト項目を抽出して、テスト項目登録部
によりテスト項目記憶部に登録し、テスト項目出力部よ
りテスト項目として出力するので、入力変数のみで表わ
すテスト項目としてソースコードの全パスを通過するテ
スト項目の作成が可能となる。According to the above configuration, the branch line of the source code input from the source code input unit is searched by the branch search unit, and the text item extraction unit determines whether the branch condition extracted by the branch condition extraction unit is correct or not. Extracts test items by decomposing into an expression expressed only by program input variables whose values can be determined from outside the program, registers them in the test item storage section with the test item registration section, and outputs them as test items from the test item output section. Therefore, it is possible to create a test item that passes through all the paths of the source code as a test item that is represented only by the input variables.
【0007】[0007]
【実施例】次に、本発明について図面を参照して説明す
る。DESCRIPTION OF THE PREFERRED EMBODIMENTS Next, the present invention will be described with reference to the drawings.
【0008】図1は本発明の一実施例によるテスト項目
作成装置の構成図を示す。図中、1はソースコード格納
ファイル、2はソースコードを入力するソースコード入
力部、3はソースコードの分岐行を検索する分岐検索
部、4は分岐行から分岐条件を抽出する分岐条件抽出
部、5は上記分岐条件の正否両条件をプログラム入力変
数のみで表した式に表現し、更にその式からテスト項目
を抽出するテスト項目抽出部、6は上記テスト項目をテ
スト項目記憶部7に登録するテスト項目登録部、7はテ
スト項目を記憶するテスト項目記憶部、8は分岐検索部
3と分岐条件抽出部4とテスト項目抽出部5とテスト項
目登録部6とテスト項目記憶部7を分岐行ごとに順次実
行する制御部、9は上記テスト項目記憶部7に記憶され
たテスト項目を出力するテスト項目出力部、10はテス
ト項目を表す。FIG. 1 is a block diagram of a test item creating apparatus according to an embodiment of the present invention. In the figure, 1 is a source code storage file, 2 is a source code input unit for inputting a source code, 3 is a branch search unit for searching a branch line of the source code, and 4 is a branch condition extraction unit for extracting a branch condition from the branch line. Reference numeral 5 is a test item extraction unit that expresses both right and wrong conditions of the branch condition in an expression expressed only by program input variables, and further extracts a test item from the expression, and 6 registers the test item in the test item storage unit 7. A test item registering unit, 7 a test item storing unit for storing test items, 8 a branch searching unit 3, a branch condition extracting unit 4, a test item extracting unit 5, a test item registering unit 6, and a test item storing unit 7. A control unit that sequentially executes each row, a test item output unit 9 that outputs the test items stored in the test item storage unit 7, and a test item 10 that represents the test items.
【0009】なお、本実施例では、ソースコードとして
図6に示すC言語のソースコード49をもとに説明す
る。In this embodiment, the source code 49 will be described based on the C language source code 49 shown in FIG.
【0010】ソースコード格納ファイル1は、ソースコ
ード49を格納したファイルである。The source code storage file 1 is a file in which the source code 49 is stored.
【0011】ソースコード入力部2は、ソースコード格
納ファイル1からソースコード49を入力し、制御部8
に渡す。The source code input unit 2 inputs the source code 49 from the source code storage file 1, and the control unit 8
Pass to.
【0012】分岐検索部3は、制御部8からソースコー
ド49を受け取りそのソースコードの最終行から降順に
if文を検索し、検出したif文の行番号を順次制御部
8に渡す。The branch retrieval unit 3 receives the source code 49 from the control unit 8, retrieves the if statements in descending order from the last line of the source code, and sequentially passes the line numbers of the detected if sentences to the control unit 8.
【0013】分岐条件抽出部4は、制御部8からソース
コード49と上記if文行番号を受け取りそのif文か
ら分岐条件を抽出し、抽出した分岐条件を制御部8に渡
す。テスト項目抽出部5は、以下の機能を有する。制御
部8から、ソースコード49とif文行番号とその分岐
条件を受け取る。受け取った分岐条件の逆条件を求め
る。分岐条件とその逆条件に使われている変数に対して
値(変数)を代入している代入文を、ソースコード49
のif文の1行前の行から降順に検索する。見付けた代
入文の右辺の値(変数)を分岐条件あるいはその逆条件
の変数と置き換える。以上のif文の降順検索と代入文
の変数の置換作業をソースコード49の先頭行まで繰り
返し行うことにより、分岐条件とその逆条件を関数の引
き数(a,b,c)で表したテスト項目に変換する。上
記テスト項目を制御部8に渡す。The branch condition extraction unit 4 receives the source code 49 and the above-mentioned if statement line number from the control unit 8, extracts the branch condition from the if sentence, and passes the extracted branch condition to the control unit 8. The test item extraction unit 5 has the following functions. From the control unit 8, the source code 49, the if statement line number and the branch condition thereof are received. Find the reverse condition of the received branch condition. The source code 49 is an assignment statement that assigns a value (variable) to a variable used in a branch condition and its inverse condition.
The if statement is searched in descending order from the line immediately preceding the if sentence. Replace the value (variable) on the right side of the found assignment statement with the variable for the branch condition or its inverse condition. A test in which the branch condition and its inverse condition are represented by the arguments (a, b, c) of the function by repeatedly performing the descending order search of the if statement and the variable replacement work of the assignment statement up to the first line of the source code 49. Convert to item. The test items are passed to the control unit 8.
【0014】テスト項目登録部6は、制御部8から上記
テスト項目を受け取りテスト項目記憶部7にないテスト
項目のみテスト項目記憶部7に登録する。The test item registration unit 6 receives the test items from the control unit 8 and registers only the test items that are not in the test item storage unit 7 in the test item storage unit 7.
【0015】テスト項目記憶部7は、テスト項目登録部
6によってテスト項目を記憶し保持する。The test item storage unit 7 stores and holds the test items by the test item registration unit 6.
【0016】制御部8は、以下の機能を有する。ソース
コード入力部2からソースコード49を受け取る。分岐
検索部3に上記ソースコード49を渡し、if文行番号
を順次受け取る。分岐条件抽出部4にソースコード49
と上記if文行番号を渡し、その分岐条件を受け取る。
テスト項目抽出部5にソースコード49とif文行番号
と上記分岐条件を渡し、テスト項目を受け取る。テスト
項目登録部6に上記テスト項目を渡す。全てのif文に
対してテスト項目を登録した後、テスト項目記憶部7か
ら全テスト項目を取り込む。全テスト項目をテスト項目
出力部9に渡す。The control unit 8 has the following functions. The source code 49 is received from the source code input unit 2. The source code 49 is passed to the branch search unit 3, and if sentence line numbers are sequentially received. Source code 49 in the branch condition extraction unit 4
And the above if statement line number are passed, and the branch condition is received.
The source code 49, the if statement line number, and the branching condition are passed to the test item extracting unit 5, and the test item is received. The test items are passed to the test item registration unit 6. After registering test items for all if statements, all test items are fetched from the test item storage unit 7. All test items are passed to the test item output unit 9.
【0017】こうして最後に、テスト項目出力部9は、
全テスト項目を出力する。次に、本実施例の動作を制御
部8の動作を中心に説明する。全体の処理について、図
2の全体処理のフローチャートに添って説明する。ま
ず、処理11ではテスト項目記憶部7内のテスト項目テ
ーブル(図9のテスト項目テーブルの遷移図に示す;5
9)の初期化を行う。次に処理12ではソースコード入
力部2がソースコード格納ファイル1からソースコード
49を入力する。次に処理13ではソースコード49の
行数(18)をカウントしカレント処理行の行番号を示
す変数1にセットする。以降処理14から処理19まで
をソースコード49の全ての行に対して行う。ここで、
ソースコードの最終行から降順に処理を行うのは、後で
説明する処理18のテスト項目重複チェックではじかれ
るテスト項目の数を減らし、処理の高速化を図るためで
ある。次に処理14では1が0より大きい(未処理の行
がある)時に処理15以降の処理でテスト項目を生成
し、1が0以下の(全ての行を処理した)時に処理20
でテスト項目を出力し処理を終了する。処理15では分
岐検索部3によって、1行がif文である時に処理16
から処理18によってテスト項目の追加を行い、1行が
if文でない時に処置19を行い次の行の処理に移る。
処理16では条件抽出部4によってif文の分岐条件を
取り出す。処理17ではテスト項目抽出部5によって上
記の分岐条件の正否両条件を関数の引き数で表された式
に変換し、それをテスト項目とする。処理18ではテス
ト項目登録部6によってテスト項目の重複チェックを行
い上記のテスト項目の内テスト項目テーブル59にない
もののみをテスト項目記憶部7内のテスト項目テーブル
59に登録する。処理19では次の行の処理に移るため
にlから1を引き処理14に戻る。処理20ではテスト
項目出力部9によってテスト項目テーブル59に格納さ
れた60に示すような全てのテスト項目を出力し、テス
ト項目10を作成する。ソースコード49の場合、最初
に処理するif文は13行目であり、処理16で取り出
される13行目の分岐条件は(m<c:以降条件Aと呼
ぶ)である。 〔テスト項目抽出処理〕 次に、上記の条件A(m<
c)のテスト項目抽出処理について図3のテスト項目抽
出処理のフローチャートを用いて説明する。このテスト
項目抽出処理では、条件Aの正否両条件(m<c,m≧
c)から、そのif文内部の実行文を実行する場合と、
実行しない場合の全ての場合を抽出し図7の条件テーブ
ル遷移図に示す条件テーブル50に登録する。Thus, finally, the test item output unit 9
Output all test items. Next, the operation of this embodiment will be described focusing on the operation of the control unit 8. The overall process will be described with reference to the flowchart of the overall process in FIG. First, in process 11, the test item table in the test item storage unit 7 (shown in the transition diagram of the test item table in FIG. 9; 5
Initialize 9). Next, in process 12, the source code input unit 2 inputs the source code 49 from the source code storage file 1. Next, in process 13, the number of lines (18) of the source code 49 is counted and set to a variable 1 indicating the line number of the current process line. After that, the processes 14 to 19 are performed for all the lines of the source code 49. here,
The processing is performed in the descending order from the last line of the source code in order to reduce the number of test items that are repelled by the test item duplication check of the process 18 described later and to speed up the process. Next, in process 14, when 1 is greater than 0 (there are unprocessed lines), test items are generated by the processes of process 15 and subsequent processes, and when 1 is 0 or less (all lines are processed), process 20 is performed.
The test item is output with and the process ends. In processing 15, the branch search unit 3 performs processing 16 when one line is an if statement.
Then, the test item is added by the process 18 and when the one line is not an if statement, the process 19 is performed and the process of the next line is performed.
In process 16, the condition extracting unit 4 extracts the branch condition of the if statement. In process 17, the test item extraction unit 5 converts both the right and wrong conditions of the branch condition into an expression represented by the argument of the function, and sets it as a test item. In process 18, the test item registration unit 6 checks the duplication of the test items and registers only those test items that are not in the test item table 59 in the test item table 59 in the test item storage unit 7. In process 19, 1 is subtracted from 1 in order to move to the process of the next line, and the process returns to process 14. In process 20, the test item output unit 9 outputs all the test items as indicated by 60 stored in the test item table 59 to create the test item 10. In the case of the source code 49, the if statement to be processed first is the 13th line, and the branch condition of the 13th line fetched in the process 16 is (m <c: hereinafter referred to as condition A). [Test Item Extraction Process] Next, the above condition A (m <
The test item extraction process of c) will be described with reference to the flowchart of the test item extraction process of FIG. In this test item extraction processing, both right and wrong conditions of condition A (m <c, m ≧
From c), when executing an executable statement inside the if statement,
All cases in which no execution is performed are extracted and registered in the condition table 50 shown in the condition table transition diagram of FIG.
【0018】まず、処理21では条件テーブル50の初
期化を行う。次に処理22では条件テーブル50のカレ
ント行を示す変数j,条件テーブル50の登録列を示す
変数k,条件テーブル50の登録行を示す変数Mのそれ
ぞれに1をセットする。次に処理23では条件A(m<
c)を条件テーブル50のM行、k列(1行、1列)に
セットして条件テーブル51とする。次に処理24では
条件A(m<c)の逆条件(m≧c:以降条件Bと呼
ぶ)を求める。次に処理25では条件Bを条件テーブル
の条件Aの次の行に登録するために変数Mに1を足す
(M=2)。次に処理26では条件B(m≧c)を条件
テーブルのM行,k列(2行,1列)にセットして条件
テーブルとする。次に処理27では上記if文を通過す
る全ての場合をテスト項目として抽出するために条件A
(m<c)に関するテスト項目と、条件Bに関するテス
ト項目を検索する。 〔テスト項目検索処理〕 次に上記の処理27のテスト
項目検索処理について条件A(m<c)の場合を例に図
4のテスト項目検索処理のフローチャートを用いて説明
する。このテスト項目検索処理では、ソースコードを検
索して条件Aが成立するための全ての場合を関数の引数
(a,b,c)のみで表された式として取り出す。ま
ず、処理28では検索開始行変数iにl−1(12行)
をセットし、対象となっている行の1行前の行からソー
スコードを逆方向に検索する。処理29では検索開始行
変数iが0より大きければ(未検索のソースコードがあ
る場合)処理30へ分岐し、検索開始行変数iが0以下
ならば(全てのソースコードを検索した場合)テスト項
目検索処理27を終了する。この場合、i=12(>
0)なので処理30を行う。処理30ではi行が代入文
である時に処理31以降の変数の入れ換え処理を行い、
i行が代入文でない時に処理36へ分岐し次の行を検索
する。ソースコード49の13行目についてテスト項目
抽出処理を行っている場合、最初に処理される代入文は
11行目(m=b)であり、代入文(m=b)について
処理31以降を説明する。処理31では条件A(m<
c)の左辺(m)がi行の左辺と等しい時に処理33,
処理34の左辺の入れ換え処理へ、条件A(m<c)の
左辺(m)がi行の左辺と異なる時に処理32へ分岐す
る。この場合、条件A(m<c)の左辺と11行(m=
b)の左辺が等しいので、処理33を行う。ここで代入
文(m=b)はif文(9行目)内部の実行文であり、
その分岐条件(m<b)が成立するかどうかによって、
上記代入文が実行されるかどうかが左右される。そこで
9行目のif文が成立する場合と成立しない場合に条件
Aを分解して条件テーブルにそれぞれを登録する。処理
33ではこの条件A(m<c)の代入文(m<b)に関
する分解処理を行う。処理34では条件Aの左辺(m)
と代入文の右辺(b)を入れ換える。処理32,処理3
3,処理35では代入文が条件Aの右辺の代入文である
時に、処理31、処理33、処理34と同様に、条件A
の分解処理を行い、条件Aの右辺を入れ換える。処理3
6では変数lから1を引き次の行の処理に移る。 〔条件の分解処理〕 次に上記処理33の条件A(m<
c)の代入文(m=b)に関する分解処理について、図
5の条件分解処理のフローチャートを用いて説明する。
なお、各変数は以下のとおりである。First, in process 21, the condition table 50 is initialized. Next, in process 22, 1 is set to each of the variable j indicating the current row of the condition table 50, the variable k indicating the registered column of the condition table 50, and the variable M indicating the registered row of the condition table 50. Next, in process 23, condition A (m <
c) is set to M rows and k columns (1 row, 1 column) of the condition table 50 to form a condition table 51. Next, in process 24, the reverse condition of condition A (m <c) (m ≧ c: hereinafter referred to as condition B) is obtained. Next, in process 25, 1 is added to the variable M (M = 2) in order to register the condition B in the line next to the condition A in the condition table. Next, in process 26, the condition B (m ≧ c) is set in the M rows and k columns (2 rows, 1 column) of the condition table to form the condition table. Next, in process 27, in order to extract all cases that pass the if statement as test items, condition A
A test item regarding (m <c) and a test item regarding condition B are searched. [Test Item Search Process] Next, the test item search process of the process 27 will be described with reference to the flowchart of the test item search process of FIG. 4 by taking the condition A (m <c) as an example. In this test item search process, the source code is searched and all cases where the condition A is satisfied are taken out as an expression represented only by the function arguments (a, b, c). First, in process 28, the search start row variable i is set to l-1 (12 rows).
Is set, and the source code is searched in the reverse direction from the line immediately preceding the target line. In process 29, if the search start line variable i is larger than 0 (when there is an unsearched source code), the process branches to process 30, and if the search start line variable i is 0 or less (when all the source codes are searched), a test The item search process 27 ends. In this case, i = 12 (>
Since it is 0), processing 30 is performed. In process 30, when the i-th row is an assignment statement, the process of changing variables after process 31 is performed,
When the i-th line is not an assignment statement, the process branches to step 36 to search for the next line. When the test item extracting process is performed on the 13th line of the source code 49, the first assignment statement processed is the 11th line (m = b), and the description of the process 31 and the subsequent steps will be given for the assignment statement (m = b). To do. In process 31, condition A (m <
When the left side (m) of c) is equal to the left side of row i, processing 33,
When the left side (m) of the condition A (m <c) is different from the left side of the i-th row, the process proceeds to the process 32 of replacing the left side of the process 34. In this case, the left side of condition A (m <c) and 11 lines (m =
Since the left sides of b) are equal, processing 33 is performed. Here, the assignment statement (m = b) is an execution statement inside the if statement (9th line),
Depending on whether the branch condition (m <b) is satisfied,
It depends on whether the above assignment statement is executed. Therefore, the condition A is decomposed and registered in the condition table when the if statement on the ninth line is satisfied or not satisfied. In process 33, the decomposition process for the assignment statement (m <b) of this condition A (m <c) is performed. In process 34, the left side (m) of condition A
And replace the right side (b) of the assignment statement. Process 32, Process 3
3, in the process 35, when the assignment statement is the assignment statement on the right side of the condition A, the condition A is the same as the processes 31, 33 and 34.
Then, the right side of condition A is replaced. Process 3
At 6, the variable 1 is subtracted from 1 and the process for the next line is performed. [Condition decomposition processing] Next, the condition A (m <
The decomposition process regarding the assignment statement (m = b) in c) will be described with reference to the flowchart of the conditional decomposition process in FIG.
The variables are as follows.
【0019】M=2,i=11,j=1,k=1 この条件の分解処理では、代入文(m=b)がif文内
部の実行文である時に、そのif文が成立する場合と成
立しない場合とに条件テーブルに登録された条件Aを分
解する。M = 2, i = 11, j = 1, k = 1 In the decomposition process of this condition, when the assignment statement (m = b) is an executable statement inside the if statement, the if statement is satisfied. The condition A registered in the condition table when the above condition is not satisfied is decomposed.
【0020】処理37ではi(11)行(m=b)が条
件文内の代入文である場合は処理38以降の分解処理
へ、i行が条件文内の代入文でない場合は条件の分解処
理を終了する。この場合、11行(m=b)は9行(i
f (m<b))の条件文内の代入文であるから処理3
8を行う。処理38では上記条件文の分岐条件(m<
b:以降条件Cと呼ぶ)を取り出す。処理39では条件
テーブルの1行目を条件Cが成立した場合の条件とする
ために、上記条件C(m<b)を条件テーブルのj行
(1行),k+1列(2列)にセットして条件テーブル
とする。次に処理40から処理43で条件テーブルの3
行目に条件Cが成立しなかった場合の条件を登録する。
処理40では変数Mに1を足す(M=3)。処理41で
は条件A(m<c)と同一の条件(以降条件Dと呼ぶ)
を条件テーブルのM行(3行),k列(1列)にセット
して条件テーブルとする。処理42では条件C(m<
b)の逆条件(m≧b:以降条件Eと呼ぶ)を求める。
処理43では上記条件E(m≧b)をM行(3行),k
+1列(2列)にセットして条件テーブルとする。次
に、処理44以降の処理で上記の条件C,条件D,条件
Eについてテスト項目検索処理を行い、それぞれの条件
を関数の引き数のみで表された式にする。処理44では
jjにjを、kkにkをセットする(jj=1,kk=
1)。処理45ではkにkk+1をセットする(k=
2)。次に処理27で、検索開始行を9行として条件C
(m<b)に関するテスト項目検索処理を行う。処理4
6ではjにMを、kにkkをセットする(j=3,k=
1)。次に処理27で、検索開始行を9行として条件D
(m<c)に関するテスト項目検索処理を行う。処理4
7ではkにkk+1をセットする(k=2)。次に処理
27で、検索開始行を9行として条件E(m≧b)に関
するテスト項目検索処理を行う。以上の3回のテスト項
目検索処理を行うと、8行目の代入文(m=a)によっ
て条件C,条件D,条件Eの左辺(m)が代入文の右辺
(a)に換わり条件テーブル56となる。処理48では
jにjjを、kにkkをセットする(j=1,k=
1)。In process 37, if the i (11) line (m = b) is an assignment statement in the conditional statement, the process proceeds to step 38 and thereafter. If i line is not an assignment statement in the conditional statement, the condition is decomposed. The process ends. In this case, 11 lines (m = b) are 9 lines (i
Process 3 because it is an assignment statement in the conditional statement of f (m <b))
Do 8. In process 38, the branch condition (m <
b: hereinafter referred to as condition C). In the process 39, the condition C (m <b) is set in the jth row (1st row) and the k + 1th column (2nd column) of the condition table in order to set the first row of the condition table as the condition when the condition C is satisfied. And make a condition table. Next, in processing 40 to processing 43, the condition table 3
The condition when condition C is not satisfied is registered in the line.
In the process 40, 1 is added to the variable M (M = 3). In process 41, the same condition as condition A (m <c) (hereinafter referred to as condition D)
Is set in M rows (3 rows) and k columns (1 column) of the condition table to form a condition table. In process 42, condition C (m <
The reverse condition of b) (m ≧ b: hereinafter referred to as condition E) is obtained.
In the process 43, the above condition E (m ≧ b) is set to M rows (3 rows), k.
Set to +1 column (2 columns) to make a condition table. Next, the test item search processing is performed for the above-mentioned conditions C, D, and E in the processing after the processing 44, and each condition is made into an expression expressed only by the arguments of the function. In process 44, j is set to j and kk is set to k (jj = 1, kk =
1). In process 45, k is set to kk + 1 (k =
2). Next, in process 27, the search start line is set to 9 lines and condition C is set.
A test item search process regarding (m <b) is performed. Process 4
In step 6, M is set to j and kk is set to k (j = 3, k =
1). Next, in process 27, the search start line is set to 9 lines and the condition D is set.
A test item search process for (m <c) is performed. Process 4
At 7, kk + 1 is set to k (k = 2). Next, in process 27, a test item search process relating to condition E (m ≧ b) is performed with the search start line being 9 lines. When the test item search process is performed three times as described above, the left side (m) of condition C, condition D, and condition E is replaced by the right side (a) of the assignment statement by the assignment statement (m = a) in the eighth line, and the condition table 56. In process 48, jj is set to j and kk is set to k (j = 1, k =
1).
【0021】以上で条件の分解処理が終わり、次に処理
34によって条件Aの左辺(m)が代入文の右辺(b)
に換わり条件テーブルは57となる。上記のように条件
Aを分解し、その分解の結果生成された新たな条件に対
して、繰り返し前述のテスト項目検索処理を行うことに
より、最終的に条件Aが成立する全ての場合を関数の引
き数のみで表された式(テスト項目)で表すことができ
る(条件テーブル57の1行目と3行目)。With the above processing, the condition decomposition process is completed. Next, in process 34, the left side (m) of condition A is the right side (b) of the assignment statement.
Is replaced with 57 in the condition table. As described above, the condition A is decomposed, and the new condition generated as a result of the decomposition is repeatedly subjected to the above-described test item search processing, so that the condition A is finally satisfied in all cases. It can be represented by an expression (test item) represented by only arguments (first and third rows of the condition table 57).
【0022】次に上記のようなテスト項目抽出処理を条
件B(m≧c)に対しても行い、条件Bが成立する全て
の場合を関数の引き数のみで表された式(テスト項目)
で表す(条件テーブル58の2行目と4行目)。Next, the test item extraction processing as described above is also performed for the condition B (m ≧ c), and in all cases where the condition B is satisfied, an expression (test item) expressed only by the argument of the function
(The second and fourth rows of the condition table 58).
【0023】最後に処理18によって、上記の条件をテ
スト項目としてテスト項目テーブル59に登録して60
に示す項目とする。Finally, in process 18, the above conditions are registered as test items in the test item table 59 and are registered 60.
The items are shown in.
【0024】[0024]
【発明の効果】以上説明したように本発明は、ソースコ
ードの分岐行全てに対する正否両条件を取り出し、それ
ら全ての条件をプログラム入力変数のみで表された式で
表現し、それをテスト項目とすることにより、ソースコ
ードの全パスを通過するテスト項目を作成することがで
きるという効果を有する。As described above, according to the present invention, both right and wrong conditions for all branch lines of a source code are taken out, all of these conditions are expressed by an expression expressed only by program input variables, and they are used as test items. By doing so, it is possible to create a test item that passes all the paths of the source code.
【図1】本発明の一実施例によるテスト項目作成装置の
構成図である。FIG. 1 is a configuration diagram of a test item creation device according to an embodiment of the present invention.
【図2】図1に示す実施例の全体の処理のフローチャー
トである。FIG. 2 is a flowchart of the overall processing of the embodiment shown in FIG.
【図3】図1に示すテスト項目抽出部の抽出処理のフロ
ーチャートである。FIG. 3 is a flowchart of an extraction process of a test item extraction unit shown in FIG.
【図4】図1に示すテスト項目抽出部の検索処理のフロ
ーチャートである。FIG. 4 is a flowchart of a search process of a test item extraction unit shown in FIG.
【図5】図1に示すテスト項目抽出部の条件分解処理の
フローチャートである。5 is a flowchart of a condition decomposition process of the test item extracting unit shown in FIG.
【図6】図1に示すソースコードの1例とテスト項目を
示す図である。FIG. 6 is a diagram showing an example of the source code shown in FIG. 1 and test items.
【図7】図1に示すテスト項目記憶部の条件テーブルの
遷移図である。7 is a transition diagram of a condition table of a test item storage unit shown in FIG.
【図8】図1に示すテスト項目記憶部のテスト項目出力
条件テーブルの遷移図である。8 is a transition diagram of a test item output condition table in the test item storage unit shown in FIG.
【図9】図1に示すテスト項目記憶部のテスト項目テー
ブルの遷移図である。9 is a transition diagram of the test item table of the test item storage unit shown in FIG.
1 ソースコード格納ファイル 2 ソースコード入力部 3 分岐検索部 4 分岐条件抽出部 5 テスト項目抽出部 6 テスト項目登録部 7 テスト項目記憶部 8 制御部 9 テスト項目出力部 10 テスト項目 1 Source Code Storage File 2 Source Code Input Section 3 Branch Search Section 4 Branch Condition Extraction Section 5 Test Item Extraction Section 6 Test Item Registration Section 7 Test Item Storage Section 8 Control Section 9 Test Item Output Section 10 Test Items
Claims (1)
ウェアの機能を確認するためのテスト項目を作成するシ
ステムにおいて、ソースコードを入力するソースコード
入力部と、ソースコードの分岐行を検索する分岐検索部
と、上記分岐行から分岐条件を抽出する分岐条件抽出部
と、上記分岐条件の正否両条件を該プログラムの外側か
ら値を決定できるプログラム入力変数のみで表した式に
表現し、更にその式からテスト項目を抽出するテスト項
目抽出部と、上記テスト項目をテスト項目記憶部に登録
するテスト項目登録部と、上記テスト項目を記憶するテ
スト項目記憶部と、上記各部を分岐行ごとに順次実行す
る制御部と、上記テスト項目記憶部に記憶されたテスト
項目を出力するテスト項目出力部を有することを特徴と
するテスト項目作成装置。1. A system for creating a test item for confirming a software function in a software development test process, and a source code input section for inputting a source code and a branch search section for searching a branch line of the source code. , A branch condition extraction unit that extracts a branch condition from the branch line, and both the right and wrong conditions of the branch condition are expressed in an expression expressed only by a program input variable whose value can be determined from outside the program, and the test is performed from the expression. A test item extraction unit for extracting items, a test item registration unit for registering the test items in the test item storage unit, a test item storage unit for storing the test items, and a control for sequentially executing each unit for each branch line. Section and a test item output section for outputting the test item stored in the test item storage section described above. apparatus.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP4038430A JPH05210537A (en) | 1992-01-30 | 1992-01-30 | Test item preparing device |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP4038430A JPH05210537A (en) | 1992-01-30 | 1992-01-30 | Test item preparing device |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| JPH05210537A true JPH05210537A (en) | 1993-08-20 |
Family
ID=12525094
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| JP4038430A Pending JPH05210537A (en) | 1992-01-30 | 1992-01-30 | Test item preparing device |
Country Status (1)
| Country | Link |
|---|---|
| JP (1) | JPH05210537A (en) |
Cited By (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JP2009070322A (en) * | 2007-09-18 | 2009-04-02 | Nec Corp | Data processor, system, program and method |
| JP2023000907A (en) * | 2021-06-18 | 2023-01-04 | 株式会社日立製作所 | Source code correction support device and source code correction support method |
-
1992
- 1992-01-30 JP JP4038430A patent/JPH05210537A/en active Pending
Cited By (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JP2009070322A (en) * | 2007-09-18 | 2009-04-02 | Nec Corp | Data processor, system, program and method |
| JP2023000907A (en) * | 2021-06-18 | 2023-01-04 | 株式会社日立製作所 | Source code correction support device and source code correction support method |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| EP1252568A2 (en) | Apparatus for automatically generating source code | |
| CN111680494A (en) | Similar text generation method and device | |
| EP0737928B1 (en) | Language processing method and apparatus | |
| CN117435230A (en) | Code annotation processing method and device based on neural network | |
| CN114328525B (en) | Data processing method and device | |
| Haji et al. | Exploratory inference chain: Exploratorily chaining multi-hop inferences with large language models for question-answering | |
| JPH0619962A (en) | Text dividing device | |
| JP2002108652A (en) | Program correlation detector | |
| JPS6190269A (en) | Translation system | |
| JP2001125783A (en) | Homogeneous instruction group extraction method and homogenous instruction group extraction device | |
| CN112380205B (en) | Automatic feature generation method and system of distributed architecture | |
| JPH0553780A (en) | Automatic program synthesizing device | |
| Boinpally | Task-Specific Code Synthesis for Data Pipelines Using Transformer-Based LLM | |
| KR102066022B1 (en) | Apparatus and method for generating function signature on executable code | |
| JPH06214777A (en) | Program development method and apparatus | |
| Jenkins | Automated Generation of Input Output Pairs for the Cais Validation Test Suite. | |
| JPH06222913A (en) | Program analyzer | |
| JP3087699B2 (en) | Standard information simple input system and standard information simple input method | |
| JPH0695890A (en) | Name replacement system in compiler | |
| JP2002073373A (en) | A program inspection device that extracts inspection programs that check peripheral / similar functions based on correction confirmation inspection items | |
| JPH0793144A (en) | Program analysis device | |
| JP2861630B2 (en) | Connection structure analyzer | |
| JPH0668160A (en) | Information retrieval method | |
| Sneed | Business Rule Recovery as a Fata Morgana | |
| JPH0632090B2 (en) | Pattern recognition device |