CN105446867B - A kind of generation method and device of test data - Google Patents

A kind of generation method and device of test data Download PDF

Info

Publication number
CN105446867B
CN105446867B CN201410419779.0A CN201410419779A CN105446867B CN 105446867 B CN105446867 B CN 105446867B CN 201410419779 A CN201410419779 A CN 201410419779A CN 105446867 B CN105446867 B CN 105446867B
Authority
CN
China
Prior art keywords
request message
service side
called
code
data
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201410419779.0A
Other languages
Chinese (zh)
Other versions
CN105446867A (en
Inventor
方磊
陈成
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.)
Advanced New Technologies Co Ltd
Advantageous New Technologies Co Ltd
Original Assignee
Alibaba Group Holding 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 Alibaba Group Holding Ltd filed Critical Alibaba Group Holding Ltd
Priority to CN201410419779.0A priority Critical patent/CN105446867B/en
Publication of CN105446867A publication Critical patent/CN105446867A/en
Application granted granted Critical
Publication of CN105446867B publication Critical patent/CN105446867B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

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

Abstract

This application discloses a kind of computer technology, in particular to the generation method and device of a kind of test data, to improve the validity of test result.This method are as follows: binary data record is carried out to transmission data in data transmission procedure, unserializing operation is carried out to the binary data of record again, obtain code elements information, and the test code needed for being generated based on code elements information, in this way, code can be tested accordingly based on true Application of Interface environment generation, to effectively increase the formation efficiency of test code, the validity and accuracy of test result are improved, while the development and maintenance cost of test code is also greatly saved.Further, the versatility of the embodiment of the present application is high, is suitable for various protocol interfaces, and easy to operate, does not need the development Experience that developer has many years, so that reducing it into one extends cost.

Description

A kind of generation method and device of test data
Technical field
This application involves computer technology, in particular to the generation method and device of a kind of test data.
Background technique
In computer program exploitation and maintenance process, developer usually requires to write a large amount of test case to interface Calling is detected.And during writing test case, developer generally requires test data needed for oneself constructing.This The excessive experience dependent on developer of kind method, usually will appear error in data (e.g., lacking call parameter), so as to cause Interface calls test to interrupt, and needing to debug repeatedly could succeed, and cause the time costly.
And in practical application, even if test process smoothly completes, test data and really called that developer constructs Whether the data in journey are also unanimously a unknown number, so that the validity of test result reduces.
For above situation in the case where interface enters ginseng complexity, drawback is especially prominent.
Summary of the invention
The embodiment of the present application provides the generation method and device of a kind of test data, to improve the effective of test result Property.
Specific technical solution provided by the embodiments of the present application is as follows:
A kind of generation method of test data, comprising:
The request message that called side is sent is received, is sent to service side after carrying out data record, and receive server and return Response message, carry out data record after be sent to called side;
Unserializing processing is carried out to the data of record, obtains code elements information;
Code elements information based on acquisition generates corresponding test code.
In this way, code can be tested accordingly based on true Application of Interface environment generation, to effectively increase test The formation efficiency of code improves the validity and accuracy of test result, while the exploitation of test code is also greatly saved And maintenance cost.Further, the versatility of the embodiment of the present application is high, is suitable for various protocol interfaces, and easy to operate, no Need developer that there is the development Experience of many years, so that reducing it into one extends cost.
Optionally, the request message that called side is sent is received, is sent to service side after carrying out data record, and receive service The response message that device returns is sent to called side after carrying out data record, comprising:
When receiving the request message of called side transmission, the specific field in the request message is read, according to described The type of the parsing result decision request message of specific field, and obtain the system domain name of service side;
If the request message is to obtain get request message, the binary data in start recording get request message, After record, the local connection to service side is opened according to the system domain name of service side, and get request message is passed through into institute It states connection and is sent to service side, and in the response message for receiving service side, the binary data of recording responses message, and It is back to called side;
If the request message is publication post request message, is opened according to the system domain name of service side and locally extremely serviced The connection of side, the binary data in start recording post request message, and circulation reading is carried out to post request message, it will It records the data portion finished and service side is successively sent to by the connection, and disappear in the response for receiving service side's return When breath, the binary data of recording responses message, and circulation reading is carried out to response message, the data portion finished will have been recorded Successively it is sent to called side.
Optionally, unserializing processing is carried out to the data of record, obtains code elements information, comprising:
What it is by record includes that the binary data of request message and response message is converted to character string, and therefrom parses Used calling interface and call method when called side is called service side;
String data progress unserializing processing to acquisition, the acquisition operable test object of java applet, and from In parse the call result for entering to join list and service side and returning used when called side is called service side;
By the calling interface of acquisition, call method, enter to join list and call result is determined as code elements information.
Optionally, the code elements information based on acquisition generates corresponding test code, comprising:
According to the calling interface that the called side of acquisition uses, calling interface title and calling used in code are tested in configuration Call method title, called side used in code are tested in interface type, and the call method used according to called side, configuration Method type and call parameters;
To used based on called side enter to join test object that the call result that list and service side return generates respectively into Row parsing, acquisition enter join title, enter to join type, enter to join assignment and result parameter title, result parameter type, result accordingly Parameter assignment, and corresponding test code is generated according to information is obtained.
Optionally, further comprise:
It is carried out to the test object of the call result generation for entering to join list and service side's return used based on called side During Parameter analysis of electrochemical, if test object to be obtained is plain objects, directly it is called;If test pair to be obtained Address is saved as complex object, then reading the corresponding file of the complex object to obtain and generate based on the complex object File is saved, and is called again after the preservation file is converted to the complex object.
A kind of generating means of test data, comprising:
Communication unit is sent to service side, Yi Jijie after carrying out data record for receiving the request message of called side transmission The response message that server returns is received, is sent to called side after carrying out data record;
Processing unit carries out unserializing processing for the data to record, obtains code elements information;
Generation unit generates corresponding test code for the code elements information based on acquisition.
In this way, code can be tested accordingly based on true Application of Interface environment generation, to effectively increase test The formation efficiency of code improves the validity and accuracy of test result, while the exploitation of test code is also greatly saved And maintenance cost.Further, the versatility of the embodiment of the present application is high, is suitable for various protocol interfaces, and easy to operate, no Need developer that there is the development Experience of many years, so that reducing it into one extends cost.
Optionally, the request message that called side is sent is received, is sent to service side after carrying out data record, and receive service The response message that device returns carries out after data record when being sent to called side, and the communication unit is specifically used for:
When receiving the request message of called side transmission, the specific field in the request message is read, according to described The type of the parsing result decision request message of specific field, and obtain the system domain name of service side;
If the request message is to obtain get request message, the binary data in start recording get request message, After record, the local connection to service side is opened according to the system domain name of service side, and get request message is passed through into institute It states connection and is sent to service side, and in the response message for receiving service side, the binary data of recording responses message, and It is back to called side;
If the request message is publication post request message, is opened according to the system domain name of service side and locally extremely serviced The connection of side, the binary data in start recording post request message, and circulation reading is carried out to post request message, it will It records the data portion finished and service side is successively sent to by the connection, and disappear in the response for receiving service side's return When breath, the binary data of recording responses message, and circulation reading is carried out to response message, the data portion finished will have been recorded Successively it is sent to called side.
Optionally, unserializing processing is carried out to the data of record, when obtaining code elements information, the recording unit tool Body is used for:
What it is by record includes that the binary data of request message and response message is converted to character string, and therefrom parses Used calling interface and calling device when called side is called service side;
String data progress unserializing processing to acquisition, the acquisition operable test object of java applet, and from In parse the call result for entering to join list and service side and returning used when called side is called service side;
By the calling interface of acquisition, call method, enter to join list and call result is determined as code elements information.
Optionally, when the code elements information based on acquisition generates corresponding test code, the generation unit is specifically used In:
According to the calling interface that the called side of acquisition uses, calling interface title and calling used in code are tested in configuration Interface type, and the calling device used according to called side, configuration test calling device title used in code, call dress Set type and call parameters;
To used based on called side enter to join test object that the call result that list and service side return generates respectively into Row parsing, acquisition enter join title, enter to join type, enter to join assignment and result parameter title, result parameter type, result accordingly Parameter assignment, and corresponding test code is generated according to information is obtained.
Optionally, the generation unit is further used for:
It is carried out to the test object of the call result generation for entering to join list and service side's return used based on called side During Parameter analysis of electrochemical, if test object to be obtained is plain objects, directly it is called;If test pair to be obtained Address is saved as complex object, then reading the corresponding file of the complex object to obtain and generate based on the complex object File is saved, and is called again after the preservation file is converted to the complex object.
Detailed description of the invention
Fig. 1 is TCP agent System Working Principle schematic diagram in the embodiment of the present application;
Fig. 2 is that TCP agent system generates test data general introduction flow chart in the embodiment of the present application;
Fig. 3 is TCP agent system structure diagram in the embodiment of the present application.
Specific embodiment
In order to improve the test result validity of interface testing, in the embodiment of the present application, test data has been redesigned Generating mode, i.e., by monitoring transmission control protocol (TransmissionControl Protocol, TCP) data then inverted sequence Columnization, thus the test data needed for being generated based on truthful data, completely without manual construction data, that is, when saving test Between, and because of the authenticity of test data, effectively improve the validity of test result.
The application preferred embodiment is described in detail with reference to the accompanying drawing.
As shown in fig.1, being provided with the agency positioned at TCP layer between called side and service side in the embodiment of the present application System, referred to as, TCP agent system, any request for calling direction service side to send all can be received and be forwarded by TCP agent system To service side, correspondingly, any response that service side returns also all can be forwarded to called side by TCP agent system work.
In specific implementation, as long as the destination service of called side, which is switched to TCP agent system, will e.g. call The service domain name of side is directed toward TCP agent system etc., and this is no longer going to repeat them.In addition, tester can pass through any side Formula can also be returned to call by service orientation called side and be rung in any manner by calling direction service side to send call request It answers, all operating process by TCP agent system forwards and can all record.
As shown in fig.2, the general introduction process that TCP agent system generates test data is as follows in the embodiment of the present application:
Step 200: receiving the request message that called side is sent, be sent to service side after carrying out data record, and receive clothes The response message that business device returns, is sent to called side after carrying out data record.
As shown in Figure 1, TCP agent system forwards between the two between called side and service side in the embodiment of the present application Interaction message, during forwarding, optionally, TCP agent system records interaction message between the two, packet in TCP layer Include that called side is sent to the request message of service side and service side is sent to the response message of called side.Due to being carried out in TCP layer Data decryptor, therefore, the embodiment of the present application are a kind of general schemes, are adapted to the system using any protocol stack and set It is standby, as long as accordingly being developed based on TCP layer, so that it may carry out the monitoring of any type interface service agreement.
On the other hand, the application supports the network service (Webservice, wb) of xfire and some customized at present Far call agreement can also suitably extend the agreement that technical scheme is paid according to practical application request, In the present embodiment, function presentation only is done in a manner of the ws protocol processes of xfire.
Specifically, TCP agent system is mainly used for the request message for sending called side, forwarding when executing step 200 Called side is returned to specified service side, and by the response message that service side returns, and in this calling process, record The binary data of request message and response message.
In practical application, request message is divided into acquisition (get) request message and publication (post) request message, the former is used for Service description language (sdl) (Web Services Description Languag, wsdl) document (i.e. service side is requested to service side Enter to join list), the latter is for calling service side to execute various operations.For different types of request message, TCP agent system Different processing will be executed.Wherein, Web service description is defined as one group of service access point by wsdl document, and client can lead to These service access points are crossed to access (similar to remote process tune to the service comprising Oriented Documents information or procedure-oriented calling With).
Specific executive mode is as follows:
It after the starting of TCP agent system, monitors designated port (e.g., being configured to 8080 ports), is requested when receiving called side When message, the specific field in TCP agent system read requests message is (for example, preceding 256 bytes or preceding 1024 bytes etc. Deng), according to the type of the parsing result decision request message of this partial data, and the system domain name of service side is obtained, it is also referred to as main Machine (host) information;
If request message be get request message, the purpose is to obtain service side wsdl document (i.e. service side enter ginseng List), it is so-called enter to join list be that parameter list to be used is needed when calling service side, called side is according to entering to join the prompt of list Service side can be called by filling corresponding parameter in post request.So, TCP agent system start recording get Binary data in request message, and after record, it is opened according to the system domain name of service side local to service side's Get request message is sent to service side by established TCP connection by TCP connection;Correspondingly, TCP agent system is receiving To service side response message (carry wsdl file) when, the binary data of recording responses message, and be back to called side.
Why in this way processing is less because of the data volume carried in get request message, it can be finished in record Afterwards, all data are sent to service side together.
If post request message, then the purpose is to call service side to complete various operations, then, TCP agent system root The local TCP connection to service side is opened according to the system domain name of service side, this TCPL is written into the specific field that early period reads and is connected Meet (all data will incoming service side, first will acquire the data received herein and first send), and start recording post Binary data (optional, request array to can be used, i.e., byte [], request was recorded) in request message, connects , TCP agent system can carry out circulation reading to post request message, will record the data portion finished by having been established TCP connection be successively sent to service side;Correspondingly, the response message that TCP agent system receives service side's return (is carried and is adjusted With result) when, (response array, i.e. byte [] response optionally, can be used in the binary data of recording responses message Recorded), and circulation reading is carried out to response message, the data portion finished will have been recorded and be successively sent to called side.
Wherein, when to service side's returning response message, in order to avoid reading empty data, optionally, TCP agent system can It is slept 25 milliseconds of (sleep) with circulation, is until the data recorded in byte [] response contain wsdl ending identifier Only.
Why in this way processing is because the data volume carried in post request message is more, in order to avoid causing data to hinder Post request message is sent to service side several times by plug, TCP processing system.
Step 210: unserializing processing being carried out to the data of record, obtains code elements information.
When executing step 210, TCP processing system specifically executes following steps:
Firstly, TCP agent system obtain recorded binary data (include: get request message and its response message, Post request message and its response message), binary data is converted into character string, and therefrom parse called side to service side Used calling interface and call method when being called.
In practical application, all data record in binary form, and TCP agent system is carrying out unserializing behaviour It before work, needs that binary data is first converted to character string (e.g., soap version of an agreement), after being converted to character string, call The calling interface and call method of Fang Caiyong can directly parse acquisition, and enter to join list and be related to complicated parameter configuration, adjust Also include mass data with result, acquisition can not be parsed under character string state, it is necessary to carry out unserializing operation, be converted to The operable object of java applet.
Secondly, the string data to acquisition carries out unserializing processing, the operable test object of java applet is obtained, And therefrom parse used when called side is called service side enter to join list, use enter to join list and service side returns The calling returned obtains the operable test object of java applet.
Finally, by the calling interface of acquisition, call method, entering to join list and call result is determined as code elements information.
In the embodiment of the present application, TCP agent system, which executes unserializing operation, to be realized based on the transformation to xfire , xFire is of new generationJavaWeb service engine, for simplifying the step of Java application is converted into Web service and process, In the present embodiment, the function of xfire processor has been transformed, has only remained its data parsing function, other services is not provided, because This, the unserializing that TCP agent system need to only call improved xfire that data can be realized operates.It is grasped by unserializing After work, TCP agent system can be parsed out the call result for entering to join list and service side's return that called side uses, both of which It is converted into the operable test object of java applet, wherein due to entering to join in list and call result include a large amount of multiple Miscellaneous data, therefore, the object of generation include plain objects and complex object.
Above-mentioned calling interface, call method enter to join list and call result and are important code elements information, by these The accurate test code for meeting actual application environment can be generated as dimension in information;Certainly, if administrative staff are known in advance The calling interface and call method that called side uses, then TCP agent system can not also parse from character string and obtain this information, And unserializing operation only is carried out to character string and obtains mostly important to enter to join list and call result.It is no longer superfluous herein It states.
Step 220: the code elements information based on acquisition generates corresponding test code.
Specifically, TCP code system executes following operation when executing step 220:
Firstly, according to the calling interface that the called side of acquisition uses, calling interface title used in configuration test code With calling interface type, and call method title used in the call method configuration test code that is used according to called side, Call method type and call parameters.
For example, the calling interface and call method that are used according to called side, interface name used in configuration test code, A kind of bean (java class) type, bean title, call parameters method etc.;Wherein, for simple parameter variable and parameter piece Act value needs to carry out initial assignment.
Secondly, the test object point to the call result generation for entering to join list and service side's return used based on called side Do not parsed, obtain accordingly enter join title, enter to join type, enter to join assignment and result parameter title, result parameter type, Result parameter assignment, and corresponding test code is generated according to information is obtained.
For example, can be parsed to entering to join list for entering and joining list, in test code with merging ginseng type, Enter ginseng statement, import type, initialization assignment etc..
On the other hand, after to entering to join list and call result progress unserializing operation, due to the test object of generation It may be plain objects and complex object, therefore, preserving type may be different, and e.g., plain objects are directly with Java object Form saves, and complex object needs to be saved more safe safety with document form since data volume is huge, therefore, TCP Agency plant needs to be converted to complex object document form (e.g., Javascript Object Notation (Javascript Object Notation, Json) save file) saved, and record file and save address.) stored, and record file and save ground Location.
In this way, in the test object to the call result generation for entering to join list and service side's return used based on called side During carrying out Parameter analysis of electrochemical, if test object to be obtained is plain objects, TCP agent system is directly called, The Java object of corresponding preservation is directly read, and if test object to be obtained is complex object, the reading of TCP agent system The corresponding file of the complex object saves address to obtain the preservation file generated based on the complex object, and by the preservation file Corresponding complex object is converted to be called again.
Using the above method, can gradually be given birth to (i.e. since the part package) since the initial part of test code At the interface testing code of a standard.
As shown in fig.3, in the embodiment of the present application, a kind of generating means of test data (i.e. TCP agent system), including Communication unit 30, processing unit 31 and generation unit 32, wherein
Communication unit 30, the request message sent for receiving called side, is sent to service side after carrying out data record, and The response message that server returns is received, is sent to called side after carrying out data record;
Processing unit 31 carries out unserializing processing for the data to record, obtains code elements information;
Generation unit 32 generates corresponding test code for the code elements information based on acquisition.
Optionally, communication unit is specifically used for:
When receiving the request message of called side transmission, specific field in read requests message, according to specific field Parsing result decision request message type, and obtain the system domain name of service side;
If request message is to obtain get request message, the binary data in start recording get request message is being remembered After record, the local connection to service side is opened according to the system domain name of service side, and get request message is passed through into connection hair It send to service side, and in the response message for receiving service side, the binary data of recording responses message, and is back to tune With side;
If request message is publication post request message, opened according to the system domain name of service side local to service side's It connects, the binary data in start recording post request message, and circulation reading is carried out to post request message, will record The data portion finished is successively sent to service side by connection, and when receiving the response message of service side's return, note The binary data of response message is recorded, and circulation reading is carried out to response message, the data portion finished will have been recorded and successively sent out Give called side.
Optionally, recording unit is specifically used for:
What it is by record includes that the binary data of request message and response message is converted to character string, and therefrom parses Used calling interface and calling device when called side is called service side;
String data progress unserializing processing to acquisition, the acquisition operable test object of java applet, and from In parse the call result for entering to join list and service side and returning used when called side is called service side;
By the calling interface of acquisition, call method, enter to join list and call result is determined as code elements information.
Optionally, generation unit is specifically used for:
According to the calling interface that the called side of acquisition uses, calling interface title and calling used in code are tested in configuration Interface type, and the calling device used according to called side, configuration test calling device title used in code, call dress Set type and call parameters;
To used based on called side enter to join test object that the call result that list and service side return generates respectively into Row parsing, acquisition enter join title, enter to join type, enter to join assignment and result parameter title, result parameter type, result accordingly Parameter assignment, and corresponding test code is generated according to information is obtained.
Optionally, generation unit is further used for:
It is carried out to the test object of the call result generation for entering to join list and service side's return used based on called side During Parameter analysis of electrochemical, if test object to be obtained is plain objects, directly it is called;If test pair to be obtained Address is saved as complex object, then reading the corresponding file of complex object to obtain the preservation text generated based on complex object Part, and will save after file is converted to complex object and be called again.
In conclusion in the embodiment of the present application, TCP agent system in data transmission procedure to transmission data carry out two into Data record processed, then unserializing operation is carried out to the binary data of record, code elements information is obtained, and be based on code Element information generates required test code, in this way, code can be tested based on true Application of Interface environment generation accordingly, To effectively increase the formation efficiency of test code, the validity and accuracy of test result are improved, while also saving significantly The development and maintenance cost of test code is saved.Further, the versatility of the embodiment of the present application is high, is suitable for various agreements Interface, and it is easy to operate, the development Experience that developer has many years is not needed, so that reducing it into one extends cost.
It should be understood by those skilled in the art that, embodiments herein can provide as method, system or computer program Product.Therefore, complete hardware embodiment, complete software embodiment or reality combining software and hardware aspects can be used in the application Apply the form of example.Moreover, it wherein includes the computer of computer usable program code that the application, which can be used in one or more, The computer program implemented in usable storage medium (including but not limited to magnetic disk storage, CD-ROM, optical memory etc.) produces The form of product.
The application is referring to method, the process of equipment (system) and computer program product according to the embodiment of the present application Figure and/or block diagram describe.It should be understood that every one stream in flowchart and/or the block diagram can be realized by computer program instructions The combination of process and/or box in journey and/or box and flowchart and/or the block diagram.It can provide these computer programs Instruct the processor of general purpose computer, special purpose computer, Embedded Processor or other programmable data processing devices to produce A raw machine, so that being generated by the instruction that computer or the processor of other programmable data processing devices execute for real The device for the function of being specified in present one or more flows of the flowchart and/or one or more blocks of the block diagram.
These computer program instructions, which may also be stored in, is able to guide computer or other programmable data processing devices with spy Determine in the computer-readable memory that mode works, so that it includes referring to that instruction stored in the computer readable memory, which generates, Enable the manufacture of device, the command device realize in one box of one or more flows of the flowchart and/or block diagram or The function of being specified in multiple boxes.
These computer program instructions also can be loaded onto a computer or other programmable data processing device, so that counting Series of operation steps are executed on calculation machine or other programmable devices to generate computer implemented processing, thus in computer or The instruction executed on other programmable devices is provided for realizing in one or more flows of the flowchart and/or block diagram one The step of function of being specified in a box or multiple boxes.
Although the preferred embodiment of the application has been described, it is created once a person skilled in the art knows basic Property concept, then additional changes and modifications may be made to these embodiments.So it includes excellent that the following claims are intended to be interpreted as It selects embodiment and falls into all change and modification of the application range.
Obviously, those skilled in the art can carry out various modification and variations without departing from this Shen to the embodiment of the present application Please embodiment spirit and scope.In this way, if these modifications and variations of the embodiment of the present application belong to the claim of this application And its within the scope of equivalent technologies, then the application is also intended to include these modifications and variations.

Claims (8)

1. a kind of generation method of test data characterized by comprising
When receiving the request message of called side transmission, the specific field in the request message is read, according to described specified The type of the parsing result decision request message of field, and obtain the system domain name of service side;
If the request message is to obtain get request message, the binary data in start recording get request message is being remembered After record, the local connection to service side is opened according to the system domain name of service side, and get request message is passed through into the company It receives and sends to service side, and in the response message for receiving service side, the binary data of recording responses message, and returns To called side;
If the request message is publication post request message, opened according to the system domain name of service side local to service side's It connects, the binary data in start recording post request message, and circulation reading is carried out to post request message, will record The data portion finished is successively sent to service side by the connection, and in the response message for receiving service side's return When, the binary data of recording responses message, and circulation reading is carried out to response message, will record the data portion that finishes according to It is secondary to be sent to called side;
Unserializing processing is carried out to the data of record, obtains code elements information;
Code elements information based on acquisition generates corresponding test code.
2. the method as described in claim 1, which is characterized in that carry out unserializing processing to the data of record, obtain code Element information, comprising:
What it is by record includes that the binary data of request message and response message is converted to character string, and therefrom parses calling Side used calling interface and call method when being called to service side;
Unserializing processing is carried out to the string data of acquisition, obtains the operable test object of java applet, and therefrom solve The call result for entering to join list and service side's return used when called side is called service side is precipitated;
By the calling interface of acquisition, call method, enter to join list and call result is determined as code elements information.
3. method according to claim 2, which is characterized in that the code elements information based on acquisition generates corresponding test generation Code, comprising:
According to the calling interface that the called side of acquisition uses, calling interface title and calling interface used in code are tested in configuration Call method title, call method class used in code are tested in type, and the call method used according to called side, configuration Type and call parameters;
The test object of the call result generation for entering to join list and service side's return used based on called side is solved respectively Analysis, acquisition enter join title, enter to join type, enter to join assignment and result parameter title, result parameter type, result parameter accordingly Assignment, and corresponding test code is generated according to information is obtained.
4. method as claimed in claim 3, which is characterized in that further comprise:
Parameter is being carried out to the test object of the call result generation for entering to join list and service side's return used based on called side During parsing, if test object to be obtained is plain objects, directly it is called;If test object to be obtained is Complex object is then read the corresponding file of the complex object and saves address to obtain the preservation generated based on the complex object File, and be called again after the preservation file is converted to the complex object.
5. a kind of generating means of test data characterized by comprising
Communication unit, for reading the specific field in the request message when receiving the request message of called side transmission, According to the type of the parsing result decision request message of the specific field, and obtain the system domain name of service side;If described ask Ask message to obtain get request message, then the binary data in start recording get request message, after record, according to The system domain name of service side opens the local connection to service side, and get request message is sent to service by the connection Side, and in the response message for receiving service side, the binary data of recording responses message, and it is back to called side;If The request message is publication post request message, then opens the local connection to service side according to the system domain name of service side, Binary data in start recording post request message, and circulation reading is carried out to post request message, it is finished having recorded Data portion service side is successively sent to by the connection, and when receiving the response message of service side's return, note The binary data of response message is recorded, and circulation reading is carried out to response message, the data portion finished will have been recorded and successively sent out Give called side;
Processing unit carries out unserializing processing for the data to record, obtains code elements information;
Generation unit generates corresponding test code for the code elements information based on acquisition.
6. device as claimed in claim 5, which is characterized in that carry out unserializing processing to the data of record, obtain code When element information, the processing unit is specifically used for:
What it is by record includes that the binary data of request message and response message is converted to character string, and therefrom parses calling Side used calling interface and calling device when being called to service side;
Unserializing processing is carried out to the string data of acquisition, obtains the operable test object of java applet, and therefrom solve The call result for entering to join list and service side's return used when called side is called service side is precipitated;
By the calling interface of acquisition, call method, enter to join list and call result is determined as code elements information.
7. device as claimed in claim 6, which is characterized in that the code elements information based on acquisition generates corresponding test generation When code, the generation unit is specifically used for:
According to the calling interface that the called side of acquisition uses, calling interface title and calling interface used in code are tested in configuration Calling device title, calling device class used in code are tested in type, and the calling device used according to called side, configuration Type and call parameters;
The test object of the call result generation for entering to join list and service side's return used based on called side is solved respectively Analysis, acquisition enter join title, enter to join type, enter to join assignment and result parameter title, result parameter type, result parameter accordingly Assignment, and corresponding test code is generated according to information is obtained.
8. device as claimed in claim 7, which is characterized in that the generation unit is further used for:
Parameter is being carried out to the test object of the call result generation for entering to join list and service side's return used based on called side During parsing, if test object to be obtained is plain objects, directly it is called;If test object to be obtained is Complex object is then read the corresponding file of the complex object and saves address to obtain the preservation generated based on the complex object File, and be called again after the preservation file is converted to the complex object.
CN201410419779.0A 2014-08-22 2014-08-22 A kind of generation method and device of test data Active CN105446867B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201410419779.0A CN105446867B (en) 2014-08-22 2014-08-22 A kind of generation method and device of test data

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410419779.0A CN105446867B (en) 2014-08-22 2014-08-22 A kind of generation method and device of test data

Publications (2)

Publication Number Publication Date
CN105446867A CN105446867A (en) 2016-03-30
CN105446867B true CN105446867B (en) 2019-05-28

Family

ID=55557098

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410419779.0A Active CN105446867B (en) 2014-08-22 2014-08-22 A kind of generation method and device of test data

Country Status (1)

Country Link
CN (1) CN105446867B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106095688A (en) * 2016-06-23 2016-11-09 微梦创科网络科技(中国)有限公司 A kind of software performance testing method and device
CN107918737B (en) * 2016-10-10 2021-09-07 北京奇虎科技有限公司 Pressure test data transmission method, device and system
CN109460219B (en) * 2018-09-28 2021-09-03 西南电子技术研究所(中国电子科技集团公司第十研究所) Method for quickly serializing interface control file

Family Cites Families (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101193007A (en) * 2006-11-28 2008-06-04 国际商业机器公司 Testing method, scenario testing method and corresponding device for URL command
CN101651707B (en) * 2009-09-22 2012-05-23 西安交通大学 Method for automatically acquiring user behavior log of network
CN101771701B (en) * 2010-01-04 2012-12-26 北京航空航天大学 Web service client automation generation method and device
EP2820583A4 (en) * 2012-02-29 2015-11-25 Hewlett Packard Development Co Network service interface analysis
CN103312551B (en) * 2012-03-12 2016-02-17 腾讯科技(深圳)有限公司 The method of testing of CGI(Common gateway interface) and testing apparatus
CN103428019A (en) * 2012-05-24 2013-12-04 中兴通讯股份有限公司 Network service message management method and system
CN102810069A (en) * 2012-07-16 2012-12-05 深圳市融创天下科技股份有限公司 JAVA object requesting and responding methods, devices and systems and terminal
CN103580937B (en) * 2012-07-24 2016-11-23 阿里巴巴集团控股有限公司 A kind of Web services the method and system thereof and service broker system simulated
CN103905258B (en) * 2012-12-24 2018-03-06 百度国际科技(深圳)有限公司 A kind of method of testing and device of client data upload function

Also Published As

Publication number Publication date
CN105446867A (en) 2016-03-30

Similar Documents

Publication Publication Date Title
CN105450476B (en) A kind of regression test system and test method
CN109726128A (en) A kind of method for generating test case, device and server
CN108664395B (en) Application program testing method, device, equipment and storage medium
CN103246606B (en) The performance test methods of ESB platform and system
CN113722020B (en) Interface calling method, device and computer readable storage medium
CN108228444B (en) Test method and device
CN112714047A (en) Industrial control protocol flow based test method, device, equipment and storage medium
CN104281520A (en) Tracking and debugging method, device and system
CN108459850B (en) Method, device and system for generating test script
CN106559289A (en) The concurrent testing method and device of SSLVPN gateways
CN105049280B (en) The interface Behavior modeling test macro and method of Business Management Platform
CN105446867B (en) A kind of generation method and device of test data
CN108664385A (en) A kind of test method and device of application programming interface
CN108347356A (en) A kind of multi-protocols unit test method, device, electronic equipment and storage medium
CN105701009B (en) Security application test method in mobile terminal
CN109299530A (en) A kind of emulation testing case generation method, system, storage medium and terminal
CN104598348B (en) A kind of method and system of the long-range external system interface performance of analysis in real time
CN113127108A (en) Service request processing method and device, storage medium and electronic equipment
CN103164324B (en) Microblog test method and device
CN104376056B (en) A kind of method and apparatus of data processing
CN106802865B (en) Response simulator and method for software test
CN103294482B (en) Web service method for packing and system for PWscf concurrent computational system
CN103309676B (en) Web service method for packing and system for marine numerical simulation ROMS
CN107908512A (en) The test method and test device of a kind of disk performance
CN110750446A (en) System testing method and related device

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20200923

Address after: Cayman Enterprise Centre, 27 Hospital Road, George Town, Grand Cayman Islands

Patentee after: Innovative advanced technology Co.,Ltd.

Address before: Cayman Enterprise Centre, 27 Hospital Road, George Town, Grand Cayman Islands

Patentee before: Advanced innovation technology Co.,Ltd.

Effective date of registration: 20200923

Address after: Cayman Enterprise Centre, 27 Hospital Road, George Town, Grand Cayman Islands

Patentee after: Advanced innovation technology Co.,Ltd.

Address before: Cayman Islands Grand Cayman capital building, a four storey No. 847 mailbox

Patentee before: Alibaba Group Holding Ltd.