[embodiment]
For making the object of the embodiment of the present invention, technical scheme and advantage clearly, below in conjunction with the accompanying drawing in the embodiment of the present invention, technical scheme in the embodiment of the present invention is clearly and completely described, obviously, described embodiment is the present invention's part embodiment, instead of whole embodiments.Based on the embodiment in the present invention, those of ordinary skill in the art, not making the every other embodiment obtained under creative work prerequisite, belong to the scope of protection of the invention.
The schematic flow sheet of the test data generating method that Fig. 1 provides for one embodiment of the invention.As shown in Figure 1, the method comprises:
101, generate call request according to testing requirement, this call request provides the service end of data supporting to application program to be measured for calling, this call request comprises type of service to be measured.
102, call service end according to call request, generate to make service end the test data matched with above-mentioned type of service and test data is stored in database, use for the above-mentioned application program to be measured of test.
In the present embodiment, will the application program of carrying out testing be needed to be designated as application program to be measured, this application program can carry out miscellaneous service, by needing the business of test to be designated as business to be measured, the type of business to be measured is designated as type of service to be measured.Such as, type of service to be measured can be domestic consumer's login, Modify password, trade company create signing etc.
In actual applications, the normal operation of above-mentioned application program to be measured needs to rely on some data, and these data are normally provided by other application program.Other application program of data can be provided to be called service by for above-mentioned application program to be measured, such as, can be ws service, the one end at this service place is designated as service end.
Concrete, when needs are tested above-mentioned application program to be measured, Test data generation equipment generates according to testing requirement and calls as above-mentioned application program to be measured provides the call request of the service end of data supporting, and this call request comprises type of service to be measured.Afterwards, call request is sent to service end by Test data generation equipment, generating the test data that matches with above-mentioned type of service to be measured and being stored in database by test data, using for the above-mentioned application program to be measured of test by calling service end.
Database in the present embodiment can be but be not limited to: oracle, mysql etc.
In the present embodiment, Test data generation equipment is no longer based on the mutual generation test data of SQL statement and database, just do not need the change along with business or data structure and adjust SQL statement yet, but generate test data by calling service end by service end, because service end provides data supporting to application program to be measured, so can upgrade along with the change of business or data structure, the test data adapted with business or data structure can be generated, therefore, the efficiency that the present embodiment generates test data is higher, and cost is lower.
Further, owing to generating test data be stored in database by test data by service end, therefore, Test data generation equipment does not need to pay close attention to bottom and stores, and directly completes by service end the conversion that test data stores to bottom.In addition, if it is master/slave data storehouse or other split databases that bottom stores what adopt, then service end also can automatically identify the concrete memory location (i.e. test data land) of test data.Moreover service end can also to process such as test data are encrypted, and Test data generation equipment does not need to be concerned about yet, is transparent concerning Test data generation equipment, and the automaticity generating test data is higher.
Illustrate at this, Test data generation equipment can obtain above-mentioned testing requirement in advance.Such as, testing requirement can be supplied to Test data generation equipment by various mode by user or tester in advance.In a kind of concrete implementation, Test data generation equipment can provide visualization interface to user or tester, for supplying user or tester's input test demand.Such as, Test data generation equipment can provide multiple options of various test parameter in testing requirement on visualization interface, selects for user or tester.Again such as, Test data generation equipment can provide input frame on visualization interface, for the test parameter in user or tester's input test demand.
In an Alternate embodiments, testing requirement comprises above-mentioned type of service to be measured.Above-mentioned type of service to be measured can be supplied to Test data generation equipment by user or tester by visualization interface.
In an Alternate embodiments, user may have special requirement to test data, and the test data directly generated by service end possibly cannot meet the specific demand of user, so need after service end generates test data, customization is carried out to test data, to meet the specific demand of user.Several mode of test data being carried out to customization is provided below:
The mode of the first customization: comprise the first customization indication information in above-mentioned call request, this first customization indication information is used to indicate service end and carries out customization to test data.Concrete, Test data generation equipment obtains the first customization indication information in advance, customizes indication information send to service end together with type of service to be measured by call request by first.After service end receives call request, generate the test data matched with type of service to be measured, customize indication information according to first afterwards and customization is carried out to the test data generated.
The mode of the second customization: after Test data generation equipment calls service end according to call request, sends first to service end and customizes indication information, carry out customization to indicate service end to test data.Concrete, Test data generation equipment obtains the first customization indication information in advance, customizes indication information send to service end by first.After service end receives the first customization indication information, customization is carried out to the test data generated.
Illustrate at this, testing requirement can comprise the first customization indication information.Then the first customization indication information can be supplied to Test data generation equipment by user or tester by visualization interface.
What deserves to be explained is, the mode of the first customization above-mentioned is distinguished with the mode of the second customization and is: the mode sending the first customization indication information to service end is different.
In the mode of above-mentioned two kinds of customization, first customization indication information only can be used to indicate service end and carry out customization to test data, the type of concrete customization can be set in advance in service end, after such service end receives the first customization indication information, according to the type of the customization preset, customization is carried out to test data.
In the mode of above-mentioned two kinds of customization, first customizes indication information can comprise: customization type and customization parameter, first customizes indication information carries out except customization except instruction service end to test data, also can tell that service end is carried out what kind of customization (i.e. the type of customization) to test data and carries out the parameter (i.e. customization parameter) needed for customization.Based on this, service end to the process that test data carries out customization is: service end carries out customization according to customization type and customization parameter to test data.Concrete, service end uses customization parameter, carries out the customization required by customization type to test data.
The mode of the third customization: after calling service end according to call request, Test data generation equipment customizes indication information and type of service according to second, structure carries out the database statement needed for customization to test data, the database statement constructed is used to operate database, to realize the customization to test data.Concrete, Test data generation equipment obtains the second customization indication information in advance, know and need to carry out customization to test data, so after calling service end according to call request, constructs database statement, utilize database statement to operate database, realize the customization to test data.
Illustrate at this, testing requirement can comprise the second customization indication information.Then the second customization indication information can be supplied to Test data generation equipment by user or tester by visualization interface.
Wherein, the second customization indication information can comprise customization type and customization parameter.Then above-mentioned according to the second customization indication information and type of service, structure comprises the database statement that test data is carried out needed for customization: according to above-mentioned type of service, determine test data memory location in a database, according to customization type, determine the type of test data being carried out to the database statement needed for customization, by above-mentioned customization parameter and test data memory location in a database, as the parameter of this database statement, obtain described database statement.Illustrate at this, the data that dissimilar business relies on are different, and such as domestic consumer logs in and the signing data used of trade company's establishment are different.Determine type of service, mean the data determining this business and use.The data storage location that different service types is corresponding is different.In Test data generation equipment, prestore the corresponding relation of type of service and memory location.Based on this, Test data generation equipment is specifically searched in the corresponding relation stored according to above-mentioned type of service, determines the test data memory location in a database that this type of service is corresponding.
Which is equivalent to provide the interface directly operated database, the service of calling and database manipulation can be combined, meet the customization requirement of user to test data.
In conjunction with the mode of above-mentioned three kinds of customization, below concrete customization is illustrated.
Customization type is limited to current type of service.Illustrate, customization can be the accession number un-activation that customizes of personal user and senior auth type, and wherein accession number un-activation can by calling service end to realize, and senior auth type can be realized by customization SQL; Customization parameter can be accession number whether activation parameter, senior auth type parameter.The process of this customization is as follows: Test data generation equipment receives and customizes parameter, first confirms in this customization parameter, which part can realize by calling service end, and which part needs constructs database statement to realize; Afterwards, build according to current type of service and the accession number un-activation parameter imported into the call request customized, use call request to call service end, generate the unactivated regular account of accession number by service end; Such as, and according to senior auth type parameter, construct a corresponding database statement, SQL statement (update**set**=*) goes database to perform, and so far whole customization process completes.
Based on embodiment illustrated in fig. 1, in the embodiment depicted in figure 2, also comprise after step 102:
103, the test data that service end returns is received.
104, show test data, and/or output test data with document form.
After generation test data, test data returns by service end, Test data generation equipment or display test data, or outputs test data with document form, facilitates user to check or understands test data.In addition, test data can also be stored in this locality by Test data generation equipment.
What deserves to be explained is, Test data generation equipment can arrange the displaying form of test data.
According to the difference of testing requirement, sometimes generate one or a small amount of test data, generate a large amount of test data sometimes.For the mode of Test data generation equipment display test data, compare the situation being applicable to generation one or a small amount of test data.For the mode that Test data generation equipment outputs test data with document form, compare the scene being applicable to test data batch generation.
What deserves to be explained is, for needing the scene generating a large amount of test data, above-mentioned testing requirement can also comprise test data quantity.Then Test data generation equipment according to test data quantity, can generate multiple call request, by repeatedly calling service end, obtains a described test data quantity test data.The number of call request is identical with test data quantity.
It should be noted that, for aforesaid each embodiment of the method, in order to simple description, therefore it is all expressed as a series of combination of actions, but those skilled in the art should know, the present invention is not by the restriction of described sequence of movement, because according to the present invention, some step can adopt other orders or carry out simultaneously.Secondly, those skilled in the art also should know, the embodiment described in instructions all belongs to preferred embodiment, and involved action and module might not be that the present invention is necessary.
In the above-described embodiments, the description of each embodiment is all emphasized particularly on different fields, in certain embodiment, there is no the part described in detail, can see the associated description of other embodiments.
The structural representation of the Test data generation equipment that Fig. 3 provides for one embodiment of the invention.As shown in Figure 3, this equipment comprises: generation module 31 and calling module 32.
Generation module 31, for generating call request according to testing requirement, this call request provides the service end of data supporting to application program to be measured for calling, this call request comprises type of service to be measured.
Calling module 32, be connected with generation module 31, call request for generating according to generation module 31 calls above-mentioned service end, generates the test data matched with above-mentioned type of service and be stored in database to make service end, uses for the above-mentioned application program to be measured of test.
In an Alternate embodiments, the Test data generation equipment of the present embodiment can also carry out customization to test data.
In a kind of mode, above-mentioned call request also comprises: first customizes indication information.This first customization indication information is used to indicate above-mentioned service end and carries out customization to test data.
In a further mode of operation, as shown in Figure 4, this equipment can also comprise: sending module 33.Sending module 33, after calling service end at calling module 32 according to call request, sends first to service end and customizes indication information, carry out customization to indicate service end to test data.
Optionally, first customizes indication information can comprise customization type and customization parameter, carries out customization to indicate service end according to customization type and customization parameter to test data.
In an Alternate embodiments, as shown in Figure 4, this equipment can also comprise: constructing module 34 and operational module 35.
Constructing module 34, for according to the second customization indication information and above-mentioned type of service, constructs database statement test data being carried out to customization.
Operational module 35, is connected with constructing module 34, and the database statement constructed for using constructing module 34 operates above-mentioned database, to realize the customization to test data.
Further, the second customization indication information can comprise: customization type and customization parameter.Based on this, constructing module 34 specifically can be used for according to above-mentioned type of service, determine test data memory location in a database, according to above-mentioned customization type, determine the type of database statement, by customization parameter and test data memory location in the database, as the parameter of database statement.
Optionally, the equipment of the present embodiment can also comprise: receiver module.Receiver module, for receiving the test data that service end returns.
Further, the equipment of the present embodiment can also comprise: display module and/or output module.Display module, for showing the test data that receiver module receives.Output module, for exporting the test data that receiver module receives with document form.
Each functional module of the Test data generation equipment that the present embodiment provides can be used for the flow process performing embodiment of the method shown in Fig. 1 or Fig. 2, and its specific works principle repeats no more, and refers to the description of embodiment of the method.
The Test data generation equipment that the present embodiment provides, no longer based on the mutual generation test data of SQL statement and database, just do not need the change along with business or data structure and adjust SQL statement yet, but generate test data by calling service end by service end, because service end provides data supporting to application program to be measured, so can upgrade along with the change of business or data structure, the test data adapted with business or data structure can be generated, therefore, the efficiency that the present embodiment generates test data is higher, and cost is lower.
Illustrate at this, the Test data generation equipment that the embodiment of the present invention provides, except adopting said structure and realizing, can also adopt other structures to realize, but the function realized does not change.Such as, from the angle of software architecture, Test data generation equipment can also adopt structure shown in Fig. 5.In Fig. 5, solid line left part belongs to Test data generation equipment, belongs to service end on the right side of solid line.This Test data generation equipment comprises: page adaptation (Pageadapter), Access Control (AcessControl), customization (Customizedprocessing), file management (Filemanager), model (model), CSS, aid (AssistantTools), DB operation (DBoperator), Jar call (Jarcaller), WS calls (WScaller) and DB.Wherein, DB operation is used for operating database, such as, generate SQL statement and go database to perform; Jar calls and calls user respectively with WS and generate corresponding call request, goes to call service end; Customization is for realizing the customization of test data; Page is adaptive is used for filtering model, arranges display format and shows data; File management for exporting relevant data, such as test data; DB for storing relevant data, such as test data.
Those skilled in the art can be well understood to, and for convenience and simplicity of description, the system of foregoing description, the specific works process of device and unit, with reference to the corresponding process in preceding method embodiment, can not repeat them here.
In several embodiment provided by the present invention, should be understood that, disclosed system, apparatus and method, can realize by another way.Such as, device embodiment described above is only schematic, such as, the division of described unit, be only a kind of logic function to divide, actual can have other dividing mode when realizing, such as multiple unit or assembly can in conjunction with or another system can be integrated into, or some features can be ignored, or do not perform.Another point, shown or discussed coupling each other or direct-coupling or communication connection can be by some interfaces, and the indirect coupling of device or unit or communication connection can be electrical, machinery or other form.
The described unit illustrated as separating component or can may not be and physically separates, and the parts as unit display can be or may not be physical location, namely can be positioned at a place, or also can be distributed in multiple network element.Some or all of unit wherein can be selected according to the actual needs to realize the object of the present embodiment scheme.
In addition, each functional unit in each embodiment of the present invention can be integrated in a processing unit, also can be that the independent physics of unit exists, also can two or more unit in a unit integrated.Above-mentioned integrated unit both can adopt the form of hardware to realize, and the form that hardware also can be adopted to add SFU software functional unit realizes.
The above-mentioned integrated unit realized with the form of SFU software functional unit, can be stored in a computer read/write memory medium.Above-mentioned SFU software functional unit is stored in a storage medium, comprising some instructions in order to make a computer equipment (can be personal computer, server, or the network equipment etc.) or processor (processor) perform the part steps of method described in each embodiment of the present invention.And aforesaid storage medium comprises: USB flash disk, portable hard drive, ROM (read-only memory) (Read-OnlyMemory, ROM), random access memory (RandomAccessMemory, RAM), magnetic disc or CD etc. various can be program code stored medium.
Last it is noted that above embodiment is only in order to illustrate technical scheme of the present invention, be not intended to limit; Although with reference to previous embodiment to invention has been detailed description, those of ordinary skill in the art is to be understood that: it still can be modified to the technical scheme described in foregoing embodiments, or carries out equivalent replacement to wherein portion of techniques feature; And these amendments or replacement, do not make the essence of appropriate technical solution depart from the spirit and scope of various embodiments of the present invention technical scheme.