JPH02103644A - Method for testing software module - Google Patents

Method for testing software module

Info

Publication number
JPH02103644A
JPH02103644A JP63256476A JP25647688A JPH02103644A JP H02103644 A JPH02103644 A JP H02103644A JP 63256476 A JP63256476 A JP 63256476A JP 25647688 A JP25647688 A JP 25647688A JP H02103644 A JPH02103644 A JP H02103644A
Authority
JP
Japan
Prior art keywords
sut
test
module
information
data
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
JP63256476A
Other languages
Japanese (ja)
Inventor
Mitsuru Yokoyama
充 横山
Junichi Mizoguchi
溝口 潤一
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.)
Hewlett Packard Japan Inc
Original Assignee
Yokogawa Hewlett Packard 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 Yokogawa Hewlett Packard Ltd filed Critical Yokogawa Hewlett Packard Ltd
Priority to JP63256476A priority Critical patent/JPH02103644A/en
Publication of JPH02103644A publication Critical patent/JPH02103644A/en
Pending legal-status Critical Current

Links

Landscapes

  • Debugging And Monitoring (AREA)

Abstract

PURPOSE:To perform a perfect module test by using the information delivered to the interface of a module to be tested (SUT) for calling the SUT and calling information of the SUT to another module as the information representing the behavior of the SUT. CONSTITUTION:A test attendant 101 gives the interface information 103 of an SUT 109 to an automatic deriver stab preparing program 105. The information 103 contains a list of parameters for calling the SUT 109 and another list of parameters for discriminating global variables used by the SUT 109 and of modules called by the SUT 109 and used for describing input-output interfaces performed between the SUT 109 and its higheer- and lower-rank modules. Therefore, the behavior of the SUT 109 viewed from the lower-rank side interface can be observed in addition to the behavior viewed from the higher-rank side interface without changing the SUT 109 itself. Thus a perfect module test can be performed.

Description

【発明の詳細な説明】 〔発明の技術分野〕 本発明はソフトウェアのテスト方法に関し、特にモジュ
ール単位でのテスト方法に関する。
DETAILED DESCRIPTION OF THE INVENTION [Technical Field of the Invention] The present invention relates to a software testing method, and particularly to a testing method for each module.

〔従来技術およびその問題点〕[Prior art and its problems]

ソフトウェアの信頼性を高めるための一つの手段として
、充分なテストを開発のライフサイクル中でできるだけ
早期に行うことが挙げられる。
One way to increase the reliability of software is to perform sufficient testing as early as possible in the development lifecycle.

ある程度以上大規模なソフトウェアは階層構造をなす多
くのモジュールから構成されている。このような構造を
有するソフトウェアのテストを行う手法として、トップ
ダウン法、ボトムアップ法、サンドインチ法、ビッグパ
ン法(big−bangtesting)などがある。
Software that is larger than a certain level is composed of many modules that form a hierarchical structure. Methods for testing software having such a structure include a top-down method, a bottom-up method, a sandwich method, and a big-bang testing method.

トップダウン法は、最上位のモジュールを先ずテストし
、その後はその直下のモジュールをテストが終わったモ
ジュールに付加してテストを行うという手続きを最下位
のモジュールの付加・テストまで繰り返す。すなわち、
このテストが終了した時点で、全モジュールのインテグ
レーションも終わっている。
In the top-down method, the top-level module is first tested, and then the modules immediately below it are added to the tested module and tested, and the procedure is repeated until the lowest-level module is added and tested. That is,
At the end of this test, all modules have been integrated.

ボトムアップ法は、トップダウン法とは逆に、最下位の
モジュールから始めて、上位のモジュールを付加しなが
らテストを進めるものである。
In contrast to the top-down method, the bottom-up method starts with the lowest-level module and proceeds with testing while adding higher-level modules.

サンドインチ法は、トップダウン法とボトムアップ法の
折衷的なものであり、両方法を同時に進める。
The Sand Inch method is a compromise between top-down and bottom-up methods, in which both methods are carried out simultaneously.

これら3種類のテストにおいては、モジュールの作成と
テストを並行して行うためには、モジュールを作成する
順序が決まってしまう。例えば、トップダウン法では上
位のモジュールができない限り、下位のモジュールのテ
ストができない。そのため、一部のモジュールのスケジ
ュールの遅れが全体に影響しやすい。また、このように
インテグレーションとテストが同時進行する方法では、
インテグレーションが進んでくると大きくかつ複雑な動
作をするソフトウェアをテストすることになるので、障
害の発見やその切り分けが次第に困難になるという問題
がある。
In these three types of tests, in order to perform module creation and testing in parallel, the order in which modules are created is determined. For example, in the top-down method, lower-level modules cannot be tested unless higher-level modules are completed. Therefore, schedule delays in some modules are likely to affect the entire project. Also, in this method of simultaneous integration and testing,
As integration progresses, large and complex software must be tested, making it increasingly difficult to detect and isolate failures.

これに対して、ビッグパン法では一つ一つのモジュール
について単体でテストを行うので、上述の開発スケジュ
ールの自由度や障害の発見・切り分けの問題は解消され
る。しかしながら、この方法には以下で説明するような
問題点があるため、多数のモジュールを含むソフトウェ
アの開発に適用するのには適さなかった。
On the other hand, in the big punch method, each module is tested individually, so the above-mentioned problems of flexibility in the development schedule and finding and isolating failures are resolved. However, this method has problems as described below, so it is not suitable for application to the development of software containing a large number of modules.

ソフトウェアを構成するモジュールは上位側のモジュー
ルから呼び出され、また下位のモジュールを呼び出す、
すなわち他のモジュールと関連しながら動作している。
The modules that make up the software are called by higher-level modules, which also call lower-level modules.
In other words, it operates in conjunction with other modules.

ビッグパン法ではモジュール単体でのテストを全てのモ
ジュールについて行うので、モジュール毎に当該モジュ
ールを直接呼び出すあるいはそれから呼び出されるモジ
ュールに代わるダミーのモジュール群等のテスト環境を
用意する必要がある。準備しなければならないテスト環
境はモジュール数が多くなると膨大なものとなり、テス
トに要するコストや時間が許容しかいはどのものになっ
てしまう。
Since the big bread method tests all modules individually, it is necessary to prepare a test environment for each module, such as a group of dummy modules that directly call the module or replace the modules that will be called. The test environment that must be prepared becomes enormous as the number of modules increases, and the amount of cost and time required for testing becomes acceptable.

また、従来のモジュール・テストでは、そのモジュール
の機能の代用特性として、モジュール内部の制御の流れ
の径路や分岐に関する情報を取得するという、いわゆる
ホワイトボックス・テストが採用されることが多かった
。しかし、ホワイトボックス・テストでは制御の流れは
見えるが情報の流れは見えないので、必ずしも満足でき
るものではなかった。一方、従来のモジュールに対する
ブラックボックス・テストでは、上位側から被試験モジ
ュール(以下、SUTと称する)を呼び出したときのこ
のSUTからの応答を記録してそれを期待される応答と
比較していたが、SUTからのその下位側に対する呼び
出しに関する情報については特に記録する等の処理はな
されていなかった。そのため、SUTの挙動を外部から
観測して正しい動きをしているかを調べるブラックボッ
クス・テストとしては不充分なものであらた。
Furthermore, in conventional module testing, so-called white-box testing was often employed, which acquired information about the control flow paths and branches within the module as substitute characteristics for the module's functions. However, in white box testing, the flow of control is visible but the flow of information is not, so it is not always satisfactory. On the other hand, in conventional black box testing of modules, when the module under test (hereinafter referred to as SUT) is called from the upper side, the response from the SUT is recorded and compared with the expected response. However, no particular processing was performed, such as recording information regarding calls from the SUT to its lower-level side. Therefore, it was insufficient as a black box test to observe the behavior of the SUT from the outside and check whether it was moving correctly.

〔発明の目的〕[Purpose of the invention]

本発明は上述した従来技術の問題点を解消し、SUTの
環境に対する挙動をできるだけ多く調べることができる
モジュール・テスト方法を提供することを目的とする。
SUMMARY OF THE INVENTION It is an object of the present invention to solve the problems of the prior art described above and to provide a module testing method that can examine as much behavior of an SUT as possible with respect to the environment.

また、このようなモジュール・テスト方法において、テ
スト環境を自動的に生成してテスト・コストを低減する
ことも目的とする。
Another object of this module testing method is to automatically generate a test environment to reduce test costs.

〔発明の概要〕[Summary of the invention]

本発明の一実施例によれば、上述の目的を達成するため
のモジュール・テスト方法が提供される。
According to one embodiment of the present invention, a module testing method is provided to achieve the above objectives.

このため、実施例においては、SUTを呼び出すために
そのインターフェースへ渡された情報およびSUTが他
のモジュールに対して行う呼び出しの情報の両者をSU
Tの挙動を表す情報とする。
For this reason, in embodiments, the SUT
The information represents the behavior of T.

これによって、テスト環境から与えられるテスト・デー
タ等に対するSUTの挙動を従来のテスト方法よりも充
分に把握することができる。
This makes it possible to more fully understand the behavior of the SUT with respect to test data etc. given from the test environment than with conventional testing methods.

更に、上述のようなテストのためのテスト環境を自動的
に作成′するため、この実施例ではSUTのインターフ
ェース情報(SUTが呼び出す下位のモジュールとのイ
ンターフェース情報も含む)からテスト・ドライバ(テ
スト環境のうちのSUTを呼び出す側)とスタブ(SU
Tから呼び出される側)を自動的に作成する。シミュレ
ート・モードではS U Tを実際に動作させる代わり
に、SUTとテスト環境との間の入出力や他のモジュー
ルの呼び出し等の相互作用のテスト・データ(インター
フェースを介してSUTへ与える値−3UTへの入力)
および期待データ(StJTがインターフェースを介し
て外部へ渡す値=SUTからの出力)を使用者が与える
。実行モードでは先に与えられたテスト・データに基づ
いてSUTを実行し、そのテスト環境に対する作用(出
力、他のモジュールの呼び出し等)をやはり先に与えら
れた期待データと比較する。期待データと異なる場合に
はSUTを修正したのち再度実行モードで動作させると
いうサイクルを、一致がとられるまで繰り返す。
Furthermore, in order to automatically create a test environment for the above-mentioned test, this embodiment creates a test driver (test environment) from SUT interface information (including interface information with lower modules called by the SUT). (the side that calls the SUT) and the stub (the side that calls the SUT
(the side called by T) is automatically created. In the simulate mode, instead of actually operating the SUT, test data (values given to the SUT via the interface) of interactions such as input/output and calls to other modules between the SUT and the test environment are generated. input to 3UT)
The user provides expected data (value passed by StJT to the outside via the interface = output from SUT). The run mode executes the SUT based on previously provided test data and compares its effects on the test environment (outputs, calls to other modules, etc.) with the expected data also provided previously. If the data differs from the expected data, the SUT is corrected and operated in execution mode again, and the cycle is repeated until a match is found.

〔発明の実施例〕[Embodiments of the invention]

第1図に本発明の一実施例を概念的に示す。また、これ
と比較するために従来方法に基づいた場合のモジュール
・テストを第3図に概念的に示す。
FIG. 1 conceptually shows an embodiment of the present invention. Further, for comparison, a module test based on the conventional method is conceptually shown in FIG.

第3図の従来例において、テスト担当者301は自分で
テスト・ドライバおよびスタブ303を作成し、これを
5tJT305とともにコンパイル/リンクして実行可
能なテスト・プログラム307を作成する。次にテスト
・プログラム307にテスト・データ309を与えて実
行させる。テスト・プログラム307中にリンクされて
いるテスト・ドライバは同じくそこにリンクされている
SUTからの出力(関数の戻り値や参照渡しパラメータ
・グローバル変数への書き込み等)を実行結果としてフ
ァイルへ書き込む。テスト担当者311はこの実行結果
を期待データと照合し、不一致があれば5UT305に
不具合があるものとしてデバッグを行う。デバッグ完了
後、上述の過程を実行結果と期待データの一致がとれる
まで繰り返す。
In the conventional example shown in FIG. 3, a tester 301 creates a test driver and stub 303 by himself, and compiles/links them with the 5tJT 305 to create an executable test program 307. Next, the test program 307 is given test data 309 and executed. The test driver linked in the test program 307 writes the output (return value of a function, parameter passed by reference, writing to a global variable, etc.) from the SUT also linked therein to a file as an execution result. The tester 311 compares this execution result with expected data, and if there is a discrepancy, debugs the 5UT 305 assuming that there is a problem. After debugging is completed, the above process is repeated until the execution results match the expected data.

これに対して、第1図に示す本発明の一実施例では、テ
スト担当者101はテスト・ドライバやスタブを自分で
作成する代わりに、5UT109のインターフェース情
報103をドライバ・スタブ自動生成プログラム105
へ与える。インターフェース情報103はSUTを呼び
出す際のパラメータのリスト、SUTがどのようなグロ
ーバル変数を使用するか、またSUTが呼び出すモジュ
ールのパラメータのリスト等を含んでおり、SUTとそ
の上位および下位のモジュールとの間で行われる入出力
のインターフェースを記述するものである。
On the other hand, in the embodiment of the present invention shown in FIG.
give to The interface information 103 includes a list of parameters when calling the SUT, what kind of global variables the SUT uses, a list of parameters of the module called by the SUT, etc. It describes the input/output interface between the two.

次に自動生成されたテスト・ドライバおよびスタブ10
7と5UT109をコンパイル・リンクしてテスト・プ
ログラム111を作成する。テスト・プログラム111
の内部の動作の概略を説明する図面を第2図に示す。テ
スト・プログラム110は第3図に示した従来技術とは
異なり、シミュレート・モードと実行モードの2つの動
作モードを持つ。
Next, the automatically generated test driver and stub 10
7 and 5UT 109 are compiled and linked to create a test program 111. Test program 111
FIG. 2 shows a diagram illustrating an outline of the internal operation of the system. The test program 110 differs from the prior art shown in FIG. 3 in that it has two operating modes: a simulation mode and an execution mode.

シミュレート・モードではテスト・プログラム111は
第2図(a)で説明されるような動作をする。同図にお
いて、テスト・ドライバ201はテスト担当者に対して
5UT109” (コンパイル・リンクされたSUTと
いうことを示すため、゛を参照番号に付加する)を呼び
出すためのSUTへの入力、およびSUTがその実行結
果として戻す出力の入力を要求する。テスト担当者はS
UTへの入力のデータの要求に対しては対応するテスト
・データ113を、またSUTからの出力のデータの要
求に対しては期待データ115を例えばコンソールから
与える。これらはそれぞれテスト・データ・ファイル1
19と期待データ・ファイル117へ書き込まれる。
In the simulate mode, test program 111 operates as illustrated in FIG. 2(a). In the figure, the test driver 201 provides the tester with an input to the SUT to call 5UT109'' (add `` to the reference number to indicate that it is a compiled and linked SUT), and when the SUT is The tester requests the input of the output returned as the execution result.
Corresponding test data 113 is provided in response to a request for input data to the UT, and expected data 115 is provided in response to a request for output data from the SUT, for example, from a console. These are each test data file 1
19 and is written to the expected data file 117.

次にテスト・ドライバ201はテスト・ドライバの一部
分であるダミー・モジュール201−1に制御を移す。
Test driver 201 then transfers control to dummy module 201-1, which is part of the test driver.

ここでは、5UT109’がどのモジュールを呼び出す
かについてテスト担当者への問い合わせが行われる。最
初に呼び出されるべきモジュールをテスト担当者が指定
すると、ダミ−・モジュールはそれに対応するスタブ2
03〜207を呼び出す。呼び出されたスタブは、シミ
ュレート・モードでは、丁度テスト・ドライバ201が
先に行ったように、SUTから呼び出されるべきモジュ
ールへ渡されるべきデータ(SUTからの出力データ)
とそのときそのモジュールがSUTへ戻すデータ(SU
Tへの入力データ)をテスト担当者がコンソール等から
与えるように要求し、その入力が終わるとダミー・モジ
ュールへ制御を戻す。このとき、呼び出されるべきモジ
ュールを識別する情報およびSUTからそのモジュール
へ渡されるべきものとしてテスト担当者から与えられた
データは期待データ・ファイル117へ、またこのモジ
ュールがSUTへ渡すものとして与えられたデータはテ
スト・データ・ファイル119へ書き込まれる。
Here, an inquiry is made to the tester regarding which module the 5UT 109' calls. When the tester specifies the module that should be called first, the dummy module creates the corresponding stub 2
Call 03-207. The called stub, in simulate mode, contains the data to be passed from the SUT to the module to be called (output data from the SUT), just as the test driver 201 did earlier.
and the data that the module returns to the SUT (SU
The tester requests input data (input data to T) from a console or the like, and when the input is completed, control is returned to the dummy module. At this time, the information identifying the module to be called and the data given by the tester to be passed from the SUT to that module are given to the expected data file 117 and by this module to be passed to the SUT. The data is written to test data file 119.

ダミー・モジュール201−1へ制御が戻ると、その次
に呼び出されるべきモジュールの指定の要求がテスト担
当者に対してなされ、上述のような動作が繰り返される
。このような手順を呼び出されるべきモジュール全てに
ついて行った後、モジュール呼び出しに関する情報の入
力の終了をダミー・モジュールへ通知する。これでシミ
ュレート・モードでの動作が完了する。
When control is returned to dummy module 201-1, a request is made to the tester to specify the module to be called next, and the above-described operations are repeated. After performing this procedure for all modules to be called, the dummy module is notified of the end of inputting information regarding module calling. This completes the operation in simulate mode.

次に、第2図(b)に示すような実行モードに入る。こ
のモードでは、5UT109’に入力すべきデータをテ
スト・ドライバ201がテスト・データ・ファイル11
9から読み出して設定し、実際に5UT109’へ制御
を渡す。SUTの動作中に下位のモジュールを呼び出す
ことになると、SUTからはその呼び出すべきモジュー
ルと全く同じものに見える対応するスタブ203〜20
7へ制御が移る。
Next, the execution mode is entered as shown in FIG. 2(b). In this mode, the test driver 201 saves the data to be input to the 5UT 109' into the test data file 11.
5UT 109', and actually transfers control to the 5UT 109'. When a lower module is called during SUT operation, the corresponding stubs 203 to 20, which look exactly the same as the module to be called from the SUT, are
Control is transferred to 7.

実行モードで呼び出されたスタブは、SUTから渡され
たデータを実行結果ファイル121へ書き込むとともに
、SUTへ渡すべきデータをテスト・データ・ファイル
119から読み出して所要のパラメータや変数等への設
定を行った後に、SUTへ制御を移す。
The stub called in execution mode writes the data passed from the SUT to the execution result file 121, reads the data to be passed to the SUT from the test data file 119, and sets the required parameters and variables. After that, control is transferred to the SUT.

このような5UT109’の内部動作および他のモジュ
ールの呼び出しが全て終了すると、制御がテスト・ドラ
イバ201へ戻る。テスト・ドライバは必要な後処理を
行った後、その動作を停止するか、あるいは制御を次の
段階の処理を行うルーチンへ移す。
When all of the internal operations of the 5UT 109' and calls to other modules are completed, control returns to the test driver 201. After the test driver performs the necessary post-processing, it either stops its operation or transfers control to a routine that performs the next stage of processing.

もし5UT109”が期待通りの動作をしたのであれば
、この時点での期待データ・ファイル117と実行結果
ファイル121の内容は同一になっているはずであるの
で、両者を比較することにより、5UT109が正しく
作成されているか否かが判断できる(第1図123)。
If ``5UT109'' operated as expected, the contents of the expected data file 117 and the execution result file 121 should be the same at this point, so by comparing the two, it is possible to determine whether 5UT109 It can be determined whether or not it has been created correctly (FIG. 1 123).

あるいは、この比較を完全一致か否かではなく、必要に
応じである範囲内に収まっているか否かの判定としても
よい。
Alternatively, this comparison may not be performed to determine whether or not there is a complete match, but to determine whether or not the values fall within a certain range, as necessary.

以下ではSUTが一部仕様の拡張されたPa5ca 1
の手続きあるいは関数であるとして、更に具体的な説明
を行う。勿論能の言語に対しても本発明は同様に適用し
うるし、またモジュールとしては、個々の手続き/関数
以外の別の独立してテストしうる単位でも良いことを注
意しておく。
Below, the SUT is Pa5ca 1 with some expanded specifications.
A more specific explanation will be provided assuming that it is a procedure or function. It should be noted that, of course, the present invention can be similarly applied to functional languages, and the module may be any independently testable unit other than individual procedures/functions.

SOTとして以下の手続き頭部を持った手続きを考える
Consider a procedure with the following procedure head as an SOT.

procedure GetADC12(pinLis
t : PinListType;offset : 
integer; resultNun+ : int
egerHvar  resultArray  : 
 Re5ultArrayType);ここで、Pin
ListTypeはユーザが定義した型であって、配列
やポインタ型以外のものである。また、Re5ultA
rrayTypeはやはりユーザがrea lの配列と
して定義している型である。また、3番目のパラメータ
resultNu−は配列resultArrayのサ
イズを表している。
procedure GetADC12(pinLis
t: PinListType; offset:
integer; resultNun+: int
egerHvar resultArray:
Re5ultArrayType); Here, Pin
ListType is a type defined by the user and is other than an array or pointer type. Also, Re5ultA
rrayType is also a type defined by the user as a real array. Further, the third parameter resultNu- represents the size of the array resultArray.

この手続きGetADC12のインターフェース情報(
含インターフェース上で使用されている型の定義情報な
ど)をドライバ・スタブ自動生成プログラムに通すこと
によって、モジュール・テスト用のテスト・ドライバお
よびもしこの手続きが他のモジュールを呼び出す場合に
はそのモジュールの代用となるスタブが自動的に生成さ
れる。表1にこの手続きに対して生成されるテスト・ド
ライバの主要部である手続きのソース・コードを示す。
This procedure GetADC12 interface information (
By passing the information (including type definition information used on interfaces) through the driver stub automatic generation program, the test driver for module testing and, if this procedure calls other modules, that module's A replacement stub will be automatically generated. Table 1 shows the source code of the procedure, which is the main part of the test driver generated for this procedure.

1:PROCEDtlRE 表  1 proc539; EGIN pros+ptln(″====GetA口Cl2==
==’);pfistReadln (’pinList’、 PIist[1]);1va
rReadln (’offset’、  1var[1]);1var
Readln (’resultNus+ber’、  1var[2
コ);IF  simulateMode  <>  
I  THENGetADC12(P1istL1]、
  1var[1]。
1: PROCEDtlRE Table 1 proc539; EGIN pros+ptln(″====GetA port Cl2==
==');pfistReadln('pinList', PIist[1]);1va
rReadln ('offset', 1var [1]); 1var
Readln ('resultNus+ber', 1var[2
) ;IF simulateMode <>
I THENGetADC12(P1istL1),
1var[1].

1var[2]、 rvararray[13) ;I
F  simulateMode  =  I  TH
ENdums+yModule; IF  simulateMode  =  I  T
HENrvararrayReadIn (’ res
uI tArray15: 1var[2]、 rvararray(−1]);r
vararrayWritelnResult(’re
sultArray’、  1var[21゜rvar
array(月): 16:  END。
1var[2], rvararray[13);I
F simulateMode = I TH
ENdums+yModule; IF simulateMode = I T
HENrvararrayReadIn ('res
uI tArray15: 1var[2], rvararray(-1]); r
varrayWritelnResult('re
sultArray', 1var[21°rvar
array (Mon): 16: END.

なお、このようなテスト・ドライバを生成する際、SU
TであるGetADC12を呼び出すためのインターフ
ェースを指示するため、表2に示すような形のパラメー
タ情報をドライバ・スタブ自動生成プログラムに与える
Note that when generating such a test driver, SU
In order to instruct the interface for calling GetADC12, which is T, parameter information in the format shown in Table 2 is given to the driver stub automatic generation program.

539    GetADC12 PinList     1 offset      T resultNua+   T resultArray  0 表2 procedure    PASCAL    4a
tom  PinListType Btt)lIIinteger atO@  integer array real    316384表2に示す
パラメータ情報において、 最初の行 に置かれている項目は左からSUTに与えられた識別番
号、SUTの名前、SUTが手続きが関数かを示す識別
子(もし関数ならここはfunctionとなる)、S
UTの記述言語、パラメータの個数である。2行目から
5行目は個々のパラメータに関する情報である。左から
パラメータであることを示す識別子(もし値の引き渡し
が手続き頭部中のパラメータ以外に、グローバル変数を
介して行われる場合はここがPではなくGとなっている
行もここに含まれる)、手続き頭部でこのパラメータが
何番目に位置するかを示すシーケンス番号、このパラメ
ータを介して値を入力するのか(T)それとも値を出力
するのか(0)を示す識別子、パラメータの名前、この
パラメータが単一の変数か(atom)配列か(arr
ay )それともポインタが(pointer )を示
す識別子、パラメータ(配列の場合はその要素)の型で
ある。パラメータが任意のサイズをとることができる配
列の場合は更にその配列の実行時のサイズを指定する数
がパラメータ・リストの何番目に置かれているかを示す
指示子および配列の最大サイズを示す指示子が置かれる
539 GetADC12 PinList 1 offset T resultNua+ T resultArray 0 Table 2 procedure PASCAL 4a
tom PinListType Btt)lIIinteger atO@ integer array real 316384In the parameter information shown in Table 2, the items placed in the first row are, from the left, the identification number given to the SUT, the name of the SUT, and whether the SUT is a function. Identifier to indicate (if it is a function, this will be function), S
This is the UT description language and the number of parameters. The second to fifth lines are information regarding individual parameters. Identifier indicating that it is a parameter from the left (if the value is passed through a global variable other than the parameter in the procedure head, the line where G is written instead of P is also included here) , a sequence number indicating the position of this parameter in the procedure head, an identifier indicating whether a value is input through this parameter (T) or a value is output (0), the name of the parameter, this Whether the parameter is a single variable (atom) or an array (arr
ay) or the type of the identifier or parameter (in the case of an array, its element) indicating the pointer (pointer). If the parameter is an array that can take any size, an indicator indicating the position in the parameter list of the number specifying the execution-time size of the array and an indicator indicating the maximum size of the array. A child is placed.

なお、表2に示すような情報を人間が作って与える代わ
りに、被試験副プログラム(SUT)の副プログラム頭
部の構文解析などを行うことにより、それに相当する情
報をドライバ・スタブ自動生成プログラム自身がSUT
から抽出してもよい。
In addition, instead of creating and providing the information shown in Table 2 manually, by parsing the subprogram head of the subprogram under test (SUT), the driver stub automatic generation program generates the corresponding information. myself is SUT
It may be extracted from.

なお、これを行う際には、ユーザが定義した型やグロー
バル変数等に関する情報はSOTの外部にあるので、こ
れらの外部定義情報だけを含んだダミーのプログラム中
にSOTを埋め込んだ形のものをドライバ・スタブ自動
生成プログラムに与えたりあるいはそのような情報だけ
を表2のような形で与える等の方法を用いることができ
る。
Note that when doing this, since information about user-defined types and global variables is external to SOT, it is necessary to embed SOT in a dummy program that only contains these external definition information. It is possible to use a method such as giving the information to an automatic driver stub generation program or giving only such information in the form shown in Table 2.

上述のように、ドライバ・スタブ自動生成プログラムは
スタブの自動生成も行う。SUTであるGetADC1
2が、その頭部が以下のようになっている2つの副プロ
グラムProcA 、 FuncBを呼び出すものとす
る: procedure ProcA(paraml、pa
ram2:integer);function   
FuncB(param3:integer):rea
l;このとき、SUTの場合と同様に例えば表3に示す
ようなパラメータ情報を与える。
As described above, the driver stub automatic generation program also automatically generates stubs. GetADC1 which is SUT
2 calls two subprograms ProcA and FuncB whose heads are as follows: procedure ProcA(paraml, pa
ram2: integer); function
FuncB (param3: integer):rea
l: At this time, parameter information as shown in Table 3, for example, is given as in the case of SUT.

$ 601 pH 2T 表3 ProcA   procedure   PASCA
L  2paraml  atom  integer
paraw2 atom integer宰602  
 FuncB   function   PASCA
L   IP  1 1  paraIII3 ato
m integerP  OOFuncB  atom
  realここで、FuncBのパラメータ情報の3
行目でそのシーケンス番号が0であるのは、これがこの
関数の戻り値であることを示すためである。GetAD
C12のパラメータ情報の与え方に関して述べたように
、スタブを作成するための情報についてもこのような表
の形ではなく、例えば副プログラム頭部だけをSUTの
ソースコードファイル中に書き込む等してもよい。
$601 pH 2T Table 3 ProcA procedure PASCA
L 2paraml atom integer
paraw2 atom integer 602
FuncB function PASCA
L IP 1 1 paraIII3 ato
m integerP OOFuncB atom
realHere, FuncB parameter information 3
The sequence number in line 1 is 0 to indicate that this is the return value of this function. GetAD
As mentioned regarding how to provide C12 parameter information, the information for creating a stub is not in the form of a table like this, but can be written, for example, by writing only the subprogram head into the SUT source code file. good.

このようにパラメータ情報を与えることによりスタブが
生成される。FuncB用のスタブの主要部の例を表4
に示す。なお、ProcAについて生成されるスタブも
同様であるので、その具体例は省略する。
A stub is generated by providing parameter information in this manner. Table 4 shows an example of the main parts of the stub for FuncB.
Shown below. Note that the stub generated for ProcA is similar, so a specific example thereof will be omitted.

表4 FUCNCTION FuncB(param3 : 
integer) : real;AR ReturnValue : real;BEGIN promptIn (’ ====FuncB====
 ’ ) ;IP (simulateMode <>
 1) THEN BEGINivarWriteRe
sult(’param3’、 para+*3);E
ND ELSE BEGIN ivarReadln(’param3″、  par
am3):1varWriteResult(’par
as+3’、 param3);END 。
Table 4 FUCNCTION FuncB (param3:
integer) : real; AR ReturnValue : real; BEGIN promptIn (' ====FuncB====
');IP (simulateMode <>
1) THEN BEGINivarWriteRe
sult('param3', para+*3);E
ND ELSE BEGIN ivarReadln('param3'', par
am3):1varWriteResult('par
as+3', param3); END.

rvarReadln(’ReturnVarRetu
rnValue); FuncB  := ReturnValue; END。
rvarReadln('ReturnVarRetu
rnValue); FuncB := ReturnValue; END.

また上述のようなインターフェース情報に基づいて生成
されるテスト ドライバの別の一部分を 構成するダミー・モジュールは例えば以下の表5のよう
になる。
Further, dummy modules forming another part of the test driver generated based on the above-mentioned interface information are as shown in Table 5 below, for example.

表 procedure dun+wyModule;AR procID  : integer; BEGIN EPEAT ivarReadln (’Dummy odule No。table procedure dun+wyModule;AR procID: integer; BEGIN EPEAT ivarReadln ('Dummy odule No.

9′ proclD); ASE procID 0F 601 : ProcA (ivar[1]+ 1var[2J); 602  :  rvar[1]  :=  func
B(ivar(1コ);0THERWISE  : IF proclD > OTHEN promptln(’  Wrong nu++ber!’); END。
9'proclD); ASE procID 0F 601: ProcA (ivar[1]+1var[2J); 602: rvar[1]:= func
B (ivar (1 piece); 0 THERWISE: IF proclD > OTHEN promptln ('Wrong nu++ber!'); END.

UNTIL proclD <= 0;END。UNTIL proclD <= 0; END.

なお、これらインターフェース情報を用いてテスト・ド
ライバおよびテスト・スタブを自動生成すること自体は
コンパイラ、インタープリタ、トランスレータにおける
構文解析、解釈、コード生成等の技術そのものであって
当業者にとっては周知の事項であるので、テスト・ドラ
イバ・スタブ自動生成プログラムの実現手法についての
説明は省略する。
Note that the automatic generation of test drivers and test stubs using this interface information is itself a technique for parsing, interpreting, code generation, etc. in compilers, interpreters, and translators, and is well known to those skilled in the art. Therefore, a description of the method for implementing the test driver stub automatic generation program will be omitted.

以下では、このようにして生成されたテスト・ドライバ
、スタブを使用してテストを行う手順を上述の表を参照
して説明する。
Below, the procedure for conducting a test using the test driver and stub generated in this way will be explained with reference to the above table.

表1のコードで、シミュレート・モードのときはグロー
バル変数s imu la teModeの値を1にセ
ットし、実行モードのときには1以外にセットする。
In the code in Table 1, the value of the global variable simulateMode is set to 1 when in simulation mode, and set to a value other than 1 when in execution mode.

このセット動作はテスト・ドライバ中の表1に示した手
続きproc539の外側にある部分で行う。
This set operation is performed in a portion outside the procedure proc539 shown in Table 1 in the test driver.

表1の行3の手続きpromptInは、そのパラメー
タの文字列および復帰/改行コードを期待データ・ファ
イルへ格納する。
The procedure promptIn in row 3 of Table 1 stores the string of its parameters and the return/linefeed code to the expected data file.

行4の手続きplistReadlnはSUTであるG
etADC12の最初のパラメータであるpinLis
tの取り込みに関するものである。この手続きは、その
最初のパラメータを含むプロンプト: pinList ? をコンソールへ出力して(シミュレート・モードでは)
テスト担当者にどのテスト・データを入力すべきかを指
示した後、標準入力からの入力を型がPinLisTy
peである2番目のパラメータにセットする。標準入力
は、シミュレート・モードではコンソールへ、また実行
モードではテスト・データ・ファイルへ接続されている
。また、1番目のパラメータの文字列、および2番目の
パラメータにセットされた値の文字列表現が出力される
。なおシミュレート・モードにおいては、1番目のパラ
メータの文字列および2番目のパラメータにセットされ
たデータの文字列表現は同時にテスト・データ・ファイ
ルにも書き込まれる。
The procedure plistReadln in line 4 is SUT G
pinLis, the first parameter of etADC12
This is related to the incorporation of t. This procedure prompts with its first parameter: pinList? to the console (in simulated mode)
After telling the tester what test data to enter, input from standard input is typed PinLisTy.
Set the second parameter to be pe. Standard input is connected to the console in simulate mode and to the test data file in run mode. Also, a character string of the first parameter and a character string representation of the value set to the second parameter are output. Note that in the simulate mode, the character string of the first parameter and the character string representation of the data set in the second parameter are also written to the test data file at the same time.

行5.6の手続き1varRead Inも、取り扱う
変数の型がintegerである点を除いては、pli
stReadlnと全く同様の動作であり、GetAD
Cの2番目、3番目のパラメータの値の取り込みを行う
。他のxxxReadlnという名前の手続きも同様の
動作をする。なお、配列について同様の動作を行う手続
きrvararrayRead Inでは、その2番目
のパラメータで値が取り込まれる配列のサイズを指定す
る。
Procedure 1varRead In on line 5.6 is also similar to pli, except that the type of the variable it handles is integer.
The operation is exactly the same as stReadln, and GetAD
Import the values of the second and third parameters of C. Other procedures named xxxReadln operate similarly. Note that in the procedure rvararrayRead In, which performs a similar operation for arrays, the second parameter specifies the size of the array into which the values are to be taken.

シミュレート・モードの場合は行12でダミー・モジュ
ールdus++syModuleが呼ばれ、上述のよう
に、SUTから呼び出される下位のモジュールの識別番
号の入力を要求し、その指定されたモジュールに対応す
るスタブを呼び出してそのモジュールに期待値データお
よびテスト・データの収集・蓄積を行わせる。このdu
mmyModuleの動作、およびシミュレート・モー
ドにおけるスタブの動作は夫々表4、表5から明らかで
ある。
In the case of simulate mode, the dummy module dus++syModule is called on line 12, and as described above, it requests the input of the identification number of the lower-level module to be called from the SUT, and calls the stub corresponding to the specified module. The module collects and stores expected value data and test data. This du
The operation of mmyModule and the operation of the stub in simulated mode are clear from Tables 4 and 5, respectively.

また、SUTからの出力については、シミュレート・モ
ードでは行14でその出力(ここでは参照渡しされた4
番目のパラメータである配列中にGetADC12が書
き込むデータ)となるはずのデータの入力をテスト担当
者に要求する。これにより与えられたデータを行15で
パラメータ名とともに期待データ・ファイルへ書き込む
Also, regarding the output from the SUT, in simulate mode, line 14 displays its output (here the 4 passed by reference).
The tester is requested to input the data that is supposed to be the data written by GetADC 12 in the array that is the th parameter. The data given by this is written to the expected data file along with the parameter name in line 15.

シミュレート・モードの動作は以上の通りである。なお
、何通りかのテスト・データを一度にセットすることも
、表1の手続きproc539を必要な回数だけ繰り返
す等すれば簡単にできる。
The operation of the simulate mode is as described above. Note that setting several types of test data at once can be easily done by repeating procedure proc 539 in Table 1 as many times as necessary.

上述のようにテスト・データおよび期待データの蓄積が
終わった後、実行モードでテスト・プログラムを動作さ
せる。
After the test data and expected data have been accumulated as described above, the test program is operated in the execution mode.

このモードでは、表1の行1において、このSUTが試
験されたことを示すためpromptInにより文字列
GetADC12を実行結果ファイルへ格納する。
In this mode, in row 1 of Table 1, the string GetADC12 is stored in the execution result file by promptIn to indicate that this SUT has been tested.

その後、行4〜行6により、先にテスト・データ・ファ
イルにセットされたテスト・データが読み出され、行9
でこれらの値が実パラメータとしてセットされたGet
ADC12が実際に呼び出される。
After that, in lines 4 to 6, the test data previously set in the test data file is read out, and in line 9
These values are set as actual parameters with Get
ADC 12 is actually called.

GetADC12からの出力(resultArray
 )は行15で実行結果ファイルへ記憶される。
Output from GetADC12 (resultArray
) is stored in the execution result file on line 15.

実行モードでGetADC12が下位のモジュールを呼
び出そうとすると、実際にはそれに対応するスタブが呼
び出される。実行モードにおけるスタブの動作は表4か
られかるように、引き渡されたデータ(パラメータや、
場合によってはグローバル変数等)を実行結果ファイル
へ記憶するものである。
When the GetADC 12 attempts to call a lower module in execution mode, the corresponding stub is actually called. As shown in Table 4, the operation of the stub in execution mode is based on the passed data (parameters, etc.).
In some cases, global variables, etc.) are stored in the execution result file.

また、SUTであるGetADC12へ入力すべき値(
ここでは関数FuncBO値)をテスト・データ・ファ
イルから読み出してセットすることも行われる。
Also, the value to be input to GetADC12 which is SUT (
Here, the function FuncBO value) is also read out from the test data file and set.

SUTへ入力すべき値は、グーパル変数や参照渡しのパ
ラメータによって引き渡すこともあるが、その場合の値
のセットのやり方も同様である。
Values to be input to the SUT may be passed through Goopal variables or parameters passed by reference, but the method for setting values in that case is the same.

以上のようにして実行モードの動作の終了後、期待デー
タ・ファイルと実行結果ファイルを比較することにより
、SUTが期待通りの動作をしているか否かがわかる。
After the execution mode operation is completed as described above, by comparing the expected data file and the execution result file, it can be determined whether the SUT is operating as expected.

なお、全ての実行動作が終了した後に比較する代わりに
、個々の実行結果データが得られる毎に比較を行っても
よい。
Note that instead of comparing after all execution operations are completed, comparison may be made every time individual execution result data is obtained.

比較の結果不一致があれば、SUTに修正を加える。こ
こでSUTのインターフェースに変更がない限り、次回
のモジュール・テストに必要なことは、新しいSUTを
コンパイルし、以前のテスト・ドライバおよびスタブと
リンクしたあと、既に作成されているテスト・データ・
ファイルおよび期待データ・ファイルを用いて直ちに実
行モードでテスト・プログラムを走らせることだけであ
る。これを期待データと実行結果の一致がとれるまで繰
り返すことにより、テストが完了する。
If there is a discrepancy as a result of the comparison, make corrections to the SUT. Unless there are changes to the SUT's interface here, all that is required for the next module test is to compile the new SUT, link it with the previous test drivers and stubs, and then use the test data already created.
All you have to do is run the test program in immediate run mode with the file and expected data file. The test is completed by repeating this until the expected data matches the execution results.

〔発明の効果〕〔Effect of the invention〕

以上説明したように、本発明によれば、SUT自体は何
ら変更せずに、その上位側に加えて下位側のインターフ
ェースから見た挙動も観測できるので、より完全なモジ
ュール・テストを行うことができる。更に、テスト・ド
ライバおよびスタブの自動生成により、従来困難と考え
られていた、大規模なプログラムのモジュール単位のテ
ストが容易に行えるようになる。また、テスト・プログ
ラムをシミュレーション・モードで動作させている間に
それからの質問に順番に答えて必要なデータを入力して
いくことにより、これら入力されたデータをテスト・デ
ータ・ファイルと期待データ・ファイルに自動的に振り
分けて夫々正しい順序で書き込むため、これらのデータ
の入力間違いが低減される。また、両ファイルを一度作
っておけば、SUTの修正とテストを繰り返す際に同じ
ものを毎回使用できるので、再テストを自動的に行うこ
とができる。再テストを行うことにより、不具合が正し
く修正されたかをチエツクするのみならず、その修正が
他の機能に影響を与えていないかも検査できる。これに
よりソフトウェアの信頼性が全体的に向上する。更に、
両ファイルに正しい順序でデータが書き込まれるため、
実行結果と期待データの照合も自動化することができる
As explained above, according to the present invention, it is possible to observe the behavior seen from the interface on the lower side in addition to the upper side without making any changes to the SUT itself, making it possible to perform more complete module tests. can. Furthermore, automatic generation of test drivers and stubs makes it easier to test large-scale programs on a module-by-module basis, which was previously thought to be difficult. In addition, by answering the questions in order and inputting the necessary data while the test program is running in simulation mode, these input data can be combined into the test data file and the expected data file. Since the data is automatically sorted into files and written in the correct order, errors in inputting this data are reduced. Additionally, once you create both files, you can use the same files each time you modify and test the SUT, allowing you to retest automatically. By retesting, you can not only check whether the defect has been corrected correctly, but also check whether the correction has affected other functions. This improves the overall reliability of the software. Furthermore,
Data is written to both files in the correct order, so
Comparison of execution results and expected data can also be automated.

【図面の簡単な説明】[Brief explanation of the drawing]

第1図および第2図は本発明の一実施例を説明するため
の図、第3図は従来技術を説明する図である。 105:テスト・ドライバ・スタブ自動生成プログラム 107:テスト・ドライバ/スタブ 109:被試験モジュール 117:期待データ・ファイル 119:テスト・データ・ファイル 121:実行結果ファイル 201:テスト・ドライバ 201−1:ダミー・モジュール 203.205.207:スタブ
1 and 2 are diagrams for explaining one embodiment of the present invention, and FIG. 3 is a diagram for explaining the prior art. 105: Test driver stub automatic generation program 107: Test driver/stub 109: Module under test 117: Expected data file 119: Test data file 121: Execution result file 201: Test driver 201-1: Dummy・Module 203.205.207: Stub

Claims (3)

【特許請求の範囲】[Claims] (1)被試験モジュールが他のモジュールを呼び出すこ
とに関する情報を含むテスト環境との相互作用情報を被
試験モジュールから取得することを特徴とするソフトウ
ェア・モジュール・テスト方法。
(1) A software module testing method characterized in that interaction information with a test environment, including information regarding the module under test calling other modules, is obtained from the module under test.
(2)第1のモードと第2のモードを有するテスト・ド
ライバおよび前記被試験モジュールが呼び出す前記他の
モジュールの代わりに用いられるスタブとを設け、 前記第1のモードでは前記相互作用情報を使用者に入力
せしめ、 前記第2のモードでは前記相互作用情報に基づいて前記
被試験モジュールを実行し、この実行中に前記テスト環
境に対してなした作用を記録しまたは前記相互作用情報
と比較する請求項1記載のソフトウェア・モジュール・
テスト方法。
(2) A test driver having a first mode and a second mode and a stub used in place of the other module called by the module under test are provided, and the interaction information is used in the first mode. the second mode executes the module under test based on the interaction information and records or compares actions made on the test environment during this execution with the interaction information; The software module according to claim 1.
Test method.
(3)前記被試験モジュールのインターフェース情報に
基づいて前記テスト・ドライバおよび前記スタブを自動
的に作成する手段を設けることを特徴とする 請求項2記載のソフトウェア・モジュール・テスト方法
(3) The software module testing method according to claim 2, further comprising means for automatically creating the test driver and the stub based on interface information of the module under test.
JP63256476A 1988-10-12 1988-10-12 Method for testing software module Pending JPH02103644A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP63256476A JPH02103644A (en) 1988-10-12 1988-10-12 Method for testing software module

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP63256476A JPH02103644A (en) 1988-10-12 1988-10-12 Method for testing software module

Publications (1)

Publication Number Publication Date
JPH02103644A true JPH02103644A (en) 1990-04-16

Family

ID=17293166

Family Applications (1)

Application Number Title Priority Date Filing Date
JP63256476A Pending JPH02103644A (en) 1988-10-12 1988-10-12 Method for testing software module

Country Status (1)

Country Link
JP (1) JPH02103644A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH04149646A (en) * 1990-10-09 1992-05-22 Nec Corp Program evolving system applying description of stub parts
JP2004133739A (en) * 2002-10-11 2004-04-30 Nec Engineering Ltd Client-server program simulator system and simulation method
JP2008262510A (en) * 2007-04-13 2008-10-30 Fuji Xerox Co Ltd Electronic circuit device, failure diagnostic device, failure diagnostic system, and failure diagnostic program

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH04149646A (en) * 1990-10-09 1992-05-22 Nec Corp Program evolving system applying description of stub parts
JP2004133739A (en) * 2002-10-11 2004-04-30 Nec Engineering Ltd Client-server program simulator system and simulation method
JP2008262510A (en) * 2007-04-13 2008-10-30 Fuji Xerox Co Ltd Electronic circuit device, failure diagnostic device, failure diagnostic system, and failure diagnostic program

Similar Documents

Publication Publication Date Title
Zeller Why programs fail: a guide to systematic debugging
US6721922B1 (en) System for electronic circuit characterization, analysis, modeling and plan development
US6061643A (en) Method for defining durable data for regression testing
CN101739339B (en) Program dynamic dependency relation-based software fault positioning method
US7917895B2 (en) Automated software testing and validation system
US4727545A (en) Method and apparatus for isolating faults in a digital logic circuit
US6986125B2 (en) Method and apparatus for testing and evaluating a software component using an abstraction matrix
CA2391125C (en) Method for computer-assisted testing of software application components
Zage et al. Evaluating design metrics on large-scale software
US7895575B2 (en) Apparatus and method for generating test driver
CN103246770B (en) A kind of system action emulation mode of based upon activities graph model
CN113742215A (en) Method and system for automatically configuring and calling test tool to perform test analysis
JPH02103644A (en) Method for testing software module
US20070220338A1 (en) Method and system for generating checkpoints of hardware description language simulations that include a specific model state together with a software testcase state
Bergmann PHPUnit Pocket Guide: Test-Driven Development in PHP
Graf et al. Gaining insight into executable models during runtime: Architecture and mappings
US6961887B1 (en) Streamlined LASAR-to-L200 post-processing for CASS
Stumptner et al. A model-based tool for finding faults in hardware designs
Tsiatsoulis et al. Testing and debugging message passing programs in synergy with their specifications
Hashempour et al. An integrated environment for design verification of ATE systems
US20070220390A1 (en) Method and system for verifying equivalence of two representations of a stimulus pattern for testing a design
Donnelly Evaluating the IOBIDS specification using gate-level system simulation
Raina QuickCheck-Style Testing of Embedded Software using the PropEr Framework
Zander-Nowicka et al. Model driven testing of real-time embedded systems-from object oriented towards function oriented development
Wiberg Running BASIC test programs in a C/ATLAS test environment