JP2010226617A - Test program creation method and program - Google Patents

Test program creation method and program Download PDF

Info

Publication number
JP2010226617A
JP2010226617A JP2009073830A JP2009073830A JP2010226617A JP 2010226617 A JP2010226617 A JP 2010226617A JP 2009073830 A JP2009073830 A JP 2009073830A JP 2009073830 A JP2009073830 A JP 2009073830A JP 2010226617 A JP2010226617 A JP 2010226617A
Authority
JP
Japan
Prior art keywords
communication
communication operation
test program
tcp
log
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.)
Withdrawn
Application number
JP2009073830A
Other languages
Japanese (ja)
Inventor
Tomoaki Nishiono
友明 西小野
Yuuki Dogo
勇樹 堂後
Byonhee Ryu
丙煕 柳
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.)
Seiko Epson Corp
Original Assignee
Seiko Epson Corp
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 Seiko Epson Corp filed Critical Seiko Epson Corp
Priority to JP2009073830A priority Critical patent/JP2010226617A/en
Publication of JP2010226617A publication Critical patent/JP2010226617A/en
Withdrawn legal-status Critical Current

Links

Images

Landscapes

  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

<P>PROBLEM TO BE SOLVED: To prevent reproducibility of a reproduction test program creation by a communication log from degrading by creating and releasing a socket at the timing corresponding to the features of communication motions. <P>SOLUTION: The test program to be executed between a server device and a client device acquires a communication log between the server device and the client device, sorts multiple TCP packets included in the log into the groups wherein the address port numbers equal to the sending port numbers and the sequence numbers correspond to the ACK numbers, and acquires the communication motions each TCP packet indicates and the chronological orders. The test program instructs to chronologically execute the communication motions, creates a first socket between a second communication motion corresponding to a TCP connect and a first communication motion chronologically one motion before to release the first socket between a third communication motion corresponding to a TCP closing and a forth communication motion chronologically one motion after. <P>COPYRIGHT: (C)2011,JPO&INPIT

Description

本発明は、通信ログに残された通信を自動的に再現するためのテストプログラムを生成する方法、およびそのテストプログラムを生成するプログラムに関する。   The present invention relates to a method for generating a test program for automatically reproducing communications left in a communication log, and a program for generating the test program.

従来、通信機能を備えたテスト対象機器に組み込まれたテスト対象プログラムを、ネットワークを介して外部から与えたテスト動作指示によって、テストする構成が知られている。特許文献1には、PLC機器に組み込まれたシーケンスプログラムをテストするためのテスト装置において、所望のテストに必要な動作指示を当該PLC機器に与えるために使用した一連の通信メッセージを予め記録しておき、記録しておいた一連の通信メッセージをテスト装置で再生することにより、PLC機器に対する前述の動作指示を自動再現することが記載されている。   2. Description of the Related Art Conventionally, a configuration is known in which a test target program incorporated in a test target device having a communication function is tested by a test operation instruction given from the outside via a network. In Patent Document 1, in a test apparatus for testing a sequence program incorporated in a PLC device, a series of communication messages used for giving the PLC device an operation instruction necessary for a desired test is recorded in advance. In addition, it is described that the above-described operation instruction for the PLC device is automatically reproduced by reproducing a series of recorded communication messages with a test apparatus.

特開2001−209414号公報JP 2001-209414 A

ネットワーク上を行き来するパケットデータをキャプチャーし、通信ログとして出力する機能を備えたパケットキャプチャー装置が知られている。ネットワークに接続された通信機器の間でなされた通信を再現するために、パケットキャプチャー装置から取得した通信ログを元にテストプログラムを自動生成する仕組みを構築することを考える。テストプログラムを自動生成することができれば、手動で作成する場合よりも作成所要時間を短縮できる。   2. Description of the Related Art A packet capture device having a function of capturing packet data traveling on a network and outputting it as a communication log is known. In order to reproduce communications performed between communication devices connected to a network, consider building a mechanism for automatically generating a test program based on a communication log acquired from a packet capture device. If the test program can be automatically generated, the time required for creation can be shortened compared to the case where the test program is created manually.

例えば、TCP/IPやUDP/IPの通信動作を実行するプログラムを作成する場合、当該プログラムでは、ソケットと呼ばれるインターフェースを用いて、OSの一機能としてのプロトコルスタックを扱うことが一般的である。当該プロトコルスタックが、各プロトコルに従った通信の制御を受け持つ。通信ログから自動生成しようとするテストプログラムも、ソケットを使用してプロトコルスタックを扱い通信を実行するようにする。通信を開始しようとする前にソケットを生成し、必要な通信が終わった後ソケットを解放することが、ソケットを使用して通信を行うときの基本的な手順である。ソケットの実体は、対応する通信に関連する制御情報を保持しておくためのメモリ領域である。ソケットの最大数はOS等に依存するが、実質的に上限がある。   For example, when creating a program for executing a TCP / IP or UDP / IP communication operation, the program generally uses a protocol stack as an OS function by using an interface called a socket. The protocol stack is responsible for controlling communication according to each protocol. A test program that automatically generates from a communication log also uses a socket to handle the protocol stack and execute communication. Creating a socket before starting communication and releasing the socket after necessary communication is a basic procedure when performing communication using a socket. The entity of the socket is a memory area for holding control information related to the corresponding communication. Although the maximum number of sockets depends on the OS and the like, there is a practical upper limit.

コネクションを確立してデータの送受信を行うことを特徴とする通信(例えばTCP/IP)では、送受信するデータサイズが大きいと、やりとりするパケット数が増えコネクションの存続期間が長くなる。そのため、あるコネクションが存続中に別のコネクションが新たに確立され、同時に複数のコネクションが存続しうる。そのため、ソケットの生成や解放のタイミング次第では、テストプログラム実行中に使用可能なソケットが枯渇していく可能性がある。そうすると、例えば新たにソケットが生成できないためにテストプログラムを最後まで実行できず、通信ログに示された通信を最後まで再現できなくなるなどの問題が発生する。また、ソケット生成や終了には多少時間を要するため、ソケットの生成と解放を頻繁に繰り返すことを指示したテストプログラムを作成すると、当該テストプログラム実行中にソケットの生成と解放に要する時間が増え、その待ち時間のために実際の通信動作がなかなか実行されないという事態が発生しうる。コネクションを確立しないため信頼性は低いが高速にデータ送受信ができることを特徴とする通信(例えばUDP/IP)を再現しようとするテストプログラムにおいて、このような事態が発生すると高速な通信動作を再現できないという問題がある。   In communication (for example, TCP / IP) characterized in that a connection is established and data is transmitted and received, if the data size to be transmitted and received is large, the number of packets to be exchanged increases and the duration of the connection becomes longer. Therefore, another connection is newly established while a certain connection exists, and a plurality of connections can exist simultaneously. Therefore, the sockets that can be used during the test program execution may be exhausted depending on the timing of socket generation and release. Then, for example, since a new socket cannot be generated, the test program cannot be executed to the end, and the communication indicated in the communication log cannot be reproduced to the end. Also, since it takes some time to create and terminate sockets, creating a test program that instructs to repeatedly generate and release sockets increases the time required to create and release sockets during execution of the test program. Due to the waiting time, a situation may occur in which the actual communication operation is not easily performed. In a test program that attempts to reproduce communications (for example, UDP / IP) characterized by low-reliability but high-speed data transmission / reception because no connection is established, high-speed communication operations cannot be reproduced when such a situation occurs. There is a problem.

本発明は、上記問題に鑑みてなされたもので、通信ログに残された通信動作を再現するテストプログラムを生成するにあたって、通信動作の特徴に応じたタイミングでソケットを生成および解放することにより、ソケットの生成および解放が原因で再現したい通信動作の再現性が低下することを防止することを目的の一つとする。   The present invention has been made in view of the above problems, and in generating a test program that reproduces the communication operation remaining in the communication log, by generating and releasing a socket at a timing according to the characteristics of the communication operation, One of the purposes is to prevent the reproducibility of the communication operation to be reproduced due to the generation and release of the socket.

(1)上記目的を達成するためのテストプログラム生成方法は、ネットワークに接続されたサーバー機器とクライアント機器との間の通信ログを取得する通信ログ取得工程と、前記通信ログに含まれる複数のTCPパケットを、前記TCPパケットに含まれる宛先ポート番号と送信元ポート番号との組み合わせが同一であって、前記TCPパケットに含まれるシーケンス番号とACK番号とが対応するグループにグループ分けするグルーピング工程と、前記通信ログに含まれる各前記TCPパケットが示す通信動作と、前記通信動作の時系列順と、を取得する通信フロー取得工程と、前記サーバー機器と通信するクライアント機器で実行するためのテストプログラムであって、前記時系列順に前記通信動作を実行することを指示するとともに、TCPコネクトに対応する第二の通信動作より前記時系列順に一つ前の第一の通信動作と、前記第二の通信動作との間に、当該第二の通信動作を含むグループに対応する第一のソケットの生成を行い、前記第二の通信動作を含むグループに含まれるTCPクローズに対応する第三の通信動作と、当該第三の通信動作の時系列順に一つ後の第四の通信動作との間に、前記第二の通信動作および前記第三の通信動作を含むグループに対応する前記第一のソケットの解放を行うことを指示するテストプログラムを生成するテストプログラム生成工程と、を含む。   (1) A test program generation method for achieving the above object includes a communication log acquisition step of acquiring a communication log between a server device and a client device connected to a network, and a plurality of TCPs included in the communication log. A grouping step of grouping packets into groups in which a combination of a destination port number and a source port number included in the TCP packet is the same, and a sequence number and an ACK number included in the TCP packet correspond to each other; A communication flow acquisition step for acquiring a communication operation indicated by each of the TCP packets included in the communication log, and a time series order of the communication operation, and a test program for execution on a client device communicating with the server device. And instructing to execute the communication operation in the time series order The second communication operation corresponding to the group including the second communication operation between the first communication operation immediately before the second communication operation corresponding to the TCP connect and the second communication operation in the time series order. A third communication operation corresponding to a TCP close included in the group including the second communication operation, and a fourth communication after the third communication operation in chronological order. A test program generating step for generating a test program instructing to release the first socket corresponding to the group including the second communication operation and the third communication operation between the operation and the operation; Including.

本発明によると、データ送信またはデータ受信に対応する全ての通信動作の前にまとめてソケット生成とTCPコネクトを実行し、データ送信またはデータ受信に対応する全ての通信動作の後にまとめてTCPクローズとソケット解放を実行する場合と比較して、同時に存在するソケットの数を必要以上に増加させないテストプログラムを生成することができる。   According to the present invention, socket generation and TCP connect are collectively performed before all communication operations corresponding to data transmission or data reception, and TCP close is collectively performed after all communication operations corresponding to data transmission or data reception. A test program that does not increase the number of simultaneously existing sockets more than necessary can be generated as compared with the case of performing socket release.

ソケットは、本テストプログラムがTCP/IP(UDP/IPも含む)プログラム(プロトコルスタック)を扱う際のAPIを意味している。ソケットを生成する処理の実体は、TCP/IPプログラムが管理するメモリ領域(通信動作に関連する各種の制御情報を保持するためのメモリ領域)を確保することであり、ソケットの解放は当該メモリ領域を破棄することを意味する。テストプログラムを実行するクライアント機器において同時に存在しえるソケットの最大数には実質的に上限がある。テストプログラム実行期間中に、任意のTCPコネクション存続期間の前後にも当該TCPコネクションに対応しない役割を終えたソケットが存続し続けると、テストプログラム実行中に他の通信動作のために使用可能なソケットが枯渇していく。TCPコネクション存続期間とそれに対応するソケットの存続期間とを本発明のように同期させることにより、同時に存在するソケットを必要以上に増加させないことによってソケットの枯渇をまねきにくいテストプログラムを生成することができる。   The socket means an API when this test program handles a TCP / IP (including UDP / IP) program (protocol stack). The entity of the process for generating the socket is to secure a memory area (memory area for holding various control information related to communication operations) managed by the TCP / IP program. Means to discard. There is a practical upper limit on the maximum number of sockets that can exist simultaneously in a client device executing a test program. Sockets that can be used for other communication operations during test program execution if the socket that has finished the role that does not support the TCP connection continues before and after any TCP connection lifetime during the test program execution period Will be depleted. By synchronizing the lifetime of the TCP connection and the lifetime of the corresponding socket as in the present invention, it is possible to generate a test program that is unlikely to cause socket exhaustion by not increasing the number of sockets that exist simultaneously. .

また、通信ログに含まれるTCPパケットの時系列順に、各TCPパケットが示す通信動作を実行することが指示されているので、このテストプログラムを実行するクライアント機器は、前述の通信ログが取得されたときのサーバー機器とクライアント機器との間の通信と同じ順序で同じ種類の通信動作を再現することができる。なお、TCPを使用して通信されるパケットをTCPパケットと表現するものとする。   In addition, since it is instructed to execute the communication operation indicated by each TCP packet in the chronological order of the TCP packets included in the communication log, the client device that executes this test program has acquired the above-described communication log. The same type of communication operation can be reproduced in the same order as the communication between the server device and the client device. Note that a packet communicated using TCP is expressed as a TCP packet.

(2)上記目的を達成するためのテストプログラム生成方法は、ネットワークに接続されたサーバー機器とクライアント機器との間の通信ログを取得する通信ログ取得工程と、前記通信ログに含まれる複数のUDPパケットを、前記UDPパケットに含まれる宛先ポート番号と送信元ポート番号との組み合わせが同一であるグループにグループ分けするグルーピング工程と、前記通信ログに含まれる各前記UDPパケットが示す通信動作と、前記通信動作の時系列順と、を取得する通信フロー取得工程と、前記サーバー機器と通信するクライアント機器で実行するためのテストプログラムであって、前記通信ログに含まれる前記グループの個数分のソケットの生成処理と、生成された前記ソケットの解放処理との間に、前記時系列順に前記通信動作を実行することを指示したテストプログラムを生成するテストプログラム生成工程と、を含む。   (2) A test program generation method for achieving the above object includes a communication log acquisition step of acquiring a communication log between a server device and a client device connected to a network, and a plurality of UDPs included in the communication log. A grouping step of grouping packets into groups in which a combination of a destination port number and a transmission source port number included in the UDP packet is the same; a communication operation indicated by each UDP packet included in the communication log; A communication flow acquisition step of acquiring a time series order of communication operations, and a test program to be executed by a client device communicating with the server device, the number of sockets corresponding to the number of the groups included in the communication log. Between the generation process and the generated socket release process, the communication is performed in the chronological order. Including a test program generating step of generating a test program that instructs to execute the operation, the.

本発明によると、宛先ポート番号と送信元ポート番号との組み合わせが同一であるUDPパケットを一つのグループとし、そのグループの個数分のソケットの生成および解放を実施するテストプログラムを生成することができる。したがって、同一グループの通信動作には同一のソケットを使い回すことになるので、例えばデータ送信とそれに対応するデータ受信の対ごとにソケットの生成と解放を行う場合と比較すると、ソケットの生成および解放の回数を低減したテストプログラムを生成することができる。その結果、当該テストプログラムを実行するクライアント機器において、ソケットの生成および解放が頻繁に実施されることを防ぐことができる。そのため高速にデータ送受信ができることを特徴とするUDP/IPの通信動作を再現しやすくなる。   According to the present invention, a UDP program having the same combination of destination port number and source port number can be made into one group, and a test program for generating and releasing sockets for the number of groups can be generated. . Therefore, since the same socket is used repeatedly for the communication operation of the same group, for example, compared to the case of generating and releasing the socket for each pair of data transmission and corresponding data reception, the generation and release of the socket. A test program with a reduced number of times can be generated. As a result, it is possible to prevent the socket device from being frequently generated and released in the client device that executes the test program. Therefore, it becomes easy to reproduce the UDP / IP communication operation characterized in that data can be transmitted and received at high speed.

また、通信ログに含まれるUDPパケットの時系列順に、各UDPパケットが示す通信動作を実行することが指示されているので、このテストプログラムを実行するクライアント機器は、前述の通信ログが取得されたときのサーバー機器とクライアント機器との間の通信と同じ順序で同じ通信動作を実行することができる。なお、UDPを使用して通信されるパケットをUDPパケットと表現するものとする。   In addition, since it is instructed to execute the communication operation indicated by each UDP packet in the time-series order of the UDP packets included in the communication log, the client device that executes this test program has acquired the communication log described above. The same communication operation can be executed in the same order as the communication between the server device and the client device. Note that a packet communicated using UDP is expressed as a UDP packet.

なお、以上のようなテストプログラム生成方法は、この方法をコンピューターに実現させるプログラムの発明や、この方法を実施する装置の発明としても適用可能である。また、以上のような方法を実施する装置は、単独の装置によって実現される場合もあれば、複数の装置を組み合わせることによって実現される場合もあり、各種の態様を含むものである。一部がソフトウェアであり一部がハードウェアであったりするなど、適宜、変更可能である。さらに、前述のプログラムを記録する記録媒体としても発明は成立する。むろん、その記録媒体は、磁気記録媒体であってもよいし光磁気記録媒体であってもよいし、今後開発されるいかなる記録媒体においても全く同様に考えることができる。   The test program generation method as described above can also be applied as an invention of a program that causes a computer to realize this method, or an invention of an apparatus that implements this method. Moreover, the apparatus which implements the above methods may be implement | achieved by a single apparatus, may be implement | achieved by combining several apparatus, and includes various aspects. It can be changed as appropriate, for example, part of it is software and part is hardware. Furthermore, the present invention is established as a recording medium for recording the above-described program. Of course, the recording medium may be a magnetic recording medium, a magneto-optical recording medium, or any recording medium that will be developed in the future.

本発明の構成を示すブロック図。The block diagram which shows the structure of this invention. 通信ログに含まれるパケット群のシーケンスの一例を示すシーケンス図。The sequence diagram which shows an example of the sequence of the packet group contained in a communication log. 通信ログに含まれるパケット群のシーケンスの一例を示すシーケンス図。The sequence diagram which shows an example of the sequence of the packet group contained in a communication log. テストプログラム生成処理を示すフローチャート。The flowchart which shows a test program production | generation process. テストプログラム生成処理を示すフローチャート。The flowchart which shows a test program production | generation process. (6A)および(6B)は、通信ログの解析結果を説明するための図。(6A) and (6B) are diagrams for explaining the analysis result of the communication log. (7A)は(7B)の比較例のテストプログラムのソースコード、(7B)は、本実施形態にかかるテストプログラムのソースコードを示す図。(7A) is a source code of the test program of the comparative example of (7B), and (7B) is a diagram showing a source code of the test program according to the present embodiment. (8A)は(8B)の比較例のテストプログラムのソースコード、(8B)は、本実施形態にかかるテストプログラムのソースコードを示す図。(8A) is a source code of the test program of the comparative example of (8B), and (8B) is a diagram showing source code of the test program according to the present embodiment.

ここでは、下記の順序に従って本発明の実施の形態について説明する。
(1)テストプログラム生成方法の概要と構成:
(2)テストプログラム生成処理:
(3)他の実施形態:
Here, embodiments of the present invention will be described in the following order.
(1) Outline and configuration of test program generation method:
(2) Test program generation processing:
(3) Other embodiments:

(1)テストプログラム生成方法の概要と構成:
図1は、本発明にかかるテストプログラム生成方法を実施する構成と、生成されたテストプログラムを実施する構成を説明するためのブロック図である。コンピューター50,53、プリンター52、パケットキャプチャー装置51は、LANに接続されている。パケットキャプチャー装置51は、コンピューター50とプリンター52との間で交わされるパケットデータを時系列順に取得し、パケットデータ群を示すバイナリデータを含む通信ログファイルを出力する。コンピューター10は、RAM,ROM,CPU等を備える制御部20とHDD30とを備えており、ROMまたはHDD30に記録された様々なプログラムを制御部20で実行することができる。本実施形態においては、テストプログラム生成プログラム21を実行することができる。
(1) Outline and configuration of test program generation method:
FIG. 1 is a block diagram for explaining a configuration for executing a test program generation method according to the present invention and a configuration for executing a generated test program. The computers 50 and 53, the printer 52, and the packet capture device 51 are connected to the LAN. The packet capture device 51 acquires packet data exchanged between the computer 50 and the printer 52 in chronological order, and outputs a communication log file including binary data indicating a packet data group. The computer 10 includes a control unit 20 including a RAM, a ROM, a CPU, and the like and an HDD 30, and can execute various programs recorded in the ROM or the HDD 30 by the control unit 20. In the present embodiment, the test program generation program 21 can be executed.

テストプログラム生成プログラム21は、パケットキャプチャー装置51から取得した通信ログをもとに、コンピューター50とプリンター52との間で行われた通信を再現するためのプログラムを生成する機能を有している。従来より、キャプチャーした通信をそのまま再現することができる機器は知られているが、キャプチャー環境と再現環境とが同じでなければ機能しなかった。キャプチャー環境と異なる環境で再現するためには、環境固有のパラメーターを再現環境に適したものに変更する必要があると考えられる。   The test program generation program 21 has a function of generating a program for reproducing communication performed between the computer 50 and the printer 52 based on the communication log acquired from the packet capture device 51. Conventionally, devices that can reproduce a captured communication as it is are known, but they would not function unless the capture environment and the reproduction environment were the same. In order to reproduce in an environment different from the capture environment, it is necessary to change environment-specific parameters to those suitable for the reproduction environment.

テストプログラム生成プログラム21によって生成されたテストプログラム30aは、コンピューター50を含めた様々なコンピューターで実行させることによって、通信ログを取得した際のコンピューター50とプリンター52間の通信を、様々なコンピューター(例えばコンピューター53)とプリンター52の間で再現させることを目的としたプログラムである。   The test program 30a generated by the test program generation program 21 is executed by various computers including the computer 50, thereby communicating between the computer 50 and the printer 52 when acquiring the communication log with various computers (for example, This program is intended to be reproduced between the computer 53) and the printer 52.

テストプログラム生成プログラム21は、上述のテストプログラムを生成する機能を実現するために、通信ログ取得部21aと、グルーピング部21bと、通信フロー取得部21cと、テストプログラム生成部21dと、を備えている。通信ログ取得部21aは、二つの通信機器間の通信ログを取得する機能を制御部20に実現させるモジュールである。例えば、パケットキャプチャー装置51が生成したバイナリファイルとしての通信ログを取得する。グルーピング部21bは、通信ログに含まれるパケットデータを、使用するプロトコル別(TCPまたはUDP)や、あるいは後述する分類基準別にグルーピングする機能を制御部20に実現させるモジュールである。通信フロー取得部21cは、通信ログに含まれるパケットの時系列順や、各パケットが示す通信動作を通信ログから取得する機能を制御部20に実現させるモジュールである。テストプログラム生成部21dは、通信ログを再現するためのテストプログラム30aを生成する機能を制御部20に実現させるモジュールである。   The test program generation program 21 includes a communication log acquisition unit 21a, a grouping unit 21b, a communication flow acquisition unit 21c, and a test program generation unit 21d in order to realize the function of generating the test program described above. Yes. The communication log acquisition unit 21a is a module that causes the control unit 20 to realize a function of acquiring a communication log between two communication devices. For example, a communication log as a binary file generated by the packet capture device 51 is acquired. The grouping unit 21b is a module that causes the control unit 20 to realize a function of grouping packet data included in the communication log by protocol to be used (TCP or UDP) or by classification criteria to be described later. The communication flow acquisition unit 21c is a module that causes the control unit 20 to realize a function of acquiring from the communication log the time series order of packets included in the communication log and the communication operation indicated by each packet. The test program generation unit 21d is a module that causes the control unit 20 to realize a function of generating a test program 30a for reproducing a communication log.

テストプログラム30aを実行するコンピューター(例えばコンピューター53)ROM,RAM,CPU等を含む制御部200を備えている。コンピューター53の制御部200は、テストプログラム30aの他に、TCP/IPプログラム220やLANアダプタードライバープログラム230を実行可能である。TCP/IPプログラム220は、TCPやUDPやIPなどのプロトコルスタックを含んでおり、各プロトコルに準拠した通信の実行を担当する。LANアダプタードライバープログラム230は、コンピューター53に備えられているLANアダプター400を制御するためのドライバープログラムである。   A computer (for example, a computer 53) that executes the test program 30a includes a control unit 200 including a ROM, a RAM, a CPU, and the like. The control unit 200 of the computer 53 can execute a TCP / IP program 220 and a LAN adapter driver program 230 in addition to the test program 30a. The TCP / IP program 220 includes protocol stacks such as TCP, UDP, and IP, and is in charge of executing communication conforming to each protocol. The LAN adapter driver program 230 is a driver program for controlling the LAN adapter 400 provided in the computer 53.

テストプログラム30aは、TCP/IPプログラム220を使用して、コンピューター53(クライアント機器)とプリンター52(サーバー機器)との通信を実行するための指示(処理命令)を含んでいる。コンピューター53でテストプログラム30aを実行している間、プリンター52とコンピューター53の間で、テストプログラム30aの指示に対応する通信が行われる。   The test program 30a includes an instruction (processing instruction) for executing communication between the computer 53 (client device) and the printer 52 (server device) using the TCP / IP program 220. While the test program 30a is being executed by the computer 53, communication corresponding to the instruction of the test program 30a is performed between the printer 52 and the computer 53.

(2)テストプログラム生成処理:
まず、図2は、コンピューター53とプリンター52との間で交わされたTCP/IP通信の一例を説明するためのシーケンス図である。図3は、コンピューター53とプリンター52との間で交わされたUDP/IP通信の一例を説明するためのシーケンス図である。シーケンス図の上から下に向かう方向は、過去からの時間経過を表している。一つの矢印が一つのパケットを表しており、矢印の根本側がそのパケットの送信元で矢印の先側がそのパケットの宛先を意味している。図3のシーケンス図は、データ送信パケット(リクエスト)とそれに対するデータ受信パケット(レスポンス)の対を一組として合計5組の対を表している。
(2) Test program generation processing:
First, FIG. 2 is a sequence diagram for explaining an example of TCP / IP communication exchanged between the computer 53 and the printer 52. FIG. 3 is a sequence diagram for explaining an example of UDP / IP communication exchanged between the computer 53 and the printer 52. The direction from the top to the bottom of the sequence diagram represents the passage of time from the past. One arrow represents one packet, and the root side of the arrow means the transmission source of the packet, and the destination side of the arrow means the destination of the packet. The sequence diagram of FIG. 3 represents a total of five pairs, one pair of a data transmission packet (request) and a corresponding data reception packet (response).

TCP/IP通信では、SYNに相当するパケットを送信してからFINに相当するパケットを送信するまでTCPコネクションが確立した状態となる。図2のシーケンス図には、コネクション1〜3の3つのTCPコネクションが含まれている。コネクション3はコネクション2が存続している途中に開始しており、コネクション2はコネクション3の存続期間中に終了している。UDP/IP通信は、コネクションレスの通信である。図3の例では、パケットP16、P17、P24、P25はパケットに含まれるポート番号の組み合わせが同一であり、パケットP18〜P23もポート番号の組み合わせが同一であることを表している。   In TCP / IP communication, a TCP connection is established after a packet corresponding to SYN is transmitted until a packet corresponding to FIN is transmitted. The sequence diagram of FIG. 2 includes three TCP connections 1 to 3. Connection 3 starts while connection 2 continues, and connection 2 ends during the lifetime of connection 3. UDP / IP communication is connectionless communication. In the example of FIG. 3, packets P16, P17, P24, and P25 have the same combination of port numbers included in the packet, and packets P18 to P23 also have the same combination of port numbers.

なお、TCPコネクションの確立時のフローは、実際は、3ウェイ・ハンドシェイクとなるが、図2では説明簡略化のためSYNに相当するパケット以外の残りの2つのパケット(ACK/SYN、ACK)の記載を省略している。また、TCPコネクションの終了時のフローは、実際は、双方でFINとACKを交換し合うフローとなるが、図2では簡略化のため、プリンター52およびコンピューター53が送信するFINに相当するパケット以外の残りの2つのパケット(ACK、ACK)の記載を省略している。   Note that the flow at the time of establishing a TCP connection is actually a three-way handshake, but in FIG. 2, for the sake of simplicity, the remaining two packets (ACK / SYN, ACK) other than the packet corresponding to SYN are used. Description is omitted. In addition, the flow at the end of the TCP connection is actually a flow in which both FIN and ACK are exchanged. However, in FIG. Description of the remaining two packets (ACK, ACK) is omitted.

シーケンス図として可視化すると図2のように表されるバイナリデータとしての通信ログファイルや、シーケンス図として可視化すると図3のように表されるバイナリデータとしての通信ログファイルを、コンピューター10は、パケットキャプチャー装置51から取得することができる。図4および図5はテストプログラム生成処理を示すフローチャートである。制御部20は、通信ログファイルを取得し(ステップS100)、通信ログに含まれるパケットのグループ分けと、通信動作フロー(パケットの時系列順とパケットが示す通信動作)の取得のために、通信ログファイルを解析する(ステップS101〜S180)。   The computer 10 captures a packet capture of a communication log file as binary data represented as shown in FIG. 2 when visualized as a sequence diagram, and a communication log file as binary data represented as FIG. 3 when visualized as a sequence diagram. It can be acquired from the device 51. 4 and 5 are flowcharts showing the test program generation process. The control unit 20 acquires a communication log file (step S100), and performs communication for grouping packets included in the communication log and for acquiring a communication operation flow (the time sequence of packets and communication operations indicated by the packets). The log file is analyzed (steps S101 to S180).

まず、制御部20は、時系列順に1パケット分のデータを取り出し(ステップS101)、そのパケットがTCPを使用して通信されたパケットであるか否かを判定する(ステップS105)。具体的には、パケットに含まれるIPヘッダーのプロトコル番号フィールドを参照して判定する。TCPを使用して通信されたパケットである場合、制御部20はそのパケットがSYNであるか否かを判定する(ステップS110)。具体的にはTCPヘッダーのコントロールビットフィールドのSYNビットが1ならSYNと判定する。すなわちこれは、3ウェイ・ハンドシェイクの最初の通信動作を示すパケットであるかどうかを判定していることを意味する。   First, the control unit 20 extracts data for one packet in time series order (step S101), and determines whether the packet is a packet communicated using TCP (step S105). Specifically, the determination is made with reference to the protocol number field of the IP header included in the packet. If the packet is communicated using TCP, the control unit 20 determines whether the packet is SYN (step S110). Specifically, if the SYN bit in the control bit field of the TCP header is 1, it is determined as SYN. In other words, this means that it is determined whether the packet indicates the first communication operation of the three-way handshake.

ステップS110でこのパケットがSYNであると判定された場合、制御部20は、グループ識別子を新規作成し、当該グループ識別子と、このパケットに含まれるシーケンス番号・ACK番号・送信元および宛先ポート番号とを関連づけて記憶する(ステップS120)。グループ識別子は、通信ログに含まれるパケット群をコネクション別にグループ分けするための識別子である。送信元ポート番号・宛先ポート番号・シーケンス番号・ACK番号はTCPヘッダーを参照して取得する。続いて制御部20は、このパケットは、TCPコネクション確立のための通信動作であることを記憶する(ステップS125)。また、この通信動作の時系列順も合わせて記憶する。   When it is determined in step S110 that the packet is SYN, the control unit 20 newly creates a group identifier, and includes the group identifier, a sequence number / ACK number / source and destination port numbers included in the packet. Are stored in association with each other (step S120). The group identifier is an identifier for grouping packets included in the communication log by connection. The source port number, destination port number, sequence number, and ACK number are obtained by referring to the TCP header. Subsequently, the control unit 20 stores that this packet is a communication operation for establishing a TCP connection (step S125). Further, the time series order of this communication operation is also stored.

ステップS110にてこのパケットがSYNでないと判定された場合、制御部20は、このパケットに、アプリケーションから受け取ったデータあるいはアプリケーションに届けるデータが含まれているか否かを判定する(ステップS130)。すなわちこのパケットが、TCPコネクションが確立した後のデータ送受信に対応する通信動作であるか否かを判定する。具体的には例えば、IPメッセージ部の全長からヘッダー部のサイズを引いた残りのサイズからデータの有無を判定する。次に制御部20は、このパケットのシーケンス番号・ACK番号・送信元および宛先ポート番号に基づいて、このパケットが属するグループを決定し、そのグループに対応付けて記憶する(ステップS135)とともに、このパケットがデータ送信またはデータ受信を示す通信動作であることとこの通信動作の時系列順を記憶する(ステップS140)。   When it is determined in step S110 that the packet is not SYN, the control unit 20 determines whether or not the packet includes data received from the application or data to be delivered to the application (step S130). That is, it is determined whether this packet is a communication operation corresponding to data transmission / reception after the TCP connection is established. Specifically, for example, the presence / absence of data is determined from the remaining size obtained by subtracting the size of the header portion from the total length of the IP message portion. Next, the control unit 20 determines a group to which the packet belongs based on the sequence number, ACK number, transmission source and destination port number of the packet, stores the packet in association with the group (step S135), and The fact that the packet is a communication operation indicating data transmission or data reception and the time series order of this communication operation are stored (step S140).

宛先ポート番号と送信元ポート番号とは、そのパケットを送り出す側に応じて入れ替わるが、同一コネクションの通信であればその組み合わせは同じであるため、宛先ポート番号と送信元ポート番号の組み合わせを同一グループであるかどうかの判断基準の一つとする。シーケンス番号とACK番号は二者間で送受信するデータについて、確実に送受信できたことを確認するためにパケット内に含まれている値である。送信したいデータ全体の何バイト目からのデータがそのパケットに含まれているかを示すのがシーケンス番号で、ACK番号はシーケンス番号に受信できたデータのバイト数を加算したものである。シーケンス番号と、パケットに含まれる送受信データのサイズと、ACK番号とから、このパケットがどのコネクションのパケットの続きのパケットであるかを判断することができるため、グループ分けの判断基準の一つとする。   The destination port number and the source port number are switched according to the side that sends out the packet, but the combination is the same for communication of the same connection, so the combination of the destination port number and the source port number is the same group. One of the criteria for judging whether or not. The sequence number and the ACK number are values included in the packet to confirm that data transmitted / received between the two parties can be transmitted / received reliably. The sequence number indicates how many bytes of the entire data to be transmitted are included in the packet, and the ACK number is obtained by adding the number of received data bytes to the sequence number. Since it is possible to determine from which sequence packet, the size of the transmission / reception data included in the packet, and the ACK number, this packet is a continuation of the packet of which connection, this is one of the criteria for grouping .

ステップS130にてこのパケットに前述のデータが含まれないと判定された場合、制御部20は、このパケットがFINであるか否かを判定する(ステップS145)。具体的には、TCPヘッダーのコントロールビットフィールドのFINビットが1ならFINと判定する。このパケットがFINである場合、制御部20は、このパケットのシーケンス番号・ACK番号・送信元および宛先ポート番号に基づいて、このパケットが属するグループを決定し、そのグループに対応付けて記憶する(ステップS150)とともに、このパケットがコネクション終了を示す通信動作であることとこの通信動作の時系列順を記憶する(ステップS155)。   When it is determined in step S130 that this packet does not include the above-described data, the control unit 20 determines whether or not this packet is FIN (step S145). Specifically, if the FIN bit in the control bit field of the TCP header is 1, it is determined as FIN. When this packet is FIN, the control unit 20 determines a group to which this packet belongs based on the sequence number, ACK number, transmission source, and destination port number of this packet, and stores the packet in association with the group ( Along with step S150), the fact that this packet is a communication operation indicating the end of connection and the time series order of this communication operation are stored (step S155).

ステップS105にてこのパケットはTCPを使用して通信されたパケットでないと判定された場合、制御部20は、このパケットはUDPを使用して通信されたパケットであるか否かを判定する(図5、ステップS160)。具体的には、パケットに含まれるIPヘッダーのプロトコル番号フィールドがUDPを示す番号であればUDPを使用したパケットであると判定する。このパケットがUDPを使用したパケットである場合、制御部20は、宛先ポート番号と送信元ポート番号の組み合わせが、通信ログファイルのパケットを時系列順に解析していく中で初めて出てきた組み合わせであるかどうかを判定する(ステップS165)。宛先ポート番号と送信元ポート番号はパケットに含まれるUDPヘッダーから取得できる。ポート番号の組み合わせが初めて出て来た組み合わせである場合、制御部20は、グループ識別子を新規作成し、宛先ポート番号と送信元ポート番号の組み合わせと対応付けて記憶する(ステップS170)。また、このパケットが示す通信動作を特定し(データ送信または受信)、このパケットの時系列順も記憶しておく。   When it is determined in step S105 that this packet is not a packet communicated using TCP, the control unit 20 determines whether this packet is a packet communicated using UDP (see FIG. 5, Step S160). Specifically, if the protocol number field of the IP header included in the packet is a number indicating UDP, it is determined that the packet uses UDP. When this packet is a packet using UDP, the control unit 20 determines that the combination of the destination port number and the transmission source port number is the first combination that has emerged while analyzing the packets of the communication log file in chronological order. It is determined whether or not there is (step S165). The destination port number and the source port number can be obtained from the UDP header included in the packet. If the combination of port numbers is the first combination, the control unit 20 creates a new group identifier and stores the group identifier in association with the combination of the destination port number and the transmission source port number (step S170). Further, the communication operation indicated by this packet is specified (data transmission or reception), and the time series order of this packet is also stored.

ステップS165でポート番号の組み合わせが初めて出てきた組み合わせでないと判定された場合は、制御部20は、このパケットのポート番号の組み合わせと同じ組み合わせの通信動作が含まれるグループに、このパケットが示す通信動作(データ送信または受信)を関連づけて記憶する(ステップS175)。制御部20は、通信ログファイルに含まれる最後のパケットまで解析が完了したか否かを判定し(図4、ステップS180)、完了していない場合は、ステップS101に戻って時系列順に次のパケットの解析を始める。通信ログファイルに含まれる全てのパケットの解析が完了したとき、テストプログラム生成処理は内部的に、通信ログに含まれる各パケットが属するグループと、そのパケットが示す通信動作と、そのパケットの時系列順序との対応付けが完了した状態となる。   When it is determined in step S165 that the combination of port numbers is not the first combination, the control unit 20 performs communication indicated by this packet in a group including communication operations of the same combination as the combination of port numbers of this packet. The operation (data transmission or reception) is associated and stored (step S175). The control unit 20 determines whether or not the analysis has been completed up to the last packet included in the communication log file (FIG. 4, step S180). If not completed, the control unit 20 returns to step S101 and continues to the next in chronological order. Start analyzing packets. When the analysis of all packets included in the communication log file is completed, the test program generation process internally performs the group to which each packet included in the communication log belongs, the communication operation indicated by the packet, and the time series of the packet. The association with the order is completed.

図6Aは、図2にシーケンス図で示されているパケットP1〜P15の通信ログファイルを解析したときの対応付けの結果を示している。時系列順と通信動作とグループとが対応付けられている。通信動作は、そのパケットがどのような意味を持つものであるかを示す「ふるまい」と「その他」の情報を含んでいる。「その他」の情報とは、その通信動作を再現するのに必要なパラメーターなどを意味しており、例えば、宛先ポート番号や、パケットサイズや、送受信するデータそのものなどを含んでいる。テストプログラムを実行するコンピューターに依存するパラメーター(例えば送信元IPアドレスや送信元ポート番号、シーケンス番号、ACK番号など)やその他の環境に依存するパラメーター(例えば宛先IPアドレス)は、必ずしも含まれていなくてよい。図2のパケットP1〜P15は、図6Aの時系列順の1〜15と対応している。図6Bは図3にシーケンス図として示されているパケットP16〜P25の通信ログファイルを解析したときの対応付け結果を表している。図3のパケットP16〜P25は、図6Bの時系列順1〜10と対応している。   FIG. 6A shows a correlation result when the communication log files of the packets P1 to P15 shown in the sequence diagram of FIG. 2 are analyzed. The time series order, the communication operation, and the group are associated with each other. The communication operation includes “behavior” and “other” information indicating what the packet has. The “other” information means a parameter necessary for reproducing the communication operation, and includes, for example, a destination port number, a packet size, data to be transmitted / received, and the like. Parameters that depend on the computer executing the test program (for example, source IP address, source port number, sequence number, ACK number, etc.) and other environment-dependent parameters (for example, destination IP address) are not necessarily included. It's okay. Packets P1 to P15 in FIG. 2 correspond to 1 to 15 in time series order of FIG. 6A. FIG. 6B shows an association result when the communication log files of the packets P16 to P25 shown as the sequence diagram in FIG. 3 are analyzed. The packets P16 to P25 in FIG. 3 correspond to the time series order 1 to 10 in FIG. 6B.

フローチャートの説明に戻る。続いて制御部20は、時系列順と通信動作とグループとが対応付けが示された中間ファイルを生成する(図4、ステップS185)。具体的には、例えば図6Aや図6Bで示したような、パケットが属するグループとパケットが示す通信動作とパケットの時系列順の対応付けを表す情報を含む中間ファイルを生成する。次に制御部20は、中間ファイルの内容に基づいて、テストプログラムのソースコードを記述したファイルを生成する(ステップS190)。   Return to the description of the flowchart. Subsequently, the control unit 20 generates an intermediate file in which the time series order, the communication operation, and the group are associated with each other (FIG. 4, step S185). Specifically, for example, as illustrated in FIGS. 6A and 6B, an intermediate file including information indicating the association of the group to which the packet belongs, the communication operation indicated by the packet, and the chronological order of the packet is generated. Next, the control unit 20 generates a file describing the source code of the test program based on the contents of the intermediate file (step S190).

例えば、図6Aの対応付けを表す情報を元にして生成されるテストプログラムのソースコードを説明する。テストプログラム30aは、図1を用いて説明したように、TCP/IPプログラム220をソケットと呼ばれるインターフェースを用いて扱うことによって、プリンター52と通信するように設計されたプログラムである。であるので、通信を行う前にソケットを生成しておく必要がある。ソケットは、TCPコネクションと一対一に対応するものであり、TCPコネクションを確立する前にソケットを生成し、TCPコネクションが終了した後にソケットを解放する。ソケットを生成することによって、生成されたソケットを識別するためのディスクリプタを取得できるので、そのディスクリプタを用いて、各コネクションに対応する通信動作の処理を時系列順に記述していくことが基本的な方針である。   For example, the source code of the test program generated based on the information representing the correspondence in FIG. 6A will be described. As described with reference to FIG. 1, the test program 30a is a program designed to communicate with the printer 52 by handling the TCP / IP program 220 using an interface called a socket. Therefore, it is necessary to create a socket before communication. The socket has a one-to-one correspondence with the TCP connection. The socket is generated before the TCP connection is established, and the socket is released after the TCP connection is completed. Since a descriptor for identifying the generated socket can be obtained by creating a socket, it is fundamental to describe the processing of communication operations corresponding to each connection in chronological order using that descriptor. It is a policy.

ここで注意すべき点が、ソケットを生成・解放するタイミングである。図7Aのように、先にソケット生成とTCPコネクト(TCPコネクションの確立)をまとめて行い、データ送受信をした後、最後にまとめてTCPクローズ(TCPコネクションの終了)とソケット解放を行う方法が考えられる。なお、図7A・7Bの「TCPソケット生成」処理の中では、ソケット生成を終えた後にTCPコネクト処理を実行することが記述されており、「クローズ」処理の中では、TCPコネクトを終了する処理の後にソケットを解放することが記述されている。   What should be noted here is the timing of creating and releasing a socket. As shown in FIG. 7A, a method is considered in which socket generation and TCP connect (establishment of TCP connection) are performed together, data transmission / reception is performed, and finally TCP closing (end of TCP connection) and socket release are performed together. It is done. 7A and 7B describes that the TCP connect process is executed after the socket generation is completed. In the “close” process, the TCP connect process is terminated. Is described to release the socket after.

しかし、ソケットの数には上限があり、図7Aのような手順が指示されたテストプログラムを実行すると、テストプログラム実行中にソケットが枯渇していく可能性がある。ソケットに対応するコネクションにおける通信が始まる前や、終わった後にもソケットが存在するからである。ゆえに、ソケットを使用したデータ送受信の直前までそのコネクションに対応するソケットは生成しない方が望ましいし、データ送受信で使用し終わったソケットはその都度解放して行くことが望ましい。であるので、本実施形態では、TCPコネクトに対応する第二の通信動作より時系列順に一つ前の第一の通信動作と、第二の通信動作との間に、当該第二の通信動作を含むグループに対応する第一のソケットの生成を行い、第二の通信動作を含むグループに含まれるTCPクローズに対応する第三の通信動作と、当該第三の通信動作の時系列順に一つ後の第四の通信動作との間に、第二の通信動作および第三の通信動作を含むグループに対応する第一のソケットの解放を行うようにする。   However, there is an upper limit on the number of sockets, and when a test program in which a procedure as shown in FIG. 7A is instructed is executed, there is a possibility that sockets may be exhausted during execution of the test program. This is because the socket exists before or after the communication in the connection corresponding to the socket starts. Therefore, it is desirable not to create a socket corresponding to the connection until immediately before the data transmission / reception using the socket, and it is desirable to release the socket used for the data transmission / reception each time. Therefore, in the present embodiment, the second communication operation is performed between the first communication operation immediately before the second communication operation corresponding to the TCP connect and the second communication operation in time series order. The first socket corresponding to the group including the first communication is generated, and the third communication operation corresponding to the TCP close included in the group including the second communication operation and one of the third communication operations in chronological order. During the subsequent fourth communication operation, the first socket corresponding to the group including the second communication operation and the third communication operation is released.

図6Aを用いて具体的に説明すると、時系列順に5番目の通信動作であるTCPコネクトより時系列順に一つ前の4番目の通信動作であるTCPクローズの処理の後であって、5番目のTCPコネクトの処理の前に、5番目の通信動作が属するグループTCP2に対応するソケットの生成処理を行うように記述する。また、グループTCP2に属するTCPクローズ(時系列順で12番目のTCPクローズ)の処理の後であって、時系列順に次の13番目の通信動作に対応するTCPデータ受信処理の前に、グループTCP2に対応するソケットの解放処理を行うように記述する。なお、データ受信処理とは、受信したデータを取り出す処理である。   Specifically, using FIG. 6A, after the TCP close process, which is the fourth communication operation immediately before the TCP connect, which is the fifth communication operation in the time series order, the fifth communication operation, which is the fifth communication operation. Before the TCP connect processing, the socket generation processing corresponding to the group TCP2 to which the fifth communication operation belongs is described. In addition, after the TCP close process (12th TCP close in time series order) belonging to the group TCP2, and before the TCP data reception process corresponding to the 13th communication operation in the time series order, the group TCP2 It is described so that the socket corresponding to is released. Note that the data reception process is a process for extracting received data.

以上をふまえて生成したソースコードは図7Bのようになる。図7Bのテストプログラムは、図7Aで説明した、データ送信またはデータ受信に対応する全ての通信動作の前にまとめてソケット生成を行い、データ送信またはデータ受信に対応する全ての通信動作の後にまとめてソケット解放を行う場合と比較して、同時に存在するソケットの数を必要以上に増加させずに済む。そのため、テストプログラム実行中にソケット枯渇をまねきにくくすることができる。また、通信ログに含まれるパケットの時系列順に、各パケットが示す通信動作を実行することが記述されているので、このテストプログラムを実行するコンピューターは、通信ログが取得されたときのプリンター52とコンピューター50との間の通信と同じ順序で同じ通信動作を再現することができる。   The source code generated based on the above is as shown in FIG. 7B. The test program of FIG. 7B performs socket generation collectively before all communication operations corresponding to data transmission or data reception described in FIG. 7A, and collects after all communication operations corresponding to data transmission or data reception. As compared with the case of releasing the socket, it is not necessary to increase the number of sockets existing at the same time more than necessary. Therefore, it is possible to make it difficult to cause socket exhaustion during the execution of the test program. Further, since it is described that the communication operation indicated by each packet is executed in the time series order of the packets included in the communication log, the computer executing this test program is connected to the printer 52 when the communication log is acquired. The same communication operation can be reproduced in the same order as the communication with the computer 50.

次に、図6Bの対応付けを表す情報を元にして生成されるテストプログラムのソースコードについて説明する。UDP通信の場合も実際の通信動作を実行することを指示する前にソケットを生成し、所望の通信動作が終了した後のソケットを生成する必要がある。ソケットを生成することによって、生成されたソケットを識別するためのディスクリプタを用いて、各通信動作を実行する処理を時系列順に記述していくことが基本的な方針である。   Next, the source code of the test program generated based on the information representing the correspondence in FIG. 6B will be described. Also in the case of UDP communication, it is necessary to generate a socket before instructing execution of an actual communication operation and to generate a socket after a desired communication operation is completed. The basic policy is to describe the process of executing each communication operation in time series by using the descriptor for identifying the generated socket by generating the socket.

UDP通信には、コネクションを確立するという手続が必要ないので、データ送信およびそれに対応するデータ受信の組み合わせは、他の組み合わせとは連続性などの関連がない独立した通信である。であるので、図8Aのように、その組み合わせごとにソケット生成および解放を実行するように記述するという方法がまず考えられる。なお、図8A・8Bの「ソケット生成」は文字通りソケットの生成処理を表し、「クローズ」は、ソケットの解放処理を意味している。   Since the UDP communication does not require a procedure for establishing a connection, the combination of data transmission and data reception corresponding thereto is an independent communication having no relation such as continuity with other combinations. Therefore, as shown in FIG. 8A, a method of describing so as to execute socket generation and release for each combination is conceivable. 8A and 8B literally indicates socket generation processing, and “close” indicates socket release processing.

しかし、図8Aのような手順でテストプログラムを実行すると、テストプログラム実行中に頻繁にソケットの生成と解放が実行されることになる。ソケットの生成と解放には多少時間を要するため、ソケットの生成と解放の回数が多いとその部分、その待ち時間のために実際の通信動作がなかなか実行されないという事態が発生しうる。そこで、本実施形態では、パケット内部に含まれる、送信元ポート番号と宛先ポート番号の組み合わせに注目し、その組み合わせが同一である通信動作は、同じソケットを使い回して通信するようにソースコードを記述する。   However, when the test program is executed according to the procedure shown in FIG. 8A, sockets are frequently generated and released during execution of the test program. Since it takes some time to generate and release sockets, if the number of socket generations and releases is large, a situation may occur in which actual communication operations are not easily executed due to the waiting time. Therefore, in the present embodiment, attention is paid to the combination of the source port number and the destination port number included in the packet, and the communication operation in which the combination is the same is performed by using the same socket as the source code. Describe.

本実施形態では、図6Bを用いて説明したように対応付けられた情報から、必要なソケット数をカウントし(必要なソケット数はグループの個数に等しい)、必要な分のソケット生成処理と、生成されたソケットの解放処理との間に、時系列順に通信動作を実行することを指示したテストプログラムを生成する。   In the present embodiment, as described with reference to FIG. 6B, the necessary number of sockets is counted from the associated information (the necessary number of sockets is equal to the number of groups), and the necessary number of socket generation processes; A test program that instructs execution of communication operations in time series is generated between the generated socket release process.

以上をふまえて生成したソースコードは図8Bのようになる。図8Bのテストプログラムは、図8Aで説明したようなデータ送受信の組み合わせごとにソケットの生成と解放を実行する場合と比較して、ソケット生成および解放の回数を減らすことができる。その結果、テストプログラムを実行するコンピューターにおいて、ソケットの生成および解放が頻繁に実施されることを防ぐことができる。また、通信ログに含まれるパケットの時系列順に、各パケットが示す通信動作に対応する処理を実行することが記述されているので、このテストプログラムを実行するコンピューターは、通信ログが取得されたときのプリンター52とコンピューター50との間の通信と同じ順序で同じ通信動作を実行することができる。   The source code generated based on the above is as shown in FIG. 8B. The test program of FIG. 8B can reduce the number of socket generation and release times as compared to the case of generating and releasing sockets for each combination of data transmission and reception as described in FIG. 8A. As a result, it is possible to prevent the socket that is frequently generated and released in the computer that executes the test program. In addition, since it is described that the processing corresponding to the communication operation indicated by each packet is executed in chronological order of the packets included in the communication log, the computer that executes this test program can obtain the communication log. The same communication operation can be executed in the same order as the communication between the printer 52 and the computer 50.

(3)他の実施形態:
尚、本発明の技術的範囲は、上述した実施の形態に限定されるものではなく、本発明の要旨を逸脱しない範囲内において種々変更を加え得ることは勿論である。例えば、プリンター52は、TCP/IP、UDP/IPの通信機能を備えたFAXやスキャナーあるいは複合機であってもよい。
(3) Other embodiments:
It should be noted that the technical scope of the present invention is not limited to the above-described embodiment, and various modifications can be made without departing from the scope of the present invention. For example, the printer 52 may be a FAX, a scanner, or a multifunction machine having a TCP / IP or UDP / IP communication function.

10:コンピューター、20:制御部、21:テストプログラム生成プログラム、21a:通信ログ取得部、21b:グルーピング部、21c:通信フロー取得部、21d:テストプログラム生成部、30a:テストプログラム、50:コンピューター、51:パケットキャプチャー装置、52:プリンター、53:コンピューター、200:制御部、220:TCP/IPプログラム、230:LANアダプタードライバープログラム、400:LANアダプター。   10: Computer, 20: Control unit, 21: Test program generation program, 21a: Communication log acquisition unit, 21b: Grouping unit, 21c: Communication flow acquisition unit, 21d: Test program generation unit, 30a: Test program, 50: Computer 51: Packet capture device 52: Printer 53: Computer 200: Control unit 220: TCP / IP program 230: LAN adapter driver program 400: LAN adapter

Claims (4)

ネットワークに接続されたサーバー機器とクライアント機器との間の通信ログを取得する通信ログ取得工程と、
前記通信ログに含まれる複数のTCPパケットを、前記TCPパケットに含まれる宛先ポート番号と送信元ポート番号との組み合わせが同一であって、前記TCPパケットに含まれるシーケンス番号とACK番号とが対応するグループにグループ分けするグルーピング工程と、
前記通信ログに含まれる各前記TCPパケットが示す通信動作と、前記通信動作の時系列順と、を取得する通信フロー取得工程と、
前記サーバー機器と通信するクライアント機器で実行するためのテストプログラムであって、前記時系列順に前記通信動作を実行することを指示するとともに、TCPコネクトに対応する第二の通信動作より前記時系列順に一つ前の第一の通信動作と、前記第二の通信動作との間に、当該第二の通信動作を含むグループに対応する第一のソケットの生成を行い、前記第二の通信動作を含むグループに含まれるTCPクローズに対応する第三の通信動作と、当該第三の通信動作の時系列順に一つ後の第四の通信動作との間に、前記第二の通信動作および前記第三の通信動作を含むグループに対応する前記第一のソケットの解放を行うことを指示するテストプログラムを生成するテストプログラム生成工程と、
を含むテストプログラム生成方法。
A communication log acquisition step for acquiring a communication log between a server device and a client device connected to the network;
A plurality of TCP packets included in the communication log have the same combination of a destination port number and a transmission source port number included in the TCP packet, and a sequence number and an ACK number included in the TCP packet correspond to each other. A grouping process for grouping into groups;
A communication flow acquisition step of acquiring a communication operation indicated by each of the TCP packets included in the communication log, and a time series order of the communication operation;
A test program for execution on a client device that communicates with the server device, instructing execution of the communication operation in the time series order, and in a time series order from a second communication operation corresponding to TCP Connect A first socket corresponding to the group including the second communication operation is generated between the previous first communication operation and the second communication operation, and the second communication operation is performed. The second communication operation and the second communication operation between the third communication operation corresponding to the TCP closing included in the group including the fourth communication operation one after the third communication operation in chronological order. A test program generating step for generating a test program instructing to release the first socket corresponding to the group including the three communication operations;
A test program generation method including:
ネットワークに接続されたサーバー機器とクライアント機器との間の通信ログを取得する通信ログ取得工程と、
前記通信ログに含まれる複数のUDPパケットを、前記UDPパケットに含まれる宛先ポート番号と送信元ポート番号との組み合わせが同一であるグループにグループ分けするグルーピング工程と、
前記通信ログに含まれる各前記UDPパケットが示す通信動作と、前記通信動作の時系列順と、を取得する通信フロー取得工程と、
前記サーバー機器と通信するクライアント機器で実行するためのテストプログラムであって、前記通信ログに含まれる前記グループの個数分のソケット生成処理と、生成された前記ソケットの解放処理との間に、前記時系列順に前記通信動作を実行することを指示したテストプログラムを生成するテストプログラム生成工程と、
を含むテストプログラム生成方法。
A communication log acquisition step for acquiring a communication log between a server device and a client device connected to the network;
A grouping step of grouping a plurality of UDP packets included in the communication log into groups in which a combination of a destination port number and a source port number included in the UDP packet is the same;
A communication flow acquisition step of acquiring a communication operation indicated by each of the UDP packets included in the communication log, and a time series order of the communication operation;
A test program for execution on a client device that communicates with the server device, between the socket generation processing for the number of the groups included in the communication log and the generated socket release processing, A test program generating step for generating a test program instructing execution of the communication operation in time series;
A test program generation method including:
ネットワークに接続されたサーバー機器とクライアント機器との間の通信ログを取得する通信ログ取得機能と、
前記通信ログに含まれる複数のTCPパケットを、前記TCPパケットに含まれる宛先ポート番号と送信元ポート番号との組み合わせが同一であって、前記TCPパケットに含まれるシーケンス番号とACK番号とが対応するグループにグループ分けするグルーピング機能と、
前記通信ログに含まれる各前記TCPパケットが示す通信動作と、前記通信動作の時系列順と、を取得する通信フロー取得機能と、
前記サーバー機器と通信するクライアント機器で実行するためのテストプログラムであって、前記時系列順に前記通信動作を実行することを指示するとともに、TCPコネクトに対応する第二の通信動作より前記時系列順に一つ前の第一の通信動作と、前記第二の通信動作との間に、当該第二の通信動作を含むグループに対応する第一のソケットの生成を行い、前記第二の通信動作を含むグループに含まれるTCPクローズに対応する第三の通信動作と、当該第三の通信動作の時系列順に一つ後の第四の通信動作との間に、前記第二の通信動作および前記第三の通信動作を含むグループに対応する前記第一のソケットの解放を行うことを指示するテストプログラムを生成するテストプログラム生成機能と、
をコンピューターに実現させるテストプログラム生成プログラム。
A communication log acquisition function for acquiring a communication log between a server device and a client device connected to the network;
A plurality of TCP packets included in the communication log have the same combination of a destination port number and a transmission source port number included in the TCP packet, and a sequence number and an ACK number included in the TCP packet correspond to each other. A grouping function for grouping into groups,
A communication flow acquisition function for acquiring a communication operation indicated by each of the TCP packets included in the communication log, and a time series order of the communication operation;
A test program for execution on a client device that communicates with the server device, instructing execution of the communication operation in the time series order, and in a time series order from a second communication operation corresponding to TCP Connect A first socket corresponding to the group including the second communication operation is generated between the previous first communication operation and the second communication operation, and the second communication operation is performed. The second communication operation and the second communication operation between the third communication operation corresponding to the TCP closing included in the group including the fourth communication operation one after the third communication operation in chronological order. A test program generation function for generating a test program instructing to release the first socket corresponding to the group including the three communication operations;
A test program generation program that enables a computer to implement a program.
ネットワークに接続されたサーバー機器とクライアント機器との間の通信ログを取得する通信ログ取得機能と、
前記通信ログに含まれる複数のUDPパケットを、前記UDPパケットに含まれる宛先ポート番号と送信元ポート番号との組み合わせが同一であるグループにグループ分けするグルーピング機能と、
前記通信ログに含まれる各前記UDPパケットが示す通信動作と、前記通信動作の時系列順と、を取得する通信フロー取得機能と、
前記サーバー機器と通信するクライアント機器で実行するためのテストプログラムであって、前記通信ログに含まれる前記グループの個数分のソケット生成処理と、生成された前記ソケットの解放処理との間に、前記時系列順に前記通信動作を実行することを指示したテストプログラムを生成するテストプログラム生成機能と、
をコンピューターに実現させるテストプログラム生成プログラム。
A communication log acquisition function for acquiring a communication log between a server device and a client device connected to the network;
A grouping function for grouping a plurality of UDP packets included in the communication log into groups in which a combination of a destination port number and a source port number included in the UDP packet is the same;
A communication flow acquisition function for acquiring a communication operation indicated by each of the UDP packets included in the communication log, and a time series order of the communication operation;
A test program for execution on a client device that communicates with the server device, between the socket generation processing for the number of the groups included in the communication log and the generated socket release processing, A test program generation function for generating a test program instructing execution of the communication operation in time series order;
A test program generation program that enables a computer to implement a program.
JP2009073830A 2009-03-25 2009-03-25 Test program creation method and program Withdrawn JP2010226617A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2009073830A JP2010226617A (en) 2009-03-25 2009-03-25 Test program creation method and program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2009073830A JP2010226617A (en) 2009-03-25 2009-03-25 Test program creation method and program

Publications (1)

Publication Number Publication Date
JP2010226617A true JP2010226617A (en) 2010-10-07

Family

ID=43043285

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2009073830A Withdrawn JP2010226617A (en) 2009-03-25 2009-03-25 Test program creation method and program

Country Status (1)

Country Link
JP (1) JP2010226617A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102045346A (en) * 2010-11-25 2011-05-04 深圳市科陆电子科技股份有限公司 TCP (Transmission Control Protocol) service channel realized by adopting Netty framework
US9356836B2 (en) 2012-12-10 2016-05-31 Fujitsu Limited Administration device, administration control method, and program
JPWO2018135336A1 (en) * 2017-01-20 2019-11-07 パイオニア株式会社 REPRODUCTION DEVICE, REPRODUCTION METHOD, AND PROGRAM
WO2020157795A1 (en) * 2019-01-28 2020-08-06 三菱電機株式会社 Test device, test method, and test program

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102045346A (en) * 2010-11-25 2011-05-04 深圳市科陆电子科技股份有限公司 TCP (Transmission Control Protocol) service channel realized by adopting Netty framework
US9356836B2 (en) 2012-12-10 2016-05-31 Fujitsu Limited Administration device, administration control method, and program
JPWO2018135336A1 (en) * 2017-01-20 2019-11-07 パイオニア株式会社 REPRODUCTION DEVICE, REPRODUCTION METHOD, AND PROGRAM
WO2020157795A1 (en) * 2019-01-28 2020-08-06 三菱電機株式会社 Test device, test method, and test program
JPWO2020157795A1 (en) * 2019-01-28 2021-04-30 三菱電機株式会社 Test equipment, test methods and test programs

Similar Documents

Publication Publication Date Title
US7990866B2 (en) Server device, method for controlling a server device, and method for establishing a connection using the server device
JP5363658B1 (en) RELAY DEVICE, RELAY DEVICE CONTROL METHOD, AND NETWORK SYSTEM
CN105939297B (en) A kind of TCP message recombination method and device
KR101430032B1 (en) Method for improving a tcp data transmission process in case the physical transmission medium is disconnected
JP5696724B2 (en) Relay device, relay system, relay method, program, and computer-readable recording medium recording the program
EP3208989A1 (en) Secure shell (ssh2) protocol data collection method and device
JP2010226617A (en) Test program creation method and program
CN110071939B (en) Improvement method for SYN FLOOD protection of traditional DDOS firewall in industrial network
JP2007142582A (en) Data communication device, data communication method, program, and storage medium
JP5067362B2 (en) Communication terminal, network interface card and method thereof
Hernández-Campos et al. Generating Realistic TCP Workloads.
CN109413018A (en) A kind of port scanning method and device
US8646066B2 (en) Security protocol control apparatus and security protocol control method
JP2007110680A (en) Communication apparatus, communication program, communication control method, and recording medium
JP5935602B2 (en) Transfer device, transfer method, and transfer program
JP2010225044A (en) Test program generation method and program
JP2005210352A (en) Ip address converter and converting method
US20080172456A1 (en) Method for detecting the ipv6 network application layer protocol
WO2011135181A1 (en) Method and arrangement for message analysis
JP2003264609A (en) Protocol sequence analyzer, protocol sequence output data generating method therefor, and computer program
JP2009225089A (en) Communication device and method of capturing packet
CN115085864B (en) Data transmission method and device
CN113032123B (en) Thread scheduling method, system and related device of remote NPL running environment
Billington et al. Coloured Petri net modelling of an evolving Internet standard: The datagram congestion control protocol
WO2017161876A1 (en) Method and device implementing network access

Legal Events

Date Code Title Description
A300 Application deemed to be withdrawn because no request for examination was validly filed

Free format text: JAPANESE INTERMEDIATE CODE: A300

Effective date: 20120605