CN106502896B - A kind of generation method and device of function test code - Google Patents

A kind of generation method and device of function test code Download PDF

Info

Publication number
CN106502896B
CN106502896B CN201610921921.0A CN201610921921A CN106502896B CN 106502896 B CN106502896 B CN 106502896B CN 201610921921 A CN201610921921 A CN 201610921921A CN 106502896 B CN106502896 B CN 106502896B
Authority
CN
China
Prior art keywords
function
test
parameter
buried
objective
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201610921921.0A
Other languages
Chinese (zh)
Other versions
CN106502896A (en
Inventor
张磊
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Wuhan Douyu Network Technology Co Ltd
Original Assignee
Wuhan Douyu Network 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 Wuhan Douyu Network Technology Co Ltd filed Critical Wuhan Douyu Network Technology Co Ltd
Priority to CN201610921921.0A priority Critical patent/CN106502896B/en
Publication of CN106502896A publication Critical patent/CN106502896A/en
Application granted granted Critical
Publication of CN106502896B publication Critical patent/CN106502896B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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

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 the generation methods and device of a kind of function test code, bury a little this method comprises: testing objective function setting function to be tested, a little position to characterize each component part of objective function is buried in the function test;The code source file for a little reading and parsing the objective function is buried based on function test, obtains the function name of the objective function, the value of function parameter, function return type;The value of function name, function parameter, function return type based on the target, constructs the test function of the objective function, and generates the test code file of the objective function.In through the above technical solution, automatically generating for test code is realized, it is no longer necessary to which developer writes test code manually, to solve the low technical problem of testing efficiency in the process of application development of the prior art, improves testing efficiency.

Description

A kind of generation method and device of function test code
Technical field
The present invention relates to software technology field, in particular to a kind of the generation method and device of function test code.
Background technique
With the continuous development of information technology, the exploitation and application of application program obtain development at full speed.Application program In development process, in order to guarantee the correctness of logic in code, it will usually write test case code for detection function function Correctness.
In the project of Java language exploitation, most commonly used test frame is compiled by Erich Gamma and Kent Beck The regression testing framework write: Junit unit testing frame.Developer can be helped to test code using the test frame The correctness of middle function performance.But this scheme has a very fatal defect, that is, all test codes all need It manually to write, can thus spend a large amount of human cost, be dropped significantly simultaneously as manually writing test code Testing efficiency in low development process.
As it can be seen that there are the technical problems that testing efficiency is low in the process of application development of the prior art.
Summary of the invention
The embodiment of the present invention provides the generation method and device of a kind of function test code, solves the application journey of the prior art There are the technical problems that testing efficiency is low in sequence development process, improve testing efficiency.
The embodiment of the present application provides a kind of generation method of function test code, which comprises
Objective function setting function to be tested is tested and is buried a little, the function test is buried a little as the characterization objective function The position of each component part;
The code source file for a little reading and parsing the objective function is buried based on function test, obtains the target The value of the function name of function, function parameter, function return type;
The value of function name, function parameter, function return type based on the target, constructs the survey of the objective function Trial function, and generate the test code file of the objective function.
Optionally, described test objective function setting function is buried a little, comprising:
Function name, function parameter, return type the setting function of the objective function are tested respectively and buried a little.
Optionally, described that the code source file for a little reading and parsing the objective function is buried based on function test, it wraps It includes:
The source file of the objective function is opened by document reading manner;
Open source file is converted into inlet flow, function test is obtained from inlet flow and buries burying and indicate a little Symbol;
The target data between the corresponding initial position mark of an identifier and end position mark is buried described in reading;
The target data is buried into the corresponding function name of identifier, function parameter or function as described in and returns to class Type.
Optionally, the value of the function name based on the target, function parameter, function return type, described in construction The test function of objective function, comprising:
The value of function name based on the objective function constructs the function name of the test function;
It is parsed by data interchange format JSON, obtains the corresponding all parameters of value of function parameter in the objective function Value, the function parameter of the test function is constructed by all parameter values;
Variable identical with the value of function return type of the objective function is set to receive and save the test letter Several function return values.
Optionally, the test code file for generating the objective function, comprising:
By the function name of the test function, function parameter, function return value and the printing function return value function The information of energy is written in the test code file.
The embodiment of the present application also provides a kind of generating means of function test code, and described device includes:
Dot element is buried, is buried a little for testing objective function setting function to be tested, the function test is buried a little as table Levy the position of each component part of the objective function;
Resolution unit, for burying the code source file for a little reading and parsing the objective function based on function test, Obtain the function name of the objective function, the value of function parameter, function return type;
Generation unit constructs institute for the value of function name, function parameter, function return type based on the target The test function of objective function is stated, and generates the test code file of the objective function.
Optionally, described to bury dot element, it is used for: respectively to the function name of the objective function, function parameter, return class Type setting function, which is tested, to be buried a little.
Optionally, the resolution unit, comprising:
Subelement is opened, for opening the source file of the objective function by document reading manner;
Subelement is obtained, for open source file to be converted to inlet flow, the function test is obtained from inlet flow Bury a little bury an identifier;
Reading subunit, for reading described bury between the corresponding initial position mark of an identifier and end position mark Target data;The target data is buried the corresponding function name of an identifier, function parameter or function to return as described in Return type.
Optionally, the generation unit, comprising:
Title constructs subelement, and the value for the function name based on the objective function constructs the letter of the test function Several titles;
Parametric configuration subelement obtains function in the objective function and joins for being parsed by data interchange format JSON The corresponding all parameter values of several values, the function parameter of the test function is constructed by all parameter values;
Return value constructs subelement, for variable identical with the value of function return type of the objective function to be arranged Receive and save the function return value of the test function.
Optionally, the generation unit, is also used to: the function name, function parameter, function of the test function are returned The information for being worth and printing the function return value function is written in the test code file.
Said one or multiple technical solutions in the embodiment of the present application at least have following one or more technology effects Fruit:
The embodiment of the present application provides a kind of generation method of function test code, and function is arranged to objective function to be tested Test is buried a little, and buries function name, function parameter and function the return class for reading and parsing objective function based on function test The value of type, and then test function and life are constructed according to the value of the function name of objective function, function parameter and function return type At test code file, automatically generating for test code is realized, it is no longer necessary to developer writes test code manually, thus It solves the low technical problem of testing efficiency in the process of application development of the prior art, improves testing efficiency.
Detailed description of the invention
Fig. 1 is the flow chart for the generation method that a kind of function provided by the embodiments of the present application tests code;
Fig. 2 is the flow chart of reading and parsing code source file provided by the embodiments of the present application;
Fig. 3 is the schematic diagram provided by the embodiments of the present application for generating test code file;
Fig. 4 is the generating means that a kind of function provided by the embodiments of the present application tests code.
Specific embodiment
In technical solution provided by the embodiments of the present application, buried by the way that function test is arranged to objective function to be tested Point to read and parse each component part of objective function, and constructs test function, life according to each component part of objective function It at test code file, realizes that test code automatically generates, solves in the prior art because caused by writing test code manually The low technical problem of testing efficiency.
With reference to the accompanying drawing to main realization principle, specific embodiment and its correspondence of the embodiment of the present application technical solution The beneficial effect that can reach is explained in detail.
Embodiment one
Referring to FIG. 1, the embodiment of the present application provides a kind of generation method of function test code, this method comprises:
S101: testing objective function setting function to be tested and bury a little, and the function test is buried a little as the characterization mesh The position of each component part of scalar functions;
S102: it is buried based on function test and a little reads and parse the code source file of the objective function, described in acquisition The value of the function name of objective function, function parameter, function return type;
S103: the value of function name, function parameter, function return type based on the target constructs the target letter Several test functions, and generate the test code file of the objective function.
In the specific implementation process, test code is automatically generated in order to side, S101 is first carried out in the embodiment of the present application It carries out burying a setting in source code.It is exactly to be added on function to bury an identifier beginning that setting function, which is tested and buried a little main, Test description information.Wherein, burying an identifier is for the variable of application program or the word of function where distinguishing objective function Symbol, and the operation of application program is not influenced, such as: variable or function etc. can not be used@beginning in Java grammer, then @conduct can be used in java applet and bury an identifier.It should be noted that the embodiment of the present application, which is not intended to limit, buries an identifier Concrete form, the programs of language are become using difference, can be used it is different bury an identifier, such as assume the # in C++ program It cannot be used for the beginning of variable or function, bury an identifier then can be used as using # in C++ program.
Below bury a little with to the trial function to be measured in source code in java applet under Junit unit testing frame For, it buries a setting to provided by the embodiments of the present application and is described in detail.
One function has generally comprised three component parts: 1, function name;2, function parameter;3, function return value, so right When function bury setting, function name, function parameter and function return type setting function can be tested respectively and be buried a little, A function can be accurately identified very much by the setting that the test of these three functions is buried a little, life is parsed to it in order to subsequent At corresponding test code.
Function test is buried a little for characterizing the position of each component part of objective function, comprising: is buried an identifier, is marked with burying Show symbol corresponding initial position mark and end position mark, such as :@funName:[function name] ,@funParam:[function Parameter] ,@return:[return type], " [" and "] " is respectively the corresponding initial position mark of@and end position mark, that is, is existed Target data in " [" and "] " is the function data for needing to be read out and parse.
A)@funName:[function name]
Buried in order to facilitate understanding and a little watch rule attentively, above-mentioned form is exemplified below :@funName:[addFun], expression pair The function (addFun is specific function name) of addFun carries out burying a note, and burying can a little solve behind function a little to burying Analyse and then generate the corresponding test code of the function.
B)@funParam:[function parameter]
Likewise, form is exemplified below :@funParam:[A], it indicates to carry out burying a note to parameter A, need to the ginseng Number A carries out parsing and generates corresponding test code.
Wherein by JSON, ((JavaScript Object Notation, is one to the function parameter in " [function parameter] " The data interchange format of kind of lightweight) form is described.JSON can very easily describe one or more object Specifying information.Very easily multiple parameters can be described clearly by JSON.
Such as: format below describes the information of Person parameter:
JSON character string above is explained as follows:
Param1:Param1 represents first parameter, and having several parameters is exactly param several.It is to the ginseng inside Param1 Several descriptions, the parameter in example in Param1 is Person.
Person: being a customization type, the content inside following Person is the description to Person, wherein retouching Having stated age (age) is 10 years old, and name (name) is tom, and height (height) is 180.
Param2:Param2 represents the second parameter for being passed to the function, this parameter only includes that a hobby becomes Amount, value is play.
C)@return:[return type]
If a function has return value so bury a little by@return sentence by the return value, such as :@ Return:[String], the declaration of will of the words function has return value, and return value is String type.
For the objective function being a little provided with is buried, executes S102 and read and parse the code source file of objective function, have Body implementation process is as follows:
Step 1, the source file that objective function is opened by document reading manner.
Wherein, it can specifically be realized by File class (Java language JDK included tool-class), such as: pass through calling File file=File (filePath) (File is method name, and filePath indicates the absolute path where file), energy It enough by the corresponding File Open of filePath, and is file by open file designation.
Open source file is converted to inlet flow by step 2, and function test is obtained from inlet flow and buries burying and to indicate a little Symbol.
Specifically, fileInputStream=new FileInputStream (file) can be used, file is converted It is named as fileInputStream as inlet flow, and by inlet flow) it is directed to inlet flow fileInputStream, it can adopt It goes to read a line in file line by line with readline method (functional based method for reading a full line of file corresponding to inlet flow) Information.Using read line by line be exactly recycle go to call the readline method in fileInputStream, and will read The data of current line are saved in the variable lineString of String type.
By calling contains ("@") method, (this method major function is to judge the character string in lineString In whether include this character string of@) come judge in current line whether comprising@this buries an identifier.If comprising@this Identifier, then continuing the data of reading next line, as shown in Figure 2.The data for reading next line are equally to call Readline method in fileInputStream.If containing this identifier of@executes step 3.
Step 3, reading bury the target data between the corresponding initial position mark of an identifier and end position mark.
Due to read this identifier, illustrate the information in this line comprising needing to parse.The step in then need Determine the position of identifier in lineString.In lineString can by call indexOf ("@") function come The location information of identifier@is positioned, this function major function is this character string position@returned in lineString Information (assuming that this position is indicated with pos1).Since this position pos1, then taken out by way of searching loop All data within first " [] " symbol next, as shown in Figure 2.Since this position pos1, a word is once taken out (using the string value of the function acquisition pos1 of charAt (pos1), in cyclic process 1) each positional value adds symbol, then sentences Break this character whether and " ["or"] ", the two characters are equal.If it is with " [" it is equal, then recording from that point on Subsequent data.If it is with "] " it is equal, then stopping recording data.Since at the mark of starting position, end position mark is arrived Terminate at knowledge, the data read are exactly the truthful data value for needing to obtain, i.e. target data.
Step 4, using target data as burying the corresponding function name of an identifier, function parameter or function return type Value.If@followed by character string be funName, then the target data in subsequent first " [] " symbol of@is The value of function name;If@followed by character string be funParam, then the target in subsequent first " [] " symbol of@ Data are then the value of function parameter;If@followed by character string be return, then in subsequent first " [] " symbol of@ Target data be then function return type value.
It should be understood that the embodiment of the present application is with funName come representative function title@in order to which subsequent descriptions are convenient The specific value information of funName;With returnValue come the specific value information of representative function return type return;With ParamValue carrys out the specific value information of representative function parameter funParam.
After S102, the value of function name of the S103 based on reading, function parameter, function return type, construction are executed The test function of objective function, and generate the test code file of objective function.
Referring to FIG. 3, the test function of construction objective function, specifically comprises the following steps:
S31: the function name of the value construction test function of the function name based on objective function.
It is funName that being had determined that by the parsing of S102 above, which needs objective function title to be tested, for Uniform Name The title that rule can construct test function is testfunName, is exactly before adding test before original function name Sew, main purpose is for clear test function function and Uniform Name rule.The embodiment of the present application is not intended to limit test letter The specific name of several function names, is also possible to t-funName, funNametest etc..
S32: being parsed by data interchange format JSON, obtains the corresponding all parameters of value of function parameter in objective function Value, the function parameter of test function is constructed by all parameter values.
Since function parameter is the JSON format of standard, (general technology) can be parsed by JSON, parsed All parameter values in paramValue, then construct the function parameter of test function according to the value parsed.Example Such as: the information of above-mentioned Person parameter, parsing the occurrence in Person includes: " age ": " 10 ", " name ": and " tom ", " Height ": 180, it is come out then instantiating Person object by the constructed fuction of Person.
S33: variable identical with the value of function return type of objective function is set to receive and save test function Function return value.
What the returned data that objective function is had confirmed that by returnValue is, to this end it is possible to use, same type Variable be received and saved in returnValue2 to the value of the return type of test function.Function return value is printed Come, by the printf System.println (" returnValue2 ") of system, (this function major function is printing, will Information in bracket prints on console), the return value of function is printed in console.
By the construction of above-mentioned test function, the function name, function parameter, function return value of test function are obtained, Next, generating the test code file of objective function.Specifically, by the function name, function parameter, letter of above-mentioned test function The information such as number return value and printing return value function are all written in file.The mode that file is written is to pass through FileWriter class (tool-class that JDK is provided) is completed.By the write function in calling FileWriter, (function is main Function is write information in file), corresponding information is written in file.
The operation that file is written is as follows:
1, FileWriter object is obtained by the constructed fuction of FileWriter class, constructed fuction (such as: FileWriter("C:\\demo1.java",false);) in need to transmit 2 parameters: first parameter: be need be written text The position of part, that is, the file being written;Second parameter: whether file continues (namely file appending write-in), if it is true It is exactly additional write-in, is exactly to restart to be written if it is false.
2, the constructed fuction of FileWriter obtains the FileWriter the inside object fw, fw after returning has one Write function, the major function of this function are write-in file operations.(such as: fw.write (" some information are written "), this Sample the content of double quotation marks will be written in file).
3, after file write-in finishes, there is a close function inside fw, after calling close function, system can be closed Close the resource occupation of corresponding file operation, the resources such as memory of releasing document read-write.
Automation, which is realized, in a kind of generation method of function test code provided through the foregoing embodiment generates test The function of code can greatly save the time that developer writes test code, greatly improve the survey in development process Try efficiency.
Based on the same inventive concept, generation method of the embodiment of the present application also based on above-mentioned function test code, correspondence mention For a kind of generating means of function test code, as shown in figure 4, the device includes:
Dot element 41 is buried, is buried a little for testing objective function setting function to be tested, the function test, which is buried, is a little Characterize the position of each component part of the objective function;
Resolution unit 42, for burying the code source document for a little reading and parsing the objective function based on function test Part obtains the function name of the objective function, the value of function parameter, function return type;
Generation unit 43, for the value of function name, function parameter, function return type based on the target, construction The test function of the objective function, and generate the test code file of the objective function.
In the specific implementation process, described to bury dot element 41, it is used for: the function name to the objective function, letter respectively Number parameter, return type setting function are tested and are buried a little.
The resolution unit 42 includes: to open subelement, obtain subelement and reading subunit.Subelement is opened for leading to Cross the source file that document reading manner opens the objective function;Subelement is obtained to be used to open source file being converted to input Stream, obtained from inlet flow function test bury a little bury an identifier;Reading subunit buries a mark described in being used to read Accord with the target data between corresponding initial position mark and end position mark;The target data is buried into a mark as described in Show the corresponding function name of symbol, function parameter or function return type.
The generation unit 43, comprising: title constructs subelement, parametric configuration subelement and return value and constructs subelement. Title construction subelement constructs the function name of the test function for the value of the function name based on the objective function;Ginseng For number construction subelement for being parsed by data interchange format JSON, the value for obtaining function parameter in the objective function is corresponding All parameter values are constructed the function parameter of the test function by all parameter values;Return value construction subelement is used for Variable identical with the value of function return type of the objective function is set to receive and save the function of the test function Return value.
The generation unit 43 generate test code file when, be specifically used for: by the function name of the test function, The information of function parameter, function return value and the printing function return value function is written in the test code file.
About the device in above-described embodiment, wherein each unit executes the concrete mode of operation in related this method Embodiment in be described in detail, no detailed explanation will be given here.
By one or more technical solutions in the embodiment of the present application, following one or more technology effects may be implemented Fruit:
The embodiment of the present application provides a kind of generation method of function test code, and function is arranged to objective function to be tested Test is buried a little, and buries function name, function parameter and function the return class for reading and parsing objective function based on function test The value of type, and then test function and life are constructed according to the value of the function name of objective function, function parameter and function return type At test code file, automatically generating for test code is realized, it is no longer necessary to developer writes test code manually, thus It solves the low technical problem of testing efficiency in the process of application development of the prior art, improves testing efficiency.
It should be understood by those skilled in the art that, the embodiment of the present invention can provide as method, system or computer program Product.Therefore, complete hardware embodiment, complete software embodiment or reality combining software and hardware aspects can be used in the present invention Apply the form of example.Moreover, it wherein includes the computer of computer usable program code that the present invention, which can be used in one or more, The computer program implemented in usable storage medium (including but not limited to magnetic disk storage, CD-ROM, optical memory etc.) produces The form of product.
The present invention be referring to according to the method for the embodiment of the present invention, the process of equipment (system) and computer program product Figure and/or block diagram describe.It should be understood that every one stream in flowchart and/or the block diagram can be realized by computer program instructions The combination of process and/or box in journey and/or box and flowchart and/or the block diagram.It can provide these computer programs Instruct the processor of general purpose computer, special purpose computer, Embedded Processor or other programmable data processing devices to produce A raw machine, so that being generated by the instruction that computer or the processor of other programmable data processing devices execute for real The device for the function of being specified in present one or more flows of the flowchart and/or one or more blocks of the block diagram.
These computer program instructions, which may also be stored in, is able to guide computer or other programmable data processing devices with spy Determine in the computer-readable memory that mode works, so that it includes referring to that instruction stored in the computer readable memory, which generates, Enable the manufacture of device, the command device realize in one box of one or more flows of the flowchart and/or block diagram or The function of being specified in multiple boxes.
These computer program instructions also can be loaded onto a computer or other programmable data processing device, so that counting Series of operation steps are executed on calculation machine or other programmable devices to generate computer implemented processing, thus in computer or The instruction executed on other programmable devices is provided for realizing in one or more flows of the flowchart and/or block diagram one The step of function of being specified in a box or multiple boxes.
Although preferred embodiments of the present invention have been described, it is created once a person skilled in the art knows basic Property concept, then additional changes and modifications may be made to these embodiments.So it includes excellent that the following claims are intended to be interpreted as It selects embodiment and falls into all change and modification of the scope of the invention.
Obviously, various changes and modifications can be made to the invention without departing from essence of the invention by those skilled in the art Mind and range.In this way, if these modifications and changes of the present invention belongs to the range of the claims in the present invention and its equivalent technologies Within, then the present invention is also intended to include these modifications and variations.

Claims (10)

1. a kind of generation method of function test code, which is characterized in that the described method includes:
Objective function setting function to be tested is tested and is buried a little, comprising: function name, function parameter and function are returned respectively Type setting function, which is tested, to be buried a little, and a little position to characterize each component part of objective function is buried in the function test;It is described It a little includes burying an identifier, identifying and end position mark with the corresponding initial position of an identifier of burying that function test, which is buried,;
The code source file for a little reading and parsing the objective function is buried based on function test, obtains the objective function Function name, function parameter, function return type value;
The value of function name, function parameter, function return type based on the target, constructs the test letter of the objective function Number, and generate the test code file of the objective function.
2. the method as described in claim 1, which is characterized in that described test objective function setting function is buried a little, comprising:
Function name, function parameter, return type the setting function of the objective function are tested respectively and buried a little.
3. method according to claim 2, which is characterized in that it is described to be buried a little based on function test, it reads and parses institute State the code source file of objective function, comprising:
The source file of the objective function is opened by document reading manner;
Open source file is converted into inlet flow, obtained from inlet flow function test bury a little bury an identifier;
The target data between the corresponding initial position mark of an identifier and end position mark is buried described in reading;
The target data is buried into the corresponding function name of identifier, function parameter or function return type as described in.
4. the method as described in claim 1, which is characterized in that the function name based on the target, function parameter, letter The value of number return type, constructs the test function of the objective function, comprising:
The value of function name based on the objective function constructs the function name of the test function;
It is parsed by data interchange format JSON, obtains the corresponding all parameter values of value of function parameter in the objective function, The function parameter of the test function is constructed by all parameter values;
Variable identical with the value of function return type of the objective function is set to receive and save the test function Function return value.
5. method as claimed in claim 4, which is characterized in that the test code file for generating the objective function, packet It includes:
By the function name of the test function, function parameter, function return value and the printing function return value function Information is written in the test code file.
6. a kind of generating means of function test code, which is characterized in that described device includes:
Dot element is buried, is buried a little for testing objective function setting function to be tested, comprising: respectively to function name, function Parameter and function return type setting function are tested and are buried a little, and the function test is buried a little as characterization each composition portion of objective function The position divided;Function test bury a little include bury an identifier, with it is described bury the corresponding initial position of an identifier identify and End position mark;
Resolution unit is obtained for being buried the code source file for a little reading and parsing the objective function based on function test The value of the function name of the objective function, function parameter, function return type;
Generation unit constructs the mesh for the value of function name, function parameter, function return type based on the target The test function of scalar functions, and generate the test code file of the objective function.
7. device as claimed in claim 6, which is characterized in that it is described to bury dot element, it is used for:
Function name, function parameter, return type the setting function of the objective function are tested respectively and buried a little.
8. device as claimed in claim 7, which is characterized in that the resolution unit, comprising:
Subelement is opened, for opening the source file of the objective function by document reading manner;
Subelement is obtained, for open source file to be converted to inlet flow, the function test is obtained from inlet flow and is buried a little Bury an identifier;
Reading subunit, for reading the mesh buried between the corresponding initial position mark of an identifier and end position mark Mark data;The target data is buried into the corresponding function name of identifier, function parameter or function as described in and returns to class Type.
9. device as claimed in claim 6, which is characterized in that the generation unit, comprising:
Title constructs subelement, and the value for the function name based on the objective function constructs the function name of the test function Claim;
Parametric configuration subelement obtains function parameter in the objective function for parsing by data interchange format JSON It is worth corresponding all parameter values, the function parameter of the test function is constructed by all parameter values;
Return value constructs subelement, receives for variable identical with the value of function return type of the objective function to be arranged And save the function return value of the test function.
10. device as claimed in claim 9, which is characterized in that the generation unit is also used to:
By the function name of the test function, function parameter, function return value and the printing function return value function Information is written in the test code file.
CN201610921921.0A 2016-10-21 2016-10-21 A kind of generation method and device of function test code Active CN106502896B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610921921.0A CN106502896B (en) 2016-10-21 2016-10-21 A kind of generation method and device of function test code

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610921921.0A CN106502896B (en) 2016-10-21 2016-10-21 A kind of generation method and device of function test code

Publications (2)

Publication Number Publication Date
CN106502896A CN106502896A (en) 2017-03-15
CN106502896B true CN106502896B (en) 2019-08-23

Family

ID=58318602

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610921921.0A Active CN106502896B (en) 2016-10-21 2016-10-21 A kind of generation method and device of function test code

Country Status (1)

Country Link
CN (1) CN106502896B (en)

Families Citing this family (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107133174A (en) * 2017-05-04 2017-09-05 浙江路港互通信息技术有限公司 Test case code automatically generating device and method
CN110471830B (en) * 2018-05-10 2022-06-21 武汉斗鱼网络科技有限公司 Program testing method and device and electronic equipment
CN108984612B (en) * 2018-06-12 2024-02-02 中国平安人寿保险股份有限公司 Method and device for acquiring target SQL statement, computer equipment and storage medium
CN110858172A (en) * 2018-08-23 2020-03-03 北京京东尚科信息技术有限公司 Automatic test code generation method and device
CN109542529B (en) * 2018-10-26 2022-04-05 深圳壹账通智能科技有限公司 Function name-based point burying method and device, computer equipment and storage medium
CN111190807B (en) * 2018-11-14 2023-08-18 杭州萤石软件有限公司 Buried point testing method and equipment
CN110209386B (en) * 2019-05-17 2023-07-21 北京奇艺世纪科技有限公司 Method for setting buried point of data, method and device for acquiring buried point data
CN111209195B (en) * 2019-12-30 2023-08-15 瑞庭网络技术(上海)有限公司 Method and device for generating test case
CN113139190A (en) * 2020-01-17 2021-07-20 Oppo广东移动通信有限公司 Program file detection method and device, electronic equipment and storage medium
CN111913888A (en) * 2020-09-09 2020-11-10 中移(杭州)信息技术有限公司 Function generation method, automatic test method, electronic device, and storage medium
CN113688031B (en) * 2021-07-15 2024-03-26 上海浦东发展银行股份有限公司 Test positioning method based on byte code enhancement technology
CN114328276B (en) * 2022-03-10 2022-05-20 北京车智赢科技有限公司 Test case generation method and device, and test case display method and device

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101802792A (en) * 2007-09-14 2010-08-11 空中客车运营简易股份公司 Method for automatic script generation for testing the validity of operational software of a system onboard and aircraft and device for implementing the same
CN102591777A (en) * 2012-01-10 2012-07-18 深圳市同洲视讯传媒有限公司 Unit test code generation method and device
CN103914370A (en) * 2012-12-31 2014-07-09 百度国际科技(深圳)有限公司 XML (Extensive Markup Language) configuration file based test method and device
CN104346278A (en) * 2014-09-28 2015-02-11 上海新炬网络技术有限公司 Matrix-model-based software testing method

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101802792A (en) * 2007-09-14 2010-08-11 空中客车运营简易股份公司 Method for automatic script generation for testing the validity of operational software of a system onboard and aircraft and device for implementing the same
CN102591777A (en) * 2012-01-10 2012-07-18 深圳市同洲视讯传媒有限公司 Unit test code generation method and device
CN103914370A (en) * 2012-12-31 2014-07-09 百度国际科技(深圳)有限公司 XML (Extensive Markup Language) configuration file based test method and device
CN104346278A (en) * 2014-09-28 2015-02-11 上海新炬网络技术有限公司 Matrix-model-based software testing method

Also Published As

Publication number Publication date
CN106502896A (en) 2017-03-15

Similar Documents

Publication Publication Date Title
CN106502896B (en) A kind of generation method and device of function test code
CN103902456B (en) Test script processing meanss, system and method
US9720811B2 (en) Unified model for visual component testing
US20030028856A1 (en) Method and apparatus for testing a software component using an abstraction matrix
CN104391786B (en) Webpage automatization test system and its method
US9417991B2 (en) Translation verification testing
CN106886509A (en) A kind of academic dissertation form automatic testing method
CN109871326A (en) A kind of method and apparatus that script is recorded
US8868976B2 (en) System-level testcase generation
CN104572463A (en) Method and device for testing interface information
US9304893B1 (en) Integrated software development and test case management system
CN110221959B (en) Application program testing method, device and computer readable medium
US20160224448A1 (en) Test generation using expected mode of the target hardware device
CN107015903A (en) A kind of generation method, device and the electronic equipment of interface detection program
US10823782B2 (en) Ensuring completeness of interface signal checking in functional verification
CN101770388A (en) Method and device for obtaining chip code information
CN115904989A (en) Interface testing method, device, equipment and readable storage medium
CN116955097A (en) Test flow display method and device and test flow display system
CN110018827A (en) Method, apparatus, electronic equipment and the readable storage medium storing program for executing of automatic code generating
CN111143228B (en) Test code generation method and device based on decision table method
CN110688823A (en) XML file verification method and device
CN115543832A (en) Software code standard detection method, system, equipment and storage medium
CN106469050B (en) A kind of case generation method, page generation method and device
CN114327614A (en) Method and application for recording and analyzing data flow of reference model
Su et al. Constructing a system knowledge graph of user tasks and failures from bug reports to support soap opera testing

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant