CN108804327A - A kind of method and apparatus of automatic Data Generation Test - Google Patents
A kind of method and apparatus of automatic Data Generation Test Download PDFInfo
- Publication number
- CN108804327A CN108804327A CN201810599901.5A CN201810599901A CN108804327A CN 108804327 A CN108804327 A CN 108804327A CN 201810599901 A CN201810599901 A CN 201810599901A CN 108804327 A CN108804327 A CN 108804327A
- Authority
- CN
- China
- Prior art keywords
- test
- replaced
- data
- parameter
- value
- 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
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3668—Software testing
- G06F11/3672—Test management
- G06F11/3684—Test management for test design, e.g. generating new test cases
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Computer Hardware Design (AREA)
- Quality & Reliability (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Debugging And Monitoring (AREA)
Abstract
The invention discloses a kind of method and apparatus of automatic Data Generation Test, are related to field of computer technology.One specific implementation mode of this method includes:Read test template with test data, the test data includes parameter name and parameter value in the test template;Target data is obtained, the target data is converted to by desired value by format conversion;The parameter value to be replaced is replaced, to automatically generate target detection data in the position that parameter value to be replaced is searched in the test template with the desired value.The embodiment can solve the problems, such as that data element splicing difficulty is big, splicing error rate is high.
Description
Technical field
The present invention relates to field of computer technology more particularly to a kind of method and apparatus of automatic Data Generation Test.
Background technology
With the fast development of internet, WEB application system quantity is continuously increased, thing followed distributed system
Occur so that the intersection of business between various systems can all be related to the mutual calling of the interface of system.
Meanwhile with the development of Internet technology, having derived the extremely complex interface of more and more transmission datas, it is such
Interface uses JSON formats more, and (JavaScript Object Notation are a kind of data interchange formats of lightweight, are easy to
Read and write, while being also easy to machine parsing and generating) the complicated data element of splicing, complete the transmission and friendship of various data
It changes, the test data of JSON formats splicing can easily mobile data and object in the application.
In realizing process of the present invention, inventor has found that at least there are the following problems in the prior art:
During the test, it generally requires tester and artificially searches complicated data element, and it is carried out manually
Format transformation, splicing, replacement etc. cause working efficiency low;And manually splice the character string of JSON formats, lead to the quality of data
Difference, error rate are high;Especially in interminable JSON data elements, such as JSON format test datas include BASE64 formats
Picture lead to splice that difficulty is big, and splicing error rate is high due to the tediously long complexity of data element.
Invention content
In view of this, the embodiment of the present invention provides a kind of method and apparatus of automatic Data Generation Test, number can be solved
According to the problem that element splicing difficulty is big, splicing error rate is high.
To achieve the above object, one side according to the ... of the embodiment of the present invention provides a kind of automatic Data Generation Test
Method, including:
Read test template with test data, the test data includes parameter name and parameter in the test template
Value;
Target data is obtained, the target data is converted to by desired value by format conversion;
The position that parameter value to be replaced is searched in the test template is replaced described to be replaced with the desired value
Parameter value, to automatically generate target detection data.
Optionally, target data is obtained, the target data is converted to by desired value by format conversion, including:
The target data for obtaining picture format, is converted to the target data of the picture format by format conversion
BASE64 values or binary value.
Optionally, the position that parameter value to be replaced is searched in the test template, described in desired value replacement
Parameter value to be replaced, including:
Read parameter name input by user;
Parameter name input by user is matched in the test template using regular expression, is found and the parameter name
The position of corresponding parameter value to be replaced;
The parameter value in the position range is obtained, the parameter value in the position range is replaced with the desired value.
Optionally, the parameter value in the position range is replaced with the desired value, including:
The character string replacement method provided by JAVA, automatically replaces with the mesh by the character string in the position range
The character string of scale value.
Optionally, the test template is the text file that test data is written with JSON formats;
After automatically generating target detection data, the method further includes:By replaced JSON formats test data
It is illustrated in web page text frame.
In addition, other side according to the ... of the embodiment of the present invention, provides a kind of device of automatic Data Generation Test, packet
It includes:
Read module is used for read test template, includes with test data, the test data in the test template
Parameter name and parameter value;
The target data is converted to desired value by conversion module for obtaining target data by format conversion;
Replacement module, the position for searching parameter value to be replaced in the test template are replaced with the desired value
The parameter value to be replaced is changed, to automatically generate target detection data.
Optionally, the conversion module is used for:
The target data for obtaining picture format, is converted to the target data of the picture format by format conversion
BASE64 values or binary value.
Optionally, the replacement module is used for:
Read parameter name input by user;
Parameter name input by user is matched in the test template using regular expression, is found and the parameter name
The position of corresponding parameter value to be replaced;
The parameter value in the position range is obtained, the parameter value in the position range is replaced with the desired value.
Optionally, the parameter value in the position range is replaced with the desired value, including:
The character string replacement method provided by JAVA, automatically replaces with the mesh by the character string in the position range
The character string of scale value.
Optionally, the test template is the text file that test data is written with JSON formats;
The replacement module is additionally operable to:After automatically generating target detection data, replaced JSON formats are tested
Data are illustrated in web page text frame.
Other side according to the ... of the embodiment of the present invention additionally provides a kind of electronic equipment, including:
One or more processors;
Storage device, for storing one or more programs,
When one or more of programs are executed by one or more of processors so that one or more of processing
Device realizes the method described in any of the above-described embodiment.
Other side according to the ... of the embodiment of the present invention additionally provides a kind of computer-readable medium, is stored thereon with meter
Calculation machine program, realizes the method described in any of the above-described embodiment when described program is executed by processor.
One embodiment in foregoing invention has the following advantages that or advantageous effect:Because using using in test template
The position for searching parameter value to be replaced replaces parameter value to be replaced with desired value, to the skill of automatic Data Generation Test
Art means, so overcoming the technical problem that data element splicing difficulty is big, splicing error rate is high;The present invention is by target data
It is automatically converted to desired value, is matched in test template using regular expression and replaces position, and target is replaced in correct position
Value is conducive to improve interface testing working efficiency, letter to avoid artificial repeatability splicing from replacing complicated interminable data format
Change workflow.
Further effect possessed by above-mentioned non-usual optional mode adds hereinafter in conjunction with specific implementation mode
With explanation.
Description of the drawings
Attached drawing does not constitute inappropriate limitation of the present invention for more fully understanding the present invention.Wherein:
Fig. 1 is the schematic diagram of the main flow of the method for automatic Data Generation Test according to the ... of the embodiment of the present invention;
Fig. 2 is showing according to the main flow of the method for an automatic Data Generation Test that can refer to embodiment of the invention
It is intended to;
Fig. 3 is the schematic diagram of the main modular of the device of automatic Data Generation Test according to the ... of the embodiment of the present invention;
Fig. 4 is that the embodiment of the present invention can be applied to exemplary system architecture figure therein;
Fig. 5 is adapted for the structural representation of the computer system for the terminal device or server of realizing the embodiment of the present invention
Figure.
Specific implementation mode
It explains to the exemplary embodiment of the present invention below in conjunction with attached drawing, including the various of the embodiment of the present invention
Details should think them only exemplary to help understanding.Therefore, those of ordinary skill in the art should recognize
It arrives, various changes and modifications can be made to the embodiments described herein, without departing from scope and spirit of the present invention.Together
The description to known function and structure is omitted for clarity and conciseness in sample in following description.
Fig. 1 is the schematic diagram of the main flow of the method for automatic Data Generation Test according to the ... of the embodiment of the present invention.Such as Fig. 1
Shown, as an embodiment of the present invention, the method for the automatic Data Generation Test may include:
Step 101, read test template with test data, the test data includes parameter in the test template
Name and parameter value.
Since the data of each interface transmission are different, to realize that function versatility, the embodiment of the present invention take reading mould
The form of plate, to ensure that method provided in an embodiment of the present invention can be used to realize automatic Data Generation Test.
Currently, the format of test data can be generally divided into:JSON formats, XML format, binary format etc., due to
JSON is a kind of data interchange format of lightweight, is easy to read and write, while being also easy to machine parsing and generating, and transmits number
The complicated data element of JSON formats splicing is mostly used according to extremely complex interface, therefore the embodiment of the present invention is with JSON formats
It is described in detail for test data.
Before step 101, the method can also include:Test data is written in text file with JSON formats
(such as TXT files etc.) is selected in this, as test template for user.Enter to join different, need due to each interface
It to be directed to different interfaces, different test datas is write, to produce different test templates.
For example, the content in test template can be as follows:
{
"appName":"LEE_LOCAL_TEST",
"appAuthorityKey":" UqhrKxsCykLN/29npDP1kQ==",
"verifyBusinessType":"MESHED_PHOTO_VERIFY",
"businessId":"JRAPP-BT_AUTH",
"faceSDK":"jdin",
"faceSDKVersion":"1.0",
"ip":"49.118.242.36",
"shieldInfo":null,
"pin":"",
"name":" Yang Lili ",
"idCard":"370123199203160528",
"faceData":null,
"extra":null
}
It should be pointed out that the test data in above-mentioned test template is merely exemplary ground, test data is according to each
The ginseng that enters of interface based on JSON transmission datas determines, interface enters ginseng and (including enters to join and name and enter ginseng value, i.e. parameter name and parameter
Value) it is converted to after JSON formats in write-in .txt files, it is used as test template, guarantee to be mostly based on JSON and pass .txt files
The interface of transmission of data enters ginseng and method provided in an embodiment of the present invention can be used to realize automatic Data Generation Test.
Test template can store local, and user selects local test template to carry out by click " uploading Template button "
It uploads.
Step 102, target data is obtained, the target data is converted to by desired value by format conversion.
In this step, the type for the format conversion that can be inputted or select according to user, automatically by target data
Be converted to required desired value.
In some embodiments of the invention, for the target data of picture format, BASE64 lattice can be converted into
Formula, binary format etc..Specifically, step 102 may include:The target data for obtaining picture format, will by format conversion
The target data of the picture format is converted to BASE64 values or binary value.If user's selection is BASE64 formats,
Target data is then converted into BASE64 values.If user selection be binary format, by target data be converted to two into
Value processed.
Step 103, the position that parameter value to be replaced is searched in the test template, described in desired value replacement
Parameter value to be replaced, to automatically generate target detection data.
In this step, it needs first to read parameter name input by user, then be searched in the test template to be replaced
Parameter value position, the parameter value to be replaced in test template is replaced with into the desired value obtained in step 102.Therefore,
The embodiment of the present invention can be with Dynamic Recognition parameter name input by user, to replace corresponding parameter value, to complete data element
Splicing.
As an alternative embodiment of the invention, step 103 can specifically include:First, parameter input by user is read
Name;Then, parameter name input by user is matched in the test template using regular expression, found and the parameter name
The position of corresponding parameter value to be replaced;Finally, the parameter value in the position range is obtained, which is replaced with the desired value
Set the parameter value in range.
By taking the test template in step 102 as an example:
First, parameter name input by user is read;User can input the parameter name to be replaced in web page text frame, than
Such as, the entitled image of the parameter of the target data of picture format, entitled faceData of parameter of the target data of pictures etc.;
Then, parameter name input by user is matched in the test template using regular expression, such as image,
FaceData etc., to find the position of parameter value to be replaced corresponding with the parameter name in the test template;
Finally, the character string (as needing the character string replaced) in the position range is obtained, in the position range
Character string replaces with the character string of the desired value obtained in step 102, such as BASE64 values or binary value etc..
For example, tester needs to replace the BASE64 values of picture, then matched in test template by regular expression
BASE64 values after to image parameters name, replaced test data are as follows:
As it can be seen that the embodiment of the present invention be directed to the interface based on JSON transmission datas, automatic conversion complex data format (such as
Picture format), a key generates complete JSON strings, and it includes BASE64 picture formats that the transmission of the interfaces such as manual identified, which may be implemented,
When JSON test datas, automatic conversion, splicing picture format, and generate the functions such as JSON test datas.
Optionally, the parameter value in the position range is replaced with the desired value, including:The character string provided by JAVA
Character string in the position range is automatically replaced with the character string of the desired value by replacement method.
Optionally, after step 103, the method further includes:Replaced JSON formats test data is illustrated in
In web page text frame, in order to which tester replicates.
According to various embodiments recited above, it can be seen that the present invention uses and searches ginseng to be replaced in test template
The position of numerical value replaces parameter value to be replaced with desired value, to the technical solution of automatic Data Generation Test, solves number
According to the problem that element splicing difficulty is big, splicing error rate is high.That is, in the prior art, generally requiring tester people
For the data element for searching complicated, and manual switch format, splicing, replacement etc. are carried out to it, leads to that working efficiency is low, data
Problem of poor quality, error rate is high.And the present invention is that target data is automatically converted to desired value, is being surveyed using regular expression
Position is replaced in matching in die trial plate, and replaces desired value in correct position, complicated superfluous to avoid artificial repeatability splicing from replacing
Long data format is conducive to improve interface testing working efficiency, simplifies workflow.
Fig. 2 is showing according to the main flow of the method for an automatic Data Generation Test that can refer to embodiment of the invention
It is intended to, the method for the automatic Data Generation Test may include:
Step 201, the test template that user uploads is read;
Step 202, the target data of user's selection, such as picture are obtained;
Step 203, the type of the format conversion selected by user, desired value is converted to by target data;
Step 204, the parameter name that user inputs in web page text frame is read;
Step 205, when automatically generating button when the user clicks, it is defeated that user is matched in test template using regular expression
The parameter name entered finds the position of parameter value to be replaced corresponding with parameter name;
Step 206, the parameter value in the position range is obtained, the parameter value in the position range is replaced with desired value;
Step 207, the automatic Data Generation Test in web page text frame.
If be pointed out that target data (such as:Abc format conversion) need not be carried out, then need not execute step
Rapid 203, but step 204 is directly executed, with the parameter value in target data replacement test template, the test data of generation is such as
Under:
{
"appName":"LEE_LOCAL_TEST",
"appAuthorityKey":" UqhrKxsCykLN/29npDP1kQ==",
"verifyBusinessType":"MESHED_PHOTO_VERIFY",
"businessId":"JRAPP-BT_AUTH",
"faceSDK":"jdin",
"faceSDKVersion":"1.0",
"ip":"49.118.242.36",
"shieldInfo":null,
"pin":"",
"name":" Yang Lili ",
"idCard":"370123199203160528",
"faceData":"abc",
"extra":null
}
If target data is changing value, random digit generation method or data rule changing method may be selected;If mesh
Mark data are increment value, then selecting data increases method certainly;If target data is data common-used formula calculated value, may be selected
Common-used formula computational methods etc..These target datas need not convert format, can directly read target data, and complete to spell
It connects.
By from for increasing ID, the content of test template is as follows:
{
"ID":"000000001",
"appName":"LEE_LOCAL_TEST",
"appAuthorityKey":" UqhrKxsCykLN/29npDP1kQ==",
"verifyBusinessType":"MESHED_PHOTO_VERIFY",
"businessId":"JRAPP-BT_AUTH",
"faceSDK":"jdin",
"faceSDKVersion":"1.0",
"ip":"49.118.242.36",
"shieldInfo":null,
"pin":"",
"name":" Yang Lili ",
"idCard":"370123199203160528",
"faceData":null,
"extra":null
}
Automatically increase ID certainly and spliced test data is as follows:
{
"ID":"000000002",
"appName":"LEE_LOCAL_TEST",
"appAuthorityKey":" UqhrKxsCykLN/29npDP1kQ==",
"verifyBusinessType":"MESHED_PHOTO_VERIFY",
"businessId":"JRAPP-BT_AUTH",
"faceSDK":"jdin",
"faceSDKVersion":"1.0",
"ip":"49.118.242.36",
"shieldInfo":null,
"pin":"",
"name":" Yang Lili ",
"idCard":"370123199203160528",
"faceData":null,
"extra":null
}
{
"ID":"000000003",
"appName":"LEE_LOCAL_TEST",
"appAuthorityKey":" UqhrKxsCykLN/29npDP1kQ==",
"verifyBusinessType":"MESHED_PHOTO_VERIFY",
"businessId":"JRAPP-BT_AUTH",
"faceSDK":"jdin",
"faceSDKVersion":"1.0",
"ip":"49.118.242.36",
"shieldInfo":null,
"pin":"",
"name":" Yang Lili ",
"idCard":"370123199203160528",
"faceData":null,
"extra":null
}
In addition, in the specific implementation content of a method that can refer to automatic Data Generation Test in embodiment of the invention,
It has been described in detail in the method for automatic Data Generation Test described above, therefore has no longer illustrated in this duplicate contents.
Fig. 3 is the schematic diagram of the main modular of the device of automatic Data Generation Test according to the ... of the embodiment of the present invention.Such as Fig. 3
Shown, the device 300 of the automatic Data Generation Test includes read module 301, conversion module 302 and replacement module.Wherein,
301 read test template of the read module with test data, the test data includes parameter name in the test template
And parameter value;The conversion module 302 obtains target data, and the target data is converted to desired value by format conversion;
The replacement module 303 searches the position of parameter value to be replaced in the test template, described in desired value replacement
Parameter value to be replaced, to automatically generate target detection data.
Optionally, the conversion module 302 obtains the target data of picture format, by format conversion by the picture lattice
The target data of formula is converted to BASE64 values or binary value.
Optionally, the replacement module 303 reads parameter name input by user;Using regular expression in the test mould
Parameter name input by user is matched in plate, finds the position of parameter value to be replaced corresponding with the parameter name;Obtaining should
Parameter value in position range replaces the parameter value in the position range with the desired value.
Optionally, the parameter value in the position range is replaced with the desired value, including:
The character string replacement method provided by JAVA, automatically replaces with the mesh by the character string in the position range
The character string of scale value.
Optionally, the test template is the text file that test data is written with JSON formats;
After automatically generating target detection data, replaced JSON formats are also tested number by the replacement module 303
According to being illustrated in web page text frame.
According to various embodiments recited above, it can be seen that the present invention uses and searches ginseng to be replaced in test template
The position of numerical value replaces parameter value to be replaced with desired value, to the technical solution of automatic Data Generation Test, solves number
According to the problem that element splicing difficulty is big, splicing error rate is high.That is, in the prior art, generally requiring tester people
For the data element for searching complicated, and manual switch format, splicing, replacement etc. are carried out to it, leads to that working efficiency is low, data
Problem of poor quality, error rate is high.And the present invention is that target data is automatically converted to desired value, is being surveyed using regular expression
Position is replaced in matching in die trial plate, and replaces desired value in correct position, complicated superfluous to avoid artificial repeatability splicing from replacing
Long data format is conducive to improve interface testing working efficiency, simplifies workflow.
It should be noted that the specific implementation content of the device in automatic Data Generation Test of the present invention, above
It has been described in detail in the method for the automatic Data Generation Test, therefore has no longer illustrated in this duplicate contents.
Fig. 4 shows the method for the automatic Data Generation Test that can apply the embodiment of the present invention or automatically generates test number
According to method exemplary system architecture 400.
As shown in figure 4, system architecture 400 may include terminal device 401,402,403, network 404 and server 405.
Network 404 between terminal device 401,402,403 and server 405 provide communication link medium.Network 404 can be with
Including various connection types, such as wired, wireless communication link or fiber optic cables etc..
User can be interacted by network 404 with server 405 with using terminal equipment 401,402,403, to receive or send out
Send message etc..Various telecommunication customer end applications, such as the application of shopping class, net can be installed on terminal device 401,402,403
(merely illustrative) such as the application of page browsing device, searching class application, instant messaging tools, mailbox client, social platform softwares.
Terminal device 401,402,403 can be the various electronic equipments with display screen and supported web page browsing, packet
Include but be not limited to smart mobile phone, tablet computer, pocket computer on knee and desktop computer etc..
Server 405 can be to provide the server of various services, such as utilize terminal device 401,402,403 to user
The shopping class website browsed provides the back-stage management server (merely illustrative) supported.Back-stage management server can be to receiving
To the data such as information query request analyze etc. processing, and (such as target push information, product are believed by handling result
Breath --- merely illustrative) feed back to terminal device.
It should be noted that the method for the automatic Data Generation Test that the embodiment of the present invention is provided is generally in server
405 execute, and correspondingly, the device of the automatic Data Generation Test is generally located in server 405.Institute of the embodiment of the present invention
The method of the automatic Data Generation Test of offer can also be executed in terminal device 401,402,403, correspondingly, the automatic life
It is generally located on terminal device 401,402,403 at the device of test data.
It should be understood that the number of the terminal device, network and server in Fig. 4 is only schematical.According to realization need
It wants, can have any number of terminal device, network and server.
Below with reference to Fig. 5, it illustrates the computer systems 500 suitable for the terminal device for realizing the embodiment of the present invention
Structural schematic diagram.Terminal device shown in Fig. 5 is only an example, to the function of the embodiment of the present invention and should not use model
Shroud carrys out any restrictions.
As shown in figure 5, computer system 500 includes central processing unit (CPU) 501, it can be read-only according to being stored in
Program in memory (ROM) 502 or be loaded into the program in random access storage device (RAM) 503 from storage section 508 and
Execute various actions appropriate and processing.In RAM 503, also it is stored with system 500 and operates required various programs and data.
CPU 501, ROM 502 and RAM 503 are connected with each other by bus 504.Input/output (I/O) interface 505 is also connected to always
Line 504.
It is connected to I/O interfaces 505 with lower component:Importation 506 including keyboard, mouse etc.;It is penetrated including such as cathode
The output par, c 507 of spool (CRT), liquid crystal display (LCD) etc. and loud speaker etc.;Storage section 508 including hard disk etc.;
And the communications portion 509 of the network interface card including LAN card, modem etc..Communications portion 509 via such as because
The network of spy's net executes communication process.Driver 510 is also according to needing to be connected to I/O interfaces 505.Detachable media 511, such as
Disk, CD, magneto-optic disk, semiconductor memory etc. are mounted on driver 510, as needed in order to be read from thereon
Computer program be mounted into storage section 508 as needed.
Particularly, it according to embodiment disclosed by the invention, may be implemented as counting above with reference to the process of flow chart description
Calculation machine software program.For example, embodiment disclosed by the invention includes a kind of computer program product comprising be carried on computer
Computer program on readable medium, the computer program include the program code for method shown in execution flow chart.?
In such embodiment, which can be downloaded and installed by communications portion 509 from network, and/or from can
Medium 511 is dismantled to be mounted.When the computer program is executed by central processing unit (CPU) 501, system of the invention is executed
The above-mentioned function of middle restriction.
It should be noted that computer-readable medium shown in the present invention can be computer-readable signal media or meter
Calculation machine readable storage medium storing program for executing either the two arbitrarily combines.Computer readable storage medium for example can be --- but not
Be limited to --- electricity, magnetic, optical, electromagnetic, infrared ray or semiconductor system, device or device, or arbitrary above combination.Meter
The more specific example of calculation machine readable storage medium storing program for executing can include but is not limited to:Electrical connection with one or more conducting wires, just
It takes formula computer disk, hard disk, random access storage device (RAM), read-only memory (ROM), erasable type and may be programmed read-only storage
Device (EPROM or flash memory), optical fiber, portable compact disc read-only memory (CD-ROM), light storage device, magnetic memory device,
Or above-mentioned any appropriate combination.In the present invention, can be any include computer readable storage medium or storage journey
The tangible medium of sequence, the program can be commanded the either device use or in connection of execution system, device.And at this
In invention, computer-readable signal media may include in a base band or as the data-signal that a carrier wave part is propagated,
Wherein carry computer-readable program code.Diversified forms may be used in the data-signal of this propagation, including but unlimited
In electromagnetic signal, optical signal or above-mentioned any appropriate combination.Computer-readable signal media can also be that computer can
Any computer-readable medium other than storage medium is read, which can send, propagates or transmit and be used for
By instruction execution system, device either device use or program in connection.Include on computer-readable medium
Program code can transmit with any suitable medium, including but not limited to:Wirelessly, electric wire, optical cable, RF etc. or above-mentioned
Any appropriate combination.
Flow chart in attached drawing and block diagram, it is illustrated that according to the system of various embodiments of the invention, method and computer journey
The architecture, function and operation in the cards of sequence product.In this regard, each box in flowchart or block diagram can generation
A part for a part for one module, program segment, or code of table, above-mentioned module, program segment, or code includes one or more
Executable instruction for implementing the specified logical function.It should also be noted that in some implementations as replacements, institute in box
The function of mark can also occur in a different order than that indicated in the drawings.For example, two boxes succeedingly indicated are practical
On can be basically executed in parallel, they can also be executed in the opposite order sometimes, this is depended on the functions involved.Also it wants
It is noted that the combination of each box in block diagram or flow chart and the box in block diagram or flow chart, can use and execute rule
The dedicated hardware based systems of fixed functions or operations is realized, or can use the group of specialized hardware and computer instruction
It closes to realize.
Being described in module involved in the embodiment of the present invention can be realized by way of software, can also be by hard
The mode of part is realized.Described module can also be arranged in the processor, for example, can be described as:A kind of processor packet
Include read module, conversion module and replacement module, wherein the title of these modules is not constituted under certain conditions to the module
The restriction of itself.
As on the other hand, the present invention also provides a kind of computer-readable medium, which can be
Included in equipment described in above-described embodiment;Can also be individualism, and without be incorporated the equipment in.Above-mentioned calculating
Machine readable medium carries one or more program, when said one or multiple programs are executed by the equipment, makes
Obtaining the equipment includes:Read test template, with test data in the test template, the test data include parameter name and
Parameter value;Target data is obtained, the target data is converted to by desired value by format conversion;It is looked into the test template
The parameter value to be replaced is replaced in the position for looking for parameter value to be replaced with the desired value, is surveyed to automatically generate target
Try data.
Technical solution according to the ... of the embodiment of the present invention, because searching parameter value to be replaced in test template using using
Position, parameter value to be replaced is replaced with desired value, to automatic Data Generation Test technological means, so overcoming number
According to the technical problem that element splicing difficulty is big, splicing error rate is high;The present invention is that target data is automatically converted to desired value, is adopted
It is matched in test template with regular expression and replaces position, and desired value is replaced in correct position, to avoid manually repeating
Property splicing replace complicated interminable data format, be conducive to improve interface testing working efficiency, simplify workflow.
Above-mentioned specific implementation mode, does not constitute limiting the scope of the invention.Those skilled in the art should be bright
It is white, design requirement and other factors are depended on, various modifications, combination, sub-portfolio and replacement can occur.It is any
Modifications, equivalent substitutions and improvements made by within the spirit and principles in the present invention etc., should be included in the scope of the present invention
Within.
Claims (12)
1. a kind of method of automatic Data Generation Test, which is characterized in that including:
Read test template with test data, the test data includes parameter name and parameter value in the test template;
Target data is obtained, the target data is converted to by desired value by format conversion;
The parameter to be replaced is replaced in the position that parameter value to be replaced is searched in the test template with the desired value
Value, to automatically generate target detection data.
2. according to the method described in claim 1, it is characterized in that, target data is obtained, by format conversion by the target
Data are converted to desired value, including:
The target data for obtaining picture format, BASE64 values are converted to by format conversion by the target data of the picture format
Or binary value.
3. according to the method described in claim 1, it is characterized in that, searching parameter value to be replaced in the test template
The parameter value to be replaced is replaced in position with the desired value, including:
Read parameter name input by user;
Parameter name input by user is matched in the test template using regular expression, is found corresponding with the parameter name
Parameter value to be replaced position;
The parameter value in the position range is obtained, the parameter value in the position range is replaced with the desired value.
4. according to the method described in claim 3, it is characterized in that, replacing the parameter in the position range with the desired value
Value, including:
The character string replacement method provided by JAVA, automatically replaces with the desired value by the character string in the position range
Character string.
5. according to the method described in claim 1, it is characterized in that, the test template is that test data is written with JSON formats
Text file;
After automatically generating target detection data, further include:Replaced JSON formats test data is illustrated in webpage text
In this frame.
6. a kind of device of automatic Data Generation Test, which is characterized in that including:
Read module is used for read test template, with test data, the test data includes parameter in the test template
Name and parameter value;
The target data is converted to desired value by conversion module for obtaining target data by format conversion;
Institute is replaced in replacement module, the position for searching parameter value to be replaced in the test template with the desired value
Parameter value to be replaced is stated, to automatically generate target detection data.
7. device according to claim 6, which is characterized in that the conversion module is used for:
The target data for obtaining picture format, BASE64 values are converted to by format conversion by the target data of the picture format
Or binary value.
8. device according to claim 6, which is characterized in that the replacement module is used for:
Read parameter name input by user;
Parameter name input by user is matched in the test template using regular expression, is found corresponding with the parameter name
Parameter value to be replaced position;
The parameter value in the position range is obtained, the parameter value in the position range is replaced with the desired value.
9. device according to claim 8, which is characterized in that replace the parameter in the position range with the desired value
Value, including:
The character string replacement method provided by JAVA, automatically replaces with the desired value by the character string in the position range
Character string.
10. device according to claim 6, which is characterized in that the test template is that test number is written with JSON formats
According to text file;
The replacement module is additionally operable to:After automatically generating target detection data, by replaced JSON formats test data
It is illustrated in web page text frame.
11. a kind of electronic equipment, which is characterized in that including:
One or more processors;
Storage device, for storing one or more programs,
When one or more of programs are executed by one or more of processors so that one or more of processors are real
The now method as described in any in claim 1-5.
12. a kind of computer-readable medium, is stored thereon with computer program, which is characterized in that described program is held by processor
The method as described in any in claim 1-5 is realized when row.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810599901.5A CN108804327A (en) | 2018-06-12 | 2018-06-12 | A kind of method and apparatus of automatic Data Generation Test |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810599901.5A CN108804327A (en) | 2018-06-12 | 2018-06-12 | A kind of method and apparatus of automatic Data Generation Test |
Publications (1)
Publication Number | Publication Date |
---|---|
CN108804327A true CN108804327A (en) | 2018-11-13 |
Family
ID=64085449
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201810599901.5A Pending CN108804327A (en) | 2018-06-12 | 2018-06-12 | A kind of method and apparatus of automatic Data Generation Test |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN108804327A (en) |
Cited By (12)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109739701A (en) * | 2018-12-14 | 2019-05-10 | 北京奇安信科技有限公司 | Interface test method and device |
CN110163241A (en) * | 2019-03-18 | 2019-08-23 | 腾讯科技(深圳)有限公司 | Data sample generation method, device, computer equipment and storage medium |
CN110175129A (en) * | 2019-05-30 | 2019-08-27 | 立讯精密工业股份有限公司 | Test method and test macro |
CN110362495A (en) * | 2019-07-19 | 2019-10-22 | 浙江诺诺网络科技有限公司 | A kind of interface enters to join function test method, device, equipment and storage medium |
CN110737790A (en) * | 2019-10-25 | 2020-01-31 | 中国人民解放军国防科技大学 | database-based universal image data set management method |
CN111708701A (en) * | 2020-06-18 | 2020-09-25 | 中国信息通信研究院 | Method and device for data testing |
CN112087486A (en) * | 2020-07-30 | 2020-12-15 | 山东浪潮通软信息科技有限公司 | Data integration method, equipment and medium for Internet of things equipment |
CN112102813A (en) * | 2020-07-31 | 2020-12-18 | 南京航空航天大学 | Method for generating voice recognition test data based on context in user comment |
CN112486838A (en) * | 2020-12-14 | 2021-03-12 | 广州品唯软件有限公司 | Interface testing method and device, computer equipment and storage medium |
CN112835809A (en) * | 2021-03-22 | 2021-05-25 | 亿企赢网络科技有限公司 | Test data setting method, device, equipment and medium based on browser |
CN113378518A (en) * | 2021-05-17 | 2021-09-10 | 广东广宇科技发展有限公司 | Regular expression-based JSON data format replacement method, system and storage medium |
CN113778846A (en) * | 2020-11-30 | 2021-12-10 | 北京沃东天骏信息技术有限公司 | Method and apparatus for generating test data |
Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101430661A (en) * | 2008-11-18 | 2009-05-13 | 阿里巴巴集团控股有限公司 | Method, system and apparatus for test data batch generation |
CN102855184A (en) * | 2012-07-24 | 2013-01-02 | 北京播思软件技术有限公司 | Android automatic test cross application device and method |
CN103135976A (en) * | 2011-11-30 | 2013-06-05 | 阿里巴巴集团控股有限公司 | Code automatic generation method and device |
CN103164323A (en) * | 2011-12-09 | 2013-06-19 | 深圳市腾讯计算机系统有限公司 | Data automatic generation method and data automatic generation system |
US9275554B2 (en) * | 2013-09-24 | 2016-03-01 | Jimmy M Sauz | Device, system, and method for enhanced memorization of a document |
CN106021111A (en) * | 2016-05-30 | 2016-10-12 | 上海携程商务有限公司 | Interface testing method and system |
CN107341102A (en) * | 2017-06-12 | 2017-11-10 | 北京奇安信科技有限公司 | A kind of test case file generation method and device |
CN107608951A (en) * | 2017-09-22 | 2018-01-19 | 上海金智晟东电力科技有限公司 | Report form generation method and system |
CN107688531A (en) * | 2017-06-20 | 2018-02-13 | 平安科技(深圳)有限公司 | Geo-database integration method of testing, device, computer equipment and storage medium |
-
2018
- 2018-06-12 CN CN201810599901.5A patent/CN108804327A/en active Pending
Patent Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101430661A (en) * | 2008-11-18 | 2009-05-13 | 阿里巴巴集团控股有限公司 | Method, system and apparatus for test data batch generation |
CN103135976A (en) * | 2011-11-30 | 2013-06-05 | 阿里巴巴集团控股有限公司 | Code automatic generation method and device |
CN103164323A (en) * | 2011-12-09 | 2013-06-19 | 深圳市腾讯计算机系统有限公司 | Data automatic generation method and data automatic generation system |
CN102855184A (en) * | 2012-07-24 | 2013-01-02 | 北京播思软件技术有限公司 | Android automatic test cross application device and method |
US9275554B2 (en) * | 2013-09-24 | 2016-03-01 | Jimmy M Sauz | Device, system, and method for enhanced memorization of a document |
CN106021111A (en) * | 2016-05-30 | 2016-10-12 | 上海携程商务有限公司 | Interface testing method and system |
CN107341102A (en) * | 2017-06-12 | 2017-11-10 | 北京奇安信科技有限公司 | A kind of test case file generation method and device |
CN107688531A (en) * | 2017-06-20 | 2018-02-13 | 平安科技(深圳)有限公司 | Geo-database integration method of testing, device, computer equipment and storage medium |
CN107608951A (en) * | 2017-09-22 | 2018-01-19 | 上海金智晟东电力科技有限公司 | Report form generation method and system |
Cited By (15)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109739701A (en) * | 2018-12-14 | 2019-05-10 | 北京奇安信科技有限公司 | Interface test method and device |
CN110163241B (en) * | 2019-03-18 | 2022-12-30 | 腾讯科技(深圳)有限公司 | Data sample generation method and device, computer equipment and storage medium |
CN110163241A (en) * | 2019-03-18 | 2019-08-23 | 腾讯科技(深圳)有限公司 | Data sample generation method, device, computer equipment and storage medium |
CN110175129A (en) * | 2019-05-30 | 2019-08-27 | 立讯精密工业股份有限公司 | Test method and test macro |
CN110362495A (en) * | 2019-07-19 | 2019-10-22 | 浙江诺诺网络科技有限公司 | A kind of interface enters to join function test method, device, equipment and storage medium |
CN110737790A (en) * | 2019-10-25 | 2020-01-31 | 中国人民解放军国防科技大学 | database-based universal image data set management method |
CN111708701A (en) * | 2020-06-18 | 2020-09-25 | 中国信息通信研究院 | Method and device for data testing |
CN112087486A (en) * | 2020-07-30 | 2020-12-15 | 山东浪潮通软信息科技有限公司 | Data integration method, equipment and medium for Internet of things equipment |
CN112102813A (en) * | 2020-07-31 | 2020-12-18 | 南京航空航天大学 | Method for generating voice recognition test data based on context in user comment |
CN112102813B (en) * | 2020-07-31 | 2023-10-03 | 南京航空航天大学 | Speech recognition test data generation method based on context in user comment |
CN113778846A (en) * | 2020-11-30 | 2021-12-10 | 北京沃东天骏信息技术有限公司 | Method and apparatus for generating test data |
CN112486838A (en) * | 2020-12-14 | 2021-03-12 | 广州品唯软件有限公司 | Interface testing method and device, computer equipment and storage medium |
CN112835809A (en) * | 2021-03-22 | 2021-05-25 | 亿企赢网络科技有限公司 | Test data setting method, device, equipment and medium based on browser |
CN113378518A (en) * | 2021-05-17 | 2021-09-10 | 广东广宇科技发展有限公司 | Regular expression-based JSON data format replacement method, system and storage medium |
CN113378518B (en) * | 2021-05-17 | 2024-06-11 | 广东广宇科技发展有限公司 | Regular expression-based JSON data format replacement method, system and storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108804327A (en) | A kind of method and apparatus of automatic Data Generation Test | |
CN107832045A (en) | Across the method and apparatus of programming language interface conversion | |
CN107491534A (en) | Information processing method and device | |
CN107577763A (en) | Search method and device | |
CN107451109A (en) | Report form generation method and system | |
CN110472207A (en) | List generation method and device | |
CN108628830A (en) | A kind of method and apparatus of semantics recognition | |
CN109815107A (en) | The method and apparatus of automatic test | |
CN107844371A (en) | Task processing method, system and electronic equipment | |
CN109446274A (en) | The method and apparatus of big data platform BI metadata management | |
CN108108342A (en) | Generation method, search method and the device of structured text | |
CN109522486A (en) | Method and apparatus for match information | |
CN109145014A (en) | The method and apparatus for generating elastic searching request | |
CN110134427A (en) | A kind of method and apparatus generating code file | |
CN109002440A (en) | Method, apparatus and system for big data multidimensional analysis | |
CN107908662A (en) | The implementation method and realization device of search system | |
CN109840192A (en) | The method and apparatus of automatic test | |
CN109614327A (en) | Method and apparatus for output information | |
JP2023036681A (en) | Task processing method, processing device, electronic equipment, storage medium, and computer program | |
CN109284367A (en) | Method and apparatus for handling text | |
CN109284342A (en) | Method and apparatus for output information | |
CN109389660A (en) | Image generating method and device | |
CN109960212A (en) | Task sending method and device | |
CN110309142A (en) | The method and apparatus of regulation management | |
CN110109983A (en) | A kind of method and apparatus operating Redis database |
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 | ||
CB02 | Change of applicant information |
Address after: 101111 Room 221, 2nd Floor, Block C, 18 Kechuang 11th Street, Beijing Economic and Technological Development Zone Applicant after: Jingdong Digital Technology Holding Co., Ltd. Address before: 101111 Room 221, 2nd Floor, Block C, 18 Kechuang 11th Street, Beijing Economic and Technological Development Zone Applicant before: Beijing Jingdong Financial Technology Holding Co., Ltd. |
|
CB02 | Change of applicant information | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20181113 |
|
RJ01 | Rejection of invention patent application after publication |