JPH08212105A - Program managing device - Google Patents

Program managing device

Info

Publication number
JPH08212105A
JPH08212105A JP7015873A JP1587395A JPH08212105A JP H08212105 A JPH08212105 A JP H08212105A JP 7015873 A JP7015873 A JP 7015873A JP 1587395 A JP1587395 A JP 1587395A JP H08212105 A JPH08212105 A JP H08212105A
Authority
JP
Japan
Prior art keywords
subroutine
program
input
designated
output
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
Application number
JP7015873A
Other languages
Japanese (ja)
Inventor
Keiji Yokota
恵司 横田
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.)
Casio Computer Co Ltd
Original Assignee
Casio Computer Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Casio Computer Co Ltd filed Critical Casio Computer Co Ltd
Priority to JP7015873A priority Critical patent/JPH08212105A/en
Publication of JPH08212105A publication Critical patent/JPH08212105A/en
Pending legal-status Critical Current

Links

Landscapes

  • Debugging And Monitoring (AREA)
  • Stored Programmes (AREA)

Abstract

PURPOSE: To automatically generate a test program for singly testing a subroutine called in a source program. CONSTITUTION: A designated subroutine 107 designated out of a program 101 is segmented. The designated subroutine 107 is analyzed, its input parameter is extracted, an input part is generated from the input parameter, and a header part + input part 109 is generated. Further, an output part 110 is generated from an output parameter, and a single test program 102 is generated by linking the header part + input part 109, designated subroutine 107 and output part 110. Afterwards, a person in charge of a test performs debugging by executing the single test program 102 and when there is bugging, a single test program 103 is corrected. Then, the corrected designated subroutine is returned to the original program 101 so that the debugging of the designated subroutine in the source program can be finished.

Description

【発明の詳細な説明】Detailed Description of the Invention

【0001】[0001]

【産業上の利用分野】本発明は、ソフトウェア開発業務
において、ソースプログラムをデバッグするためのテス
トプログラムを作成するプログラム管理装置に関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a program management device for creating a test program for debugging a source program in software development work.

【0002】[0002]

【従来の技術】ソフトウェア開発においては、ソースプ
ログラムのデバッグ作業が必要不可欠であり、該デバッ
グ作業を短時間で終了することが開発期間の短縮化にと
って非常に重要である。該デバッグ作業においては、専
用のデバッグツールを使用する以外にターゲットのソー
スプログラム内にテスト用のルーチンを組み込みテスト
プログラムを作成する方法がある。
2. Description of the Related Art Debugging work of a source program is indispensable in software development, and finishing the debugging work in a short time is very important for shortening the development period. In the debugging work, there is a method of creating a test program by incorporating a test routine in the target source program other than using a dedicated debug tool.

【0003】通常のソフトウェアは、複数のソースプロ
グラムから成っており、各ソースプログラム毎に、その
開発者が単体テストを行う。また、各ソースプログラム
は複数のサブルーチン(または関数)をコールするよう
になっており、ソースプログラムの不具合がどのサブル
ーチン(または関数)なのかを特定するのが難しいこと
が、テスト作業が遅れる要因の一つとなっている。
Ordinary software is composed of a plurality of source programs, and the developer performs a unit test for each source program. In addition, each source program is designed to call multiple subroutines (or functions), and it is difficult to identify which subroutine (or function) has a defect in the source program. It is one.

【0004】[0004]

【発明が解決しようとする課題】ソースプログラムのテ
スト工程では、通常ソースプログラム開発者自身がテス
トプログラムを作成してデバッグ作業を行う場合が多
い。しかし、ソースプログラムが複数のサブルーチン
(関数)から成っている場合、ソースプログラム全体で
テストを行うとバグの要因となっているサブルーチン
(関数)を推測するのが難しく、このことがデバッグ作
業が遅れてしまう大きな要因となっていた。したがっ
て、各サブルーチン毎に単体テストを行った方が、デバ
ッグ効率が向上するが、サブルーチンの数が多くなる
と、それらのテストプログラムを作成する作業は長時間
となり、テスト効率が向上しなくなる。また、該テスト
プログラムにおいては、対象となるサブルーチン(また
は、関数)をコールする前に、該サブルーチンの引数や
該サブルーチン内部で使われる外部変数などに初期値を
設定する処理などを組み込む必要があるが、それらの変
数の数が多くなると、手作業によるテストプログラム作
成では、人為的ミスにより、初期値を与えるべき変数に
抜けがあったり等してテストプログラム自体にバグが発
生する確率が高くなる。
In the source program test process, the source program developer often creates a test program and performs debugging work. However, if the source program consists of multiple subroutines (functions), it is difficult to guess the subroutine (function) that is the cause of the bug when the entire source program is tested, which delays debugging work. It was a big factor that caused it. Therefore, performing the unit test for each subroutine improves the debugging efficiency, but when the number of subroutines increases, the work for creating those test programs takes a long time and the testing efficiency does not improve. In addition, in the test program, before calling a target subroutine (or function), it is necessary to incorporate processing for setting initial values in arguments of the subroutine or external variables used inside the subroutine. However, if the number of these variables increases, the probability that a bug will occur in the test program itself due to human error in the variables that should be given initial values when creating a test program by hand, etc. .

【0005】本発明の課題は、ソースプログラム内部の
サブルーチン(または関数)の単体テスト用プログラム
を自動的に生成し、ソースプログラムのテスト効率及び
生産性を向上させることである。
An object of the present invention is to automatically generate a unit test program for a subroutine (or function) inside a source program and improve the test efficiency and productivity of the source program.

【0006】[0006]

【課題を解決するための手段】請求項1記載の第1の発
明は、以下の手段を有する。サブルーチン抽出手段は、
ソースプログラムから指定されたサブルーチンを抽出す
る。
The first aspect of the present invention has the following means. Subroutine extraction means
Extract the specified subroutine from the source program.

【0007】インタフェース情報抽出手段は、上記サブ
ルーチン抽出手段によって抽出されたサブルーチンの内
容を解析して、該サブルーチンの外部入出力インタフェ
ース情報を抽出する。
The interface information extracting means analyzes the contents of the subroutine extracted by the subroutine extracting means, and extracts external input / output interface information of the subroutine.

【0008】入出力処理部生成手段は、上記インタフェ
ース情報抽出手段で抽出された外部入出力インタフェー
ス情報に基づいて、上記指定サブルーチンの外部入力変
数の値を設定するための処理を実行する入力処理部と、
上記指定サブルーチンの外部出力変数の値を出力するた
めの処理を実行する出力処理部とを生成する。
The input / output processing unit generation means executes the processing for setting the value of the external input variable of the designated subroutine based on the external input / output interface information extracted by the interface information extraction means. When,
And an output processing unit that executes a process for outputting the value of the external output variable of the designated subroutine.

【0009】テストプログラム生成手段は、上記入出力
処理部生成手段によって生成された上記入力処理部と上
記出力処理部、及び上記サブルーチン抽出手段によって
抽出されたサブルーチンを結合して、上記指定サブルー
チンの単体テスト用プログラムを生成する。
The test program generating means combines the input processing portion and the output processing portion generated by the input / output processing portion generating means, and the subroutine extracted by the subroutine extracting means, and performs a unit test of the designated subroutine. Program for

【0010】また、請求項2記載の第2の発明は、上記
請求項1記載の発明に加え、上記テストプログラム生成
手段によって生成されたテストプログラムの実行によっ
て修正がなされた上記指定されたサブルーチンを、元の
ソースプログラム内の修正前の上記指定サブルーチンと
置き換えて、新たなソースプログラムを生成する新規ソ
ースプログラム生成手段を更に有する。
According to a second aspect of the present invention, in addition to the invention according to the first aspect, the specified subroutine modified by the execution of the test program generated by the test program generating means is added. Further, there is further provided new source program generating means for generating a new source program by replacing the above-mentioned designated subroutine in the original source program before correction.

【0011】[0011]

【作用】上記第1の発明の作用は、次の通りである。先
ず、テスト担当者がソースプログラムのデバッグを行う
際に、該ソースプログラムからデバッグを行いたいサブ
ルーチンを指定すると、該指定されたサブルーチンがサ
ブルーチン抽出手段によって切り出される。
The operation of the first invention is as follows. First, when the tester specifies a subroutine to be debugged from the source program when debugging the source program, the specified subroutine is cut out by the subroutine extracting means.

【0012】インタフェース情報抽出手段は、該サブル
ーチン抽出手段によって抽出されたサブルーチンを解析
し、該サブルーチン内に記述されている外部入出力イン
タフェース情報、例えば、該サブルーチンの引数となっ
ている入力変数、或いは該サブルーチンがメインプログ
ラムに戻す返り値である出力変数等を抽出する。
The interface information extracting means analyzes the subroutine extracted by the subroutine extracting means, and external input / output interface information described in the subroutine, for example, an input variable as an argument of the subroutine, or The subroutine extracts an output variable or the like which is a return value returned to the main program.

【0013】入出力処理部生成手段は、上記インタフェ
ース情報抽出手段で抽出された外部入出力インタフェー
ス情報から標準入力処理等から成る入力処理部、及び前
期指定されたサブルーチンの実行結果である戻り値など
の外部出力変数を表示装置や印字出力装置などに出力す
る標準出力処理等からなる出力処理部を生成する。上記
入力処理部は、例えば、キーボード等の外部入力装置か
ら単体テスト用プログラム内の前記指定されたサブルー
チンの入力変数に任意の値を設定するための処理を実行
するものである。また、上記出力処理部は、上記指定さ
れたサブルーチンの実行結果などが設定された上記外部
変数の値を、例えば、表示装置や印字出力装置を介して
画面や用紙上に出力するための処理を実行するものであ
る。
The input / output processing unit generation means includes an input processing unit including standard input processing from the external input / output interface information extracted by the interface information extraction unit, a return value which is an execution result of the subroutine designated in the previous period, and the like. And an output processing unit including standard output processing for outputting the external output variables of the above to a display device, a print output device, or the like. The input processing unit executes processing for setting an arbitrary value to an input variable of the designated subroutine in the unit test program from an external input device such as a keyboard. Further, the output processing unit performs a process for outputting the value of the external variable in which the execution result of the designated subroutine is set, for example, on a screen or paper through a display device or a print output device. It is what you do.

【0014】テストプログラム生成手段は、入出力処理
部生成手段によって生成された上記入力処理部と上記出
力処理部、及び上記サブルーチン抽出手段によって抽出
されたサブルーチン、また、必要に応じてソースプログ
ラムに記述されたヘッダ部を結合して単体テスト用プロ
グラムを生成する。テスト担当者は、該生成された単体
テスト用プログラムを実行してデバッグを行い、上記指
定したサブルーチンにバグがあった場合、そのサブルー
チンをエディタ等により修正する。
The test program generating means is described in the input processing section and the output processing section generated by the input / output processing section generating section, the subroutine extracted by the subroutine extracting section, and, if necessary, in the source program. Generate the unit test program by combining the generated header parts. The tester executes the generated unit test program to perform debugging, and if the specified subroutine has a bug, corrects the subroutine with an editor or the like.

【0015】従って、テスト担当者は、あるソースプロ
グラムにおいてテストしたいサブルーチンを指定するだ
けで、自動的にそのサブルーチン用の単体テストプログ
ラムを作成することができる。このため、複数のサブル
ーチンを呼び出しているソースプログラムにおいて各サ
ブルーチン毎に、個別に単体テストを実行することが可
能となるので、上記ソースプログラムのテストを効率良
く行うことが可能になる。
Therefore, a tester can automatically create a unit test program for a subroutine by simply designating a subroutine to be tested in a certain source program. For this reason, it is possible to individually execute a unit test for each subroutine in a source program that calls a plurality of subroutines, and thus it is possible to efficiently test the source program.

【0016】また、第2の発明においては、新規ソース
プログラム生成手段が、該修正された単体テスト用プロ
グラム内の上記指定されたサブルーチンを、元のソース
プログラム内の修正前の上記指定サブルーチンと置き換
えて、該指定サブルーチンに関してはバグが解消された
新規のソースプログラムを生成する。
Further, in the second invention, the new source program generating means replaces the designated subroutine in the modified unit test program with the designated subroutine before modification in the original source program. With respect to the designated subroutine, a new source program in which a bug is eliminated is generated.

【0017】従って、デバッグの完了したサブルーチン
をソースプログラムに直ちに反映させることができるの
で、該ソースプログラムのデバッグ作業の効率が向上す
る。
Therefore, since the subroutine for which debugging has been completed can be immediately reflected in the source program, the efficiency of the debugging work of the source program is improved.

【0018】[0018]

【実施例】図1は、本発明の一実施例の全体構成を示す
ブロック図である。表示装置21は、例えば、CRTデ
ィスプレイや液晶表示装置等から成り、プログラマーに
よって作成されたターゲット・システム用のソースプロ
グラム(以後、正規プログラムと呼ぶ)内の動作を確認
したいサブルーチンの指定や、自動作成されたテストプ
ログラムの内容等を表示する。
1 is a block diagram showing the overall construction of an embodiment of the present invention. The display device 21 is composed of, for example, a CRT display, a liquid crystal display device, or the like, and specifies a subroutine for which the operation in the source program for the target system (hereinafter referred to as a regular program) created by the programmer is to be confirmed or automatically created. Display the contents of the executed test program.

【0019】キーボード22は、上記対象プログラム及
び該対象プログラム内のサブルーチンの指定等の入力の
ために使用される入力装置である。外部記憶装置23
は、ハードディスク装置、フロッピィディスク装置、或
いは光磁気ディスク装置等からなり、システムプログラ
ム、さらには上記対象プログラムや該対象プログラム内
でコールされているサブルーチンや、使用されているフ
ァイル、ライブラリ化された標準入出力関数、プリプロ
セッサ、該対象プログラムのメインプログラム等が格納
されている記憶装置である。
The keyboard 22 is an input device used for inputting the target program and a subroutine in the target program. External storage device 23
Is a hard disk device, a floppy disk device, a magneto-optical disk device, or the like, and is a system program, the above-mentioned target program, a subroutine called in the target program, a file used, a library standard. The storage device stores an input / output function, a preprocessor, a main program of the target program, and the like.

【0020】また、さらには、正規プログラム内のテス
ト対象となるサブルーチンのテストプログラムを自動生
成するためのツールであるテストプログラム自動生成
部、動作の不具合が見つかったサブルーチンを修正のた
めのツールであるエディタ等が格納される。また、主記
憶装置24は、該外部記憶装置23内に格納されている
上記正規プログラム、上記サブプログラムやファイルな
どの各種ソフトウェアがロードされるCPU25のメイ
ンメモリである。
Furthermore, a test program automatic generation unit which is a tool for automatically generating a test program for a subroutine to be tested in a regular program, and a tool for correcting a subroutine in which a malfunction is found. The editor etc. are stored. Further, the main storage device 24 is a main memory of the CPU 25 into which various software such as the regular program, the sub program, and the files stored in the external storage device 23 are loaded.

【0021】CPU(中央処理装置)25は、該メイン
メモリ24上にロードされた前記テストプログラム自動
生成部を実行して、上記対象プログラム内のテスト対象
となるサブルーチンのテストプログラムを自動生成す
る。また、上記エディタを実行することにより、該テス
トプログラムの修正も行う。
The CPU (Central Processing Unit) 25 executes the test program automatic generation section loaded on the main memory 24 to automatically generate the test program of the subroutine to be tested in the target program. Also, the test program is modified by executing the editor.

【0022】図2は、上記テストプログラム自動生成部
のモジュール構成を示す図である。該テストプログラム
自動生成部は、正規プログラムからテスト担当者により
指定された該対象プログラム内でコールされているサブ
ルーチンの動作確認を行うためのテストプログラムを自
動生成するものであり、CPU21によって外部記憶装
置23から読み出されて上記主記憶装置24にロードさ
れる。
FIG. 2 is a diagram showing the module configuration of the test program automatic generation unit. The test program automatic generation unit is for automatically generating a test program for confirming the operation of the subroutine called in the target program designated by the tester from the regular program. It is read from 23 and loaded into the main memory 24.

【0023】このテストプログラム自動生成部は、プロ
グラム管理装置制御部31、プログラム分割/結合処理
部32、I/F生成処理部33、入出力生成処理部の4
個のモジュールから構成される。
The test program automatic generation unit includes a program management device control unit 31, a program division / connection processing unit 32, an I / F generation processing unit 33, and an input / output generation processing unit.
It consists of 4 modules.

【0024】プログラム管理装置制御部31は、主とし
て、テストプログラム自動生成の全体的な制御を行うも
のであり、プログラム分割/結合処理部32、I/F生
成処理部33、入出力生成処理部34を個々に制御す
る。
The program management device control unit 31 mainly controls the entire test program automatic generation, and includes a program division / connection processing unit 32, an I / F generation processing unit 33, and an input / output generation processing unit 34. Control individually.

【0025】プログラム分割/結合処理部32は、正規
プログラムをヘッダ部、上記指定した指定サブルーチ
ン、該指定サブルーチン以外のサブルーチンに分割す
る。また、プログラム分割/結合処理部32は、テスト
担当者により修正された上記指定サブルーチンと上記ヘ
ッダ部、及び上記指定サブルーチン以外のサブルーチン
を結合する。
The program dividing / combining unit 32 divides the regular program into a header portion, the designated subroutine designated above, and a subroutine other than the designated subroutine. In addition, the program division / combination processing unit 32 combines the specified subroutine modified by the tester, the header section, and a subroutine other than the specified subroutine.

【0026】I/F生成処理部33は、テスト担当者に
よりテスト対象として指定された上記対象プログラム内
のサブルーチン(指定サブルーチン)を解析し、該指定
サブルーチン内で記述された入力変数、及び出力変数を
抽出し、これらの変数を該指定サブルーチンに対する外
部入出力用の変数に設定する。
The I / F generation processing unit 33 analyzes a subroutine (designated subroutine) in the target program designated as a test target by the tester, and inputs and output variables described in the designated subroutine. And set these variables as variables for external input / output to the designated subroutine.

【0027】入出力生成処理部34は、上記I/F生成
処理部33で抽出された上記指定サブルーチンに対する
外部入力変数から入力部(入力処理部)を生成する。ま
た、上記外部出力変数から出力部(出力処理部)を生成
する。プログラム管理装置制御部31は、プログラム分
割/結合処理部32を制御して、上記ヘッダ部と上記入
力部、上記指定サブルーチン、及び上記出力部を結合し
て、上記指定サブルーチンをテストするためのテストプ
ログラムを生成する。テスト担当者は、キーボード22
から上記テストプログラムをコンパイル・リンクして実
行形式のプログラムに変換した後、該プログラムを実行
することにより、上記指定サブルーチン内で用いられて
いる入力変数の値を入力することにより、表示装置21
上の画面を見ながら対話形式で上記指定サブルーチンの
動作確認を行うことが可能になる。尚、この場合、該入
力変数に対する指定サブルーチンの実行結果は、表示装
置21上に表示される。
The input / output generation processing unit 34 generates an input unit (input processing unit) from the external input variable for the specified subroutine extracted by the I / F generation processing unit 33. Also, an output unit (output processing unit) is generated from the external output variable. The program management device control section 31 controls the program division / combination processing section 32 to combine the header section, the input section, the designated subroutine, and the output section to test the designated subroutine. Generate a program. The tester uses the keyboard 22
After compiling and linking the above test program into an executable program, the program is executed to input the value of the input variable used in the designated subroutine, thereby displaying the display device 21.
It is possible to check the operation of the specified subroutine interactively while looking at the screen above. In this case, the execution result of the designated subroutine for the input variable is displayed on the display device 21.

【0028】図3は、上記構成の実施例の全体的な処理
の流れを説明する図である。プログラム101は、図3
に模式的に示すように主としてヘッダ部105、及び複
数のサブルーチン106〜108によって構成されてい
る。テスト担当者は、該プログラム101全体をデバッ
グするに際して、該プログラム101内でコールされて
いる複数のサブルーチン106〜108を個々に単体テ
ストする。図3(a)に示す例では、サブルーチン10
7を単体テストの対象として指定する。その結果、図3
(a)に示すように、複数のサブルーチン106〜10
8は、第1の指定外サブルーチン106、指定サブルー
チン107、及び第2の指定外サブルーチン108に区
分される。
FIG. 3 is a diagram for explaining the overall processing flow of the embodiment having the above configuration. The program 101 is shown in FIG.
As shown schematically in FIG. 1, it is mainly composed of a header section 105 and a plurality of subroutines 106 to 108. When debugging the entire program 101, the tester individually tests each of the plurality of subroutines 106 to 108 called in the program 101. In the example shown in FIG. 3A, the subroutine 10
Specify 7 as the unit test target. As a result, FIG.
As shown in (a), a plurality of subroutines 106 to 10
8 is divided into a first undesignated subroutine 106, a designated subroutine 107, and a second undesignated subroutine 108.

【0029】該区分によりプログラム101は、図3
(b)に示すように(ヘッダ部105+第1の指定外サ
ブルーチン106)、指定サブルーチン107、及び第
2の指定外サブルーチン108に分割される。
According to the division, the program 101 is shown in FIG.
As shown in (b), (header section 105 + first undesignated subroutine 106) is divided into a designated subroutine 107 and a second undesignated subroutine 108.

【0030】I/F生成処理部33は、指定サブルーチ
ン107を解析して、該指定サブルーチン107内の入
力変数、及び出力変数を抽出する。そして、入出力生成
処理部34は、該抽出された入力変数から入力部(入力
処理部)を生成し、前記分割されたヘッダ部105と上
記生成された入力部とから(ヘッダ部+入力部)109
を生成する。更に、入出力生成処理部33は、上記抽出
された出力変数から出力部(出力処理部)110を生成
する。
The I / F generation processing unit 33 analyzes the designated subroutine 107 and extracts the input variable and the output variable in the designated subroutine 107. Then, the input / output generation processing unit 34 generates an input unit (input processing unit) from the extracted input variable, and calculates (header unit + input unit) from the divided header unit 105 and the generated input unit. ) 109
Generate Further, the input / output generation processing unit 33 generates the output unit (output processing unit) 110 from the extracted output variable.

【0031】プログラム分割/結合処理部32は、(ヘ
ッダ部+入力部)109、指定サブルーチン107、出
力部110をリンクして図3(d)に示すように、該指
定サブルーチン107をテストするための単体のテスト
プログラム102を生成する。
The program division / combination processing section 32 links the (header section + input section) 109, the designated subroutine 107, and the output section 110 to test the designated subroutine 107 as shown in FIG. 3 (d). The unit test program 102 is generated.

【0032】テスト担当者は、該単体のテストプログラ
ム102をコンパイル・リンクして実行することによ
り、該単体のテストプログラム102をデバッグする。
そして、該単体のテストプログラム102にバグが見つ
かった場合には、エディタにより該バグの修正箇所を修
正して新たな単体のテストプログラム103を作成する
(図3(e))。
The tester debugs the unit test program 102 by compiling, linking and executing the unit test program 102.
When a bug is found in the unit test program 102, the editor corrects the bug correction portion to create a new unit test program 103 (FIG. 3E).

【0033】以上のようにして、指定サブルーチン10
7のデバッグが完了すると、プログラム分割/結合処理
部32は、図3(f)に示すように、上記テストプログ
ラム103を、(ヘッダ部+入力部)109、修正され
た指定サブルーチン111、及び出力部110に分割す
る。
As described above, the designated subroutine 10
When the debugging of 7 is completed, the program division / coupling processing unit 32, as shown in FIG. 3F, outputs the test program 103 to the (header unit + input unit) 109, the modified designated subroutine 111, and the output. Divide into parts 110.

【0034】最後に、プログラム分割/結合処理部32
は、図3(g)に示すように、ヘッダ部105、第1の
指定外サブルーチン106、及び第2の指定外サブルー
チン108の間に上記デバッグの完了した指定サブルー
チン111を挿入して、指定サブルーチンのデバッグが
完了したプログラム104を生成する。
Finally, the program division / connection processing unit 32
As shown in FIG. 3G, the designated subroutine 111, which has been debugged, is inserted between the header section 105, the first undesignated subroutine 106, and the second undesignated subroutine 108, and the designated subroutine The program 104 for which debugging of is completed is generated.

【0035】以上のようにして、テスト担当者は、テス
ト対象のプログラムについて、個々のサブルーチンを個
別に指定することによりそれら個々のサブルーチンに対
する単体のプログラムを自動生成できるので、該テスト
対象のプログラムをサブルーチン単位でデバッグできる
ようになる。このため、バグが発生しているサブルーチ
ンを効率良く、見つけ出すことが可能となる。
As described above, the tester can automatically generate a single program for each sub-routine by individually specifying each sub-routine for the test target program. You will be able to debug in subroutine units. For this reason, it becomes possible to efficiently find the subroutine in which the bug has occurred.

【0036】次に、図4乃至図12のフローチャートを
参照しながら、上述した本実施例におけるプログラムの
デバッグ方法を説明する。図4は、本実施例におけるデ
バッグ処理の全体の処理手順を示すゼネラル・フローチ
ャートである。
Next, the program debugging method in the above-described embodiment will be described with reference to the flowcharts of FIGS. FIG. 4 is a general flowchart showing the overall processing procedure of the debug processing in this embodiment.

【0037】先ず、テスト担当者は表示装置21に表示
された正規プログラムの内容を見ながら、テストを行い
たいサブルーチンの指定をキーボード22を用いて行
う。すなわち、CPU25は、外部記憶装置23から上
記正規プログラムを読出し、該正規プログラムを主記憶
装置24にロードすると共に、該正規プログラムの内容
をCRT21に表示する。そしてテスト担当者は、例え
ば直接コマンド入力により、またはCRT21に表示さ
れる該対象プログラムの表示範囲をキーボード22を介
したスクロール操作により変更しながら、テストを行い
たいサブルーチン全体をキーボード22を用いて範囲指
定する(S101)。
First, the tester uses the keyboard 22 to specify the subroutine to be tested while observing the contents of the regular program displayed on the display device 21. That is, the CPU 25 reads the regular program from the external storage device 23, loads the regular program into the main storage device 24, and displays the contents of the regular program on the CRT 21. Then, the tester changes the display range of the target program displayed on the CRT 21 by scrolling through the keyboard 22 while directly changing the display range of the target program by using the keyboard 22 while performing the test operation. It is designated (S101).

【0038】該指定により、前記テストプログラム自動
生成部は、該指定されたサブルーチンの動作のみを確認
するためのテストプログラムを自動生成する(S10
2)。テスト担当者は、不図示のコンパイラを起動して
該テストプログラムをコンパイルし、さらに、不図示の
リンクを起動して上記テストプログラムのCPU25上
で実行可能な形式のファイルを作成し、該実行形式ファ
イルをCPU25上で実行させて該テストプログラムの
テストを行う(S103)。
According to the designation, the test program automatic generation unit automatically generates a test program for confirming only the operation of the designated subroutine (S10).
2). The tester activates a compiler (not shown) to compile the test program, further activates a link (not shown) to create a file in a format executable on the CPU 25 of the test program, and execute the execution format. The file is executed on the CPU 25 to test the test program (S103).

【0039】テスト担当者は上記テストプログラムの実
行によって出力される結果(テスト結果)をCRT25
の画面上で確認して、上記テスト対象のサブルーチン内
にバグが含まれているか否かを判定する。そして、該テ
スト結果が正常であれば(S104,Yes)、上記テ
スト対象のサブルーチンにはバグが含まれていないもの
と判断してステップS106へ進む。一方、テスト結果
が異常であれば(S104,No)、上記テスト対象の
サブルーチンにバグがあるものと判断してステップS1
05へ進む(S104)。
The person in charge of the test outputs the result (test result) output by the execution of the above test program to the CRT 25.
Check on the screen to determine whether a bug is included in the subroutine to be tested. If the test result is normal (S104, Yes), it is determined that the test target subroutine does not include a bug, and the process proceeds to step S106. On the other hand, if the test result is abnormal (S104, No), it is determined that there is a bug in the subroutine to be tested, and step S1 is performed.
It progresses to 05 (S104).

【0040】該ステップS105では、バグがあること
が判明した上記サブルーチンのデバッグを行う。該デバ
ッグは、例えば、以下に述べるような手順で行われる。
テスト担当者は、机上デバッグにより、上記指定サブル
ーチンのバク発生箇所を見つけると、CPU25上でエ
ディタを起動して、上記テストプログラム内のサブルー
チンを修正する。そして、該修正後のテストプログラム
に対して、コンパイル及びリンクの作業を行い、再びテ
ストプログラムをCPU25上で実行する。このような
作業を、テスト結果に異常が発生しなくなるまで繰り返
す(S105)。
In the step S105, the above subroutine found to have a bug is debugged. The debugging is performed, for example, in the procedure described below.
When the tester finds a bug occurrence location of the designated subroutine by desk debugging, he starts an editor on the CPU 25 and corrects the subroutine in the test program. Then, the modified test program is compiled and linked, and the test program is executed again on the CPU 25. Such work is repeated until no abnormality occurs in the test result (S105).

【0041】そして、上記最終的に修正されたテストプ
ログラムから指定サブルーチンを分離し、該指定サブル
ーチンを正規プログラム内の正しい位置へ自動挿入する
(S106)。
Then, the designated subroutine is separated from the finally modified test program, and the designated subroutine is automatically inserted into the correct position in the regular program (S106).

【0042】図5は、前記テストプログラム自動生成部
によって実行される正規プログラムからテストプログラ
ムを自動生成する処理を説明するフローチャートであ
る。先ず、テスト担当者はCRT21に表示された正規
プログラムに含まれているサブルーチンの中からテスト
を行いたいサブルーチンを指定する。この指定は、例え
ば、該指定サブルーチンの記述領域の前後をマーキング
することによって行う。このマーキングに基づいて、正
規プログラムから該指定サブルーチンを切り分ける処理
や修正後の上記指定サブルーチンを、再び正規プログラ
ムに挿入する処理が行われる(S201)。
FIG. 5 is a flow chart for explaining a process of automatically generating a test program from a regular program executed by the test program automatic generation section. First, the tester designates a subroutine to be tested from the subroutines included in the regular program displayed on the CRT 21. This designation is made, for example, by marking the front and back of the description area of the designated subroutine. Based on this marking, a process of separating the designated subroutine from the regular program and a process of inserting the corrected designated subroutine into the regular program again are performed (S201).

【0043】次に、正規プログラムからヘッダ部、及び
指定サブルーチンを取得する(S202)。続いて、上
記取得した指定サブルーチン内で記述されている各識別
子を解析し、入力変数、及び出力変数を抽出する。識別
子とは、例えば、“C”などのプログラミング言語で記
述されたプログラム内のマクロ命令、定数、変数、或い
は関数などに付ける名前のことであり、該識別子に基づ
いて入力変数、出力変数を抽出する(S203)。
Next, the header section and the designated subroutine are acquired from the regular program (S202). Subsequently, each identifier described in the acquired designated subroutine is analyzed to extract an input variable and an output variable. The identifier is a name given to a macro instruction, a constant, a variable, or a function in a program written in a programming language such as “C”, and extracts an input variable and an output variable based on the identifier. Yes (S203).

【0044】次に、上記抽出された入力変数に基づいて
入力処理部を生成する(S204)。更に、上記抽出さ
れた出力変数に基づいて出力処理部を生成する(S20
5)。
Next, an input processing unit is generated based on the extracted input variables (S204). Further, an output processing unit is generated based on the extracted output variable (S20).
5).

【0045】最後に、上記ステップS202で取得され
たヘッダ部と指定サブルーチン、上記ステップS204
で生成された入力処理部、及び上記ステップS205で
生成された出力処理部とを結合してテストプログラムを
生成する(S206)。
Finally, the header section acquired in step S202 and the designation subroutine, and step S204 described above.
The input processing unit generated in step S205 and the output processing unit generated in step S205 are combined to generate a test program (S206).

【0046】図6は、上記ステップS201の処理の詳
細を示したフローチャートである。マーキングは2種類
に大別され、その1つは指定サブルーチンを切り出した
後の正規プログラムに付加されるマーキングである挿入
用マーキングである。該挿入用マーキングは、指定サブ
ルーチンの最初の行の前と、該指定サブルーチンの最後
の行の後に付加される。該挿入用マーキングは、修正さ
れたサブルーチンを元の正規プログラムに戻す際の挿入
箇所を示すものである。
FIG. 6 is a flow chart showing details of the processing in step S201. The markings are roughly classified into two types, one of which is an insertion marking which is a marking added to a regular program after cutting out a designated subroutine. The insertion marking is added before the first line of the designated subroutine and after the last line of the designated subroutine. The insertion marking indicates an insertion point when the corrected subroutine is returned to the original regular program.

【0047】また、もう1つのマーキングは、指定サブ
ルーチンの最初の行、及び該指定サブルーチンの最後の
行に付加されるマーキングである取り出し用マーキング
である。該取り出し用マーキングは、修正された指定サ
ブルーチンを元の正規プログラムに戻す際の該修正され
た指定サブルーチンのポインタとして使用される。
Another marking is a marking for extraction which is a marking added to the first line of the designated subroutine and the last line of the designated subroutine. The extraction marking is used as a pointer of the modified designated subroutine when returning the modified designated subroutine to the original regular program.

【0048】先ず、テスト担当者は正規プログラム内で
検査したいサブルーチン(指定サブルーチン)を決め、
正規プログラム内での該指定サブルーチンの最初の行の
前と最後の行の後にマーキングを行う。例えば、図13
(a)に示すようなC言語で記述された正規プログラム
101を例にとると、テスト担当者が正規プログラム1
01の13〜17行目の前後
First, the tester decides a subroutine (designated subroutine) to be inspected in the regular program,
Marking is performed before the first line and after the last line of the designated subroutine in the regular program. For example, in FIG.
Taking the regular program 101 written in C language as shown in (a) as an example, the person in charge of testing is the regular program 1
Before and after the 13th to 17th lines of 01

【0049】[0049]

【数1】 [Equation 1]

【0050】に2つの特殊記号 外1 でマーキングを
行った場合、サブルーチンconvh
When the marking is performed with two special symbols 1 in, the subroutine convh

【0051】[0051]

【外1】 [Outside 1]

【0052】ex(ix)が指定サブルーチンとなる。
この時、2つの 外2 が挿入用マー
Ex (ix) is the designated subroutine.
At this time, the two outer 2 are insertion marks

【0053】[0053]

【外2】 [Outside 2]

【0054】キングとなる。尚、該挿入用マーキングと
して、コメント文を用いるようにしてもよい(S30
1)。次に、正規プログラムから上記2つの挿入用マー
キングで囲まれた指定サブルーチンを切り出し、これを
主記憶装置24内の別の領域に格納する(S302)。
Become the King. A comment sentence may be used as the insertion marking (S30).
1). Next, the designated subroutine surrounded by the two insertion markings is cut out from the regular program and stored in another area in the main memory 24 (S302).

【0055】最後に、該切り出され、格納された指定サ
ブルーチンの最初の行の前と、最後の行の後に取り出し
用マーキングを付加する。。この取り出し用マーキング
は、指定サブルーチンの修正時にも付加されたままとな
り、修正後のサブルーチンを正規プログラムに挿入する
際に使用される(S303)。
Finally, the extraction marking is added before the first line and after the last line of the cut out and stored designated subroutine. . The extraction marking remains added even when the designated subroutine is modified, and is used when the modified subroutine is inserted into the regular program (S303).

【0056】図7は、上記ステップS202の処理の詳
細を示したフローチャートである。先ず、正規プログラ
ムの中から上記挿入用マーキングを基に、指定サブルー
チンを検索すると共に、該正規プログラムのヘッダ部に
記述されているinclude文、外部変数、及びマク
ロ命令等の識別子を検索する。例えば、図13(a)に
示す正規プログラム101の場合には、1〜2行目の記
述から♯include <stdio.h> がin
clude文として、extern char hex
buf〔〕; から、hexbuf〔〕が外部変数とし
て検索される(S401)。
FIG. 7 is a flow chart showing details of the processing in step S202. First, the designated subroutine is searched from the regular program based on the above insertion marking, and at the same time, the include statement, the external variable, the macro instruction and the like described in the header of the regular program are searched. For example, in the case of the regular program 101 shown in FIG. 13A, from the description of the first and second lines, #include <stdio. h> is in
As a sentence statement, extern char hex
bubu []; is searched as hexbuf [] as an external variable (S401).

【0057】次に、正規プログラムから上記ステップS
401で検索されたinclude文、外部変数、及び
マクロ命令で構成されるヘッダ部、及び上記指定サブル
ーチンの本体を取得する(S402)。
Next, from the regular program, the above step S
The include statement retrieved in 401, the external variable, and the header section including the macro instruction and the main body of the designated subroutine are acquired (S402).

【0058】図8は、上記ステップS203の処理の詳
細を示したフローチャートである。先ず、上記ステップ
S402で取得した指定サブルーチンの先頭行から識別
子を検索する。このステップは、2回目以降は次の識別
子を検索するものである(S501)。
FIG. 8 is a flow chart showing details of the processing in step S203. First, the identifier is searched from the first line of the designated subroutine acquired in step S402. This step is to search for the next identifier after the second time (S501).

【0059】次に、上記識別子の検索結果から、識別子
が存在するか否かを判定する。すなわち、指定サブルー
チンの全ての行について、識別子の検索が終了したか否
かを判定する。識別子が存在しない場合(S502,N
o)は、指定サブルーチン内で記述されている全ての識
別子の抽出が終了したのが処理を終了する。一方、識別
子が存在する場合(S502,Yes)には、該識別子
がマクロ命令であるか否かを判定する。該識別子がマク
ロ命令の場合(S503,Yes)には、入力変数、出
力変数のいずれでもないので、上記ステップS501へ
戻り次の識別子を検索する。また、該識別子がマクロ命
令でない場合(S503,No)には、次に、上記識別
子が関数であるか否かを判定する(S504)。該識別
子が関数の場合(S504,Yes)には、入力変数、
出力変数のいずれでもないので、S501へ戻り次の識
別子を検索する。一方、該識別子が関数でない場合(S
504,No)には、該識別子が引数であるか否かを判
定する。該識別子が引数の場合(S505,Yes)に
は入力変数であると判定して、主記憶装置204内に作
成された不図示の入出力変数テーブルに該引数を設定す
ると共に、該引数に対応して設けられた入力変数フラグ
を立てる(S506)。例えば、図13(a)の13行
目の記述 convhex (ix) からixが引数であると判断され、入力変数として設定
される。
Next, it is judged from the search result of the above identifier whether or not the identifier exists. That is, it is determined whether the identifier search has been completed for all the lines of the designated subroutine. If no identifier exists (S502, N
In o), the process ends when the extraction of all the identifiers described in the designated subroutine is completed. On the other hand, if the identifier exists (S502, Yes), it is determined whether the identifier is a macro instruction. If the identifier is a macro instruction (S503, Yes), it is neither an input variable nor an output variable, so the process returns to step S501 to search for the next identifier. If the identifier is not a macro instruction (S503, No), then it is determined whether the identifier is a function (S504). If the identifier is a function (S504, Yes), the input variable,
Since it is not one of the output variables, the process returns to S501 to search for the next identifier. On the other hand, if the identifier is not a function (S
No. 504, No), it is determined whether the identifier is an argument. When the identifier is an argument (S505, Yes), it is determined to be an input variable, the argument is set in the input / output variable table (not shown) created in the main storage device 204, and the corresponding argument is set. Then, the provided input variable flag is set (S506). For example, it is determined from the description convhex (ix) on the 13th line in FIG. 13A that ix is an argument and is set as an input variable.

【0060】また、該識別子が引数でない場合(S50
5,No)には、該識別子が返値(戻り値)であるか否
かを判定する。該識別子が返値である場合(S507,
Yes)には該識別子は出力変数であると判定して、前
記入出力変数テーブルに該識別子名を設定すると共に、
それに対応付けられた出力変数フラグを立てる(S50
8)。さらに、該識別子が返値でない場合(S507,
No)には、該識別子が外部変数であるか否かの判定を
前記ステップS402で抽出した全ての外部変数と照合
することにより行う。該識別子が外部変数の場合(S5
09,Yes)には、更に該外部変数が入力変数または
出力変数のいずれであるかを判定する(S510)。
尚、該識別子が外部変数でない場合(S509,No)
には、上記S501へ戻り次の識別子を検索する。
If the identifier is not an argument (S50
5, No), it is determined whether or not the identifier is a return value (return value). If the identifier is a return value (S507,
Yes), the identifier is determined to be an output variable, the identifier name is set in the input / output variable table, and
An output variable flag associated with it is set (S50
8). Furthermore, if the identifier is not the return value (S507,
No), the determination as to whether or not the identifier is an external variable is made by collating all the external variables extracted in step S402. If the identifier is an external variable (S5
(09, Yes), it is further determined whether the external variable is an input variable or an output variable (S510).
When the identifier is not an external variable (S509, No)
To return to step S501, the next identifier is searched.

【0061】次に、上記ステップS510の判定処理の
詳細を、図9のフローチャートを用いて以下に説明す
る。先ず、外部変数を含む命令文に代入演算子が含まれ
ているか否かを判定する。代入演算子が含まれていない
場合(S601,No)には、該外部変数を入力変数と
判定する。例えば、図13(a)の16行目に外部変数
であるhexbufを含んだ命令sprintf(he
xbuf,”%04d¥n”,ix)があるが、この命
令文には代入演算子が含まれていないので、外部変数h
exbufは入力変数として判定する。
Next, the details of the determination processing in step S510 will be described below with reference to the flowchart in FIG. First, it is determined whether the imperative sentence including the external variable includes the assignment operator. When the assignment operator is not included (S601, No), the external variable is determined as the input variable. For example, in the 16th line in FIG. 13A, the instruction printf (he containing the external variable hexbuf is included.
xbuf, "% 04d \ n", ix), but since this statement does not include an assignment operator, the external variable h
exbuf is determined as an input variable.

【0062】また、代入演算子が含まれている場合(S
601,Yes)には、外部変数が代入演算子に対して
右辺であるか、左辺であるかを判定する。該外部変数が
代入演算子に対して右辺である場合(S602,Ye
s)には、それを入力変数として識別し、前記入出力変
数テーブルに該識別子名を設定すると共に、該識別子名
に対応して設けられた入力変数フラグを立てる。また、
該外部変数が代入演算子に対して左辺である場合(S6
02,No)には、出力変数として識別し、前記入出力
変数テーブルに該識別子名を設定すると共に、それに対
応付けられた出力変数フラグを立てる。
When the assignment operator is included (S
No. 601, Yes) determines whether the external variable is on the right side or the left side of the assignment operator. When the external variable is on the right side of the assignment operator (S602, Ye
In s), it is identified as an input variable, the identifier name is set in the input / output variable table, and an input variable flag provided corresponding to the identifier name is set. Also,
When the external variable is on the left side of the assignment operator (S6
No. 02, No) is identified as an output variable, the identifier name is set in the input / output variable table, and an output variable flag associated with it is set.

【0063】次に、上記ステップS204の処理の詳細
を、図10のフローチャートを用いて以下に説明する。
先ず、上記入出力変数テーブルの中で、入力変数フラグ
が立っている入力変数を検索する。次に、該検索によっ
て抽出された入力変数の型が文字型か否かを判定する。
そして、該入力変数の型が文字型の場合(S701,Y
es)には、後述するステップS703へ進む。また、
該入力変数の型が文字型でない場合(S701,No)
には、該入力変数の標準入力データを文字型から数値型
へ変換する処理を生成する(S702)。これは、標準
入力としてキーボード202から入力される変数のデー
タは文字型としてCPU25に入力されるので、CPU
25内部で上記入力変数を数値型として処理するために
は、該入力変数を文字型から数値型へ変換処理が必要と
なるからである。例えば、図13(b)の下欄の6行目
で、入力変数(引数)ixはmain( )内部で整数
型として定義されているので、この変換処理が必要とな
る。図13(b)の下欄の8行目の scanf(”%d”,&ix); の括弧内の記述がこの処理によって追加・生成されるも
のに相当する。
Details of the processing in step S204 will be described below with reference to the flowchart of FIG.
First, the input / output variable table is searched for an input variable for which an input variable flag is set. Next, it is determined whether the type of the input variable extracted by the search is the character type.
When the type of the input variable is the character type (S701, Y
es), the process proceeds to step S703 described below. Also,
When the type of the input variable is not the character type (S701, No)
In step S702, the standard input data of the input variable is converted from the character type to the numeric type (S702). This is because the variable data input from the keyboard 202 as standard input is input to the CPU 25 as a character type.
This is because in order to process the input variable as a numeric type inside 25, it is necessary to convert the input variable from a character type to a numeric type. For example, in the sixth line in the lower column of FIG. 13B, the input variable (argument) ix is defined as an integer type inside main (), so this conversion process is necessary. The description in parentheses of scanf (“% d”, &ix); on the 8th line in the lower column of FIG. 13B corresponds to that added / generated by this process.

【0064】次に、各入力変数について標準入力処理を
生成する(S703)。例えば、図13(b)の下欄の
8行目のscanf()がこの標準入力処理に相当す
る。また、入力変数が文字型の場合には(S701,Y
es)、標準入力変数の型変換を行い標準入力処理を生
成する(S703)。
Next, a standard input process is generated for each input variable (S703). For example, scanf () on the 8th line in the lower column of FIG. 13B corresponds to this standard input process. If the input variable is a character type (S701, Y
es), standard input variable type conversion is performed to generate standard input processing (S703).

【0065】上記ステップS701〜703の処理を全
ての入力変数に対して実行することにより、テストプロ
グラムの入力処理部を生成する。次に、上記ステップS
205の出力処理部の生成処理の詳細を、図11のフロ
ーチャートを用いて以下に説明する。
The input processing unit of the test program is generated by executing the processing of steps S701 to 703 for all the input variables. Next, the above step S
Details of the generation processing of the output processing unit 205 will be described below with reference to the flowchart of FIG. 11.

【0066】先ず、主記憶装置24内に設けられた上記
入出力変数テーブルの中で、出力変数フラグが立ってい
る識別子を検索する。続いて、該検索によって抽出され
た出力の変数が文字型か否かを判定する(S801)。
そして、該識別子の変数の型が文字型の場合(S80
1,Yes)には、後述するステップS803へ進む。
一方、該出力の変数が文字型でない場合(S801,N
o)には、数値から文字への変換処理を生成する(S8
02)。これは、標準出力処理において表示装置21へ
表示する変数は文字型でなければならないからである。
First, in the input / output variable table provided in the main memory 24, an identifier for which an output variable flag is set is searched. Then, it is determined whether the output variable extracted by the search is a character type (S801).
Then, if the variable type of the identifier is a character type (S80
1, Yes), the process proceeds to step S803 described below.
On the other hand, if the output variable is not a character type (S801, N
In (o), a conversion process from a numerical value to a character is generated (S8).
02). This is because the variable displayed on the display device 21 in the standard output process must be a character type.

【0067】次に、各出力変数について標準出力処理を
生成する(S803)。例えば、図13(b)の下欄の
10行目 printf(”%S¥n”,hexbuf); がこの標準出力処理に相当する。この場合、出力変数h
exbufが文字列であるので、上記ステップS802
の処理は省略され、printf()の括弧内には出力
変数を文字に変換する処理は含まれていない。
Next, a standard output process is generated for each output variable (S803). For example, the 10th line printf (“% S ¥ n”, hexbuf); in the lower column of FIG. 13B corresponds to this standard output process. In this case, the output variable h
Since exbuf is a character string, the above step S802
Is omitted, and the process of converting the output variable to a character is not included in the parentheses of printf ().

【0068】上記ステップS801〜S803の処理
を、上記入出力変数テーブルに登録されている全ての出
力変数に対して施すことにより目的とするテストプログ
ラムの出力処理部が生成される。
By subjecting all the output variables registered in the input / output variable table to the processes of steps S801 to S803, the output processing unit of the target test program is generated.

【0069】以上の処理により、図13(a)に示す正
規プログラム101から図13(b)の下欄に示す1〜
2行目がヘッダ部、4〜11行目がメイン部、及び13
〜16行目が指定サブルーチンconvhex(ix)
から成るテストプログラムが生成される。このテストプ
ログラムにおいて、新規に自動生成されるのはメイン部
である。メイン部である4〜11行目の内、4〜6行目 は、上記では特に説明しなかったが自動的に生成され
る。
By the above processing, from the regular program 101 shown in FIG. 13A to the one shown in the lower column of FIG.
The second line is the header part, the 4th to 11th lines are the main part, and 13
Line 16 is the designated subroutine convhex (ix)
A test program consisting of In this test program, it is the main part that is automatically generated. Of the 4th to 11th lines, which are the main part, the 4th to 6th lines Is automatically generated although not specifically described above.

【0070】次に、テスト担当者は上述のようにして自
動生成されたテストプログラムを実行して、指定したサ
ブルーチンのデバッグ作業を開始する。テスト担当者
は、図13(b)下欄のテストプログラムを、キーボー
ド22を介して実際に実行し、表示装置21に表示され
るその実行結果を解析することにより、該指定サブルー
チン内の sprintf(hexbuf,”%04d¥n”,i
x); という記述において、その括弧内の書式制御文字列中の
“d”の記述に誤りがあることを発見する。すなわち、
“d”はC言語において入力が整数の場合、それを10
進数と解釈させるものであり、入力される整数を16進
数表現で表示させるサブルーチンであるconvhex
(ix)においては誤りとなる。したがって、テスト担
当者は、エディタを起動して“d”を“x”に修正して
指定サブルーチンconvhex(ix)を修正する。
Next, the tester executes the test program automatically generated as described above, and starts the debugging work of the designated subroutine. The tester actually executes the test program in the lower column of FIG. 13B via the keyboard 22 and analyzes the execution result displayed on the display device 21 to determine the printf () in the designated subroutine. hexbuf, "% 04d \ n", i
x) ;, it is found that there is an error in the description of "d" in the format control character string in the parentheses. That is,
“D” is 10 when the input is an integer in C language.
Convhex, which is a subroutine that interprets the input integer in hexadecimal notation
It becomes an error in (ix). Therefore, the tester activates the editor, modifies "d" to "x", and modifies the designated subroutine convhex (ix).

【0071】図12は、上記修正された指定サブルーチ
ンを含むテストプログラム(修正後のテストプログラ
ム)から、該修正された指定サブルーチンを含む正規プ
ログラムを生成する処理を示すフローチャートである。
FIG. 12 is a flow chart showing a process for generating a regular program including the corrected designated subroutine from the test program including the corrected designated subroutine (corrected test program).

【0072】先ず、上記修正後のテストプログラムから
修正されたサブルーチンを取り出す。この処理は、図1
3(b)下欄に示すように、テストプログラム内の指定
サブルーチンconvhex(ix)の前後にそれぞれ
取り出し用マーキング 外3が付加されているので、こ
の取り出し用マーキングを基に上記テストプログラ
First, the modified subroutine is extracted from the modified test program. This process is shown in FIG.
3 (b) As shown in the lower column, since the extraction marking outside 3 is added before and after the designated subroutine convhex (ix) in the test program, the above-mentioned test program is based on this extraction marking.

【0073】[0073]

【外3】 [Outside 3]

【0074】ムからその12〜16行目に記述された修
正後の指定サブルーチンを切り出す(S901)。次
に、上記指定サブルーチンが切り出された正規プログラ
ムにおいて挿入用マーキングを検索し、該挿入用マーキ
ングが付加された箇所に上記修正後の指定サブルーチン
を挿入する(S902)。例えば、図13の具体例の場
合には同図(b)上欄に示すように、上記指定サブルー
チンが抜き出された正規プログラムの12行目の後に2
つの挿入用マーキングが付加されているのを検出し、同
図(c)に示すように、該正規プログラムの13行目以
降に上記修正後の指定サブルーチンを挿入することによ
って新たな正規プログラムを生成する。
The corrected designated subroutine described on lines 12 to 16 is cut out from the frame (S901). Next, the marking program for insertion is searched for in the regular program from which the designated subroutine is cut out, and the modified designated subroutine is inserted at the place where the marking for insertion is added (S902). For example, in the case of the concrete example of FIG. 13, as shown in the upper column of FIG.
It is detected that one insertion marking is added, and a new regular program is generated by inserting the modified designated subroutine into the 13th line and subsequent lines of the regular program, as shown in FIG. To do.

【0075】図14は、C言語で記述されたサブルーチ
ンをデバッグする処理において、テストプログラムの生
成からデバッグの完了した指定サブルーチンを正規プロ
グラムに反映するまでの工程を示す図である。
FIG. 14 is a diagram showing steps in the process of debugging a subroutine described in C language, from the generation of the test program to the reflection of the designated subroutine for which debugging has been completed in the regular program.

【0076】C言語の場合、テストプログラム401
は、ヘッダ部404、メイン部405、及び指定サブル
ーチン406から構成される。ヘッダ部404は、I/
F生成処理部33により生成され、include文、
マクロ、外部変数からなり、具体的には、上述した図1
3(b)下欄の1〜2行目に示す ♯include <stdio.h> extern char hexbuf〔〕; が相当する。この場合には、マクロが無い。
In the case of C language, the test program 401
Is composed of a header section 404, a main section 405, and a designation subroutine 406. The header section 404 is I /
Generated by the F generation processing unit 33, and includes a sentence
It consists of macros and external variables.
3 (b) #include <stdio. h> extern char hexbuf []; corresponds. In this case, there is no macro.

【0077】メイン部405は、入力処理部、サブルー
チン呼び出し、及び出力処理部からなる。入力処理部
は、上記入出力生成処理部34で自動的に生成され、具
体的には、上述した図13(b)下欄の8行目に記述さ
れた標準入力処理ルーチン scanf(”%d”,&ix); が該当する。
The main section 405 comprises an input processing section, a subroutine call, and an output processing section. The input processing unit is automatically generated by the input / output generation processing unit 34. Specifically, the standard input processing routine scanf (“% d” described in the lower line of the lower column of FIG. ", &Ix); is applicable.

【0078】また、サブルーチン呼び出しは、上記プロ
グラム管理装置制御部31で自動的に生成される。具体
的には、上述した図13(b)下欄の9行目に記述され
た convhex(ix); が該当する。
The subroutine call is automatically generated by the program management device controller 31. Specifically, the above corresponds to convhex (ix); described in the ninth line of the lower column of FIG. 13 (b).

【0079】出力処理部は、上記入出力生成処理部34
により自動的に生成され、具体的には、上述した図13
(b)下欄の10行目に記述された標準出力処理ルーチ
ン printf(”%S¥n”,hexbuf); が該当する。
The output processing unit is the input / output generation processing unit 34.
Automatically generated by the above, specifically, as shown in FIG.
(B) The standard output processing routine printf (“% S ¥ n”, hexbuf); described in the 10th line in the lower column corresponds to the standard output processing routine.

【0080】指定サブルーチン406は、操作者によっ
て指定されるデバッグ対象となるサブルーチンであり、
具体的には、図13(b)下欄の12〜16行目に記述
されている convhex(ix) int ix; { sprintf(hexbuf,”%04d¥n”,ix); } の一連のステートメントが該当する。
The designated subroutine 406 is a subroutine to be debugged designated by the operator.
Specifically, a series of statements of convhex (ix) int ix; {printf (hexbuf, “% 04d \ n”, ix);} described in lines 12 to 16 in the lower column of FIG. 13B. Is applicable.

【0081】テスト担当者は、テストプログラム401
を、CPU25上で実際に実行させて、表示装置21の
画面を見ながら対話形式で指定サブルーチン406のデ
バッグを行う。そして、該デバッグにより該指定サブル
ーチンにバグが見つかると、エディタを起動してテスト
プログラム401内の上記指定サブルーチンのバグの箇
所を修正する。これに伴って、該修正後のサブルーチン
を含むテストプログラム402が作成される(図14
(b))。
The tester is the test program 401.
Is actually executed on the CPU 25, and the designated subroutine 406 is debugged interactively while watching the screen of the display device 21. Then, when a bug is found in the designated subroutine by the debugging, the editor is activated to correct the bug portion of the designated subroutine in the test program 401. Along with this, the test program 402 including the modified subroutine is created (FIG. 14).
(B)).

【0082】このようにして、指定サブルーチンのデバ
ッグが終了すると、上記テストプログラム402は、プ
ログラム分割/結合処理部32によって図14(c)に
示すように、ヘッダ部404、メイン部405、及び修
正後の指定サブルーチン407に分割される。
When the debugging of the designated subroutine is completed in this way, the test program 402 is processed by the program division / combination processing unit 32 as shown in FIG. It is divided into the later designated subroutine 407.

【0083】続いて、上記プログラム分割/結合処理部
32は、ヘッダ部404、第1の指定外サブルーチン4
08、修正後の指定サブルーチン407、及び第2の指
定外サブルーチン409を結合して、指定サブルーチン
406のデバッグが完了した正規プログラム403を生
成する。
Subsequently, the program division / combination processing unit 32 is configured to execute the header unit 404 and the first undesignated subroutine 4
08, the modified designated subroutine 407, and the second undesignated subroutine 409 are combined to generate the regular program 403 in which the debugging of the designated subroutine 406 is completed.

【0084】このようなテスト工程を順次、サブルーチ
ン408,409にも施すことによって、正規プログラ
ムのバグを解消することが可能になる。上記実施例で
は、C言語で記述されたプログラムを例にとって説明し
たが、本発明はC言語以外のプログラミング言語、例え
ば、FORTRANやCOBOLなどで記述されたソー
スプログラム内のサブルーチンのテストにも容易に適用
可能なものである。また、該サブルーチンが外部サブル
ーチンである場合、または該サブルーチンがさらに他の
外部サブルーチンをコールしている場合でも、それらが
記述されているソースプログラムを参照することによっ
て、指定されたサブルーチンを単体でテストするための
テストプログラムを作成することが可能である。
By sequentially subjecting the subroutines 408 and 409 to such test steps, it is possible to eliminate bugs in the regular program. In the above embodiment, the program written in the C language was described as an example, but the present invention can easily test a subroutine in a source program written in a programming language other than the C language, for example, FORTRAN or COBOL. It is applicable. Also, even if the subroutine is an external subroutine, or even if the subroutine calls another external subroutine, the specified subroutine is tested by itself by referring to the source program in which they are described. It is possible to create a test program to do this.

【0085】[0085]

【発明の効果】本発明によれば、サブルーチン(または
関数)をコールしているソースプログラムをテストする
際、該ソースプログラム内のサブルーチンを指定するだ
けで、自動的にそのサブルーチン用の単体テストプログ
ラムを自動生成するので、該単体テストプログラムを短
時間かつ、正確に作成することが可能になる。また、こ
れにより、サブルーチン単位でのテストを効率良く実施
することができ、該サブルーチン内部における修正箇所
を短時間で発見することも可能になる。従って、ソース
プログラムのデバッグ効率が向上し、ソフトウェアの信
頼性が向上すると共に、その生産性も高めることが可能
となる。
According to the present invention, when a source program calling a subroutine (or a function) is tested, it is possible to automatically specify a unit test program for the subroutine by simply designating the subroutine in the source program. Since it is automatically generated, the unit test program can be created accurately in a short time. Further, this makes it possible to efficiently carry out a test in units of subroutines, and it is also possible to find a corrected portion inside the subroutine in a short time. Therefore, the debugging efficiency of the source program is improved, the reliability of the software is improved, and the productivity thereof can be improved.

【図面の簡単な説明】[Brief description of drawings]

【図1】本発明の一実施例の全体構成を示すブロック図
である。
FIG. 1 is a block diagram showing the overall configuration of an embodiment of the present invention.

【図2】本発明のテストプログラム自動生成部のモジュ
ール構成を示す図である。
FIG. 2 is a diagram showing a module configuration of a test program automatic generation unit of the present invention.

【図3】本実施例の全体的な処理の流れを説明する図で
ある。
FIG. 3 is a diagram illustrating an overall processing flow of the present embodiment.

【図4】本実施例におけるデバッグ処理の全体の処理手
順を示すゼネラル・フローチャートである。
FIG. 4 is a general flow chart showing an entire processing procedure of debug processing in the present embodiment.

【図5】正規プログラムからテストプログラムを自動生
成する処理を説明するフローチャートである。
FIG. 5 is a flowchart illustrating a process of automatically generating a test program from a regular program.

【図6】指定サブルーチンのマーキング処理を説明する
フローチャートである。
FIG. 6 is a flowchart illustrating a marking process of a designated subroutine.

【図7】正規プログラムからヘッダ部、及び指定サブル
ーチンを取得する処理を説明するフローチャートであ
る。
FIG. 7 is a flowchart illustrating a process of acquiring a header part and a designated subroutine from a regular program.

【図8】入力変数、及び出力変数の抽出処理を説明する
フローチャートである。
FIG. 8 is a flowchart illustrating an extraction process of an input variable and an output variable.

【図9】外部変数の解析処理を説明するフローチャート
である。
FIG. 9 is a flowchart illustrating an external variable analysis process.

【図10】入力処理部の生成処理を説明するフローチャ
ートである。
FIG. 10 is a flowchart illustrating a generation process of an input processing unit.

【図11】出力処理部の生成処理を説明するフローチャ
ートである。
FIG. 11 is a flowchart illustrating a generation process of an output processing unit.

【図12】修正された指定サブルーチンを含む正規プロ
グラムを生成する処理を説明するフローチャートであ
る。
FIG. 12 is a flowchart illustrating a process of generating a regular program including a modified designated subroutine.

【図13】C言語で記述された正規プログラムから修正
後の正規プログラムを生成する処理の流れを説明する図
である。
FIG. 13 is a diagram illustrating a flow of processing for generating a modified regular program from a regular program written in C language.

【図14】テストプログラムの生成からデバッグの完了
した指定サブルーチンを正規プログラムに反映するまで
の工程を示す図である。
FIG. 14 is a diagram showing steps from generation of a test program to reflection of a designated subroutine for which debugging has been completed in a regular program.

【符号の説明】[Explanation of symbols]

21 表示装置 22 キーボード 23 外部記憶装置 24 主記憶装置 25 CPU 31 プログラム管理装置制御部 32 プログラム分割/結合処理部 33 I/F生成処理部 34 入出力生成処理部 101 プログラム 102 単体のテストプログラム 103 修正後の単体のテストプログラム 104 修正後のプログラム 105 ヘッダ部 106 第1の指定外サブルーチン 107 指定サブルーチン 108 第2の指定外サブルーチン 109 ヘッダ部+入力部 110 出力部 111 修正後の指定サブルーチン 21 display device 22 keyboard 23 external storage device 24 main storage device 25 CPU 31 program management device control unit 32 program division / coupling processing unit 33 I / F generation processing unit 34 input / output generation processing unit 101 program 102 unit test program 103 correction Subsequent unit test program 104 Modified program 105 Header section 106 First undesignated subroutine 107 Designated subroutine 108 Second undesignated subroutine 109 Header section + Input section 110 Output section 111 Modified designated subroutine

Claims (2)

【特許請求の範囲】[Claims] 【請求項1】 ソースプログラムから指定されたサブル
ーチンを抽出するサブルーチン抽出手段と、 該サブルーチン抽出手段によって抽出されたサブルーチ
ンの内容を解析して、該サブルーチンの外部入出力イン
タフェース情報を抽出するインタフェース情報抽出手段
と、 該インタフェース情報抽出手段で抽出された外部入出力
インタフェース情報に基づいて、前記指定サブルーチン
の外部入力変数の値を設定するための処理を実行する入
力処理部と、前記指定サブルーチンの外部出力変数の値
を出力するための処理を実行する出力処理部とを生成す
る入出力処理部生成手段と、 該入出力処理部生成手段によって生成された前記入力処
理部と前記出力処理部、及び前記サブルーチン抽出手段
によって抽出されたサブルーチンを結合して、前記指定
サブルーチンの単体テスト用プログラムを生成するテス
トプログラム生成手段と、 を有することを特徴とするプログラム管理装置。
1. Subroutine extraction means for extracting a designated subroutine from a source program, and interface information extraction for analyzing external input / output interface information of the subroutine by analyzing the contents of the subroutine extracted by the subroutine extraction means. Means, an input processing unit for executing processing for setting a value of an external input variable of the designated subroutine based on the external input / output interface information extracted by the interface information extraction means, and an external output of the designated subroutine. An input / output processing unit generating unit that generates an output processing unit that executes a process for outputting the value of the variable; the input processing unit and the output processing unit that are generated by the input / output processing unit generation unit; By combining the subroutines extracted by the subroutine extracting means, A program management device comprising: a test program generation unit that generates a unit test program for a designated subroutine.
【請求項2】 前記テストプログラム生成手段によって
生成されたテストプログラムの実行によって修正がなさ
れた前記指定されたサブルーチンを、元のソースプログ
ラム内の修正前の前記指定サブルーチンと置き換えて、
新たなソースプログラムを生成する新規ソースプログラ
ム生成手段、 を更に有することを特徴とする請求項1記載のプログラ
ム管理装置。
2. The specified subroutine, which has been modified by the execution of the test program generated by the test program generating means, is replaced with the specified subroutine before modification in the original source program,
The program management device according to claim 1, further comprising: a new source program generation unit that generates a new source program.
JP7015873A 1995-02-02 1995-02-02 Program managing device Pending JPH08212105A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP7015873A JPH08212105A (en) 1995-02-02 1995-02-02 Program managing device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP7015873A JPH08212105A (en) 1995-02-02 1995-02-02 Program managing device

Publications (1)

Publication Number Publication Date
JPH08212105A true JPH08212105A (en) 1996-08-20

Family

ID=11900923

Family Applications (1)

Application Number Title Priority Date Filing Date
JP7015873A Pending JPH08212105A (en) 1995-02-02 1995-02-02 Program managing device

Country Status (1)

Country Link
JP (1) JPH08212105A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2004318887A (en) * 2003-04-14 2004-11-11 Microsoft Corp Method for testing object
US7739664B2 (en) 2002-10-17 2010-06-15 International Business Machines Corporation Collection and detection of differences of values of expressions/variables when debugging a computer process

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7739664B2 (en) 2002-10-17 2010-06-15 International Business Machines Corporation Collection and detection of differences of values of expressions/variables when debugging a computer process
JP2004318887A (en) * 2003-04-14 2004-11-11 Microsoft Corp Method for testing object

Similar Documents

Publication Publication Date Title
US8966449B2 (en) Test case pattern matching
EP0785510B1 (en) Program debugging system for debugging a program having a graphical user interface
US8219980B2 (en) Identifying a potential breakpoint location in a code path in a computer program based upon the frequency of execution of the code path as identified in collected profile data
US7100150B2 (en) Method and apparatus for testing embedded examples in GUI documentation
CN101739339B (en) Program dynamic dependency relation-based software fault positioning method
JP4249309B2 (en) Relocatable measurement tags for testing and debugging computer programs
US20070300209A1 (en) Run into function
JPH02272645A (en) Method for supporting program debugging
US7895575B2 (en) Apparatus and method for generating test driver
JPH0950389A (en) Apparatus and method for mounting by using computer system
CN110069404B (en) Code debugging method, device, equipment and medium
JP2000122886A (en) Program production system of semiconductor testing device
JPH0748182B2 (en) Program error detection method
JPH08212105A (en) Program managing device
JP2010287101A (en) Software debugging device and method
US20070168978A1 (en) Computer program code debugging method and system
JPH11224211A (en) Software inspection support device
CN114281709A (en) Unit testing method, system, electronic equipment and storage medium
JPH0588939A (en) Subprogram simplex test system
JP3167386B2 (en) Automatic program parallelization method
JPH05250221A (en) Simulator execution system
JPH06242943A (en) Source code level debugging device
JPH07134664A (en) Program bug latent area sampling method
JPH04162149A (en) Electronic computer
JP2003280944A (en) Support system for testing software