JP2011113277A - Apparatus, method and program for testing program - Google Patents
Apparatus, method and program for testing program Download PDFInfo
- Publication number
- JP2011113277A JP2011113277A JP2009268772A JP2009268772A JP2011113277A JP 2011113277 A JP2011113277 A JP 2011113277A JP 2009268772 A JP2009268772 A JP 2009268772A JP 2009268772 A JP2009268772 A JP 2009268772A JP 2011113277 A JP2011113277 A JP 2011113277A
- Authority
- JP
- Japan
- Prior art keywords
- test
- module
- program
- information
- input
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
Images
Landscapes
- Testing And Monitoring For Control Systems (AREA)
- Debugging And Monitoring (AREA)
- Programmable Controllers (AREA)
Abstract
Description
この発明は、産業プラントのようにポンプやバルブなどの操作器や、流量計・圧力計などのセンサが大量に配置されているシステムにおいて、センサが検出した運転データをオペレータが監視することで、プラントの状態を即時に把握し、操作器を操作することで安定した運転を支援するコンピュータのプログラムを試験するプログラム試験装置に係るものである。 In the present invention, an operator monitors the operation data detected by an operator in a system in which a large number of sensors such as a pump and a valve and sensors such as a flow meter and a pressure gauge are disposed as in an industrial plant. The present invention relates to a program test apparatus that tests a computer program that supports a stable operation by immediately grasping the state of a plant and operating a controller.
プラントはボイラや発電機などの大型の設備が多数あり、各設備にはポンプやバルブといった操作器、圧力計や流量計といったセンサなど、多数の機器が配置される。プラントの運転状態を監視するには、こうした機器がもつ信号を系統図や設備構成図などのGUI(Graphic User Interface)画面に表示されるグラフィックシンボルに割り付け、中央監視室と呼ばれる部屋で現在値を監視し、あるいは機器で生じた故障をメッセージやグラフィック形式でオペレータが確認して、操作器を操作することが行われている。こうしたプラントの現場ではPLC(programmable logic controller)と呼ばれるコンピュータが設置され、センサの値を使って演算を行いながら、オペレータの指示によりプラントの機器の制御を行うプログラムが実行されている。 The plant has a large number of large equipment such as boilers and generators, and each equipment is provided with a number of devices such as operating devices such as pumps and valves and sensors such as pressure gauges and flow meters. In order to monitor the operational status of the plant, the signals of these devices are assigned to graphic symbols displayed on the GUI (Graphic User Interface) screens such as system diagrams and equipment configuration diagrams, and the current value is assigned to a room called the central monitoring room. An operator operates the controller by monitoring or checking a failure occurring in the device in a message or graphic format. A computer called PLC (programmable logic controller) is installed at the site of such a plant, and a program is executed to control plant equipment according to instructions from an operator while performing calculations using sensor values.
こうしたプログラムを試験する場合は、信号の値を模擬するシミュレータを用いて主にオペレータが手動で値を操作・設定を行いながら目視で挙動を確認することが多い。また、プラントは信頼性が重要視されるので、プラントにつながれている信号の全点について確認を行う必要がある。プラントで扱う点数は規模にもよるが数百点から数万点の信号点数をもつものがあり、実施する試験の数が多く、試験するプログラムの規模も大きいためデバッグや保守が難しい。 When testing such a program, it is often the case that the behavior is visually confirmed mainly by an operator manually operating and setting values using a simulator that simulates signal values. Moreover, since reliability is regarded as important for a plant, it is necessary to check all points of signals connected to the plant. Although the number of points handled in a plant depends on the scale, there are some that have hundreds to tens of thousands of signal points, the number of tests to be performed is large, and the scale of the program to be tested is large, so debugging and maintenance are difficult.
このような試験(テスト)において、必要となるテストデータを設定するプログラムを自動生成することにより、テスト費用を削減するものがあった(例えば特許文献1)。テストで必要になるプログラムにはテストデータを設定するプログラムと、プログラムから出力された結果を評価するプログラムの2つがある。特許文献1では、テスト対象ラダー管理部にある試験対象となるプログラム(ラダープログラム)から入出力変数抽出部により入力となる変数を抽出することで、仮想入力ラダー生成部によりテストデータを設定するプログラムを自動的に生成することができる。また、テスト入力シーケンス管理部によりユーザが簡単なコマンドとパラメータを指定するだけで出力結果を評価するプログラムをつくることができ、比較的高度な知識を必要とするラダー言語を知らなくてもテストを行うことができる。
In such a test (test), there has been a test cost reduction by automatically generating a program for setting necessary test data (for example, Patent Document 1). There are two programs required for the test, a program for setting test data and a program for evaluating the result output from the program. In
特許文献1に開示されている技術によれば、テスト結果を評価するプログラム(手順)の設計はプログラム言語であるラダープログラムの記述方法を知らなくてもよいが、シーケンスプログラムの基本動作や、どのプログラム内のサブモジュールの依存関係や、どの変数がどこで参照されているかなどのプログラム設計者に相当するプログラムの内部情報
がないと設計ができない。
また、テスト結果の検証は正常値との比較といった単純なものだけしか扱うことができないため、複数の条件を組み合せたり、時間や状態変化を考慮するものであったり、ある条件での試験結果を他の条件の入力データとして使ったりするなどプログラマブルな条件を指定することができない。
本発明は、このような課題を解決するためになされたもので、複数の条件を組み合せたり、時間や状態変化を考慮できたり、ある条件での試験結果を他の条件の入力データとして使ったりするなど、プログラマブルな条件でプログラム試験が行えるプログラム試験装置を提供することを目的とする。
According to the technique disclosed in
In addition, since verification of test results can only deal with simple things such as comparison with normal values, it is possible to combine multiple conditions, consider time and state changes, or test results under certain conditions. Programmable conditions such as using as input data for other conditions cannot be specified.
The present invention has been made to solve such a problem, and a plurality of conditions can be combined, time and state changes can be taken into account, or test results under certain conditions can be used as input data for other conditions. An object of the present invention is to provide a program test apparatus capable of performing a program test under programmable conditions.
本発明に係るプログラム試験装置は、入力部から入力された試験対象プログラムを複数のモジュールに分割し、この分割されたモジュール毎のモジュールの情報と、モジュール毎に用いられている変数情報とを解析して取得し、モジュール毎に当該モジュールが実現する機能の情報を入力部から取得してモジュールの情報に加えてモジュール情報とし、このモジュール情報と変数情報とをテストデータベースに格納するプログラム解析部と、テストデータベースに格納されたモジュール情報と変数情報とを用いて、モジュール毎にプログラム試験を行うために必要なテストロジックとテストデータとを入力部から入力するためのテスト入力画面を生成してこのテスト入力画面を構成するためのテスト入力画面情報を上記テストデータベースに格納するテスト入力画面生成部と、テスト入力画面情報を用いて表示部にテスト入力画面を表示させるとともに、テスト入力画面を用いて入力されたテストロジックから生成されたテストプログラムと入力されたテストデータをテストデータベースに格納するテスト編集部と、入力されたテストデータを用いてテストプログラムを実行し、テスト結果をテストデータベースに格納するテストプログラム実行部とを備えたものである。 The program test apparatus according to the present invention divides a test target program input from an input unit into a plurality of modules, and analyzes module information for each of the divided modules and variable information used for each module. A program analysis unit that acquires information on the functions realized by the module for each module from the input unit, adds the module information to module information, and stores the module information and variable information in a test database; Using the module information and variable information stored in the test database, generate a test input screen for inputting the test logic and test data necessary for performing the program test for each module from the input unit. Test input screen information for configuring the test input screen in the test database The test input screen generation unit to be sent and the test input screen are displayed on the display unit using the test input screen information, and the test program generated from the test logic input using the test input screen and the input test data In the test database, and a test program execution unit that executes the test program using the input test data and stores the test result in the test database.
この発明によれば、テストに際して、テストロジックをオペレータが入力するようにしたので、複数の条件を組み合せたり、時間や状態変化を考慮できたり、ある条件での試験結果を他の条件の入力データとして使ったりするなど、プログラマブルな条件でプログラム試験が行える。 According to the present invention, since the test logic is input by the operator during the test, a plurality of conditions can be combined, time and state changes can be taken into account, and test results under certain conditions can be input data of other conditions. Program tests can be performed under programmable conditions such as
実施の形態1.
図1は本発明の一実施の形態によるプログラム試験装置の概要を示すブロック図である。プログラム試験装置はテストデータベース80と制御部70と、オペレータからデータを入力できる入力部4と、出力結果をグラフィックあるいはテキスト形式で表示する表示部2で構成される。なお、制御部70はコンピュータがプログラムにより実行するものである。すなわち制御部70はプログラム試験プログラムと同義である。入力部4から制御部70にテストに関するデータの入力を行い、その出力結果を表示部2に出力する。入力部4から試験対象プログラム92が入力されると、制御部70は試験対象プログラム92をいくつかのモジュールに分割し、モジュールのもつ変数に設定するテストデータやテストに指定するロジックを機能単位で分割してテストデータベース80に記憶する。また試験対象プログラム92を解析してプログラム中に宣言されている変数の情報をテストデータベース80に格納する。記録したテストプログラムを実行するとテスト実行結果85がテストデータベース80に記憶される。
FIG. 1 is a block diagram showing an outline of a program test apparatus according to an embodiment of the present invention. The program test apparatus includes a
テストデータベース80はテストに関するデータを管理する。変数情報81はテストの対象となるプログラムの中でどのような変数があり、その変数がどのように使われているかに関する情報を管理する。モジュール情報82は試験対象プログラム92の中にあるモジュールを機能毎に管理する。またどのモジュールでどの変数が使われているかも管理する。テストプログラム83はテストロジックをスクリプトのような軽量言語を使って記述したもので、モジュール単位で管理されている。テストデータ84はモジュール単位で管理され、各モジュールがもつ変数がテストプログラム83に格納されたテストプログラムごとにどのような値をもつかを格納したものである。テストプログラム83はローダ93によりPLC94で実行できる形式に変換されてPLC94上で実行される。実行された結果は関連する機能やテスト実行単位(何月何日の何回目の実行かなど)やバージョン単位で記録してテスト実行結果85として管理する。
The
本発明の実施の形態1によるプラント試験装置の制御部70は概略以下のように動作する。まず、入力部4から試験対象となる試験対象プログラム92を入力する。試験対象プログラム92は、プログラム解析部75により複数モジュールに分割され、モジュールごとに関連する機能や使われている変数と変数の利用状況が解析される。これらの解析は、例えば、モジュールに分割する部分などは良く知られたプログラム解析ツールなどで行われるが、以下に説明するように、モジュールがどのような機能を果たしているのかなど、解析ツールだけでは解析しきれない部分を、オペレータが関与して解析を行う。ここに本
発明の特徴がある。
The
プログラムを解析することにより得られた情報からは各モジュールで使われる変数の属性を知ることができるので、それに合わせてモジュール毎に含まれる変数の入力画面(マークアップテキスト生成)を構成する。このとき各変数には別名が自動的に、あるいは入力画面からの入力によって付加される。この別名はテストを記述するときに変数を特定するために使うものである。また、変数の説明などもオペレータによって入力され、別名とともに変数情報81の一部としてテストデータベース80に格納される。ただし、変数情報は、解析によって得られる情報のみで十分な場合もあり、常に入力によって得る必要はない。
From the information obtained by analyzing the program, it is possible to know the attributes of the variables used in each module, and accordingly, the variable input screen (markup text generation) included in each module is configured. At this time, an alias is added to each variable automatically or by input from the input screen. This alias is used to identify variables when writing tests. In addition, a description of the variable is also input by the operator, and stored in the
プログラムの解析がすべて完了すると、テスト入力画面生成部71によりテストデータやテストロジックを入力する画面が生成される。入力画面はHTML(Hyper Text Markup Language)などのマークアップ言語を生成することで実現してもよい。
テストデータの入力画面とテストロジックの入力画面は合成されてテスト入力画面として生成され、生成されたテスト入力画面がデータ形式でテスト入力画面情報88としてテストデータベース80に格納される。
When all the program analysis is completed, a screen for inputting test data and test logic is generated by the test input
The test data input screen and the test logic input screen are combined and generated as a test input screen, and the generated test input screen is stored in the
以上で試験対象プログラム92をテストする準備が整った。次に、どのようなテストを行うのかを、生成されたテスト入力画面情報88により実際にテスト入力画面を表示部2に表示させ、オペレータが入力部4から必要な情報を入力する。すなわち、テスト編集部73では、生成されたテスト入力画面を使ってテストごとに編集するテストデータと実行するテストのロジックを入力部4からオペレータが入力する。
The preparation for testing the
入力画面から入力されるテストロジックはマークアップ言語とは別にECMAのJavaScript(登録商標)やMicrosoft 社のVBScriptやAdobe社のActionScriptのようなマークアップ
内に記述可能なスクリプトとして入力される。このようなスクリプトはコンパイル不要な言語で、軽量言語と呼ばれている。上記した変数の別名を使って制御構文などを使ってテストの検証ロジックを記述する。このように、テストロジックを、制御構造を有する軽量言語で記述できるので、機械語に近い低度な表現力しか有さないラダープログラムでは記述し難かった検証ロジックを簡単に記述することができる。テスト編集部73は入力されたロジックと、別名でプログラムの変数にアクセスするためのプログラムを結合してテストプログラム83を生成してテストデータ84とともにテストデータベース80に記録する。
テストプログラム実行部74はテストデータベース80に記録されたテストデータ84を用いてテストプログラム83を実行することによりテストを実行しテスト実行結果85をテストデータベース80に記録する。
In addition to the markup language, the test logic input from the input screen is input as a script that can be written in markup such as JavaScript (registered trademark) of ECMA, VBScript of Microsoft, or ActionScript of Adobe. Such a script is a language that does not require compilation and is called a lightweight language. Write test validation logic using control syntax, etc., using the above variable aliases. As described above, since the test logic can be described in a lightweight language having a control structure, it is possible to easily describe the verification logic that is difficult to describe in a ladder program having only a low level of expressive power similar to a machine language. The
The test
以上のステップのうち、テストを準備するまでのステップでは、例えば変数の説明や機能などの入力は試験対象プログラムのプログラム知識を有するオペレータが行う必要があるが、どのようなテストを行うのかを入力したり、テストを実行したりするステップ、すなわち実際にプログラム試験を行う段階では、試験対象プログラムのプログラム知識を有しないオペレータでも、軽量言語など最低限の知識を有していれば実施することができる。 Of the above steps, until the test is prepared, for example, it is necessary for an operator having program knowledge of the test target program to input explanations and functions of variables, but input what kind of test is to be performed. Or in the step of executing a test, that is, in the stage of actually performing a program test, even an operator who does not have the program knowledge of the test target program can perform it if it has a minimum knowledge such as a lightweight language. it can.
図2に、テストデータベースの具体的な構成を示す。図2に示すように、テストデータベース80はプログラムごとにモジュール情報82を格納するモジュール情報領域820と、モジュール毎に変数情報81を格納する変数情報領域810とをもち、モジュールの識別情報である要素IDを格納する要素ID領域87を有している。またモジュールごとにテスト情報を格納するテスト情報領域86をもち、テスト情報領域86にはモジュール
で使われるすべてのテストデータ84とテストプログラム83が格納されている。モジュール情報領域820にはプログラムの解析単位であるプログラムの部分(行番号のどこからどこまで)や直接関連する機能などが記憶されており、各モジュールのモジュール情報領域に変数情報領域810、テスト情報領域86を有している。変数情報領域810には各モジュールで使われている変数に関する属性(名称、型名、別名など)や、変数の使用状況(入力変数、出力変数、値の参照)が記憶されている。このように、各情報は、モジュール毎に関連付けて格納されており、モジュール情報にはそのモジュールが実現する機能の情報も含まれているため、結局各情報は機能ごとに管理されることになる。
FIG. 2 shows a specific configuration of the test database. As shown in FIG. 2, the
図1のプログラム試験装置を、CPUなどを用いて実現した場合のハードウエア構成を図3に示す。図3において、CPU1には、メモリ3、ディスプレイ21などの表示部2、キーボード41やマウス42などの入力部4、ハードティスク8が接続される。ハードディスク8には、図1の制御部70の機能を果たすプログラム試験プログラムとテストデータベース80、オペレーティングシステム(OS)90が記録されている。プログラム試験プログラム(制御部)70は、例えば記憶媒体からハードディスク8にインストールされる。図3では、CD−ROMドライブ5を介してCD−ROMからインストールされる例を示している。
FIG. 3 shows a hardware configuration when the program test apparatus of FIG. 1 is realized using a CPU or the like. In FIG. 3, a
図4に、制御部(プログラム試験プログラム)70のプログラム解析部75の動作の概要をフローチャートにして示す。プログラム試験プログラム70は、オペレーティングシステム90と協働して処理を行う。まず、キーボードから、試験対象となる試験対象プログラム92を入力する(ST01)。プログラムの入力は、入力部4のキーボードから入力したり、CD−ROMなどの記憶媒体からファイル形式で読み込むなどして行われる。CPU1は入力された試験対象プログラム92をディスプレイ上に表示する。表示された試験対象プログラムの一例を図5に示す。図5に示すように、試験対象プログラムとともに、プログラムIDや後述する要素ID、また機能名などオペレータが入力するための入力ボックス、あるいは変数情報なども表示される。
FIG. 4 is a flowchart showing an outline of the operation of the
解析するプログラムがそこで終了すれば処理を終了し、そうでなければ次の処理を行う(ST02)。試験対象プログラムは、一般に用いられているプログラム解析ツールなどと同様の方法でモジュールと呼ばれる部分に分割され、モジュールに付加する要素IDが生成される(ST03)。図5の例では、モジュールに対して137222という要素IDが生成されたことを示している。要素IDは、分割した各モジュールに対してテストデータベースがシステム内で識別するために設ける識別子である。例えば、機能やモジュール番号、プログラム番号などにIDをつけ、それを数ビット単位で割りつけるといった形にすると検索効率がよくなる。 If the program to be analyzed ends there, the process ends. If not, the next process is performed (ST02). The test target program is divided into portions called modules by a method similar to a commonly used program analysis tool, and an element ID added to the module is generated (ST03). The example of FIG. 5 shows that an element ID of 137222 has been generated for the module. The element ID is an identifier provided for the test database to identify each divided module in the system. For example, if an ID is assigned to a function, module number, program number, etc., and assigned in units of several bits, search efficiency is improved.
入力したプログラムの解析範囲や関連する機能名をオペレータが入力する(ST04)。これら解析範囲や機能名などは、オペレータが決定するものであってプログラム試験プログラム自体では判断や生成ができないため、オペレータが入力する。解析範囲の入力は、試験対象プログラムがラダープログラムであれば、プログラムソースやラダー命令の開始行と終了行を指定することで行われる。また、機能名は文字列を使って入力する。図5の例では「ポンプ運転」を機能名として入力している。 The operator inputs the analysis range of the input program and the related function name (ST04). These analysis ranges and function names are determined by the operator and cannot be determined or generated by the program test program itself, so the operator inputs them. When the test target program is a ladder program, the analysis range is input by designating the start line and end line of the program source or ladder instruction. The function name is entered using a character string. In the example of FIG. 5, “pump operation” is input as the function name.
図6はテストデータベースにおける要素IDを記憶させた領域である要素ID領域87に格納されている情報の一例を示したもので、最上段の要素IDはプログラムのIDが01で機能ID(機能の識別情報)は10、このプログラム01におけるモジュールのシリアル番号は01であることを示している。この値を16進として 0x011001と処理すると10進で69633の値が算出できる。このように、各モジュールは機能と関連付けて管理されている。
FIG. 6 shows an example of information stored in an
また、プログラムIDが01のプログラムは、IDが01、02、13、64、45のモジュールで構成されており、01、02、13のモジュールによって機能IDが10の機能を、64、45のモジュールによって機能IDが11の機能を実現するプログラムであることを示している。同様に、プログラムIDが02のプログラムは、IDが05、11、23のモジュールから構成されており、これらのモジュールで機能IDが20の機能を実現するプログラムであることを示している。プログラムIDが03のプログラムはIDが08、09、18のモジュールから構成されており、08のモジュールで機能IDが01の機能を、09のモジュールで02の機能を、18のモジュールで03の機能を実現するプログラムであることを示している。
The program with the
以上のように、プログラム解析部75により、試験対象プログラムはモジュールに分割されるが、機能名はオペレータが名づけるものであり、オペレータが名づけた機能がどのモジュールで実行されるのかはプログラム解析部75が自動で判断することはできない。従って、上記したように、オペレータがモジュール毎に機能名を入力することで、図6のような情報が得られる、すなわち、試験対象プログラムの解析にオペレータが関与することで、例えば機能ごとのプログラム試験が行えるようになるなど、効率的でより実際の動作に近い状況でプログラム試験が実行できるようになる。
As described above, the program to be tested is divided into modules by the
次にモジュールにおける変数の解析を行い、変数情報81を変数情報領域810に格納する。図7に示す変数情報領域810に記述されている変数情報がテストデータベース80における変数情報の例であり、ここではこのモジュールには変数M02、M24、B02、B36が検出されている。変数M02などはラダープログラムにおけるメモリアドレスの識別子であり、プログラムを記述するときによくアドレスが変わることがある。そこでA1などの別名を付けておき、テストを記述する際に使用する。また、この変数M02の型はWORD型16ビット長さの変数で、モジュールの入力変数として使われていることがわかる。なお、使用状況の欄におけるINが入力変数として使用されていることを示し、OUTは出力変数、REFは参照変数として使用されていることを示す。
Next, the variable in the module is analyzed, and the
以上の解析により得られた変数情報81からは各モジュールで使われる変数の属性を知ることができるので、それに合わせてモジュール毎に含まれる変数の入力画面(マークアップテキスト生成)を構成する(ST06)。モジュール毎に入力画面を構成するのは、解析により得ることができない変数の情報をオペレータにより入力させるためである。図8は変数情報からマークアップ言語を使って画面を生成した例である。既成のテンプレートのような画面を用意することで簡単に画面を生成することができる。このとき各変数には別名が自動的に、あるいはオペレータの入力により作成される。この別名はテストを記述するときに変数を特定するために使うものである。図8の入力画面の例では、オペレータによって変数の説明を入力させるようにしている。ただし、前述のように、変数情報は解析によって得られる情報のみで十分な場合もあり、必ずしも入力画面を構成して入力によって得る必要はない。
Since the
図5の例では、この変数に関する入力画面を、モジュールの機能名などを入力する画面と同時に表示している。図5の太線枠がオペレータによって入力する情報であり、ここでは、変数の別名もオペレータにより入力するようになっている。これら入力された変数の情報は、解析により得られた変数情報とともに変数情報領域810に格納される。
In the example of FIG. 5, the input screen regarding this variable is displayed simultaneously with the screen for inputting the function name of the module. The thick line frame in FIG. 5 is information input by the operator. Here, the alias of the variable is also input by the operator. Information on these input variables is stored in the
以上で、試験対象プログラム92の解析が完了し、テストに必要なプログラムの情報が得られた。次に、テストに必要なテストの情報、すなわちどのようなテストを行うのかをオペレータが入力するためのテスト入力画面を生成する。図9に、テスト入力画面生成部71の動作をフローチャートにして示す。まず、キーボードから対象となるプログラムを
入力する(ST10)。対象となるプログラムにテスト入力画面を生成するための解析を行うモジュールがなければ終了し、そうでない場合は次の処理を行う(ST11)。
次に、プログラムのもつモジュールの解析されていない最初の要素IDを取得してモジュールを読み込む(ST12)。次に作成するテスト入力画面を識別するテスト番号を入力する(ST13)。
Thus, the analysis of the
Next, the first element ID that is not analyzed of the module of the program is acquired and the module is read (ST12). Next, a test number for identifying a test input screen to be created is input (ST13).
ステップ14(ST14)では変数を解析してテストに必要な変数の値などを入力させるためのテストデータの入力画面を生成する。変数の入力画面が生成されると、次に各モジュールのテストロジックの入力画面が生成される(ST15)。このテストロジックの入力画面は、例えばマークアップ言語を使って生成する。上記した変数の別名を使って制御構文などを用いてテストのロジックを記述する。テストデータの入力画面とテストロジックの入力画面は合成されてテスト入力画面として生成され(ST16)、その画面を構成するのに必要なデータがテスト入力画面情報88としてテストデータベース80に格納される。
In step 14 (ST14), a variable is analyzed and a test data input screen for generating a variable value necessary for the test is generated. When the variable input screen is generated, the test logic input screen of each module is then generated (ST15). The test logic input screen is generated using, for example, a markup language. Describe the logic of the test using the control syntax etc. using the above aliases of variables. The test data input screen and the test logic input screen are combined and generated as a test input screen (ST16), and data necessary to configure the screen is stored in the
図10はモジュール情報82から生成されたテスト入力画面におけるテストロジックの入力画面部分を示したものである。ここでは変数情報81で定義された別名を用いて、簡易言語のような軽量言語を使ってロジック if( A3&A4 == true) { assert( A2 == A1+100
); } を記述している。これはビット型変数であるA3とA4のいずれかがtrueであるとき、WORD型の変数A2がWORD型の変数A1より100大きい数でない場合が異常であること
を検出するロジックである。このようなテストロジックは、試験毎にオペレータが決める必要があり、テスト入力画面生成部71によって自動で生成することはできないため、入力画面によってオペレータが入力するように構成している。このようにプログラマブルな条件を指定できるように構成することで、複雑な条件など、種々の状態を模擬した試験が行えるようになる。
FIG. 10 shows the input screen portion of the test logic in the test input screen generated from the
);} Is described. This is logic for detecting that when either of the bit type variables A3 and A4 is true, it is abnormal if the WORD type variable A2 is not a
図11は生成されたテスト入力画面の例である。ここでは、このモジュールに関連するプログラム名は”A水処理場“、機能名は”水処理“であり、モジュールで使用されている変数へのテストデータ入力画面部などが表示されている。テストデータやロジックは画面にある編集ボタンを押すことで編集モードに切り替わり編集が行えるようになる。 FIG. 11 shows an example of the generated test input screen. Here, the program name related to this module is “A water treatment plant”, the function name is “water treatment”, and a test data input screen section for variables used in the module is displayed. Test data and logic can be edited by switching to the edit mode by pressing the edit button on the screen.
次に、実際にテストを行う場合、テスト編集部73が、テスト入力画面情報88を用いて、表示部2に図11の例で示すようなテスト入力画面を表示させ、オペレータにテストロジックや必要なテストデータを入力させる。入力されたテストロジックと、別名でプログラムの変数にアクセスするためのプログラムを結合してテストプログラム83を生成して、入力された変数データなどのテストデータ84とともにテストデータベース80に記録する。
Next, when the test is actually performed, the
このようにしてテストプログラム83およびテストデータ84が整った後、オペレータにより実行ボタンが押されると、テストプログラム実行部74がテストデータベース80に記録されたテストデータ84と軽量言語のような簡易言語で記述されたテストプログラム83を読み込んで、ローダ93にテストプログラム83とテストデータ84を送り、ローダ93がPLC94で実行可能な形式に変換してPLC94上でテストが実行される。テストが実行されると、テストプログラム実行部74がPLC94のメモリーにある実行結果のデータを受け取り、テスト実行結果85をテストデータベース80に記録する。また、テスト結果は表示部2に表示させることもできる。このようにして、テストプログラム実行部74では、PLC94上でテストプログラムを実行させるとともに、テストの実行結果を機能ごと、テスト実行単位で管理することができる。
After the
図12はテストデータベース80にあるテスト実行結果85の例である。これによればA水処理場に関するテストが1日単位で実行され、9月9日のテストではモジュール34
と56についてはテストが成功していないが、次の日の9月10日のテストでは各モジュールのバージョンがともに0.8から1.0、1.1から2.0に更新されることでテストがクリアされていることがわかる。このようにテスト結果を一元的に管理することで機能単位、モジュール単位、日時単位といった側面で多角的に分析を行えるため試験の効率化をはかることが可能になる。
FIG. 12 shows an example of the
Tests for 56 and 56 have not been successful, but in the next day's test on September 10, the version of each module has been updated from 0.8 to 1.0 and 1.1 to 2.0. Recognize. By managing the test results centrally in this way, analysis can be performed in a multifaceted manner in terms of functional units, module units, and date / time units, so that the efficiency of the test can be improved.
以上説明したように、本実施の形態1によれば、プログラム解析部が自動で解析により得ることができないモジュール情報や変数情報の一部を、オペレータに入力させることで得ることができ、さらに、オペレータにテストロジックとテストデータを入力させることにより、複数の条件を組み合せたり、時間や状態変化を考慮したり、ある条件での試験結果を他の条件の入力データとして使ったりするなどプログラマブルな条件でプログラム試験が行える効果がある。 As described above, according to the first embodiment, it is possible to obtain a part of module information or variable information that cannot be obtained by analysis by the program analysis unit automatically by an operator, Programmable conditions such as combining multiple conditions by taking the test logic and test data into the operator, taking into account time and state changes, and using test results under certain conditions as input data for other conditions Has the effect of being able to perform a program test.
実施の形態2.
図13は、本発明の実施の形態2によるプログラム試験装置のプログラム解析部75の動作の概要を説明するフローチャート図である。各機能は、機能同士で関連する場合がある。例えばある機能の出力値が別の機能の入力になったり、ある機能の出力値により別の機能の判断が変化したり、といった様に、相互に他の機能に依存することが多い。このような依存関係は、プログラムの解析によるだけでは抽出できない場合が多い。このため、オペレータに依存関係を入力させて、依存関係を明確にしておくことで、プログラム試験が、より効率的に実行できることになる。
FIG. 13 is a flowchart for explaining the outline of the operation of the
図13において、ステップ08(ST08)、09(ST09)以外は実施の形態1の図4と同様である。これらステップ08、09が、プログラム解析部75において依存関係を入力するステップである。依存するモジュールがなければ次の処理に移る(ST08)が、このモジュールが依存する他のモジュールがあればその要素IDを入力する(ST09)。実際には、図14に示すように、依存するモジュールを入力させるボックスを用意することで行われる。図14の例では、依存するモジュールとして要素ID69634のモジュールを指定して
いる。つまり要素ID69634のモジュールは要素ID137222のモジュールから呼び出され
るモジュールとなる。この情報は、モジュール情報に格納される。なお、依存関係は、モジュールではなく、依存する機能を入力させるようにしても良い。依存する機能がわかれば依存するモジュールが抽出できるからである。この場合、機能のIDまたは機能名を入力させることになる。
13 is the same as FIG. 4 of the first embodiment except for steps 08 (ST08) and 09 (ST09). These
図15は、本発明の実施の形態2によるプログラム試験装置のテスト入力画面生成部の動作の概要を説明するフローチャート図である。図15において、ステップ17(ST17)、18(ST18)以外は実施の形態1の図9と同様である。これらステップ17、18が、テスト入力画面生成部において、依存関係を判断して対応する入力画面を生成するステップである。入力画面を生成するモジュールのモジュール情報に、他のモジュールに依存する情報があるかどうか判断し(ST17)ある場合は、関連するモジュール(あるいはそのモジュールが実行する機能)の入力画面へのハイパーリンクを生成する(ST18)。ステップ14で生成されたテストデータの入力画面とステップ15で生成されたテストロジックの入力画面、およびステップ18で生成された関連するモジュールの入力画面は合成されてテスト入力画面として生成され、その画面を構成するためのデータがテスト入力画面情報88としてテストデータベース80に格納される。
FIG. 15 is a flowchart illustrating an outline of the operation of the test input screen generation unit of the program test apparatus according to the second embodiment of the present invention. 15 is the same as FIG. 9 of the first embodiment except for steps 17 (ST17) and 18 (ST18). These
図16に生成されたテスト入力画面の例を示す。ここでは、実施の形態1の図11と同様、このモジュールに関連するプログラム名は”A水処理場“、機能名は”水処理“であり、モジュールで使用されている変数へのテストデータ入力画面部などが表示されている。テストデータやロジックは画面にある編集ボタンを押すことで編集モードに切り替わり編集が行えるようになる。加えて、「依存関係にある機能」の欄が設けられ、この欄に関連する機能の入力画面へのハイパーリンクが表示されている。 FIG. 16 shows an example of the test input screen generated. Here, as in FIG. 11 of the first embodiment, the program name related to this module is “A water treatment plant”, the function name is “water treatment”, and test data is input to variables used in the module. The screen section is displayed. Test data and logic can be edited by switching to the edit mode by pressing the edit button on the screen. In addition, a “depending function” column is provided, and a hyperlink to an input screen for a function related to this column is displayed.
次に、実際にテストを行う場合、実施の形態1と同様、テスト編集部73が、テスト入力画面情報88を用いて、表示部2に図16の例で示すようなテスト入力画面を表示させ、オペレータにテストロジックや必要なテストデータを入力させる。入力されたテストロジックと、別名でプログラムの変数にアクセスするためのプログラムを結合してテストプログラム83を生成して、入力された変数データなどのテストデータ84とともにテストデータベース80に記録する。
Next, when the test is actually performed, the
このようにしてテストプログラム83およびテストデータ84が整った後、オペレータにより実行ボタンが押されると、テストプログラム実行部74がテストデータベース80に記録されたテストデータ84と軽量言語のような簡易言語で記述されたテストプログラム83を読み込んで、ローダ93にテストプログラム83とテストデータ84を送り、ローダ93がPLC94で実行可能な形式に変換してPLC94上でテストが実行される。テストが実行されるとテストプログラム実行部74がPLC94のメモリーにある実行の結果のデータを受け取り、テスト実行結果85をテストデータベース80に記録する。また、テスト結果は表示部2に表示させることもできる。このようにして、テストプログラム実行部74では、PLC94上でテストプログラムを実行させるとともに、テストの実行結果を機能ごと、テスト実行単位で管理することができる。
After the
以上説明したように、本実施の形態2によれば、実施の形態1と同様、プログラム解析部が自動で解析できないモジュール情報や変数情報の一部を、オペレータに入力させることで得ることができ、さらに、オペレータによりテストロジックを入力させることにより、複数の条件を組み合せたり、時間や状態変化を考慮したり、ある条件での試験結果を他の条件の入力データとして使ったりするなどプログラマブルな条件でプログラム試験が行える。本実施の形態2では、これに加えて、依存関係にある機能をテストすることができるため、テスト結果に異常があり、試験対象プログラムにバグがある可能性があると判断された場合など、依存関係にある機能のテストも行うことで、効率的にバグ検索を行うことができる。 As described above, according to the second embodiment, as in the first embodiment, it is possible to obtain a part of module information or variable information that cannot be analyzed automatically by the program analysis unit by causing the operator to input it. In addition, by inputting test logic by the operator, programmable conditions such as combining multiple conditions, considering time and state changes, and using test results under certain conditions as input data for other conditions A program test can be performed at. In the second embodiment, in addition to this, since it is possible to test the function in the dependency relationship, when it is determined that there is an abnormality in the test result and there is a possibility that the test target program has a bug, etc. You can search for bugs efficiently by testing the functions that have dependencies.
2:表示部 4:入力部
70:制御部 71:テスト入力画面生成部
73;テスト編集部 74:テストプログラム実行部
80:テストデータベース 81:変数情報
82:モジュール情報 83テストプログラム
84:テストデータ 92:試験対象プログラム
2: Display unit 4: Input unit 70: Control unit 71: Test input
Claims (11)
上記制御部は、上記入力部から入力された試験対象プログラムを複数のモジュールに分割し、この分割されたモジュール毎に当該モジュールを解析して、モジュールの情報と、上記モジュール毎に用いられている変数情報とを取得し、上記モジュール毎に当該モジュールが実現する機能の情報を上記入力部から取得して上記モジュールの情報に加えてモジュール情報とし、このモジュール情報と上記変数情報とを上記テストデータベースに格納するプログラム解析部と、
上記テストデータベースに格納された上記モジュール情報と上記変数情報とを用いて、上記モジュール毎にプログラム試験を行うために必要なテストロジックとテストデータとを上記入力部から入力するためのテスト入力画面を生成してこのテスト入力画面を構成するためのテスト入力画面情報を上記テストデータベースに格納するテスト入力画面生成部と、
上記テスト入力画面情報を用いて上記表示部に上記テスト入力画面を表示させるとともに、上記テスト入力画面を用いて入力されたテストロジックからテストプログラムを生成し、生成したテストプログラムと入力されたテストデータを上記テストデータベースに格納するテスト編集部と、
上記テストデータベースに格納された上記テストデータを用いて上記テストプログラムを実行し、テスト結果を上記テストデータベースに格納するテストプログラム実行部と
を備えたことを特徴とするプログラム試験装置。 In a program testing apparatus comprising an input unit, a display unit, a control unit, and a test database,
The control unit divides the test target program input from the input unit into a plurality of modules, analyzes the module for each of the divided modules, and uses module information and the modules. Variable information is acquired, information on the function realized by the module for each module is acquired from the input unit and added to the module information as module information, and the module information and the variable information are converted to the test database. A program analysis unit to be stored in
Using the module information and the variable information stored in the test database, a test input screen for inputting test logic and test data necessary for performing a program test for each module from the input unit. A test input screen generator for storing test input screen information for generating and configuring the test input screen in the test database;
The test input screen is displayed on the display unit using the test input screen information, a test program is generated from the test logic input using the test input screen, the generated test program and the input test data A test editing section for storing in the test database,
A program test apparatus comprising: a test program execution unit that executes the test program using the test data stored in the test database and stores a test result in the test database.
プログラム試験装置。 2. The program test apparatus according to claim 1, wherein the input test logic is described in a lightweight language.
この分割されたモジュール毎のモジュールの情報と、これらモジュール毎に用いられている変数情報とを解析して取得するステップと、
上記モジュール毎に当該モジュールが実現する機能の情報を入力部から取得して上記モジュールの情報に加えてモジュール情報とし、このモジュール情報と上記変数情報とをテストデータベースに格納するステップと、
上記テストデータベースに格納された上記モジュール情報と上記変数情報とを用いて、上記モジュール毎にプログラム試験を行うために必要なテストロジックとテストデータとを入力するためのテスト入力画面を生成するステップと、
生成された上記テスト入力画面を表示部に表示させて、上記入力部から入力されたテストロジックからテストプログラムを生成し、この生成されたテストプログラムと上記入力部から入力されたテストデータとを上記テストデータベースに格納するステップと、
上記テストデータベースに格納された上記テストデータを用いて上記テストプログラムを実行し、テスト結果を上記テストデータベースに格納するステップと
を備えたことを特徴とするプログラム試験方法。 Dividing the input program to be tested into a plurality of modules;
Analyzing and obtaining module information for each of the divided modules and variable information used for each module;
Acquiring information on the function realized by the module for each module from the input unit and adding the module information to module information, and storing the module information and the variable information in a test database;
Generating a test input screen for inputting test logic and test data necessary for performing a program test for each module, using the module information and the variable information stored in the test database; ,
The generated test input screen is displayed on the display unit, a test program is generated from the test logic input from the input unit, and the generated test program and the test data input from the input unit are Storing in a test database;
A program test method comprising: executing the test program using the test data stored in the test database and storing a test result in the test database.
この分割されたモジュール毎のモジュールの情報と、これらモジュール毎に用いられている変数情報とを解析して取得する手順と、
上記モジュール毎に当該モジュールが実現する機能の情報を入力部から取得して上記モジュールの情報に加えてモジュール情報とし、このモジュール情報と上記変数情報とをテストデータベースに格納する手順と、
上記テストデータベースに格納された上記モジュール情報と上記変数情報とを用いて、上記モジュール毎にプログラム試験を行うために必要なテストロジックとテストデータとを入力するためのテスト入力画面を生成する手順と、
生成された上記テスト入力画面を表示部に表示させ、テストロジックとテストデータとを入力させる手順と、
入力された上記テストロジックからテストプログラムを生成する手順と、
入力された上記テストデータを用いて上記テストプログラムを実行し、テスト結果を上記テストデータベースに格納する手順と、
をコンピュータに実行させることを特徴とするプログラム試験用プログラム。 A procedure for dividing the inputted program to be tested into a plurality of modules;
A procedure for analyzing and obtaining information on the modules for each of the divided modules and variable information used for each module;
For each module, information on the function realized by the module is obtained from the input unit and added to the module information as module information, and the module information and the variable information are stored in a test database.
A procedure for generating a test input screen for inputting test logic and test data necessary for performing a program test for each module using the module information and the variable information stored in the test database; ,
A procedure for displaying the generated test input screen on the display unit and inputting test logic and test data,
A procedure for generating a test program from the input test logic,
A procedure for executing the test program using the input test data and storing test results in the test database;
A program test program for causing a computer to execute.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2009268772A JP5230587B2 (en) | 2009-11-26 | 2009-11-26 | Ladder program program test apparatus, ladder program test method, and ladder program test program |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2009268772A JP5230587B2 (en) | 2009-11-26 | 2009-11-26 | Ladder program program test apparatus, ladder program test method, and ladder program test program |
Publications (2)
Publication Number | Publication Date |
---|---|
JP2011113277A true JP2011113277A (en) | 2011-06-09 |
JP5230587B2 JP5230587B2 (en) | 2013-07-10 |
Family
ID=44235567
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2009268772A Expired - Fee Related JP5230587B2 (en) | 2009-11-26 | 2009-11-26 | Ladder program program test apparatus, ladder program test method, and ladder program test program |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP5230587B2 (en) |
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2014199603A (en) * | 2013-03-29 | 2014-10-23 | 富士通株式会社 | Test support program, test support device, and test support method |
JP2018180711A (en) * | 2017-04-06 | 2018-11-15 | 株式会社日立製作所 | Calculator selecting test case and selection method of test case |
WO2020209098A1 (en) * | 2019-04-10 | 2020-10-15 | 日本電信電話株式会社 | Input value setting support device, input value setting support method, and program |
JPWO2020261325A1 (en) * | 2019-06-24 | 2020-12-30 | ||
JP2021125020A (en) * | 2020-02-06 | 2021-08-30 | 三菱電機株式会社 | Controller test data restoration system |
JP7208441B1 (en) * | 2021-12-22 | 2023-01-18 | 三菱電機株式会社 | FA control test support program, FA control test support device, FA control test support method and FA control test support system |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH0728521A (en) * | 1993-07-09 | 1995-01-31 | Yaskawa Electric Corp | Automatic generating method for simulation program |
JPH07191880A (en) * | 1993-12-27 | 1995-07-28 | Nec Corp | Test supporting device |
JPH08305609A (en) * | 1995-04-28 | 1996-11-22 | Oki Electric Ind Co Ltd | Program test method and device |
JP2005044316A (en) * | 2003-07-25 | 2005-02-17 | Omron Corp | Simulation support tool, verification system for ladder program, and program product |
-
2009
- 2009-11-26 JP JP2009268772A patent/JP5230587B2/en not_active Expired - Fee Related
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH0728521A (en) * | 1993-07-09 | 1995-01-31 | Yaskawa Electric Corp | Automatic generating method for simulation program |
JPH07191880A (en) * | 1993-12-27 | 1995-07-28 | Nec Corp | Test supporting device |
JPH08305609A (en) * | 1995-04-28 | 1996-11-22 | Oki Electric Ind Co Ltd | Program test method and device |
JP2005044316A (en) * | 2003-07-25 | 2005-02-17 | Omron Corp | Simulation support tool, verification system for ladder program, and program product |
Cited By (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2014199603A (en) * | 2013-03-29 | 2014-10-23 | 富士通株式会社 | Test support program, test support device, and test support method |
JP2018180711A (en) * | 2017-04-06 | 2018-11-15 | 株式会社日立製作所 | Calculator selecting test case and selection method of test case |
WO2020209098A1 (en) * | 2019-04-10 | 2020-10-15 | 日本電信電話株式会社 | Input value setting support device, input value setting support method, and program |
JP2020173592A (en) * | 2019-04-10 | 2020-10-22 | 日本電信電話株式会社 | Input value setting assisting apparatus, input value setting assisting method and program |
JP7211229B2 (en) | 2019-04-10 | 2023-01-24 | 日本電信電話株式会社 | Input value setting assistance device, input value setting assistance method and program |
JPWO2020261325A1 (en) * | 2019-06-24 | 2020-12-30 | ||
WO2020261325A1 (en) * | 2019-06-24 | 2020-12-30 | 日本電気株式会社 | Fault isolation system, method and program |
JP7215578B2 (en) | 2019-06-24 | 2023-01-31 | 日本電気株式会社 | Fault isolation system, method and program |
JP2021125020A (en) * | 2020-02-06 | 2021-08-30 | 三菱電機株式会社 | Controller test data restoration system |
JP7208441B1 (en) * | 2021-12-22 | 2023-01-18 | 三菱電機株式会社 | FA control test support program, FA control test support device, FA control test support method and FA control test support system |
Also Published As
Publication number | Publication date |
---|---|
JP5230587B2 (en) | 2013-07-10 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US20120116561A1 (en) | Program testing apparatus, method of testing a program, and program testing program | |
JP5649748B1 (en) | Programmable controller peripheral device and debugging support program | |
JP5230587B2 (en) | Ladder program program test apparatus, ladder program test method, and ladder program test program | |
US9389849B2 (en) | Test case pattern matching | |
US8356282B1 (en) | Integrated development environment for the development of electronic signal testing strategies | |
JP2017142800A (en) | Rule Builder for Process Control Network | |
CN101996131A (en) | Automatic test method and automatic test platform for graphic user interface (GUI) based on x extensive makeup language (XML) packaging key word | |
Aho et al. | Automated Java GUI modeling for model-based testing purposes | |
EP3361398B1 (en) | Engineering apparatus, engineering method, and program | |
US20120239374A1 (en) | System and method of simulating input/output modules in a control system | |
JP2015026129A (en) | Process controller and system; and soundness determination method | |
CN112346987A (en) | Test case generation and conversion method and system based on Xmind | |
US8874598B2 (en) | Method and system for an executable specification | |
US7451358B2 (en) | Test executive system with automatic expression logging and parameter logging | |
US10579761B1 (en) | Method and system for reconstructing a graph presentation of a previously executed verification test | |
JP2008305079A (en) | Requirement specification automatic verification method | |
JP2013171350A (en) | Device for measuring test coverage of diagram type program, and method therefor, and program | |
JP5726776B2 (en) | Simulator software replacement apparatus, method, and program | |
JP5907857B2 (en) | Logic drawing and test table creation device | |
JP5539921B2 (en) | Program development tools | |
JPH11224211A (en) | Software inspection support device | |
JP2020021109A (en) | Verification program, storage medium, verification device and verification method | |
WO2017149737A1 (en) | High-level synthesis device, high-level synthesis method, and high-level synthesis program | |
JP6139389B2 (en) | Plant control logic design support system, plant control logic design support method, and program | |
JP2005316710A (en) | Software test support device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20111025 |
|
A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20120926 |
|
A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20121009 |
|
A521 | Written amendment |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20121120 |
|
TRDD | Decision of grant or rejection written | ||
A01 | Written decision to grant a patent or to grant a registration (utility model) |
Free format text: JAPANESE INTERMEDIATE CODE: A01 Effective date: 20130312 |
|
A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20130319 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20160329 Year of fee payment: 3 |
|
R151 | Written notification of patent or utility model registration |
Ref document number: 5230587 Country of ref document: JP Free format text: JAPANESE INTERMEDIATE CODE: R151 |
|
R250 | Receipt of annual fees |
Free format text: JAPANESE INTERMEDIATE CODE: R250 |
|
R250 | Receipt of annual fees |
Free format text: JAPANESE INTERMEDIATE CODE: R250 |
|
R250 | Receipt of annual fees |
Free format text: JAPANESE INTERMEDIATE CODE: R250 |
|
LAPS | Cancellation because of no payment of annual fees |