[go: up one dir, main page]

JP2013149178A - Test code automatic generation program using debugger function - Google Patents

Test code automatic generation program using debugger function Download PDF

Info

Publication number
JP2013149178A
JP2013149178A JP2012010572A JP2012010572A JP2013149178A JP 2013149178 A JP2013149178 A JP 2013149178A JP 2012010572 A JP2012010572 A JP 2012010572A JP 2012010572 A JP2012010572 A JP 2012010572A JP 2013149178 A JP2013149178 A JP 2013149178A
Authority
JP
Japan
Prior art keywords
test code
gui
test
gui application
class
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
JP2012010572A
Other languages
Japanese (ja)
Inventor
Shinichi Tokita
信一 時田
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.)
ARP CO Ltd
Original Assignee
ARP 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 ARP CO Ltd filed Critical ARP CO Ltd
Priority to JP2012010572A priority Critical patent/JP2013149178A/en
Publication of JP2013149178A publication Critical patent/JP2013149178A/en
Pending legal-status Critical Current

Links

Landscapes

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

Abstract

PROBLEM TO BE SOLVED: To provide a program for recording an operation performed by a user and automatically generating a test code for reproducing the operation in a GUI (Graphical User Interface) application subject to a test and being independent of means such as relaying and capturing an event message represented by an X Window system and Windows (registered trade mark).SOLUTION: The test code automatic generation program comprises: a recorder 20 for obtaining and storing information from a debugger library 30 that a processing system of a GUI application 100 provides to the GUI application 100 subject to a test; an information storage unit 40 for storing the information; and a test code output unit 50 for outputting a test code source file 200 from the information storage unit 40.

Description

この発明は、GUI(Graphical User Interface)アプリケーションのテスト支援システムに係り、特に、テスト自動化で使用するテストコードの自動生成に関する。   The present invention relates to a test support system for a GUI (Graphical User Interface) application, and more particularly to automatic generation of a test code used for test automation.

近年、プログラムを作成する際、同時にそのプログラムのテストコードも作成するという開発形態が一般的になってきている。理由としては、プログラムコードを修正した際、テストコードがあれば回帰テストをすぐに実行することが出来、開発効率がよいからである。たとえば、Java(登録商標)においては、JUnitと呼ばれるテストフレームワークが存在し、このフレームワークに従ったテストコードを作成すれば、簡単に単体テストを行うことができる。   In recent years, a development form in which, when a program is created, a test code for the program is created at the same time has become common. The reason is that when the program code is modified, if there is a test code, the regression test can be executed immediately and the development efficiency is high. For example, in Java (registered trademark), there is a test framework called JUnit, and if a test code according to this framework is created, a unit test can be easily performed.

しかしながら、テストコードの作成は、対象となるプログラムのプログラム間インターフェース(関数の引数等)が変わると、テストコードの修正が必要となるなど、テストコードの作成自体が開発者にとって非常に労力が必要な作業となっている。そのため、テストコード自体を自動生成する手法が種々提案されている。   However, test code creation itself requires a lot of labor for the developer, such as the test code needs to be modified if the program interface (function arguments, etc.) of the target program changes. It has become a difficult task. Therefore, various methods for automatically generating the test code itself have been proposed.

例えば、特許文献1においては、テスト対象となるGUIアプリケーションを修正して、Xウィンドウ・システムのイベント・メッセージを補足し、イベント情報としてファイルに格納し、保存したイベント情報より、GUIを自動実行し操作する方法が紹介されている。   For example, in Patent Document 1, a GUI application to be tested is modified to supplement an X window system event message, stored in a file as event information, and a GUI is automatically executed from the saved event information. How to operate is introduced.

また、特許文献2においては、従来の方法として、Xウィンドウ・システムにおけるイベント・メッセージの補足方法としてXサーバの特別な拡張機能を使用して補足する方法が紹介されており、その改善点として同文献では、メッセージ交換手段を作成することにより、GUIアプリケーションにおけるイベント・メッセージの補足とGUIアプリケーションを再生する手法が紹介されている。   Patent Document 2 introduces a conventional method of supplementing an event message in the X window system using a special extended function of the X server as a supplement method of the event message. The literature introduces a method for supplementing an event message in a GUI application and reproducing the GUI application by creating a message exchange means.

また、特許文献3においては、ウィンドウズ(登録商標)におけるGUIアプリケーションの動作記録方法として、ウィンドウズ(登録商標)のOS内部で発生するイベント・メッセージを読み込んでGUI用スクリプトファイルに保存するという方法が紹介されている。   Patent Document 3 introduces a method of recording an operation of a GUI application in Windows (registered trademark) by reading an event message generated inside the OS of Windows (registered trademark) and saving it in a script file for GUI. Has been.

特開平7−84765JP-A-7-84765 特許第3271682号Japanese Patent No. 3271682 特許第4295775号Japanese Patent No. 4295775

上記方法では、Xウィンドウ・システム、ウィンドウズ(登録商標)のいずれの場合にしても、GUIアプリケーションがイベント・メッセージを処理する前にイベント・メッセージを補足し、イベント情報を記録するという方法であり、イベント・メッセージがない(またはイベント・メッセージを補足することが難しい)GUIシステムにおいては、同様の手法を取り入れることができず、テストコードを自動生成することが困難であった。   In the above method, in either case of the X window system or Windows (registered trademark), before the GUI application processes the event message, the event message is supplemented and the event information is recorded. In a GUI system that does not have an event message (or that it is difficult to supplement the event message), a similar method cannot be adopted, and it is difficult to automatically generate a test code.

本発明は、イベント・メッセージがないGUIシステムにおいても、ユーザがGUIアプリケーションを操作した内容を記録し、テストコードを自動生成する手法を、提案するものである。   The present invention proposes a method for automatically generating a test code by recording the content of a user operating a GUI application even in a GUI system without an event message.

本発明は、テスト対象となるGUIアプリケーションにおいて以下の条件を前提とする。
(イ)GUIアプリケーションは、GUIに関して特定のGUIフレームワーク(またはGUIライブラリ)を使用して実装されている。
(ロ)GUIアプリケーションと(イ)のフレームワークは、シンボリックデバッガにより、デバッグ可能である。
(ハ)(ロ)で提供されるデバッガは、外部プログラムから操作できるデバッガライブラリを持ち合わせている。
(ニ)ユーザの動作を再現できるようなテストプログラムのテストフレームワークが存在している。
(ホ)テストコードを自動生成するに当たり、GUIフレームワークにおいて必要となるデータ項目が明確になっている。
The present invention is premised on the following conditions in the GUI application to be tested.
(A) A GUI application is implemented using a specific GUI framework (or GUI library) with respect to the GUI.
(B) The GUI application and the framework (a) can be debugged by a symbolic debugger.
(C) The debugger provided in (b) has a debugger library that can be operated from an external program.
(D) There is a test framework for test programs that can reproduce user actions.
(E) The data items required in the GUI framework for automatically generating the test code are clarified.

本発明におけるテストコード自動生成プログラムは、以下のレコーダ、情報記憶部、テストコード出力部を含むプログラムを作成することで達成される。   The test code automatic generation program according to the present invention is achieved by creating a program including the following recorder, information storage unit, and test code output unit.

レコーダは、テスト対象となるGUIアプリケーションの処理系が持つデバッガライブラリを使用し、前記GUIアプリケーションを起動し、起動後、テストコード生成に必要となる個所に実行停止(以降、ブレイクと記述する)ポイントを自動的に設定し、前記GUIアプリケーションが動作している間は、自動で以下の動作を行うモジュールである。
(A)設定したブレイクポイントによるテスト対象プログラムのブレイク
(B)テストコードの生成に必要なデータの取得、情報記憶部への保存
(C)GUIアプリケーションの再開
The recorder uses the debugger library of the processing system of the GUI application to be tested, starts the GUI application, and after starting, stops execution at the location required for test code generation (hereinafter referred to as break). Is a module that automatically performs the following operations while the GUI application is operating.
(A) Break of test target program by set break point (B) Acquisition of data necessary for generating test code, saving to information storage unit (C) Resumption of GUI application

情報記憶部は、レコーダが記録した内容を一時的に保持し、テストコードを生成するときに使用するモジュールである。   The information storage unit is a module that temporarily holds the content recorded by the recorder and is used when generating a test code.

テストコード出力部は、情報記憶部に蓄積したデータを元にテストコードを生成するモジュールである。   The test code output unit is a module that generates a test code based on data accumulated in the information storage unit.

本発明を用いることで、イベント・メッセージのないGUIシステムにおいても、ユーザがGUIアプリケーションを操作した内容を記録し、テストコードを自動生成することが可能である。   By using the present invention, even in a GUI system without an event message, it is possible to record the content of the user operating the GUI application and automatically generate a test code.

また本発明を用いることで、GUIアプリケーション及びGUIアプリケーションが使用するGUIフレームワークを変更することなく、GUIアプリケーションを動作させた時のユーザの操作を記録し、その記録した内容からユーザ操作と同じ動作を行うテストコードを自動生成することができる。   In addition, by using the present invention, the user operation when the GUI application is operated is recorded without changing the GUI application and the GUI framework used by the GUI application, and the same operation as the user operation is performed from the recorded contents. Test code to perform can be automatically generated.

更に本発明を用いることで、GUIフレームワークに依存するが、GUIアプリケーションに依存しないテストコード自動生成プログラムを作成することができる。   Furthermore, by using the present invention, it is possible to create a test code automatic generation program that depends on the GUI framework but does not depend on the GUI application.

本発明の実施形態の一例を表す構成図である。モジュール間の実線は、モジュール間の関連を表し、矢印線はデータの流れを表す。他の構成図も同様の記法とする。It is a block diagram showing an example of embodiment of this invention. The solid line between modules represents the relationship between modules, and the arrow line represents the flow of data. The same notation is used for the other configuration diagrams. 図1における、テストコード自動生成プログラムの動作を表すフローチャートである。矢印線は処理の流れを表す。It is a flowchart showing operation | movement of the test code automatic generation program in FIG. Arrow lines represent the flow of processing. GUIアプリケーション、テストコードソースファイル、テストコード自動生成プログラムにJava(登録商標)を使用した場合の、テストコード自動生成プログラムの実施形態の一例を表す構成図である。It is a block diagram showing an example of embodiment of a test code automatic generation program at the time of using Java (trademark) for a GUI application, a test code source file, and a test code automatic generation program. 図3における、GUIアプリケーションの具体例である、画面構成を表す。3 shows a screen configuration, which is a specific example of the GUI application in FIG. 図3における、GUIフレームワークの具体例である。It is a specific example of the GUI framework in FIG. 図3における、ブレイクポイント設定テーブルの具体例である。It is a specific example of a breakpoint setting table in FIG. 図3における、GUIアプリケーション固有部分の実装部分の具体例である。It is a specific example of the mounting part of the GUI application specific part in FIG. 図4のGUIアプリケーションにおいて、記録中にユーザが行った操作の例である。5 is an example of an operation performed by a user during recording in the GUI application of FIG. 図4に対してレコーダが記録したトレース情報テーブルの具体例である。5 is a specific example of a trace information table recorded by the recorder with respect to FIG. 図3における、テストコード変換テーブルの例である。It is an example of the test code conversion table in FIG. 図3において、出力されたテストコードの例である。FIG. 3 shows an example of the output test code.

以下、本発明の実施の形態を図面を参照して説明する。   Hereinafter, embodiments of the present invention will be described with reference to the drawings.

図1は、本発明によるテストコード自動生成プログラムの実施の形態に係るもので、その内部・外部の構成を表す図であり、このプログラムは、コンピュータシステムにおけるハードウェア資源を使用することによって実現されるものである。   FIG. 1 relates to an embodiment of an automatic test code generation program according to the present invention, and is a diagram showing the internal / external configuration thereof. This program is realized by using hardware resources in a computer system. Is.

図1に示すように、このテストコード自動生成プログラム10は、テスト対象となるGUIアプリケーション100の動作を記録するレコーダ20、レコーダ20が取得した情報を保持するための情報記憶部40、情報記憶部40からテストコードソースファイル200を出力するテストコード出力部50、によって構成される。レコーダ20は、GUIアプリケーション100の処理系が提供するデバッガライブラリ30を使用するため、デバッガライブラリ30と接続している。GUIアプリケーション100は、内部的には、GUIフレームワーク110とGUIアプリケーションの固有部分120に分かれる。テストコードソースファイル200は、テストコード自動生成プログラム10が、GUIアプリケーション100のユーザによる操作を記録した後に出力する、ユーザの操作と同じ動作するテストコードソースファイルを表している。   As shown in FIG. 1, the test code automatic generation program 10 includes a recorder 20 that records the operation of the GUI application 100 to be tested, an information storage unit 40 that holds information acquired by the recorder 20, and an information storage unit. The test code output unit 50 outputs the test code source file 200 from 40. The recorder 20 is connected to the debugger library 30 in order to use the debugger library 30 provided by the processing system of the GUI application 100. The GUI application 100 is internally divided into a GUI framework 110 and a unique part 120 of the GUI application. The test code source file 200 represents a test code source file that is output after the test code automatic generation program 10 records an operation by the user of the GUI application 100 and operates in the same manner as the user operation.

図2は、テストコード自動生成プログラム10がGUIアプリケーション100を起動してからテストコードソースファイル200を出力するまでの処理手順を表すフローチャートである。以下、図2のフローチャートを元にテストコード自動生成プログラム10の処理手順について説明する。   FIG. 2 is a flowchart showing a processing procedure from when the test code automatic generation program 10 starts up the GUI application 100 to when the test code source file 200 is output. The processing procedure of the test code automatic generation program 10 will be described below based on the flowchart of FIG.

まず、ステップST1−1においてレコーダ20がGUIアプリケーション100を一時停止の状態で起動し、ステップST1−2において、GUIフレームワーク110に対してテストコード生成に必要な情報が抽出できる箇所に、デバッガライブラリ30を使ってブレイクポイントを設定する。その後、ステップST1−3において、GUIアプリケーション100を再開する。以降は、ユーザはGUIアプリケーション100を操作することが出来、ユーザ操作の記録が可能な状態となる。   First, in step ST1-1, the recorder 20 starts the GUI application 100 in a paused state, and in step ST1-2, a debugger library is placed at a location where information necessary for test code generation can be extracted from the GUI framework 110. Use 30 to set a breakpoint. Thereafter, in step ST1-3, the GUI application 100 is restarted. Thereafter, the user can operate the GUI application 100, and the user operation can be recorded.

続いて、フローチャートはGUIアプリケーションが終了するかユーザによって記録が停止されるまでのループの処理となる。ステップST1−4は、GUIアプリケーション100が起動中であるかの判定処理であり、起動中であれば処理を継続し、終了していればステップST1−9に進む。また、ステップST1−5は、テストコード自動生成プログラム10においてユーザによって記録の停止が要求されたかどうかの判定処理であり、停止要求されていなければ処理は継続し、停止要求されていれば、ステップST1−9に進む。   Subsequently, the flowchart is a loop process until the GUI application ends or the recording is stopped by the user. Step ST1-4 is a process for determining whether the GUI application 100 is activated. If it is activated, the process is continued, and if completed, the process proceeds to step ST1-9. Step ST1-5 is a process for determining whether or not recording stop is requested by the user in the test code automatic generation program 10, and if the stop is not requested, the process is continued. Proceed to ST1-9.

続いて、ステップST1−6は、GUIアプリケーション100がブレイクポイントでブレイクされるまで待つ処理である。ステップST1−6において、GUIアプリケーション100がブレイクポイントによりブレイクされると次の処理に進む。ステップST1−7は、ブレイクしたときの状態で、デバッガライブラリ30を使用してテストコード生成に必要な情報をGUIフレームワークから取得し、情報記憶部40に格納する。ステップST1−8では、デバッガライブラリ30を使用してGUIアプリケーション100を再開する。   Subsequently, step ST1-6 is a process of waiting until the GUI application 100 is broken at a breakpoint. In step ST1-6, if the GUI application 100 is broken by a breakpoint, the process proceeds to the next process. In step ST1-7, information necessary for test code generation is acquired from the GUI framework using the debugger library 30 in the state when the break occurs, and stored in the information storage unit 40. In step ST1-8, the GUI application 100 is restarted using the debugger library 30.

最後に、GUIアプリケーション100が終了したか、ユーザにより停止要求された場合は、ステップST1−9に進む。ステップST1−9において、テストコード出力部50が情報記憶部40の情報を元にテストコードソースファイル200を、コンピュータシステムのストレージまたはメモリまたはデータベースに出力する。   Finally, if the GUI application 100 is terminated or a stop request is made by the user, the process proceeds to step ST1-9. In step ST1-9, the test code output unit 50 outputs the test code source file 200 to the storage, memory or database of the computer system based on the information stored in the information storage unit 40.

図3は、Java(登録商標)を使用したGUIアプリケーション103における、Java(登録商標)によるテストコード自動生成プログラム10の実施例である。ここでは、出力するテストコードソースファイル201もJava(登録商標)で記述される。以下、図3を用いて、GUIアプリケーション、テストコード、テストプコード自動生成プログラムにJava(登録商標)を使用した場合の実施例を説明する。   FIG. 3 shows an example of the test code automatic generation program 10 by Java (registered trademark) in the GUI application 103 using Java (registered trademark). Here, the output test code source file 201 is also described in Java (registered trademark). Hereinafter, an embodiment in which Java (registered trademark) is used for a GUI application, a test code, and a test precode automatic generation program will be described with reference to FIG.

図1におけるデバッガライブラリ30は、図3においては、JDI(Java(登録商標) Debug Interface)31に置き換わる。JDI31はJDWP(Java(登録商標) Debug Wire Protocol)32を使って、GUIアプリケーション103を動作させているJava(登録商標) VM(Virtual Machine)101に接続する。情報記憶部40は、実施例としてブレイクポイント設定テーブル60、トレース情報テーブル70、テストコード変換テーブル80を持つ。   The debugger library 30 in FIG. 1 is replaced with a JDI (Java (registered trademark) Debug Interface) 31 in FIG. The JDI 31 uses a JDWP (Java (registered trademark) Debug Wire Protocol) 32 to connect to a Java (registered trademark) VM (Virtual Machine) 101 running the GUI application 103. The information storage unit 40 includes a breakpoint setting table 60, a trace information table 70, and a test code conversion table 80 as an embodiment.

図3におけるレコーダ20、テストコード出力部50の動作としては以下の通りである。レコーダ20は、GUIアプリケーション100起動時、ブレイクポイント設定テーブル60に記載している、GUIフレームワーク110のメソッド(C++のメンバ関数にあたる)の先頭に、JDI31を使用してブレイクポイントを設定する。ブレイクポイント設定テーブル60は、テストコード生成に必要な情報を抽出できる個所を記載しているテーブルであり、記録動作を開始する前に予めデータが用意されていることを想定する。レコーダ20は、記録動作中にブレイクした時、テストコード生成に必要な情報をJDI31を使用して取得し、トレース情報テーブル70に記録する。レコーダ20の記録動作が終了するとテストコード出力部50が動作する。テストコード出力部50は、トレース情報テーブル70のレコードをテストコード変換テーブル80を使用してテストコードに変換しながらテストコードソースファイル201を出力する。テストコード変換テーブル80は、トレース情報テーブル70の情報からテストコードに変換する際、テストコード上のメソッドに置き換えるための変換テーブルであり、テストコード出力動作を開始する前に予めデータが用意されていることを想定する。   Operations of the recorder 20 and the test code output unit 50 in FIG. 3 are as follows. When the GUI application 100 is activated, the recorder 20 sets a breakpoint using the JDI 31 at the head of a method (corresponding to a C ++ member function) of the GUI framework 110 described in the breakpoint setting table 60. The breakpoint setting table 60 is a table describing locations where information necessary for test code generation can be extracted, and it is assumed that data is prepared in advance before starting the recording operation. When the recorder 20 breaks during the recording operation, the recorder 20 acquires information necessary for test code generation using the JDI 31 and records it in the trace information table 70. When the recording operation of the recorder 20 ends, the test code output unit 50 operates. The test code output unit 50 outputs the test code source file 201 while converting the record of the trace information table 70 into the test code using the test code conversion table 80. The test code conversion table 80 is a conversion table for replacing with the method on the test code when converting the information in the trace information table 70 to the test code, and data is prepared in advance before starting the test code output operation. Assuming that

図3のような構成にすれば、Java(登録商標)を使用した環境において、本発明のテストコード自動生成プログラムが実施可能である。   With the configuration as shown in FIG. 3, the test code automatic generation program of the present invention can be implemented in an environment using Java (registered trademark).

続いて、図3の実施例について、図4〜図11の具体例を用いて、GUIアプリケーションにおけるユーザの操作の記録からテストコードソースファイル出力までの動作を説明する。GUIフレームワーク、GUIアプリケーション、テストコードは、Java(登録商標)で記述されることを想定する。以下、この具体例について説明する。   Next, with respect to the embodiment of FIG. 3, the operation from the recording of the user operation to the output of the test code source file in the GUI application will be described using the specific examples of FIGS. It is assumed that the GUI framework, GUI application, and test code are described in Java (registered trademark). This specific example will be described below.

図4は、図3におけるGUIアプリケーションの例である。図4のGUIアプリケーション500は、GUI部品として、”MENU1”、”MENU2”、”MENU3”というキャプションを持つメニュー502、メニュー503、メニュー504を持ち、また、”BUTTON”というキャプションを持つボタン501を持つ。GUIアプリケーション500は、メニュー部分を除いて、幅×高さは180×180で構成されており、ボタン501は、ウィンドウ部分の座標(120、80)の部分に配置されている。ボタン501の幅×高さは60×20となっている。   FIG. 4 is an example of the GUI application in FIG. The GUI application 500 of FIG. 4 has a menu 502, a menu 503, and a menu 504 having captions “MENU1”, “MENU2”, and “MENU3” as GUI components, and a button 501 having a caption “BUTTON”. Have. The GUI application 500 has a width × height of 180 × 180 except for the menu portion, and the button 501 is arranged at the coordinates (120, 80) of the window portion. The button 501 has a width × height of 60 × 20.

図5は、図3におけるGUIアプリケーションのGUIフレームワークの実装例である。GUIフレームワーク510は、GUI部品のボタンを表すButtonクラス、GUI部品のメニューを表すMenuItemクラス、画面を表すWindowクラスによって構成されている。GUIフレームワーク510における下線部分は、記録動作開始時、レコーダ20が設定する、ブレイクポイントの設定する場所を表している。   FIG. 5 is an implementation example of the GUI framework of the GUI application in FIG. The GUI framework 510 includes a Button class that represents a GUI component button, a MenuItem class that represents a GUI component menu, and a Window class that represents a screen. The underlined portion in the GUI framework 510 represents a place where a breakpoint is set, which is set by the recorder 20 at the start of the recording operation.

Buttonクラスは、コンストラクタButton()とボタンクリック時に動作するメソッドonClicked()を持つ。コンストラクタButton()は、リソースIDを表すid、ボタンの左上X座標の位置を表すposX、ボタンの左上Y座標の位置を表すposY、ボタンに表示する文字列caption、ボタンを配置するWindowを表すwinを引数で受け取り、Buttonクラスのフィールド(C++のメンバ変数にあたる)に保持し、その後、GUI部品の表示を行う。onClicked()メソッドは、呼ばれると内部で更にWindowクラスのonButtonClicked()メソッドを呼び出す。つまり、ボタンクリック時、WindowクラスのonButtonClicked()メソッドが呼ばれ、WindowクラスのonButtonClicked()メソッドをオーバーライドすることで、GUIアプリケーション固有の動作が実装できる。   The Button class has a constructor Button () and a method onClicked () that operates when the button is clicked. The constructor Button () is an id representing a resource ID, posX representing the position of the upper left X coordinate of the button, posY representing the position of the upper left Y coordinate of the button, a character string caption displayed on the button, and a window representing the window in which the button is arranged. Is stored in the Button class field (corresponding to the C ++ member variable), and then the GUI component is displayed. When the onClicked () method is called, it further calls an onButtonClicked () method of the Window class. That is, when a button is clicked, an onButtonClicked () method of the Window class is called, and an operation specific to the GUI application can be implemented by overriding the onButtonClicked () method of the Window class.

MenuItemクラスも、Buttonクラスと同様にコンストラクタMenuItem()、メニュー選択時に動作するメソッドonSelected()を持つ。onSelected()メソッドは、呼ばれると内部で更にWindowクラスのonMenuItemSelected()メソッドを呼び出す。つまり、メニュー選択時、WindowクラスのonMenuItemSelected()メソッドが呼ばれ、WindowクラスのonMenuItemSelected()メソッドをオーバーライドすることで、GUIアプリケーション固有の動作が実装できる。   Similarly to the Button class, the MenuItem class also has a constructor MenuItem () and a method onSelected () that operates when a menu is selected. When the onSelected () method is called, it further calls the onMenuItemSelected () method of the Window class. That is, when the menu is selected, the onMenuItemSelected () method of the Window class is called, and the GUI application specific operation can be implemented by overriding the onMenuItemSelected () method of the Window class.

Windowクラスは、GUIアプリケーションの基本的な画面を表しており、GUIアプリケーションはWindowクラスから派生して作成することを想定している。Windowクラスでは、アプリケーション開始時(画面生成時)に呼ばれるcreate()メソッド、create()から呼ばれるonCreated()メソッド、画面のGUI部品以外をクリックしたときに呼ばれるonDeviceTouched()メソッド、ボタンクリック時に呼び出されるonButtonClicked()メソッド、メニュー選択時に呼び出されるonMenuItemSelected()メソッド、onDeviceTouched()メソッドから呼び出されるonTouched()メソッドを持つ。onCreated()メソッド、onButtonClicked()メソッド、onMenuItemSelected()メソッド、onTouchedメソッド()は、GUIアプリケーション側の実装であるWindowクラスの派生クラスでオーバーライドすることで、GUIアプリケーションの固有の動作を実装できるようになっている。onTouched()メソッドは、引数のx、yでクリックした座標のX座標、Y座標を受け取る。   The Window class represents a basic screen of the GUI application, and it is assumed that the GUI application is created by being derived from the Window class. In the Windows class, create () method that is called when the application starts (screen creation), onCreated () method that is called from create (), onDeviceTouched () method that is called when a user clicks a part other than the GUI part of the screen, and is called when the button is clicked It has an onButtonClicked () method, an onMenuItemSelected () method called at the time of menu selection, and an onTouched () method called from the onDeviceTouched () method. The onCreate () method, onButtonClicked () method, onMenuItemSelected () method, and onTouched method () can be overridden by a derived class of the Windows class that is an implementation on the GUI application side, so that unique operations of the GUI application can be implemented. It has become. The onTouched () method receives the X and Y coordinates of the coordinates clicked by the x and y arguments.

図6の560は、レコーダ20が、GUIフレームワーク510にブレイクポイントを設定する際に使用する、ブレイクポイント設定テーブル60の例である。レコーダ20は、GUIアプリケーション500を起動した後、このブレイクポイント設定テーブル560を参照して、GUIフレームワーク510の下線箇所にブレイクポイントを設定する。   560 in FIG. 6 is an example of the break point setting table 60 that is used when the recorder 20 sets break points in the GUI framework 510. After activating the GUI application 500, the recorder 20 refers to the breakpoint setting table 560 and sets breakpoints at the underlined locations of the GUI framework 510.

図7の520は、GUIフレームワーク510を用いたGUIアプリケーション500のGUIアプリケーションの固有部分の実装例である。520のSampleApplicationクラスは、GUIアプリケーション500のメインとなるクラスである。SampleApplicationクラスでは、フィールドとして、Buttonクラスのbutton、MenuItemクラスのmenuItem1、menuItem2、menuItem3を持ち、それぞれ、GUIアプリケーション500のボタン501、メニュー502、メニュー503、メニュー504を表している。GUI部品を生成するために、WindowクラスのonCreated()メソッドをオーバーライドし、その中でGUI部品のボタンとメニューの生成を行っている。また、ボタンクリック時の動作を実装するためにonButtonClicked()メソッドをオーバーライドし、メニュー選択時の動作を実装するためにonMenuItemSelected()メソッドをオーバーライドし、画面クリック時の動作を実装するためにonTouched()メソッドをオーバーライドしている。   Reference numeral 520 in FIG. 7 is an implementation example of the unique part of the GUI application 500 of the GUI application 500 using the GUI framework 510. A SampleApplication class 520 is a main class of the GUI application 500. The SampleApplication class has a Button class button, a MenuItem class menuItem1, menuItem2, menuItem3 as a field, and represents a button 501, a menu 502, a menu 503, and a menu 504 of the GUI application 500, respectively. In order to generate a GUI component, an onCreated () method of the Window class is overridden, and a GUI component button and menu are generated therein. Also, the onButtonClicked () method is overridden to implement the action when the button is clicked, the onMenuItemSelected () method is overridden to implement the action when the menu is selected, and the onTouched ( ) Overriding method.

図8の530は、GUIアプリケーション500において、ユーザがテストコード自動生成プログラムを実行した際、GUIアプリケーション500を操作した内容をまとめた表である(以降、操作表と記述する)。操作表530は、項目として、操作表における行の連番を表す”No.”、操作した際の時刻を表す”時刻”、GUIアプリケーション500においてユーザが行った操作を表する”GUIアプリケーションでユーザが行った操作”を持つ。時刻にある形式は、No.1を例にすると、”2011−10−24T20:27:31.100”は、「2011年10月24日20時27分31秒100ミリ秒」を表しており、No.1の操作であるGUIアプリケーション500を、「2011年10月24日20時27分31秒100ミリ秒に起動した」ということを表している。No.2以降、同様にユーザが行った内容を記述している。   Reference numeral 530 in FIG. 8 is a table that summarizes the contents of operating the GUI application 500 when the user executes the test code automatic generation program in the GUI application 500 (hereinafter referred to as an operation table). The operation table 530 includes, as items, “No.” representing the row number in the operation table, “Time” representing the time when the operation was performed, and “User” in the GUI application 500 representing the operation performed by the user in the GUI application 500. Has the operation ". The format in the time is No. Taking “1” as an example, “2011-10-24T20: 27: 31.100” represents “October 24, 2011, 20:27:31, 100 milliseconds”. This indicates that the GUI application 500, which is the first operation, is “started at 20:27:31 seconds and 100 milliseconds on October 24, 2011”. No. From 2 onwards, the contents that the user has done in the same manner are described.

図9の540は、ユーザが操作表530にある動作を行った際、レコーダ20が記録したトレース情報テーブルの例である。トレース情報テーブル540は、項目として、ブレイクしたときの時刻を表す”時刻”、アプリケーションを区別するための”アプリケーション種別”、ブレイクする直前にユーザが操作していたウィンドウの種別を表す”ウィンドウ種別”、ブレイクする直前にユーザが操作していたコントロール部品のクラスを表す”クラス名”、ブレイク時のメソッドを表す”メソッド”、ブレイク時のメソッドの引数を表す”引数”、ブレイク時のコントロール部品のクラスのフィールドを表す”フィールド”を持つ。項目”アプリケーション種別”は複数のGUIアプリケーションの操作を記録する際にGUIアプリケーションを区別するために設けた項目である。項目”ウィンドウ種別”は複数のウィンドウやダイアログなどが表示された場合、区別するために設けた項目である。   Reference numeral 540 in FIG. 9 is an example of a trace information table recorded by the recorder 20 when the user performs an operation in the operation table 530. The trace information table 540 includes, as items, “time” indicating the time when the break occurs, “application type” for distinguishing the application, and “window type” indicating the type of window operated by the user immediately before the break. , “Class name” that represents the class of the control component that the user was operating immediately before the break, “method” that represents the method at the time of the break, “argument” that represents the argument of the method at the time of the break, Has a “field” that represents a class field. The item “application type” is an item provided to distinguish GUI applications when recording operations of a plurality of GUI applications. The item “window type” is an item provided for distinguishing when a plurality of windows, dialogs, and the like are displayed.

続いて図9のトレース情報テーブル540の記録内容について説明する。操作表530のNo.1にあるようにGUIアプリケーション500が起動されると、レコーダ20は、GUIアプリケーション500の実態であるSampleApplicationクラスが時刻”2011−10−24T20:27:31.100”に起動したことが検出できるため、レコーダ20はこのタイミングでトレース情報テーブルに時刻、アプリケーション種別、クラス名、メソッド名を記録する。ここでは、アプリケーション種別は”SampleApplication”、GUIアプリケーション500はウィンドウが1つなのでウィンドウ種別には”Main”と記録し、クラス名は”SampleApplication”、メソッド名は”create”と記録する。次に操作表530のNo.2にあるようにボタンがクリックされると、ButtonクラスのonClicked()メソッドにブレイクポイントが設定されていることから、時刻”2011−10−24T20:27:32.400”にButtonクラスのonClicked()メソッドでブレイクし、このタイミングでボタンがクリックされたことを検出する。前記onCreated()メソッドと同様にレコーダ20がトレース情報テーブルに記録する。このとき、ButtonクラスのonClicked()メソッドでブレイクしたことから、クラス名として”Button”、メソッド名として”onClicked”をトレース情報テーブルに記録する。また、ボタンが複数あった場合に区別をつけるために、ブレイクしている間、onClicked()メソッドの引数である、ButtonクラスのbuttonオブジェクトのフィールドidよりリソースIDの値を取得し、データ”id=1001”を項目”フィールド”に記録する。操作表530のNo.3についても、No.2と同様にトレース情報テーブルに記録する。操作表530のNo.4については、テストコードでの再現で必要となるのは、画面上の座標となるので、ブレイク時、WindowクラスのonDeviceTouched()メソッドの引数の値を取得し、クリックされた座標が(30、30)ということを検出して、「x=30、 y=30」をトレース情報テーブルの項目「引数」に記録する。以降、同様にユーザが操作したことによりブレイクしたメソッドと取得した情報をトレース情報に記録する。   Next, the contents recorded in the trace information table 540 in FIG. 9 will be described. No. in the operation table 530. 1, when the GUI application 500 is started, the recorder 20 can detect that the SampleApplication class that is the actual state of the GUI application 500 is started at the time “2011-10-24T20: 27: 31.100”. The recorder 20 records the time, application type, class name, and method name in the trace information table at this timing. Here, since the application type is “SampleApplication”, the GUI application 500 has one window, the window type is recorded as “Main”, the class name is recorded as “SampleApplication”, and the method name is recorded as “create”. Next, No. in the operation table 530 is set. When the button is clicked as shown in FIG. 2, since a breakpoint is set in the Button class's onClicked () method, the Button class's onCricked () is set at time “2011-10-24T20: 27: 32.400”. ) The method breaks and detects that the button is clicked at this timing. Similar to the onCreated () method, the recorder 20 records in the trace information table. At this time, since the break was caused by the onClicked () method of the Button class, “Button” as the class name and “onClicked” as the method name are recorded in the trace information table. In order to distinguish when there are a plurality of buttons, the resource ID value is obtained from the field id of the button object of the Button class, which is an argument of the onClicked () method, during the break, and the data “id = 1001 "is recorded in the item" field ". No. in the operation table 530. No. 3 is also No. Record in the trace information table as in 2. No. in the operation table 530. For 4, what is needed for the reproduction in the test code is the coordinates on the screen, so at break time, the value of the argument of the onDeviceTouched () method of the Window class is acquired, and the clicked coordinates are (30, 30) and record “x = 30, y = 30” in the item “argument” of the trace information table. Thereafter, similarly, the method that has been broken by the user's operation and the acquired information are recorded in the trace information.

図11の550は、図9に記録されたトレース情報テーブル540の内容を元に、図10のテストコード変換テーブルを使用してテストコード出力部50が出力したテストコードの出力例である。   550 in FIG. 11 is an output example of the test code output by the test code output unit 50 using the test code conversion table in FIG. 10 based on the contents of the trace information table 540 recorded in FIG.

図11のテストコード550においては、GUIアプリケーションの動作を再現できるテストフレームワークがあると仮定しており、550のTestFrameworkクラスがそれにあたる。TestProgramクラスのtestSampleApplication()メソッドは、テスト開始時に呼ばれるメソッドである。doWindowCreate()メソッド、sleep()メソッド、doButtonClick()メソッド、doMenuSelect()メソッド、doWindowTouch()メソッドは、GUI部品の動作を行うTestFrameworkクラスのテスト用メソッドである。それぞれ、「指定したWindowクラスのウィンドウを開く」、「指定された時間(ミリ秒)の待ちを行う」、「指定されたリソースIDのボタンをクリックする」、「指定されたリソースIDのメニューを選択する」、「指定された座標を画面上でクリック」というユーザの操作を模倣する処理となっている。   In the test code 550 of FIG. 11, it is assumed that there is a test framework that can reproduce the operation of the GUI application, and the 550 TestFramework class corresponds to this. The testSampleApplication () method of the TestProgram class is a method called at the start of the test. The doWindowCreate () method, the sleep () method, the doButtonClick () method, the doMenuSelect () method, and the doWindowTouch () method are test frame class test methods that operate the GUI component. "Open the window of the specified window class", "Wait for the specified time (milliseconds)", "Click the button of the specified resource ID", "The menu of the specified resource ID This process imitates the user's operation of “select” and “click specified coordinates on the screen”.

図10は、テストコード変換テーブルの具体例である。テストコード変換テーブル570は、項目として、GUIフレームワーク110の変換対象のクラス名を表す”変換対象のクラス名”、前記該当クラスの変換対象のメソッド名を表す”変換対象のメソッド名”、テストコードで置き換えるテストフレームワーク上のクラス名を表す”変換後のクラス名”、テストコードで置き換えるテストフレームワーク上のメソッド名を表す”変換後のメソッド名”を持つ。   FIG. 10 is a specific example of the test code conversion table. The test code conversion table 570 includes, as items, a “class name to be converted” representing a class name to be converted by the GUI framework 110, a “method name to be converted” representing a method name to be converted of the corresponding class, a test It has “class name after conversion” that represents the class name on the test framework to be replaced with code, and “method name after conversion” that represents the method name on the test framework to be replaced with test code.

図11のテストコードの出力方法について具体的に説明する。   A method for outputting the test code in FIG. 11 will be specifically described.

testSampleCreate()メソッドの中のコード以外は、テンプレートより生成することが出来るので、testSampleCreate()メソッドの中のコード以外の詳細な生成方法については省略する。   Since the code other than the code in the testSampleCreate () method can be generated from the template, the detailed generation method other than the code in the testSampleCreate () method is omitted.

続いて、testSampleCreate()メソッドの中のコードの生成方法について記載する。トレース情報テーブル540の1行目より、SampleApplicationクラスのウィンドウが開いたことがわかるので、テストコード出力部50はテストコード変換テーブル570を使って「doWindowCreate(SampleApplication.class);」を出力する。ただし、このときテストコード変換テーブル570を使って変換する際、「SampleApplicationクラスはWindowクラスの派生クラスであるからWindowクラスでもある」ということを踏まえ、トレース情報テーブル540の1行目をテストコード変換テーブル570の3行目に関連づけて変換する。続いてトレース情報テーブル540の1行目の2行目のレコードの時刻の差分より、GUIアプリケーションが起動してから1300ミリ秒待ってからボタンをクリックしていることが分かるので、テストコード出力部は「sleep(1300);」を出力する。また、2行目のレコードから「リソースID=1001のボタンをクリックする」ということがわかるので、テストコード出力部はテストコード変換テーブル570を使って「doButtonClick(1001);」を出力する。以下、同様にトレース情報テーブル540のクラス名、メソッド名、引数、フィールドに記録されている内容とテストコード変換テーブル570より、どのくらい待ってから処理するか、どの処理を行うか、が分かるので、図11の550にあるようにテストコードを出力することが出来る。   Next, a method for generating code in the testSampleCreate () method will be described. Since it can be seen from the first line of the trace information table 540 that the sample application class window has been opened, the test code output unit 50 outputs “doWindowCreate (SampleApplication.class);” using the test code conversion table 570. However, at this time, when the test code conversion table 570 is used for conversion, the first line of the trace information table 540 is converted to the test code based on the fact that the “SampleApplication class is a derived class of the Window class and is also a Windows class”. Conversion is performed in association with the third row of the table 570. Subsequently, from the time difference between the records in the first row and the second row of the trace information table 540, it can be seen that the button is clicked after waiting for 1300 milliseconds after the GUI application is started. Outputs “sleep (1300);”. Further, since it can be seen from the record in the second row that “click button of resource ID = 1001”, the test code output unit outputs “doButtonClick (1001);” using the test code conversion table 570. In the same manner, the class information, method name, argument, contents recorded in the trace information table 540 and the contents recorded in the field and the test code conversion table 570 can be used to know how long to wait and which process to perform. A test code can be output as indicated at 550 in FIG.

以上のことから、本発明は、ユーザが行った操作を記録し、その操作を再現することが出来るテストコードを出力することが可能である。   From the above, the present invention can record an operation performed by a user and output a test code that can reproduce the operation.

10…テストコード自動生成プログラム
11…テストコード自動生成プログラムを動作させるためのJava(登録商標) VM(Virtual Machine)
20…レコーダ
30…デバッガライブラリ
31…JDI(Java(登録商標) Debug Interface)
32…JDWP(Java(登録商標) Debug Wire Protocol)
40…情報記憶部
50…テストコード出力部
60…ブレイクポイント設定テーブル
70…トレース情報テーブル
80…テストコード変換テーブル
100…GUI(Graphical User Interface)アプリケーション
101…GUIアプリケーションを動作させるためのJava(登録商標) VM
110…GUIフレームワーク
120…GUIアプリケーションの固有部分
200…テストコードソースファイル
201…Java(登録商標)によるテストコードソースファイル
500…GUIアプリケーションの例
501…”BUTTON”というキャプションを持つボタン
502…”MENU1”というキャプションを持つメニュー
503…”MENU2”というキャプションを持つメニュー
504…”MENU3”というキャプションを持つメニュー
510…GUIフレームワークの実装例
520…GUIアプリケーションの固有部分の実装例
530…GUIアプリケーションにおいてユーザが行った操作の例
540…トレース情報テーブルの記録例
550…テストコードソースファイルの出力例
560…ブレイクポイント設定テーブルの例
570…テストコード変換テーブルの例
10. Test code automatic generation program 11. Java (registered trademark) VM (Virtual Machine) for operating the test code automatic generation program
20 ... Recorder 30 ... Debugger library 31 ... JDI (Java (registered trademark) Debug Interface)
32 ... JDWP (Java (registered trademark) Debug Wire Protocol)
40 ... Information storage unit 50 ... Test code output unit 60 ... Break point setting table 70 ... Trace information table 80 ... Test code conversion table 100 ... GUI (Graphical User Interface) application 101 ... Java (registered trademark) for operating the GUI application VM
110 ... GUI framework 120 ... GUI application specific part 200 ... Test code source file 201 ... Test code source file 500 by Java (registered trademark) ... Example of GUI application 501 ... Button 502 with caption "BUTTON" ... "MENU1 Menu 503 with caption "...... Menu 504 with caption" MENU2 "... Menu with caption" MENU3 "510 ... Implementation example of GUI framework 520 ... Implementation example of specific part of GUI application 530 ... User in GUI application Example of operation performed 540 ... Trace information table recording example 550 ... Test code source file output example 560 ... Breakpoint setting table Examples of Le example 570 ... test code conversion table

Claims (2)

テスト対象となる単一および複数のGUIアプリケーションに対して、操作した手順や値を記録するためのテストコード自動生成プログラムにおいて、前記GUIアプリケーションの処理系が提供するデバッガライブラリから情報を取得し保存するレコーダと、前記情報を保持する情報記憶部と、前記情報記憶部からテストコードソースファイルを出力するテストコード出力部を設けたことを特徴とするテストコード自動生成プログラム。   In a test code automatic generation program for recording an operated procedure and values for single and plural GUI applications to be tested, information is acquired from a debugger library provided by the processing system of the GUI application and stored. An automatic test code generation program, comprising: a recorder; an information storage unit that holds the information; and a test code output unit that outputs a test code source file from the information storage unit. 請求項1のテストコード自動生成プログラムにおいて、単一および複数のGUIアプリケーションが、テストコード自動生成プログラムとは別のコンピュータ上で動作していることを特徴とするテストコード自動生成プログラム。   2. The test code automatic generation program according to claim 1, wherein the single and plural GUI applications operate on a computer different from the test code automatic generation program.
JP2012010572A 2012-01-23 2012-01-23 Test code automatic generation program using debugger function Pending JP2013149178A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2012010572A JP2013149178A (en) 2012-01-23 2012-01-23 Test code automatic generation program using debugger function

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2012010572A JP2013149178A (en) 2012-01-23 2012-01-23 Test code automatic generation program using debugger function

Publications (1)

Publication Number Publication Date
JP2013149178A true JP2013149178A (en) 2013-08-01

Family

ID=49046595

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2012010572A Pending JP2013149178A (en) 2012-01-23 2012-01-23 Test code automatic generation program using debugger function

Country Status (1)

Country Link
JP (1) JP2013149178A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9904972B2 (en) 2013-08-06 2018-02-27 Square Enix Holdings Co., Ltd. Information processing apparatus, control method, program, and recording medium
JP2021009605A (en) * 2019-07-02 2021-01-28 株式会社Codeer Program and method for supporting generation of software operation scenario and device for supporting generation of software operation scenario

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9904972B2 (en) 2013-08-06 2018-02-27 Square Enix Holdings Co., Ltd. Information processing apparatus, control method, program, and recording medium
JP2021009605A (en) * 2019-07-02 2021-01-28 株式会社Codeer Program and method for supporting generation of software operation scenario and device for supporting generation of software operation scenario
JP7294609B2 (en) 2019-07-02 2023-06-20 株式会社Codeer Program, Method, and Device for Supporting Software Operation Scenario Generation

Similar Documents

Publication Publication Date Title
US8966447B2 (en) Capturing and displaying state of automated user-level testing of a graphical user interface application
US9229738B2 (en) Software development tool for providing user context information to improve message quality at development time
CN102184138B (en) Method and system for automatically reproducing and positioning software error
US7627821B2 (en) Recording/playback tools for UI-based applications
CN111104315A (en) Test script generation method and device and computer readable storage medium
CN110134600B (en) Test script recording method, device and storage medium
US10296444B1 (en) Methods and systems for testing mobile applications for android mobile devices
CN110633209A (en) Automatic testing method and system for vehicle-mounted android multimedia navigator
EP1612677A2 (en) Smart GUI Activity Recording and Playback Framework
US20140101640A1 (en) White-box testing systems and/or methods for use in connection with graphical user interfaces
CN103365779A (en) Software test method and system
CN102495802B (en) Method and device for testing software system, and computer system
CN100375059C (en) An automatic test system and method for personal digital assistant mobile phone functions
CN105740144B (en) A kind of automated testing method and system of Android mobile terminal
CN112732576B (en) Automatic testing method, device and equipment based on user interface
CN110837474A (en) Script recording method, device, terminal and storage medium
Adamoli et al. Automated GUI performance testing
Moran et al. On-device bug reporting for android applications
CN105760289A (en) Debugging method and device of embedded system
CN102479152A (en) Method and device for obtaining tool automatic test results based on Android platform
CN110825595A (en) Recording playback method and system, and storage medium
CN113126983A (en) Automatic change editing system of script program for test
CN112346946B (en) User software operation behavior monitoring method and system based on control positioning
JP2013149178A (en) Test code automatic generation program using debugger function
CN115686470A (en) Method and device for automatically generating Python script based on CAX software recording user operation