CN110221967A - Test data building method, device, computer equipment and storage medium - Google Patents

Test data building method, device, computer equipment and storage medium Download PDF

Info

Publication number
CN110221967A
CN110221967A CN201910418801.2A CN201910418801A CN110221967A CN 110221967 A CN110221967 A CN 110221967A CN 201910418801 A CN201910418801 A CN 201910418801A CN 110221967 A CN110221967 A CN 110221967A
Authority
CN
China
Prior art keywords
data
database
testing
test
sql
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201910418801.2A
Other languages
Chinese (zh)
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.)
OneConnect Smart Technology Co Ltd
Original Assignee
OneConnect Smart Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by OneConnect Smart Technology Co Ltd filed Critical OneConnect Smart Technology Co Ltd
Priority to CN201910418801.2A priority Critical patent/CN110221967A/en
Publication of CN110221967A publication Critical patent/CN110221967A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3684Test management for test design, e.g. generating new test cases
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/25Integrating or interfacing systems involving database management systems
    • G06F16/252Integrating or interfacing systems involving database management systems between a Database Management System and a front-end application

Abstract

This application involves a kind of test data building method, device, computer equipment and storage mediums.The described method includes: data configuration tool is called to obtain data configuration file;The data configuration file is configured with testing data;Script is inserted into according to the data that data configuration file generation includes SQL insertion sentence by the data configuration tool by the data configuration tool;The SQL insertion sentence is used to testing data being inserted into database;The data insertion script is executed, when the testing data belongs to constant type data, the specified testing data of SQL insertion sentence is inserted into database as test data.Use this method can Fast Construction go out test data to improve testing efficiency.

Description

Test data building method, device, computer equipment and storage medium
Technical field
This application involves the field of test technology, more particularly to a kind of test data building method, device, computer equipment And storage medium.
Background technique
The software systems developed for one, will do it corresponding test, when every technology refers to before being applied Mark carries out actual application when reaching requirement.During carrying out automatic test or performance test to software systems, need to use Every test assignment could be completed to a large amount of test data, therefore the production of test data becomes an important and necessary ring Section.
In traditional test, test data is mainly constructed using manual manipulation mode, for example, if test transaction system exists Influence after upgrading, when using manual manipulation mode, tester carries out lower single operation next life in the product page of transaction system At test data.However, constructing test data using manual manipulation mode, time-consuming and is easy by such environmental effects, thus Influence testing efficiency.
Summary of the invention
Based on this, it is necessary in view of the above technical problems, provide one kind can Fast Construction go out test data with improve survey Try test data building method, device, computer equipment and the storage medium of efficiency.
A kind of test data building method, which comprises
The file acquisition instruction that reception is triggered in the configuration page of data configuration tool;
Data configuration file corresponding with file acquisition instruction is obtained, and is input to the data configuration tool;Institute It states in data configuration file configured with field name and testing data;
It is inserted by the data configuration tool according to the data that data configuration file generation includes SQL insertion sentence Enter script;
Running each SQL insertion sentence in the data insertion script will when the testing data belongs to constant type data The specified testing data of the SQL insertion sentence is inserted into database as test data.
In one of the embodiments, the method also includes:
The database selection instruction that detection is triggered in the configuration page of data configuration tool;
It is chosen from candidate data library provided by the data configuration tool corresponding with the database selection instruction Database and the corresponding version of the database;
Obtain corresponding with database connection script, the operation connection script to connect the database, so as to The testing data is inserted into connected database as test data.
In one of the embodiments, the method also includes:
Judge the data type that the testing data is belonged to;
When the testing data belongs to function type data, corresponding function is called according to the testing data;
Target data is obtained according to the function called, the target data is determined as test data;
SQL in script, which is inserted into, by the data is inserted into sentence for the test data insertion database.
Described generated by the data configuration tool according to the data configuration file is wrapped in one of the embodiments, Data containing SQL insertion sentence are inserted into script and include:
The field name in the data configuration file is read by the data configuration tool;
When read field name is not null value, corresponding testing data is obtained according to read field name;
It is not null value verifying read testing data, includes SQL insertion according to the generation of read testing data The data of sentence are inserted into script.
Table structure information is also configured in the data configuration file in one of the embodiments,;It is described by the SQL The specified testing data of insertion sentence is inserted into database as test data and includes:
Judge whether the table structure information in the configuration file is null information;
It, will be in the specified data configuration file of SQL insertion sentence if table structure information is null information Each test data as test data be inserted into database;
If table structure information is not null information, corresponding testing data is read according to field name, passes through the SQL It is inserted into sentence and is inserted into database for the testing data of reading as test data.
The testing data that SQL insertion sentence is specified is as test number in one of the embodiments, Include: according to insertion database
Receive the data configuration instruction triggered in the configuration page;
It is instructed in response to the data configuration, checks whether the required item in the configuration page inputs and meet preset condition Information;
When required item input meets the information of preset condition, SQL insertion sentence is specified described to be measured Data are inserted into database as test data, and export the prompt information whether expression data are successively inserted into database.
The test data includes order request data in one of the embodiments,;It is described further include:
Call the payment interface of transaction system;
Payment processing is carried out to the order request data according to described pair of interface and obtains order data;
The handling duration that the order request data are carried out with payment processing is recorded, to determine institute according to the handling duration State the payment performance of transaction system;And
The order data and default order data are compared;
Test report is generated according to resulting result is compared, to determine the branch of the transaction system according to the test report Pay whether function exception occurs.
A kind of test data constructing apparatus, described device include:
File acquisition module, for calling data configuration tool to obtain data configuration file;The data configuration file is matched It is equipped with testing data;
Script generation module is used for through the data configuration tool through the data configuration tool according to the data Configuration file generation includes the data insertion script of SQL insertion sentence;The SQL insertion sentence is for testing data to be inserted into Database;
Data insertion module, for executing the data insertion script, to belong to constant type data in the testing data When, the specified testing data of SQL insertion sentence is inserted into database as test data.
Described device in one of the embodiments, further include: database connection module;Wherein:
Database connection module, the database selection that the configuration page for detecting in data configuration tool is triggered refer to It enables;Database corresponding with the database selection instruction is chosen from candidate data library provided by the data configuration tool Version corresponding with the database;Connection script corresponding with the database is obtained, runs the connection script to connect The database, so that the testing data is inserted into connected database as test data.
The Data insertion module is also used in one of the embodiments:
Judge the data type that the testing data is belonged to;When the testing data belongs to function type data, according to The testing data calls corresponding function;Target data is obtained according to the function called, the target data is determined as Test data;SQL in script, which is inserted into, by the data is inserted into sentence for the test data insertion database.
The script generation module is also used in one of the embodiments:
The field name in the data configuration file is read by the data configuration tool;When read field name not When for null value, corresponding testing data is obtained according to read field name;It is not null value verifying read testing data, Script is inserted into according to the data that the generation of read testing data includes SQL insertion sentence.
Table structure information is also configured in the data configuration file in one of the embodiments,;The data insertion Module is also used to:
Judge whether the table structure information in the configuration file is null information;If table structure information is null information When, then using each test data in the specified data configuration file of SQL insertion sentence as test data insert number According to library;If table structure information is not null information, corresponding testing data is read according to field name, is inserted by the SQL Enter sentence and is inserted into database for the testing data of reading as test data.
The Data insertion module is also used in one of the embodiments:
Receive the data configuration instruction triggered in the configuration page;It is instructed in response to the data configuration, checks institute Whether the required item stated in the configuration page inputs the information for meeting preset condition;When required item input meets preset condition When information, the specified testing data of SQL insertion sentence is inserted into database as test data, and export expression number According to whether being successively inserted into the prompt information of database.
The test data includes order request data in one of the embodiments,;Described device further include: test mould Block;Wherein:
Test module, for calling the payment interface of transaction system;According to described pair of interface to the order request data It carries out payment processing and obtains order data;The handling duration that the order request data are carried out with payment processing is recorded, with basis The handling duration determines the payment performance of the transaction system;And the order data and default order data are carried out Comparison;Test report is generated according to resulting result is compared, to determine the payment of the transaction system according to the test report Whether function there is exception.
A kind of computer equipment, including memory and processor, the memory are stored with computer program, the processing Device performs the steps of when executing the computer program
The file acquisition instruction that reception is triggered in the configuration page of data configuration tool;
Data configuration file corresponding with file acquisition instruction is obtained, and is input to the data configuration tool;Institute It states in data configuration file configured with field name and testing data;
It is inserted by the data configuration tool according to the data that data configuration file generation includes SQL insertion sentence Enter script;
Running each SQL insertion sentence in the data insertion script will when the testing data belongs to constant type data The specified testing data of the SQL insertion sentence is inserted into database as test data.
A kind of computer readable storage medium, is stored thereon with computer program, and the computer program is held by processor It is performed the steps of when row
The file acquisition instruction that reception is triggered in the configuration page of data configuration tool;
Data configuration file corresponding with file acquisition instruction is obtained, and is input to the data configuration tool;Institute It states in data configuration file configured with field name and testing data;
It is inserted by the data configuration tool according to the data that data configuration file generation includes SQL insertion sentence Enter script;
Running each SQL insertion sentence in the data insertion script will when the testing data belongs to constant type data The specified testing data of the SQL insertion sentence is inserted into database as test data.
Above-mentioned test data building method, device, computer equipment and storage medium, pass through matching in data configuration tool Page input data configuration file is set, the testing data in data configuration file can be rapidly got.According to data configuration File come generate include SQL insertion sentence data be inserted into script, by run the data be inserted into script, by data configuration text Testing data in part can be quick since testing data is configured in advance as test data insertion database Test data is got, testing efficiency is effectively improved.Moreover, because data insertion script is raw according to data configuration file At even if system upgrade transformation or interface upgrade transformation, rewrite script without tester, further improve test Efficiency.
Detailed description of the invention
Fig. 1 is the application scenario diagram of test data building method in one embodiment;
Fig. 2 is the flow diagram of test data building method in one embodiment;
Fig. 3 is the process for being determined as the testing data step of insertion database in one embodiment according to table structure information Schematic diagram;
Fig. 4 is the structural block diagram of test data constructing apparatus in one embodiment;
Fig. 5 is the structural block diagram of test data constructing apparatus in another embodiment;
Fig. 6 is the internal structure chart of computer equipment in one embodiment.
Specific embodiment
It is with reference to the accompanying drawings and embodiments, right in order to which the objects, technical solutions and advantages of the application are more clearly understood The application is further elaborated.It should be appreciated that specific embodiment described herein is only used to explain the application, not For limiting the application.
Test data building method provided by the present application, can be applied in application environment as shown in Figure 1.Wherein, eventually End 102 is communicated with server 104 by network.Server 104 receives the file acquisition instruction that terminal 102 is sent;It calls Data configuration tool obtains data configuration file;Data configuration file is configured with testing data;Passed through by data configuration tool Data configuration tool is inserted into script according to the data that data configuration file generation includes SQL insertion sentence;SQL is inserted into sentence and uses In testing data is inserted into database;It executes data and is inserted into script, when testing data belongs to constant type data, SQL to be inserted Enter the specified testing data of sentence as test data and is inserted into database.In addition, test data building method also can be applied to Terminal 102.Wherein, terminal 102 can be, but not limited to be various personal computers, laptop, smart phone, tablet computer With portable wearable device, server 104 can use the server set of the either multiple server compositions of independent server Group realizes.
In one embodiment, as shown in Fig. 2, providing a kind of test data building method, it is applied to Fig. 1 in this way In server for be illustrated, comprising the following steps:
S202 calls data configuration tool to obtain data configuration file;Data configuration file is configured with testing data.
Wherein, in data configuration file be configured with field name and testing data, can be obtained by field name it is corresponding to Measured data.Data configuration file can be the file of form, be also possible to XML (Extensible Markup Language, extensible markup language) format or JSON (JavaScript Object Notation, JS object numbered musical notation) format File.In subsequent embodiment, it is illustrated for data configuration file in a tabular form.Field name may include to be measured The title and user field name of data can find the testing data of corresponding types by field name and corresponding user mark Know.Testing data includes constant type data and function type data.Constant type data, which can be, is directly used as test data insert number According to library.Function type data can be the data of representative function title or function keyword, can be searched according to the function type data To corresponding function, corresponding target data is returned by the function, is inserted into data for the target data as test data In library.
Data configuration tool can be associated for constructing the data configuration system of test data, the number with test macro It can be called by server according to Construct Tool to carry out the construction of test data.Corresponding, terminal can be with display data structure The configuration page for making work can configure database, the corresponding number for needing to connect in the configuration page of data configuration tool According to library version, link address, port numbers, username and password etc., in addition, data configuration can also be uploaded in the configuration page File is to server.
In one embodiment, server is received is instructed by the file acquisition that terminal is sent, and then calls data configuration work Tool obtains data configuration file.
In one embodiment, before being tested, the configuration page of terminal display data configuration tool, and examine in real time It surveys user and initiates file acquisition operation on the configuration page of data configuration tool, when detecting file acquisition operation, generate The file acquisition instruction of generation is sent to server by corresponding file acquisition instruction.As receiving end, server receiving terminal The file acquisition of transmission instructs, and then calling data configuration tool, being referred to will pass through the Construct Tool of calling according to file acquisition It enables and obtains data configuration file.
In one embodiment, server preserves multiple data configuration files.Server file acquisition based on the received Instruction determines that task to be measured, the task to be measured are test assignment (such as transaction message of test transaction system or friendship of system under test (SUT) Performance etc. after easy system upgrade), server chooses corresponding data configuration file according to the task to be measured.
In another embodiment, task to be measured is carried in file acquisition instruction, server is mentioned from file acquisition instruction Task to be measured is taken, corresponding data configuration file is chosen according to the task to be measured.
S204, being generated by data configuration tool according to data configuration file by data configuration tool includes that SQL is inserted Enter the data insertion script of sentence;SQL insertion sentence is used to testing data being inserted into database.
Wherein, data insertion script can be it is a kind of include SQL insertion sentence computer program, by running the number According to insertion script, when operation data is inserted into script, each SQL insertion sentence is performed, can be according to performed SQL parenthesis Sentence is by corresponding testing data insertion operation.
In one embodiment, server reads the field name in data configuration file by data configuration tool;Work as institute When the field name of reading is not null value, corresponding testing data is obtained according to read field name;Verify it is read to Measured data is not null value, is inserted into script according to the data that the generation of read testing data includes SQL insertion sentence.
In one embodiment, server determines testing data sample, according to testing data sample setting data configuration text Furthermore the filename and field name of part also set up the table structure information of data configuration file.Server is from pre-set candidate The testing data of target is obtained in testing data, and by testing data logging data configuration file, is obtained with filename, word The data configuration file of section name, table structure information and corresponding testing data;Alternatively, available have filename, field name With the data configuration file of corresponding testing data.
In one embodiment, server carries out filename, field name, table structure information and corresponding testing data Encapsulation joins filename, field name, table structure information and corresponding testing data these fields in the code of encapsulation Numberization.When calling packaged code, server is read in data configuration file according to the field name in data configuration file Testing data and verified, verification generated after passing through according to the testing data that reads include SQL insertion sentence number According to insertion script.For example, to excel configuration file configuration table name, field name, table structure information and corresponding number to be measured It, can table name, field name, table structure to excel configuration file according to, user in configuration page uploading excel configuration file Information and corresponding testing data are read out and verify.
S206 executes data and is inserted into script, when testing data belongs to constant type data, SQL insertion sentence to be specified Testing data as test data be inserted into database.
Wherein, above-mentioned database can be relevant database, such as Oracle, MySQL, Postgre database.
In one embodiment, constant configuration mode and two kinds of variable configuration mode are supported in the configuration of testing data.When adopting When with constant configuration mode, then testing data is constant type data, and for S208, server can be directly from data configuration file Then middle reading testing data is inserted the testing data of reading by executing each SQL insertion sentence that the data are inserted into script Enter database.When configuration mode is variable configuration mode, then testing data is function type data, and for S208, server can To read testing data from data configuration file, corresponding function is then searched according to testing data, then calls function meter Calculation is specifically worth, and will calculate resulting value insertion database by executing each SQL insertion sentence that data are inserted into script, Value after insertion database is determined as test data, to realize the building of test data.When testing, directly from Test data is obtained in database.
For example, " aa ", " 111 " and " 112 " is directly substituted into if configuration mode is constant " aa ", " 111 " and " 112 " " Insert into tablename (column 1, column 2, column 3 ...) values (value 1, value 2, value 3 ...) " this SQL is inserted into sentence In " value 1 ", " value 2 " and " value 3 ".If configuration mode is variable configuration mode (i.e. configuration function type data $ { aaa (3) }), need Aaa (n) function is finished writing in advance.Function name (i.e. aaa (n)) is configured by testing data value in configuration file, according to function Name searches corresponding function, then calls the function to calculate and returns to specific value, the value of return is passed to " Insert by disease " value 1 ", " value 2 " and " value 3 " etc. in tablename (column 1, column 2, column 3 ...) values (value 1, value 2, value 3 ...) " sentence.Such as Corresponding function can not be found according to the variable of configuration file, then prompting user, " the parsing failure of XX function, please check for The function ".
In one embodiment, server detection refers in the database selection that the configuration page of data configuration tool is triggered It enables;Database corresponding with database selection instruction and database are chosen from candidate data library provided by data configuration tool Corresponding version;Obtain corresponding with database connection script, operation connects script to connect database, so as to by testing data Connected database is inserted into as test data.
In one embodiment, server judges the data type that testing data is belonged to;When testing data belongs to function When type data, corresponding function is called according to testing data;Target data is obtained according to the function called, target data is true It is set to test data;Sentence is inserted by SQL in data insertion script, and test data is inserted into database.
In one embodiment, after constructing test data in data configuration tool, test macro can use the survey Examination data are tested.
In one embodiment, test data can be single request data;After S208, this method can also include: to adjust With the payment interface of transaction system;Payment processing acquisition order data is carried out to order request data according to interface is paid;Record pair Order request data carry out the handling duration of payment processing, to determine the payment performance of transaction system according to handling duration;And Order data and default order data are compared;Test report is generated according to resulting result is compared, to report according to test It accuses and determines whether the payment function of transaction system exception occurs.
As an example, it such as the function of test transaction system payment module, skips user and places an order operation, it directly will packet Order table input data Construct Tool containing testing data, for constructing test data to test payment function, without passing through The page or interface creation user and corresponding order.Database Oracle, version number 11g are selected in the configuration page, inputs number According to the username and password that the IP and port numbers and connection of library server are used, it is directed respectively into excel configuration file, click is matched The generation button on the page is set, backstage is called, is asked transaction by executing each SQL insertion sentence that SQL is inserted into sentence script Insertion database is sought, test data is so just constructed, corresponding user and order data are generated according to configuration.In test wrapper Border is logged in using the user, and the order is selected to carry out payment test, to skip the influence of previous step, greatly improves test effect Rate.It should be noted that the order data be test data Construct Tool analog subscriber place an order and the transaction request institute that generates It is formed, the reasonability and validity of data depend on the data configuration of user.
In one embodiment, server receives the data configuration instruction triggered in the configuration page;In response to data structure Instruction is made, checks whether the required item in the configuration page inputs the information for meeting preset condition;When required item input meet it is default When the information of condition, the specified testing data of SQL insertion sentence is inserted into database as test data, and export expression data Whether the prompt information of database is successively inserted into.
For example, when user clicks on configuring the page and generates button, the required information of the server inspection configuration page is It is no that whether data configuration file imports and successfully resolved for sky, if required information is complete and data configuration file successfully resolved, Call the construction instruction of backstage code trigger data.Server responds data configuration instruction, and operation data is inserted into each in script SQL is inserted into sentence, and the testing data value read from data configuration file is inserted into database, is generated for whether indicating data It is successively inserted into the prompt information of database, and is sent to terminal and consults and/or modify for user.
As an example, user selects database and version on the configuration page, configures in the page and provides combobox, It shows that there are many databases and corresponding version in the combobox to select for user, and database is essential option, cannot be sky.Choosing Different configuration field informations is shown after having selected corresponding database and version.Such as link address, port numbers, user name and close Code, these configuration informations are that must fill out, and cannot be sky.
It, can be rapidly by the configuration page input data configuration file in data configuration tool in above-described embodiment Get the testing data in data configuration file.Generated according to data configuration file include SQL insertion sentence data It is inserted into script, script is inserted by running the data, using the testing data in data configuration file as test data insert number According to library, since testing data is configured in advance, test effect can be effectively improved with quick obtaining to test data Rate.Moreover, because data insertion script is generated according to data configuration file, even if system upgrade transformation or interface upgrade change It makes, rewrites script without tester, further improve testing efficiency.
In one embodiment, table structure information is also configured in data configuration file, as shown in figure 3, S208 specifically may be used To include:
S302 judges whether the table structure information in configuration file is null information.
In one embodiment, server carries out filename, field name, table structure information and corresponding testing data Encapsulation joins filename, field name, table structure information and corresponding testing data these fields in the code of encapsulation Numberization.Server judges the table structure information in data configuration file, judges table knot when calling packaged code No structure information is null information.
For example, using excel configuration file configuration table name, field name, table structure information and corresponding testing data Family in configuration page uploading excel configuration file, can table structure information to excel configuration file read and verification.
SQL is inserted into each in sentence specified data configuration file by S304 if table structure information is null information Test data is inserted into database as test data.
S306 reads corresponding testing data according to field name, passes through if table structure information is not null information SQL is inserted into sentence and is inserted into database for the testing data of reading as test data.
For example, data configuration file may include the following contents: the first behavior field name, the second behavior need to be inserted into data Table structure information, the third line and later each behavior testing data.Wherein, the field name of the first row can be used as non-empty verification, If it is empty, then configuration field name is prompted.The table structure information of second row is if it is empty, then it represents that inserts whole testing datas in table Enter database, i.e. insert into tablename values (value 1, value 2 ...);If not empty, then from data configuration file In corresponding column read field name, and then obtain corresponding testing data, i.e. insert into tablename (column 1, column 2, Column 3 ...) values (value 1, value 2, value 3 ...), the number that corresponding number generates corresponding number is recycled according to the line number of configuration data According to insertion script and execute.The third line and the later data of each row are testing data, if it is empty, then prompt input in data configuration The corresponding data of typing in file.
In above-described embodiment, by judging whether the table structure information in the configuration file is null information, when table knot When structure information is null information, data can be inserted into using each test data in the data configuration file as test data All testing datas rapidly can be inserted into database, big test is required for amount of test data, can effectively be mentioned by library High testing efficiency.When table structure information is not null information, corresponding testing data is read as test data and is inserted into data Library flexibly can provide test data as desired.
It should be understood that although each step in the flow chart of Fig. 1-2 is successively shown according to the instruction of arrow, These steps are not that the inevitable sequence according to arrow instruction successively executes.Unless expressly stating otherwise herein, these steps Execution there is no stringent sequences to limit, these steps can execute in other order.Moreover, at least one in Fig. 1-2 Part steps may include that perhaps these sub-steps of multiple stages or stage are not necessarily in synchronization to multiple sub-steps Completion is executed, but can be executed at different times, the execution sequence in these sub-steps or stage is also not necessarily successively It carries out, but can be at least part of the sub-step or stage of other steps or other steps in turn or alternately It executes.
In one embodiment, as shown in figure 4, providing a kind of test data constructing apparatus, comprising: file acquisition module 402, script generation module 404 and Data insertion module 406, in which:
File acquisition module 402, for calling data configuration tool to obtain data configuration file;Data configuration file configuration There is testing data;
Script generation module 404, for passing through data configuration tool according to data configuration file by data configuration tool Generation includes the data insertion script of SQL insertion sentence;SQL insertion sentence is used to testing data being inserted into database;
Data insertion module 406, for executing data insertion script, to incite somebody to action when testing data belongs to constant type data SQL is inserted into the specified testing data of sentence as test data and is inserted into database.
Device in one of the embodiments, further include: database connection module 408;Wherein:
Database connection module 408, the database selection that the configuration page for detecting in data configuration tool is triggered Instruction;Database corresponding with database selection instruction and data are chosen from candidate data library provided by data configuration tool The corresponding version in library;Obtain corresponding with database connection script, operation connects script to connect database, so as to by number to be measured According to being inserted into connected database as test data.
Data insertion module 406 is also used in one of the embodiments:
Judge the data type that testing data is belonged to;When testing data belongs to function type data, according to testing data Call corresponding function;Target data is obtained according to the function called, target data is determined as test data;Pass through data Test data is inserted into database by SQL insertion sentence in insertion script.
Script generation module 404 is also used in one of the embodiments:
The field name in data configuration file is read by data configuration tool;When read field name is not null value When, corresponding testing data is obtained according to read field name;It is not null value verifying read testing data, according to institute The testing data generation of reading includes the data insertion script of SQL insertion sentence.
Data insertion module 406 is also used in one of the embodiments:
Receive the data configuration instruction triggered in the configuration page;It instructs, is checked in the configuration page in response to data configuration Required item whether input the information for meeting preset condition;When required item input meets the information of preset condition, SQL is inserted into The specified testing data of sentence is inserted into database as test data, and exports whether expression data are successively inserted into mentioning for database Show information.
Test data includes order request data in one of the embodiments,;Device further include: test module 410;Its In:
Test module 410, for calling the payment interface of transaction system;Order request data are propped up according to interface is paid It pays processing and obtains order data;The handling duration that order request data are carried out with payment processing is recorded, with true according to handling duration Determine the payment performance of transaction system;And order data and default order data are compared;According to the resulting result of comparison Test report is generated, to determine whether the payment function of transaction system exception occurs according to test report.
It, can be rapidly by the configuration page input data configuration file in data configuration tool in above-described embodiment Get the testing data in data configuration file.Generated according to data configuration file include SQL insertion sentence data It is inserted into script, script is inserted by running the data, using the testing data in data configuration file as test data insert number According to library, since testing data is configured in advance, test effect can be effectively improved with quick obtaining to test data Rate.Moreover, because data insertion script is generated according to data configuration file, even if system upgrade transformation or interface upgrade change It makes, rewrites script without tester, further improve testing efficiency.
Table structure information is also configured in data configuration file in one of the embodiments,;Data insertion module 406 is also For:
Judge whether the table structure information in configuration file is null information;If table structure information is null information, Each test data that SQL is inserted into sentence specified data configuration file is inserted into database as test data;If table structure When information is not null information, then corresponding testing data is read according to field name, sentence is inserted into for the to be measured of reading by SQL Data are inserted into database as test data.
In above-described embodiment, by judging whether the table structure information in the configuration file is null information, when table knot When structure information is null information, data can be inserted into using each test data in the data configuration file as test data All testing datas rapidly can be inserted into database, big test is required for amount of test data, can effectively be mentioned by library High testing efficiency.When table structure information is not null information, corresponding testing data is read as test data and is inserted into data Library flexibly can provide test data as desired.
Specific about test data constructing apparatus limits the limit that may refer to above for test data building method It is fixed.Modules in above-mentioned test data constructing apparatus can be realized fully or partially through software, hardware and combinations thereof.On Stating each module can be embedded in the form of hardware or independently of in the processor in computer equipment, can also store in a software form In memory in computer equipment, the corresponding operation of the above modules is executed in order to which processor calls.
In one embodiment, a kind of computer equipment is provided, which can be server, internal junction Composition can be as shown in Figure 6.The computer equipment include by system bus connect processor, memory, network interface and Database.Wherein, the processor of the computer equipment is for providing calculating and control ability.The memory packet of the computer equipment Include non-volatile memory medium, built-in storage.The non-volatile memory medium is stored with operating system, computer program and data Library.The built-in storage provides environment for the operation of operating system and computer program in non-volatile memory medium.The calculating The database of machine equipment data such as configuration file for storing data.The network interface of the computer equipment is used for and external end End passes through network connection communication.To realize a kind of test data building method when the computer program is executed by processor.
It will be understood by those skilled in the art that structure shown in Fig. 6, only part relevant to application scheme is tied The block diagram of structure does not constitute the restriction for the computer equipment being applied thereon to application scheme, specific computer equipment It may include perhaps combining certain components or with different component layouts than more or fewer components as shown in the figure.
In one embodiment, a kind of computer equipment, including memory and processor are provided, which is stored with Computer program, which performs the steps of when executing computer program calls data configuration tool to obtain data configuration File;Data configuration file is configured with testing data;By data configuration tool by data configuration tool according to data configuration File generated includes the data insertion script of SQL insertion sentence;SQL insertion sentence is used to testing data being inserted into database; Execute data and be inserted into script, with when testing data belongs to constant type data, using the specified testing data of SQL insertion sentence as Test data is inserted into database.
In one embodiment, detection is also performed the steps of when processor executes computer program in data configuration work The database selection instruction that the configuration page of tool is triggered;It chooses and counts from candidate data library provided by data configuration tool According to the corresponding database of library selection instruction and the corresponding version of database;Connection script corresponding with database is obtained, operation connects Pin sheet is to connect database, so that testing data is inserted into connected database as test data.
In one embodiment, it is also performed the steps of when processor executes computer program and judges that testing data is returned The data type of category;When testing data belongs to function type data, corresponding function is called according to testing data;According to being called Function obtain target data, target data is determined as test data;SQL in script, which is inserted into, by data is inserted into sentence for survey Try insertion of data into data library.
In one embodiment, it also performs the steps of when processor executes computer program through data configuration tool Read the field name in data configuration file;When read field name is not null value, obtained according to read field name Corresponding testing data;It is not null value verifying read testing data, includes according to the generation of read testing data The data that SQL is inserted into sentence are inserted into script.
In one embodiment, table structure information is also configured in data configuration file;Processor executes computer program When also perform the steps of whether the table structure information judged in configuration file is null information;If table structure information is null value When information, then each test data that SQL is inserted into sentence specified data configuration file is inserted into database as test data; If table structure information is not null information, corresponding testing data is read according to field name, being inserted into sentence by SQL will read The testing data taken is inserted into database as test data.
In one embodiment, reception is also performed the steps of when processor executes computer program in configuration page institute The data configuration of triggering instructs;In response to data configuration instruct, check configuration the page in required item whether input meet it is default The information of condition;When required item input meets the information of preset condition, using the specified testing data of SQL insertion sentence as survey Insertion of data into data library is tried, and exports the prompt information whether expression data are successively inserted into database.
In one embodiment, test data includes order request data;Processor is also realized when executing computer program Following steps: the payment interface of transaction system is called;Payment processing acquisition order is carried out to order request data according to interface is paid Data;The handling duration that order request data are carried out with payment processing is recorded, to determine the branch of transaction system according to handling duration Pay performance;And order data and default order data are compared;Test report is generated according to resulting result is compared, To determine whether the payment function of transaction system exception occurs according to test report.
In one embodiment, a kind of computer readable storage medium is provided, computer program is stored thereon with, is calculated Machine program performs the steps of when being executed by processor calls data configuration tool to obtain data configuration file;Data configuration text Part is configured with testing data;Include according to data configuration file generation by data configuration tool by data configuration tool The data that SQL is inserted into sentence are inserted into script;SQL insertion sentence is used to testing data being inserted into database;It executes data and is inserted into foot This, with when testing data belongs to constant type data, the testing data that SQL insertion sentence is specified is as test data insert number According to library.
In one embodiment, detection is also performed the steps of when computer program is executed by processor in data configuration The database selection instruction that the configuration page of tool is triggered;From candidate data library provided by data configuration tool choose with The corresponding database of database selection instruction and the corresponding version of database;Obtain connection script corresponding with database, operation Script is connected to connect database, so that testing data is inserted into connected database as test data.
In one embodiment, it is also performed the steps of when computer program is executed by processor and judges testing data institute The data type of ownership;When testing data belongs to function type data, corresponding function is called according to testing data;According to being adjusted Function obtains target data, and target data is determined as test data;Being inserted into sentence by SQL in data insertion script will Test data is inserted into database.
In one embodiment, it also performs the steps of when processor executes computer program through data configuration tool Read the field name in data configuration file;When read field name is not null value, obtained according to read field name Corresponding testing data;It is not null value verifying read testing data, includes according to the generation of read testing data The data that SQL is inserted into sentence are inserted into script.
In one embodiment, table structure information is also configured in data configuration file;Computer program is held by processor Also perform the steps of whether the table structure information judged in configuration file is null information when row;If table structure information is sky When value information, then each test data that SQL is inserted into sentence specified data configuration file is inserted into data as test data Library;If table structure information is not null information, corresponding testing data is read according to field name, sentence is inserted by SQL Database is inserted into using the testing data of reading as test data.
In one embodiment, reception is also performed the steps of when computer program is executed by processor in the configuration page The data configuration instruction triggered;In response to data configuration instruct, check configuration the page in required item whether input meet it is pre- If the information of condition;When required item input meets the information of preset condition, using the specified testing data of SQL insertion sentence as Test data is inserted into database, and exports the prompt information whether expression data are successively inserted into database.
In one embodiment, test data includes order request data;Reality is gone back when computer program is executed by processor Existing following steps: the payment interface of transaction system is called;Order request data progress payment processing is ordered according to interface is paid Forms data;The handling duration that order request data are carried out with payment processing is recorded, to determine transaction system according to handling duration Pay performance;And order data and default order data are compared;Test report is generated according to resulting result is compared It accuses, to determine whether the payment function of transaction system exception occurs according to test report.
Those of ordinary skill in the art will appreciate that realizing all or part of the process in above-described embodiment method, being can be with Relevant hardware is instructed to complete by computer program, the computer program can be stored in a non-volatile computer In read/write memory medium, the computer program is when being executed, it may include such as the process of the embodiment of above-mentioned each method.Wherein, To any reference of memory, storage, database or other media used in each embodiment provided herein, Including non-volatile and/or volatile memory.Nonvolatile memory may include read-only memory (ROM), programming ROM (PROM), electrically programmable ROM (EPROM), electrically erasable ROM (EEPROM) or flash memory.Volatile memory may include Random access memory (RAM) or external cache.By way of illustration and not limitation, RAM is available in many forms, Such as static state RAM (SRAM), dynamic ram (DRAM), synchronous dram (SDRAM), double data rate sdram (DDRSDRAM), enhancing Type SDRAM (ESDRAM), synchronization link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic ram (DRDRAM) and memory bus dynamic ram (RDRAM) etc..
Each technical characteristic of above embodiments can be combined arbitrarily, for simplicity of description, not to above-described embodiment In each technical characteristic it is all possible combination be all described, as long as however, the combination of these technical characteristics be not present lance Shield all should be considered as described in this specification.
The several embodiments of the application above described embodiment only expresses, the description thereof is more specific and detailed, but simultaneously It cannot therefore be construed as limiting the scope of the patent.It should be pointed out that coming for those of ordinary skill in the art It says, without departing from the concept of this application, various modifications and improvements can be made, these belong to the protection of the application Range.Therefore, the scope of protection shall be subject to the appended claims for the application patent.

Claims (10)

1. a kind of test data building method, which comprises
Data configuration tool is called to obtain data configuration file;The data configuration file is configured with testing data;
Being generated by the data configuration tool according to the data configuration file by the data configuration tool includes SQL The data for being inserted into sentence are inserted into script;The SQL insertion sentence is used to testing data being inserted into database;
The data insertion script is executed, when the testing data belongs to constant type data, SQL insertion sentence to be referred to The fixed testing data is inserted into database as test data.
2. the method according to claim 1, wherein the method also includes:
The database selection instruction that detection is triggered in the configuration page of data configuration tool;
Data corresponding with the database selection instruction are chosen from candidate data library provided by the data configuration tool Library and the corresponding version of the database;
Corresponding with database connection script is obtained, the operation connection script is to connect the database, so as to by institute It states testing data and is inserted into connected database as test data.
3. the method according to claim 1, wherein the method also includes:
Judge the data type that the testing data is belonged to;
When the testing data belongs to function type data, corresponding function is called according to the testing data;
Target data is obtained according to the function called, the target data is determined as test data;
SQL in script, which is inserted into, by the data is inserted into sentence for the test data insertion database.
4. the method according to claim 1, wherein it is described by the data configuration tool according to the data Configuration file generation includes that the data insertion script of SQL insertion sentence includes:
The field name in the data configuration file is read by the data configuration tool;
When read field name is not null value, corresponding testing data is obtained according to read field name;
It is not null value verifying read testing data, includes SQL insertion sentence according to the generation of read testing data Data be inserted into script.
5. method according to any one of claims 1 to 4, which is characterized in that be also configured in the data configuration file Table structure information;The testing data that SQL insertion sentence is specified is inserted into database as test data and includes:
Judge whether the table structure information in the configuration file is null information;
It, will be each in the specified data configuration file of SQL insertion sentence if table structure information is null information Test data is inserted into database as test data;
If table structure information is not null information, corresponding testing data is read according to field name, is inserted by the SQL The testing data of reading is inserted into database by sentence.
6. method according to any one of claims 1 to 4, which is characterized in that described that the SQL is inserted into what sentence was specified The testing data is inserted into database as test data
Receive the data configuration instruction triggered in the configuration page;
It is instructed in response to the data configuration, checks whether the required item in the configuration page inputs the letter for meeting preset condition Breath;
When required item input meets the information of preset condition, by the specified testing data of SQL insertion sentence It is inserted into database as test data, and exports the prompt information whether expression data are successively inserted into database.
7. method according to any one of claims 1 to 4, which is characterized in that the test data includes order request number According to;The method also includes:
Call the payment interface of transaction system;
Payment processing is carried out to the order request data according to described pair of interface and obtains order data;
The handling duration that the order request data are carried out with payment processing is recorded, to determine the friendship according to the handling duration The payment performance of easy system;And
The order data and default order data are compared;
Test report is generated according to resulting result is compared, to determine the payment function of the transaction system according to the test report Whether exception can be occurred.
8. a kind of test data constructing apparatus, which is characterized in that described device includes:
File acquisition module, for calling data configuration tool to obtain data configuration file;The data configuration file is configured with Testing data;
Script generation module, for passing through the data configuration tool according to the data configuration by the data configuration tool File generated includes the data insertion script of SQL insertion sentence;The SQL insertion sentence is used to testing data being inserted into data Library;
Data insertion module, for executing the data insertion script, to incite somebody to action when the testing data belongs to constant type data The specified testing data of the SQL insertion sentence is inserted into database as test data.
9. a kind of computer equipment, including memory and processor, the memory are stored with computer program, feature exists In the step of processor realizes any one of claims 1 to 7 the method when executing the computer program.
10. a kind of computer readable storage medium, is stored thereon with computer program, which is characterized in that the computer program The step of method described in any one of claims 1 to 7 is realized when being executed by processor.
CN201910418801.2A 2019-05-20 2019-05-20 Test data building method, device, computer equipment and storage medium Pending CN110221967A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910418801.2A CN110221967A (en) 2019-05-20 2019-05-20 Test data building method, device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910418801.2A CN110221967A (en) 2019-05-20 2019-05-20 Test data building method, device, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN110221967A true CN110221967A (en) 2019-09-10

Family

ID=67821640

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910418801.2A Pending CN110221967A (en) 2019-05-20 2019-05-20 Test data building method, device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN110221967A (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110851357A (en) * 2019-11-04 2020-02-28 紫光云技术有限公司 Test data automatic construction method based on multiple database types
CN111831268A (en) * 2020-05-29 2020-10-27 大数金科网络技术有限公司 Test data construction method
CN112130718A (en) * 2020-08-21 2020-12-25 深圳市风云实业有限公司 Equipment function detection method
CN113420010A (en) * 2021-06-23 2021-09-21 建信金融科技有限责任公司 Database management method and device, electronic equipment and storage medium
CN114595159A (en) * 2022-05-10 2022-06-07 太平金融科技服务(上海)有限公司 Test data generation method, device, equipment and storage medium
WO2022227314A1 (en) * 2021-04-25 2022-11-03 深圳壹账通智能科技有限公司 Method and apparatus for dynamic synchronous testing, device, and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6907546B1 (en) * 2000-03-27 2005-06-14 Accenture Llp Language-driven interface for an automated testing framework
CN101046812A (en) * 2006-06-12 2007-10-03 华为技术有限公司 Method of data base table recording structure and detection and its device
CN105512042A (en) * 2015-12-22 2016-04-20 广东金赋信息科技有限公司 Automatic generation method and device for testing data of database and testing system
CN108388515A (en) * 2018-03-06 2018-08-10 平安科技(深圳)有限公司 Test data generating method, device, equipment and computer readable storage medium
CN109101415A (en) * 2018-06-25 2018-12-28 平安科技(深圳)有限公司 Interface test method, system, equipment and the storage medium compared based on database

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6907546B1 (en) * 2000-03-27 2005-06-14 Accenture Llp Language-driven interface for an automated testing framework
CN101046812A (en) * 2006-06-12 2007-10-03 华为技术有限公司 Method of data base table recording structure and detection and its device
CN105512042A (en) * 2015-12-22 2016-04-20 广东金赋信息科技有限公司 Automatic generation method and device for testing data of database and testing system
CN108388515A (en) * 2018-03-06 2018-08-10 平安科技(深圳)有限公司 Test data generating method, device, equipment and computer readable storage medium
CN109101415A (en) * 2018-06-25 2018-12-28 平安科技(深圳)有限公司 Interface test method, system, equipment and the storage medium compared based on database

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
KUNAL TANEJA ET AL: "MODA:Automated test generation for database applications via mock objects", 《ASE \'10: PROCEEDINGS OF THE 25TH IEEE/ACM INTERNATIONAL CONFERENCE ON AUTOMATED SOFTWARE ENGINEERING》, pages 289 - 292 *
杨欢乐: "数据采集与监测类系统的数据库设计及应用", 《中国优秀硕士学位论文全文数据库(电子期刊)》, vol. 2017, no. 02 *

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110851357A (en) * 2019-11-04 2020-02-28 紫光云技术有限公司 Test data automatic construction method based on multiple database types
CN111831268A (en) * 2020-05-29 2020-10-27 大数金科网络技术有限公司 Test data construction method
CN112130718A (en) * 2020-08-21 2020-12-25 深圳市风云实业有限公司 Equipment function detection method
WO2022227314A1 (en) * 2021-04-25 2022-11-03 深圳壹账通智能科技有限公司 Method and apparatus for dynamic synchronous testing, device, and storage medium
CN113420010A (en) * 2021-06-23 2021-09-21 建信金融科技有限责任公司 Database management method and device, electronic equipment and storage medium
CN114595159A (en) * 2022-05-10 2022-06-07 太平金融科技服务(上海)有限公司 Test data generation method, device, equipment and storage medium

Similar Documents

Publication Publication Date Title
CN110221967A (en) Test data building method, device, computer equipment and storage medium
CN110046334A (en) Data lead-in method, device, computer equipment and storage medium
CN110427331B (en) Method for automatically generating performance test script based on interface test tool
CN108804548B (en) Test data query method, device, computer equipment and storage medium
CN109947646A (en) Interface test method, device, computer equipment and storage medium
CN109522218A (en) Interface test method, device, computer equipment and storage medium
CN109766263A (en) Automatic test analysis and processing method, device, computer equipment and storage medium
CN108446221A (en) System detection method, device, computer equipment and storage medium
CN110213357A (en) Business datum backing method, device, computer equipment and storage medium
CN110109897A (en) Database script generation method, device, computer equipment and storage medium
CN109726134B (en) Interface test method and system
CN109144799A (en) Integrated testing method, apparatus, computer equipment and storage medium
CN109766261A (en) Coverage test method, device, computer equipment and storage medium
CN110008204A (en) Detection method, device, computer equipment and the storage medium of the quality of data
CN110474959A (en) Data interactive method, device, computer equipment and storage medium
CN108446175A (en) Task processing method, device, computer equipment and storage medium
CN110750443A (en) Webpage testing method and device, computer equipment and storage medium
CN107329976A (en) Webpage paging method, device, computer equipment and computer-readable recording medium
CN109325058A (en) Regular batch comparison method, device, computer equipment and storage medium
CN115563002A (en) Data importing method and device, storage medium and computer equipment
CN108399125B (en) Automatic testing method and device, computer equipment and storage medium
CN113778878A (en) Interface testing method and device, electronic equipment and storage medium
CN109299009A (en) Data test method, apparatus, computer equipment and storage medium
CN109460229A (en) Code file generation method, device, computer equipment and storage medium
CN108776642A (en) Test report generation method, device, computer equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination