CN108446190A - interface test method and device - Google Patents

interface test method and device Download PDF

Info

Publication number
CN108446190A
CN108446190A CN201710084564.1A CN201710084564A CN108446190A CN 108446190 A CN108446190 A CN 108446190A CN 201710084564 A CN201710084564 A CN 201710084564A CN 108446190 A CN108446190 A CN 108446190A
Authority
CN
China
Prior art keywords
interface
tested
automatic test
test cases
data
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201710084564.1A
Other languages
Chinese (zh)
Other versions
CN108446190B (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.)
Hangzhou Hikvision Digital Technology Co Ltd
Original Assignee
Hangzhou Hikvision Digital 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 Hangzhou Hikvision Digital Technology Co Ltd filed Critical Hangzhou Hikvision Digital Technology Co Ltd
Priority to CN201710084564.1A priority Critical patent/CN108446190B/en
Publication of CN108446190A publication Critical patent/CN108446190A/en
Application granted granted Critical
Publication of CN108446190B publication Critical patent/CN108446190B/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/22Detection or location of defective computer hardware by testing during standby operation or during idle time, e.g. start-up testing
    • G06F11/2205Detection or location of defective computer hardware by testing during standby operation or during idle time, e.g. start-up testing using arrangements specific to the hardware being tested
    • G06F11/2221Detection or location of defective computer hardware by testing during standby operation or during idle time, e.g. start-up testing using arrangements specific to the hardware being tested to test input/output devices or peripheral units

Landscapes

  • Engineering & Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)
  • Tests Of Electronic Circuits (AREA)

Abstract

The embodiment of the invention discloses a kind of interface test method and devices, belong to field of computer technology.The method includes:The fabric interface data of interface to be tested are obtained, the fabric interface data of interface to be tested refer to the interface data according to the interface to be tested represented by pre-set specifications;Wherein, the interface data of interface to be tested is used to describe the essential information of interface to be tested;According to the fabric interface data of interface to be tested, executable automatic test cases are generated;Test interface is treated by automatic test cases to be tested, and test result is obtained.Technical solution provided in an embodiment of the present invention improves the efficiency that test case is write, and improves the efficiency of interface testing.

Description

Interface test method and device
Technical field
The present embodiments relate to field of computer technology, more particularly to a kind of interface test method and device.
Background technology
Currently, electronic equipment usually realizes various functions by interface.In order to ensure electronic equipment can realize its function, It is generally necessary to be verified with stability to the correctness of interface namely interface testing.
The interface test method that the prior art provides is as follows:Tester writes the corresponding test of interface to be tested and uses in advance Example, the corresponding interface requests message of the test case is sent to interface to be tested, and the response for receiving interface feedback to be tested disappears Breath determines test result according to the corresponding interface requests message of test case and response message.In practical applications, each connects Mouth is all corresponding with parameter, each parameter may have multiple values, each test case includes the value of all parameters.For Ensure that tester needs to write multiple test cases to the comprehensive of interface testing, so that multiple test case can be with Cover the combination of all parameter values.
Due to needing to write test case manually by tester in the prior art, when the parameter of interface is more, survey Examination personnel need to write dozens of even a test cases up to a hundred manually so that test case is write less efficient, and then is led Cause the less efficient of interface testing.
Invention content
In order to solve to need to write test case manually by tester in the prior art, the effect for causing test case to be write Rate is relatively low and the less efficient problem of interface testing, and an embodiment of the present invention provides a kind of interface test method and devices. The technical solution is as follows:
In a first aspect, a kind of interface test method is provided, the method includes:
Obtain the fabric interface data of interface to be tested, the fabric interface data of the interface to be tested refer to according to The interface data of the interface to be tested represented by pre-set specifications;Wherein, the interface data of the interface to be tested is for retouching State the essential information of the interface to be tested;
According to the fabric interface data of the interface to be tested, executable automatic test cases are generated;
The interface to be tested is tested by the automatic test cases, obtains test result.
Optionally, the fabric interface data of the interface to be tested include:At least one ginseng of the interface to be tested Each of number, the value example of each parameter, at least one value range of each parameter and each parameter take It is worth the corresponding expected results of range;
The fabric interface data according to the interface to be tested generate executable automatic test cases, packet It includes:
The value of the parameters of the interface to be tested is read from the fabric interface data of the interface to be tested Example, and executable automatic test cases template is generated according to the value example of the parameters;
The value of the parameters of the interface to be tested is read from the fabric interface data of the interface to be tested Range, and n test object is generated according to the value range of the parameters;Wherein, included by each test object For the practical value of parameters compared with the value example of the parameters, it is different that there are the values of a parameter, and the n is Integer more than 1;
Replace the value of parameters described in the automatic test cases template respectively using the n test object Example generates the n automatic test cases, and there are one expected results for each automatic test cases correspondence.
Optionally, the fabric interface data for obtaining interface to be tested, including:
Obtain the interface data of the interface to be tested;
According to the pre-set specifications, it converts the interface data of the interface to be tested to the structure of the interface to be tested Change interface data.
Optionally, described that the interface to be tested is tested by the automatic test cases, obtain test knot Fruit, including:
The automatic test cases are executed using automated test frame, it is corresponding to obtain the automatic test cases Implementing result;
For each automatic test cases, the corresponding implementing result of automatic test cases and expected knot Fruit obtains the corresponding test result of the automatic test cases.
Optionally, described that the interface to be tested is tested by the automatic test cases, obtain test knot After fruit, further include:
The corresponding test result of each automatic test cases is associated matching respectively, generates tape test knot The automatic test cases of fruit.
Second aspect, provides a kind of interface test device, and described device includes:
Data acquisition module, the fabric interface data for obtaining interface to be tested, the structure of the interface to be tested It refers to the interface data according to the interface to be tested represented by pre-set specifications to change interface data;Wherein, described to be measured to try The interface data of mouth is used to describe the essential information of the interface to be tested;
Use-case generation module, it is executable automatic for according to the fabric interface data of the interface to be tested, generating Change test case;
Interface testing module is tested the interface to be tested for passing through the automatic test cases, is obtained Test result.
Optionally, the fabric interface data of the interface to be tested include:At least one ginseng of the interface to be tested Each of number, the value example of each parameter, at least one value range of each parameter and each parameter take It is worth the corresponding expected results of range;
The use-case generation module, including:
Template generation unit, for reading the interface to be tested from the fabric interface data of the interface to be tested Parameters value example, and executable automatic test cases mould is generated according to the value example of the parameters Plate;
Object generation unit, for reading the interface to be tested from the fabric interface data of the interface to be tested Parameters value range, and according to the value range of the parameters generate n test object;Wherein, each The practical value of parameters included by test object is compared with the value example of the parameters, and there are parameters Value is different, and the n is the integer more than 1;
Use-case generation unit, for being replaced respectively in the automatic test cases template using the n test object The value example of the parameters, generates the n automatic test cases, each automatic test cases is corresponding with one A expected results.
Optionally, the data acquisition module, including:
Data capture unit, the interface data for obtaining the interface to be tested;
Data conversion unit, for according to the pre-set specifications, converting the interface data of the interface to be tested to institute State the fabric interface data of interface to be tested.
Optionally, the interface testing module, including:
Use-case execution unit is used to execute the automatic test cases using automated test frame, and acquisition is described certainly The corresponding implementing result of dynamicization test case;
As a result acquiring unit, for for each automatic test cases, the automatic test cases to correspond to Implementing result and expected results, obtain the corresponding test result of the automatic test cases.
Optionally, described device further includes:
Use-case update module, for being respectively associated the corresponding test result of each automatic test cases Matching, generates the automatic test cases of tape test result.
The advantageous effect that technical solution provided in an embodiment of the present invention is brought includes:
By obtaining the fabric interface data of interface to be tested, generated according to the fabric interface data of interface to be tested Executable automatic test cases, and then treat test interface by the automatic test cases and tested, it is tested As a result;Solve and need to write test case manually by tester in the prior art, cause the efficiency that test case is write compared with Low and interface testing less efficient problem;On the one hand, it writes, improves since test case can automate The efficiency that test case is write;On the other hand, since test case is executable automatic test cases, the automatic test Use-case is executable file, can automatically be executed by electronic equipment, therefore improve the efficiency of interface testing.
Description of the drawings
To describe the technical solutions in the embodiments of the present invention more clearly, make required in being described below to embodiment Attached drawing is briefly described, it should be apparent that, drawings in the following description are only some embodiments of the invention, for For those of ordinary skill in the art, without creative efforts, other are can also be obtained according to these attached drawings Attached drawing.
Fig. 1 is the flow chart of interface test method provided by one embodiment of the present invention;
Fig. 2 is the flow chart for the step 102 that embodiment illustrated in fig. 1 is related to;
Fig. 3 is the block diagram of interface test device provided by one embodiment of the present invention;
Fig. 4 is the block diagram for the interface test device that another embodiment of the present invention provides;
Fig. 5 is the block diagram of electronic equipment provided by one embodiment of the present invention.
Specific implementation mode
To make the object, technical solutions and advantages of the present invention clearer, below in conjunction with attached drawing to embodiment party of the present invention Formula is described in further detail.
In embodiments of the present invention, a kind of method for automating and writing test case is provided, to improve test case The efficiency write.Also, involved test case is executable automatic test cases in the embodiment of the present invention, this is automatic It is executable file to change test case, can automatically be executed by electronic equipment, therefore the efficiency of interface testing can also improve. Below by terms of the general character being related to based on invention described above embodiment, the embodiment of the present invention is carried out further specifically It is bright.
The executive agent of method provided in an embodiment of the present invention, each step can be electronic equipment.For example, the electronic equipment Can be PC (Personal Computer, personal computer), server etc..In addition, in embodiments of the present invention, to be measured The type of mouth of trying is not construed as limiting, and illustratively, interface to be tested is Web Service (network service) interface, HTTP (HyperText Transfer Protocol, hypertext transfer protocol) interface etc..
Referring to FIG. 1, it illustrates the flow charts of interface test method provided by one embodiment of the present invention.This method can To include the following steps.
Step 101, the fabric interface data of interface to be tested are obtained.
The fabric interface data of interface to be tested refer to the number of ports according to the interface to be tested represented by pre-set specifications According to.
Pre-set specifications refer to the specification set by the recognition rule according to electronic equipment.Optionally, pre-set specifications are bases The data type setting that electronic equipment can identify, for example, the data type that electronic equipment can identify is JSON (JavaScript Object Notation, a kind of data interchange format of lightweight) format, then pre-set specifications are by the interface of interface to be tested Data are expressed as JSON formats.
The interface data of interface to be tested is used to describe the essential information of interface to be tested.Optionally, interface to be tested Interface data can be read from the clean interface document of interface to be tested comprising the title of interface to be tested, address of service, The value example etc. of the parameter of interface to be tested, the explanation information of parameters and parameters.
Wherein, the address of service of interface to be tested is the corresponding URL of interface to be tested (Uniform Resource Locator, uniform resource locator) address, it is used to indicate the address for calling interface to be tested on the internet.The explanation of parameter Information includes the corresponding at least one value range of title, type, parameter and the corresponding expected knot of the value range of parameter Fruit and error code.Parameters corresponding parameter when can realize its function that the value example of parameters refers to interface to be tested Value, the value example of each parameter can be a specific numerical value, can also be a value range.
Optionally, the interface data of interface to be tested can also include precondition, operating procedure waiting test interface Other information, the embodiment of the present invention are treated the particular content included by the interface data of test interface and are not construed as limiting.
Optionally, step 101 includes following two sub-steps:
1, the interface data of interface to be tested is obtained;
2, according to pre-set specifications, the interface data of interface to be tested is converted to the fabric interface number of interface to be tested According to.
Electronic equipment obtains the interface data of interface to be tested in advance, then according to pre-set specifications, by interface to be tested Interface data is converted into the fabric interface data for the interface to be tested that electronic equipment can identify.
In a specific example, the interface data of interface to be tested can refer to table 1:
Table 1
In table 1, the corresponding address of service of interface to be tested, interface name, each parameter and the corresponding name of the parameter Title, data type, length and parameter declaration are required to be expressed as JSON formats.In a specific example, interface to be tested Including the list of parameter be expressed as JSON formats when, it is as a result as follows:Para_list=[" areajson ", " pagesize ", “start”,“threshold”].It should be noted that the conversion of structural data can be by manually performing, it can also be by electronics Equipment automatization executes.
Step 102, according to the fabric interface data of interface to be tested, executable automatic test cases are generated.
Test case is to verify one group of test input, the execution condition that the correctness of application program and stability are worked out And expected results, to test some application path or to verify whether meet some particular demands.In the prior art, it tests Use-case is write by tester, and electronic equipment is before being tested, it usually needs carries out corresponding lattice to test case Formula is converted.
Automatic test cases are the test cases that electronic equipment can execute automatically, that is, electronic equipment is being surveyed Before examination, do not need to do corresponding processing to automatic test cases.
In embodiments of the present invention, each automatic test cases correspond to one kind of a parameter in interface to be tested and take Value, electronic equipment executes automatic test cases automatically, to verify whether the corresponding parameter of automatic test cases can realize it Expected function, and then realize the test for treating test interface.
Electronic equipment can generate automatic test cases after getting the fabric interface data of interface to be tested, The automatic test cases can automatically be executed by electronic equipment, need a large amount of people to solve interface testing in the prior art The problem of work intervention, caused interface testing inefficiency, can reduce the cost of labor of interface testing, improve interface testing Efficiency.
Automatic test use is generated to electronic equipment below in conjunction with the particular content of the structural data of interface to be tested The step of example, is explained.
Optionally, the fabric interface data of interface to be tested include:At least one parameter of interface to be tested, each Each value range pair of the value example of parameter, at least one value range of each parameter and each parameter The expected results answered.
Wherein, at least one parameter of interface to be tested refers to all parameters of interface to be tested, the ginseng of each parameter Numerical value is corresponding with multiple value ranges, each value range is corresponded to there are one expected results, which can be to be measured It is directly obtained in the parameter interpretation information in the interface data of mouth of trying.For example, there are a parameter names to be for interface to be tested The parameter type of the parameter of Pagesize, the parameter is int, and corresponding value range can be with reference table 2 with expected results:
Table 2
Optionally, step 102 includes following three sub-step:
Step 102a reads the value of the parameters of interface to be tested from the fabric interface data of interface to be tested Example, and executable automatic test cases template is generated according to the value example of parameters.
Electronic equipment obtains each parameter of interface to be tested from the fabric interface data of interface to be tested first Value example, then according to the value example of parameters generate automatic test cases template.Wherein, which surveys Example template on probation can automatically execute under automated test frame.
Automated test frame be by one or more automatic test basic modules, automatic test management module, from The tool set of the compositions such as dynamicization test statistics module.Automatic test cases are used for tissue, management, execution automatic test Example.Optionally, automated test frame is Robot framework (frame).
Step 102b reads the value of the parameters of interface to be tested from the fabric interface data of interface to be tested Range, and n test object is generated according to the value range of parameters, n is the integer more than 1.
Wherein, the value example phase of the practical value of the parameters included by each test object and parameters Than it is different that there are the values of a parameter.
Test object includes one group of parameter value of whole parameters of interface to be tested, the test object that electronic equipment generates with There are the corresponding parameter value of a parameter is different for the value example of parameters, wherein the value of test object and parameters Different parameter values is determined according to the value range of parameters in example.
Step 102c, the value for being replaced parameters in automatic test cases template respectively using n test object are shown Example generates n automatic test cases.
There are one expected results for each automatic test cases correspondence.Expected results are used to indicate electronic equipment and execute certainly The expected result obtained after dynamicization test case.
The method that electronic equipment generates automatic test cases generates the side of automatic test cases template with electronic equipment Method is identical, wherein the parameter value of the parameters in test object is replaced to the value of the parameters of automation use-case template Example is to get to executable automatic test cases.
Optionally, electronic equipment sequentially generates the corresponding automatic test of test object according to the genesis sequence of test object Use-case, also, after generating the corresponding automatic test cases of a test object, whether electronic equipment detects the test object It is the last one corresponding test object of interface to be tested.If the test object is not the last one corresponding survey of interface to be tested Object is tried, then electronic equipment continues to generate the corresponding automatic test cases of next test object;If the test object is to wait for The last one corresponding test object of test interface, then electronic equipment start the implementation procedure to automatic test cases.
Step 103, it treats test interface by automatic test cases to be tested, obtains test result.
Electronic equipment executes automatic test cases using the order that automated test frame provides, to realize to be tested The test of interface.
Optionally, step 103 includes two following sub-steps:
1, automatic test cases are executed using automated test frame, obtains that automatic test cases are corresponding executes knot Fruit;
Optionally, automated test frame pre-sets at least one order, for example, the order can start test etc. Deng the order that electronic equipment is provided by executing automated test frame, to execute the test for treating test interface.
2, for each automatic test cases, compare the corresponding implementing result of automatic test cases and expected knot Fruit obtains the corresponding test result of automatic test cases.
Electronic equipment is asserted after the implementing result for obtaining automatic test cases using at least one (assertion) the corresponding implementing result of automatic test cases and expected results are compared, obtain automatic test use The corresponding test result of example.Wherein, assert and be expressed as a kind of Boolean expression, be usually applied to the source program of application program into Row test.
If implementing result is inconsistent with expected results, the corresponding test result of automatic test cases be do not pass through, if Implementing result is consistent with expected results, then the corresponding test result of automatic test cases is to pass through.
Optionally, electronic equipment can execute automatic test use successively according to the genesis sequence of automatic test cases Example, also, after having executed an automatic test cases, electronic equipment detects whether the automatic test cases are to be tested The last one corresponding automatic test cases of interface.If the automatic test cases be not interface to be tested it is corresponding last A automatic test cases, then electronic equipment continue to execute next automatic test cases;If the automatic test cases are The last one corresponding automatic test cases of interface to be tested, then execution of the electronic equipment stopping to automatic test cases, And generate the corresponding test result file of interface to be tested.The test result file can be HTML (HyperText Markup Language, hypertext markup language) format, or XML (Extensible Markup Language, expansible mark Remember language) format, the corresponding test result of whole automatic test cases for describing interface to be tested.
Optionally, test result file includes two parts.First part is for showing that any one automatic test is used The test result of example, second part include that each automatic test is used for showing automatic test cases list, list The number of example.
Optionally, the test result of automatic test cases includes the title (Full of above-mentioned automatic test cases Name), resource path (Source), testing time, (such as initial time (Start), executed duration at the end time (End) (Elapsed)), state (Status) etc..Wherein, resource path is used to indicate the test result of the automatic test cases in electricity Store path in sub- equipment.Testing time include electronic equipment execute the automatic test cases initial time, at the end of Between and execute duration.State is used to indicate the test result of the automatic test cases, the test result include by with mistake Lose two states.In a specific example, test result is as follows for automatic test cases:
Title:WIFIBIGDATA v2.0.02general Query Macs Tracks
Resource path:E:\Auto Test\cases_pool\WIFIBIGDATA v2.0\02_general Query Macs Tracks.txt
Initial time/end time/execution duration:20160704 16:23:22.156/20160704 16:23: 44.633/00:00:22.477
State:60 decisive tests, 59 pass through, 1 failure
60 tests, 59 pass through, 1 failure
Optionally, the content that the first part in test result file shows can change according to trigger signal.Than Such as, when the number of any one automatic test cases gets trigger signal, the first part of test result file then can Redirect the corresponding test result of the above-mentioned automatic test cases of display.
In conclusion method provided in an embodiment of the present invention, by obtaining the fabric interface data of interface to be tested, root Executable automatic test cases are generated according to the fabric interface data of interface to be tested, and then are used by the automatic test Example is treated test interface and is tested, and test result is obtained;It solves and needs to write survey manually by tester in the prior art Example on probation, less efficient and interface testing the less efficient problem for causing test case to be write;On the one hand, due to surveying Example on probation can be automated and be write, therefore improve the efficiency that test case is write;On the other hand, since test case is can to hold Capable automatic test cases, the automatic test cases are executable files, can automatically be executed by electronic equipment, therefore Improve the efficiency of interface testing.
In addition, due to the parameter type for having preset various parameters in automated test frame and its corresponding test , therefore provide unified specification for test distinct interface.
Further include as follows after step 103 in an optional embodiment provided based on embodiment illustrated in fig. 1 Step:The corresponding test result of each automatic test cases is associated matching respectively, generates tape test result Automatic test cases.
Not only included automatic test cases in the automatic test cases of tape test result, but also including automatic test cases Corresponding test result.Optionally, the automatic test cases of tape test result include the title, preposition of automatic test cases Condition, execution step, expected results and implementing result etc..
Optionally, electronic equipment is after having executed all automatic test cases, according in automatic test cases Characteristic information in characteristic information test result corresponding with the automatic test cases in test result file is associated Match.Wherein, for characteristic information for identifying automatic test cases, characteristic information can be the number of automatic test cases, work( Energy, executes step and expected results etc. at precondition.
In a kind of possible embodiment, after the completion of matching, electronic equipment by each automatic test cases and The corresponding test result of each automatic test cases is written with test case template pattern in document, you can obtains tape test As a result automatic test cases.Wherein, test case template pattern is used to describe the specification pattern of document, for example, test is used Example formwork style defines background colour, frame, font of document element lattice etc..
In alternatively possible embodiment, after the completion of matching, electronic equipment by each automatic test cases with And the corresponding test result of each automatic test cases is with CSV (Comma-Separated Values, comma separated value) Format is written in document, you can obtains the automatic test cases of tape test result.
In conclusion method provided in an embodiment of the present invention, by automatic test cases and its corresponding test knot Fruit is matched, and then automatically generates the automatic test cases of tape test result, is avoided by tester to test result Analysis and arrangement is carried out, cost of labor is further saved.
Following is apparatus of the present invention embodiment, can be used for executing the method for the present invention embodiment.For apparatus of the present invention reality Undisclosed details in example is applied, the method for the present invention embodiment is please referred to.
Referring to FIG. 3, it illustrates the block diagrams of interface test device provided by one embodiment of the present invention.The device has Realize that the exemplary function of the above method, the function can also be executed corresponding software realization by hardware realization by hardware. The device may include:Data acquisition module 301, use-case generation module 302 and interface testing module 303.
Data acquisition module 301, the fabric interface data for obtaining interface to be tested, the knot of the interface to be tested Structure interface data refers to the interface data according to the interface to be tested represented by pre-set specifications;Wherein, described to be tested The interface data of interface is used to describe the essential information of the interface to be tested.
Use-case generation module 302, for according to the fabric interface data of the interface to be tested, generate it is executable from Dynamicization test case.
Interface testing module 303 is tested the interface to be tested for passing through the automatic test cases, is obtained To test result.
In conclusion device provided in an embodiment of the present invention, by obtaining the fabric interface data of interface to be tested, root Executable automatic test cases are generated according to the fabric interface data of interface to be tested, and then are used by the automatic test Example is treated test interface and is tested, and test result is obtained;It solves and needs to write survey manually by tester in the prior art Example on probation, less efficient and interface testing the less efficient problem for causing test case to be write;On the one hand, due to surveying Example on probation can be automated and be write, therefore improve the efficiency that test case is write;On the other hand, since test case is can to hold Capable automatic test cases, the automatic test cases are executable files, can automatically be executed by electronic equipment, therefore Improve the efficiency of interface testing.
In the alternative embodiment provided based on embodiment illustrated in fig. 3, referring to FIG. 4, the interface to be tested Fabric interface data include:At least one parameter of the interface to be tested, the value example of each parameter, each ginseng The corresponding expected results of each value range of several at least one value ranges and each parameter.
The use-case generation module 302, including:Template generation unit 302a, object generation unit 302b and use-case generate Unit 302c.
Template generation unit 302a, it is described to be tested for being read from the fabric interface data of the interface to be tested The value example of the parameters of interface, and executable automatic test is generated according to the value example of the parameters and is used Example template.
Object generation unit 302b, it is described to be tested for being read from the fabric interface data of the interface to be tested The value range of the parameters of interface, and n test object is generated according to the value range of the parameters;Wherein, often The practical value of parameters included by one test object is compared with the value example of the parameters, and there are a ginsengs Several values is different, and the n is the integer more than 1.
Use-case generation unit 302c, for replacing the automatic test cases mould respectively using the n test object The value example of parameters described in plate, generates the n automatic test cases, each automatic test cases corresponds to There are one expected results.
In another alternative embodiment provided based on embodiment illustrated in fig. 3, referring to FIG. 4, the data acquisition mould Block 301, including:Data capture unit 301a and data conversion unit 301b.
Data capture unit 301a, the interface data for obtaining the interface to be tested.
Data conversion unit 301b, for according to the pre-set specifications, the interface data of the interface to be tested to be converted For the fabric interface data of the interface to be tested.
In another alternative embodiment provided based on embodiment illustrated in fig. 3, referring to FIG. 4, the interface testing mould Block 303, including:Use-case execution unit 303a and result acquiring unit 303b.
Use-case execution unit 303a obtains institute for executing the automatic test cases using automated test frame State the corresponding implementing result of automatic test cases.
As a result acquiring unit 303b, for for each automatic test cases, the automatic test cases Corresponding implementing result and expected results obtain the corresponding test result of the automatic test cases.
In the alternative embodiment provided based on embodiment illustrated in fig. 3, referring to FIG. 4, described device further includes:With Example update module 304.
Use-case update module 304, for respectively carrying out the corresponding test result of each automatic test cases Association matching, generates the automatic test cases of tape test result.
It should be noted that:The device that above-described embodiment provides is when realizing its function, only with above-mentioned each function module It divides and for example, in practical application, can be completed as needed and by above-mentioned function distribution by different function modules, The internal structure of equipment is divided into different function modules, to complete all or part of the functions described above.In addition, The device and method embodiment that above-described embodiment provides belongs to same design, and specific implementation process refers to embodiment of the method, this In repeat no more.
Referring to FIG. 5, it illustrates the structural schematic diagrams of electronic equipment provided by one embodiment of the present invention.The electronics is set It is ready for use on the interface test method for implementing to be provided in above-described embodiment.Specifically:
The electronic equipment 500 includes 502 He of central processing unit (CPU) 501 including random access memory (RAM) The system storage 504 of read-only memory (ROM) 503, and connection system storage 504 and central processing unit 501 be System bus 505.The electronic equipment 500 further include help computer in each device between transmission information it is basic input/ Output system (I/O systems) 506, and for the great Rong of storage program area 513, application program 514 and other program modules 515 Measure storage device 507.
The basic input/output 506 includes display 508 for showing information and inputs letter for user The input equipment 509 of such as mouse, keyboard etc of breath.The wherein described display 508 and input equipment 509 are all by being connected to The input and output controller 510 of system bus 505 is connected to central processing unit 501.The basic input/output 506 Can also include input and output controller 510 for receive and handle from keyboard, mouse or electronic touch pen etc. it is multiple its The input of his equipment.Similarly, input and output controller 510 also provides output to display screen, printer or other kinds of defeated Go out equipment.
The mass-memory unit 507 is by being connected to the bulk memory controller (not shown) of system bus 505 It is connected to central processing unit 501.The mass-memory unit 507 and its associated computer-readable medium set for electronics Standby 500 provide non-volatile memories.That is, the mass-memory unit 507 may include such as hard disk or CD- The computer-readable medium (not shown) of ROM drive etc.
Without loss of generality, the computer-readable medium may include computer storage media and communication media.Computer Storage medium includes information such as computer-readable instruction, data structure, program module or other data for storage The volatile and non-volatile of any method or technique realization, removable and irremovable medium.Computer storage media includes RAM, ROM, EPROM, EEPROM, flash memory or other solid-state storages its technologies, CD-ROM, DVD or other optical storages, tape Box, tape, disk storage or other magnetic storage apparatus.Certainly, skilled person will appreciate that the computer storage media It is not limited to above-mentioned several.Above-mentioned system storage 504 and mass-memory unit 507 may be collectively referred to as memory.
According to various embodiments of the present invention, the electronic equipment 500 can also pass through the network connections such as internet Remote computer operation on to network.Namely electronic equipment 500 can be by the network that is connected on the system bus 505 Interface unit 511 is connected to network 512, in other words, other kinds of net can also be connected to using Network Interface Unit 511 Network or remote computer system (not shown).
The memory further includes that one or more than one program, the one or more programs are stored in In memory, and it is configured to be executed by one or more than one processor.Said one or more than one program include Instruction for executing above-mentioned interface test method.
It should be understood that referenced herein " multiple " refer to two or more."and/or", description association The incidence relation of object indicates may exist three kinds of relationships, for example, A and/or B, can indicate:Individualism A, exists simultaneously A And B, individualism B these three situations.It is a kind of relationship of "or" that character "/", which typicallys represent forward-backward correlation object,.
The embodiments of the present invention are for illustration only, can not represent the quality of embodiment.
One of ordinary skill in the art will appreciate that realizing that all or part of step of above-described embodiment can pass through hardware It completes, relevant hardware can also be instructed to complete by program, the program can be stored in a kind of computer-readable In storage medium, storage medium mentioned above can be read-only memory, disk or CD etc..
The foregoing is merely presently preferred embodiments of the present invention, is not intended to limit the invention, it is all the present invention spirit and Within principle, any modification, equivalent replacement, improvement and so on should all be included in the protection scope of the present invention.

Claims (10)

1. a kind of interface test method, which is characterized in that the method includes:
The fabric interface data of interface to be tested are obtained, the fabric interface data of the interface to be tested refer to according to default The interface data of the interface to be tested represented by specification;Wherein, the interface data of the interface to be tested is for describing institute State the essential information of interface to be tested;
According to the fabric interface data of the interface to be tested, executable automatic test cases are generated;
The interface to be tested is tested by the automatic test cases, obtains test result.
2. according to the method described in claim 1, it is characterized in that, the fabric interface data of the interface to be tested include: At least one value model of at least one parameter of the interface to be tested, the value example of each parameter, each parameter It encloses and the corresponding expected results of each value range of each parameter;
The fabric interface data according to the interface to be tested generate executable automatic test cases, including:
The value example of the parameters of the interface to be tested is read from the fabric interface data of the interface to be tested, And executable automatic test cases template is generated according to the value example of the parameters;
The value range of the parameters of the interface to be tested is read from the fabric interface data of the interface to be tested, And n test object is generated according to the value range of the parameters;Wherein, each ginseng included by each test object For several practical values compared with the value example of the parameters, it is different that there are the values of a parameter, and the n is more than 1 Integer;
The value for being replaced parameters described in the automatic test cases template respectively using the n test object is shown Example generates the n automatic test cases, and there are one expected results for each automatic test cases correspondence.
3. according to the method described in claim 1, it is characterized in that, the fabric interface data for obtaining interface to be tested, Including:
Obtain the interface data of the interface to be tested;
According to the pre-set specifications, the structuring for converting the interface data of the interface to be tested to the interface to be tested connects Mouth data.
4. according to the method described in claim 1, it is characterized in that, it is described by the automatic test cases to described to be measured Mouth of trying is tested, and test result is obtained, including:
The automatic test cases are executed using automated test frame, obtain the corresponding execution of the automatic test cases As a result;
For each automatic test cases, the corresponding implementing result of the automatic test cases and expected results, Obtain the corresponding test result of the automatic test cases.
5. method according to any one of claims 1 to 4, which is characterized in that described to pass through the automatic test cases The interface to be tested is tested, after obtaining test result, further includes:
The corresponding test result of each automatic test cases is associated matching respectively, generates tape test result Automatic test cases.
6. a kind of interface test device, which is characterized in that described device includes:
The structuring of data acquisition module, the fabric interface data for obtaining interface to be tested, the interface to be tested connects Mouth data refer to the interface data according to the interface to be tested represented by pre-set specifications;Wherein, the interface to be tested Interface data is used to describe the essential information of the interface to be tested;
Use-case generation module generates executable automation and surveys for the fabric interface data according to the interface to be tested Example on probation;
Interface testing module is tested the interface to be tested for passing through the automatic test cases, is tested As a result.
7. device according to claim 6, which is characterized in that the fabric interface data of the interface to be tested include: At least one value model of at least one parameter of the interface to be tested, the value example of each parameter, each parameter It encloses and the corresponding expected results of each value range of each parameter;
The use-case generation module, including:
Template generation unit, for reading each of the interface to be tested from the fabric interface data of the interface to be tested The value example of a parameter, and executable automatic test cases template is generated according to the value example of the parameters;
Object generation unit, for reading each of the interface to be tested from the fabric interface data of the interface to be tested The value range of a parameter, and n test object is generated according to the value range of the parameters;Wherein, each is tested The practical value of parameters included by object is compared with the value example of the parameters, and there are the values of a parameter Difference, the n are the integer more than 1;
Use-case generation unit, for being replaced respectively described in the automatic test cases template using the n test object The value example of parameters generates the n automatic test cases, and there are one pre- for each automatic test cases correspondence Phase result.
8. device according to claim 6, which is characterized in that the data acquisition module, including:
Data capture unit, the interface data for obtaining the interface to be tested;
Data conversion unit, for according to the pre-set specifications, converting the interface data of the interface to be tested to described wait for The fabric interface data of test interface.
9. device according to claim 6, which is characterized in that the interface testing module, including:
Use-case execution unit obtains the automation for executing the automatic test cases using automated test frame The corresponding implementing result of test case;
As a result acquiring unit, for for each automatic test cases, the automatic test cases are corresponding to be held Row result and expected results obtain the corresponding test result of the automatic test cases.
10. according to claim 6 to 9 any one of them device, which is characterized in that described device further includes:
Use-case update module, for being respectively associated the corresponding test result of each automatic test cases Match, generates the automatic test cases of tape test result.
CN201710084564.1A 2017-02-16 2017-02-16 Interface test method and device Active CN108446190B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710084564.1A CN108446190B (en) 2017-02-16 2017-02-16 Interface test method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710084564.1A CN108446190B (en) 2017-02-16 2017-02-16 Interface test method and device

Publications (2)

Publication Number Publication Date
CN108446190A true CN108446190A (en) 2018-08-24
CN108446190B CN108446190B (en) 2021-08-17

Family

ID=63190735

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710084564.1A Active CN108446190B (en) 2017-02-16 2017-02-16 Interface test method and device

Country Status (1)

Country Link
CN (1) CN108446190B (en)

Cited By (17)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109254920A (en) * 2018-09-06 2019-01-22 上海精数信息科技有限公司 Interface testing case generation method, device, electronic equipment, storage medium
CN109298882A (en) * 2018-09-26 2019-02-01 深圳壹账通智能科技有限公司 Management method, computer readable storage medium and the terminal device of interface
CN109446068A (en) * 2018-09-26 2019-03-08 平安健康保险股份有限公司 Interface test method, device, computer equipment and storage medium
CN109522210A (en) * 2018-09-29 2019-03-26 中国平安人寿保险股份有限公司 Interface testing parameters analysis method, device, electronic device and storage medium
CN109739701A (en) * 2018-12-14 2019-05-10 北京奇安信科技有限公司 Interface test method and device
CN109766231A (en) * 2019-01-11 2019-05-17 未来电视有限公司 Interface test method and device
CN109766262A (en) * 2018-12-15 2019-05-17 深圳壹账通智能科技有限公司 Interface data processing method, automated testing method, device, equipment and medium
CN109992508A (en) * 2019-03-22 2019-07-09 恒生电子股份有限公司 Test exemple automation generation method, device and electronic equipment
CN110609791A (en) * 2019-09-03 2019-12-24 深圳证券交易所 Interface test method, interface test device and storage medium for bidding system
CN110647471A (en) * 2019-09-26 2020-01-03 招商局金融科技有限公司 Interface test case generation method, electronic device and storage medium
CN111083007A (en) * 2019-11-21 2020-04-28 京信通信系统(中国)有限公司 Test method, test device, computer equipment and storage medium
CN111078526A (en) * 2019-11-04 2020-04-28 泰康保险集团股份有限公司 Test case generation method and device and storage medium
CN111198809A (en) * 2018-11-16 2020-05-26 北京奇虎科技有限公司 Interface automation test method and device
CN111352825A (en) * 2018-12-21 2020-06-30 北京金山云网络技术有限公司 Data interface test method and device and server
CN111581083A (en) * 2020-04-26 2020-08-25 北京字节跳动网络技术有限公司 Interface testing method and device, electronic equipment and storage medium
CN112035363A (en) * 2020-09-01 2020-12-04 中国银行股份有限公司 Automatic interface testing method and device
CN112100078A (en) * 2020-09-27 2020-12-18 中国建设银行股份有限公司 Method, device and equipment for generating interface test case

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6880109B2 (en) * 2001-07-03 2005-04-12 The United States Of America As Represented By The Secretary Of The State Functional element test tool and method
US20080295076A1 (en) * 2007-05-23 2008-11-27 Microsoft Corporation Graphical user interface testing
CN102694701A (en) * 2012-06-13 2012-09-26 青岛海信传媒网络技术有限公司 Testing method and system based on message
CN103064788A (en) * 2012-12-24 2013-04-24 清华大学 Web service modeling and test method based on interface semantic contract model
CN106095673A (en) * 2016-06-07 2016-11-09 深圳市泰久信息系统股份有限公司 Automated testing method based on WEB interface and system
CN106354634A (en) * 2016-08-25 2017-01-25 青岛海信传媒网络技术有限公司 Interface testing method and device

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6880109B2 (en) * 2001-07-03 2005-04-12 The United States Of America As Represented By The Secretary Of The State Functional element test tool and method
US20080295076A1 (en) * 2007-05-23 2008-11-27 Microsoft Corporation Graphical user interface testing
CN102694701A (en) * 2012-06-13 2012-09-26 青岛海信传媒网络技术有限公司 Testing method and system based on message
CN103064788A (en) * 2012-12-24 2013-04-24 清华大学 Web service modeling and test method based on interface semantic contract model
CN106095673A (en) * 2016-06-07 2016-11-09 深圳市泰久信息系统股份有限公司 Automated testing method based on WEB interface and system
CN106354634A (en) * 2016-08-25 2017-01-25 青岛海信传媒网络技术有限公司 Interface testing method and device

Cited By (20)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109254920A (en) * 2018-09-06 2019-01-22 上海精数信息科技有限公司 Interface testing case generation method, device, electronic equipment, storage medium
CN109298882A (en) * 2018-09-26 2019-02-01 深圳壹账通智能科技有限公司 Management method, computer readable storage medium and the terminal device of interface
CN109446068A (en) * 2018-09-26 2019-03-08 平安健康保险股份有限公司 Interface test method, device, computer equipment and storage medium
CN109446068B (en) * 2018-09-26 2024-04-05 平安健康保险股份有限公司 Interface test method, device, computer equipment and storage medium
CN109522210A (en) * 2018-09-29 2019-03-26 中国平安人寿保险股份有限公司 Interface testing parameters analysis method, device, electronic device and storage medium
CN111198809A (en) * 2018-11-16 2020-05-26 北京奇虎科技有限公司 Interface automation test method and device
CN109739701A (en) * 2018-12-14 2019-05-10 北京奇安信科技有限公司 Interface test method and device
CN109766262A (en) * 2018-12-15 2019-05-17 深圳壹账通智能科技有限公司 Interface data processing method, automated testing method, device, equipment and medium
CN111352825A (en) * 2018-12-21 2020-06-30 北京金山云网络技术有限公司 Data interface test method and device and server
CN109766231A (en) * 2019-01-11 2019-05-17 未来电视有限公司 Interface test method and device
CN109992508A (en) * 2019-03-22 2019-07-09 恒生电子股份有限公司 Test exemple automation generation method, device and electronic equipment
CN110609791A (en) * 2019-09-03 2019-12-24 深圳证券交易所 Interface test method, interface test device and storage medium for bidding system
CN110647471A (en) * 2019-09-26 2020-01-03 招商局金融科技有限公司 Interface test case generation method, electronic device and storage medium
CN111078526A (en) * 2019-11-04 2020-04-28 泰康保险集团股份有限公司 Test case generation method and device and storage medium
CN111083007A (en) * 2019-11-21 2020-04-28 京信通信系统(中国)有限公司 Test method, test device, computer equipment and storage medium
CN111581083B (en) * 2020-04-26 2024-02-09 抖音视界有限公司 Interface testing method and device, electronic equipment and storage medium
CN111581083A (en) * 2020-04-26 2020-08-25 北京字节跳动网络技术有限公司 Interface testing method and device, electronic equipment and storage medium
CN112035363A (en) * 2020-09-01 2020-12-04 中国银行股份有限公司 Automatic interface testing method and device
CN112100078A (en) * 2020-09-27 2020-12-18 中国建设银行股份有限公司 Method, device and equipment for generating interface test case
CN112100078B (en) * 2020-09-27 2024-05-03 中国建设银行股份有限公司 Method, device and equipment for generating interface test case

Also Published As

Publication number Publication date
CN108446190B (en) 2021-08-17

Similar Documents

Publication Publication Date Title
CN108446190A (en) interface test method and device
US8918760B2 (en) Test script generation for application image validation
CN110532169A (en) Interface testing case generation method, device, computer equipment and storage medium
US8875102B1 (en) Multiple browser architecture and method
US20150100296A1 (en) Method and system for automated test and result comparison
CN107526676B (en) Cross-system test method and device
CN110019116B (en) Data tracing method, device, data processing equipment and computer storage medium
CN108923997B (en) Cloud service node automatic testing method and device based on python
CN109933509A (en) A kind of method and apparatus for realizing automatic test defect management
WO2015154474A1 (en) Query interface generation method and device
Avdeenko et al. The ontology-based approach to support the completeness and consistency of the requirements specification
Wahler et al. CAST: Automating software tests for embedded systems
US20200293592A1 (en) Methods and systems for browser extension used to generate relative xpath, absolute xpath and/or css selectors
US11615016B2 (en) System and method for executing a test case
Rodrigues et al. Pletsperf-a model-based performance testing tool
JP2013235398A (en) Program analysis device, method, and program
CN108334443A (en) Generate method, apparatus, equipment and the computer readable storage medium of test case
Strandberg Automated system level software testing of networked embedded systems
Deng et al. Trace4PF: A tool for Automated Decomposition of Problem Diagrams with Traceability.
Requardt et al. Modular system architecture for processing of CIM
Derr Ns-3 web-based user interface: Power grid communications planning and modeling tool
CN107894940A (en) A kind of log analysis device and method
CN117056175B (en) Data processing method, device, electronic equipment and storage medium
WO2024001594A1 (en) Operator development method and apparatus, operator processing method and apparatus, and electronic device, system and storage medium
Kaushik et al. Critical review on test case generation systems and techniques

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
GR01 Patent grant
GR01 Patent grant