CN108733554A - Mock method and apparatus - Google Patents
Mock method and apparatus Download PDFInfo
- Publication number
- CN108733554A CN108733554A CN201710266212.8A CN201710266212A CN108733554A CN 108733554 A CN108733554 A CN 108733554A CN 201710266212 A CN201710266212 A CN 201710266212A CN 108733554 A CN108733554 A CN 108733554A
- Authority
- CN
- China
- Prior art keywords
- mock
- return
- input parameter
- result set
- matching rule
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 43
- 238000012360 testing method Methods 0.000 claims abstract description 54
- 238000013515 script Methods 0.000 claims abstract description 44
- 238000004590 computer program Methods 0.000 claims description 6
- 235000013399 edible fruits Nutrition 0.000 claims description 2
- 238000011161 development Methods 0.000 abstract description 5
- 238000010586 diagram Methods 0.000 description 13
- 230000006870 function Effects 0.000 description 9
- 230000006854 communication Effects 0.000 description 4
- 238000005516 engineering process Methods 0.000 description 4
- 230000004048 modification Effects 0.000 description 4
- 238000012986 modification Methods 0.000 description 4
- 238000000926 separation method Methods 0.000 description 4
- 241000208340 Araliaceae Species 0.000 description 3
- 235000005035 Panax pseudoginseng ssp. pseudoginseng Nutrition 0.000 description 3
- 235000003140 Panax quinquefolius Nutrition 0.000 description 3
- 230000008859 change Effects 0.000 description 3
- 238000004891 communication Methods 0.000 description 3
- 235000008434 ginseng Nutrition 0.000 description 3
- 230000003287 optical effect Effects 0.000 description 3
- 238000012545 processing Methods 0.000 description 3
- 238000004458 analytical method Methods 0.000 description 2
- 230000000694 effects Effects 0.000 description 2
- 230000005291 magnetic effect Effects 0.000 description 2
- 230000008569 process Effects 0.000 description 2
- 239000004065 semiconductor Substances 0.000 description 2
- 238000004088 simulation Methods 0.000 description 2
- 230000006399 behavior Effects 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000005540 biological transmission Effects 0.000 description 1
- 239000012141 concentrate Substances 0.000 description 1
- 230000003111 delayed effect Effects 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 230000005611 electricity Effects 0.000 description 1
- 238000009434 installation Methods 0.000 description 1
- 230000010354 integration Effects 0.000 description 1
- 230000003993 interaction Effects 0.000 description 1
- 239000004973 liquid crystal related substance Substances 0.000 description 1
- 239000013307 optical fiber Substances 0.000 description 1
- 230000001902 propagating effect Effects 0.000 description 1
- 230000004044 response Effects 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 230000007474 system interaction Effects 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Prevention of errors by analysis, debugging or testing of software
- G06F11/3668—Testing of software
- G06F11/3672—Test management
- G06F11/3688—Test management for test execution, e.g. scheduling of test suites
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 embodiment of the present invention provides a kind of Mock method and apparatus, the Mock scripts of primary development can be made to cope with the Mock demands of different test scenes, realize that a Mock interface can return to different Mock return values according to actual test scene, without developing different Mock scripts for different test scenes, so as to build simple, quick Mock service.This method includes:Receive the request for calling Mock interfaces;The request includes:Input parameter;To the input parameter and from database, the result set that can return to of dynamic loading parses;The input parameter after parsing and the result set that can return to after parsing are matched according to preset matching rule;The Mock return values for meeting matching rule are back to the system for calling Mock interfaces.
Description
Technical field
The present invention relates to field of computer technology more particularly to a kind of Mock method and apparatus.
Background technology
Joint debugging test is a very important link in current software quality assurance system, is protected in operational trials scene
Demonstrate,prove the effective means of data interaction between different systems correctness.Since business becomes increasingly complex, system interaction side is more and more,
Cause joint debugging test in participant it is also more and more, in turn result in joint debugging test slowly, can not quick response business variation.
In order to solve the problems, such as joint debugging test it is slow, joint debugging test in introduce Mock (simulation) service.Pass through Mock
Service simulation return parameters or return value, solve Dependence Problem of the system under test (SUT) to external interface service so that joint debugging is tested
It can quickly carry out, reduce risk of the system under test (SUT) in joint debugging test, ensure that the quality of system under test (SUT).
Mock service is broadly divided into according to the size of use scope:Method grade Mock service, component level Mock service and
System testing grade Mock service.For method grade Mock service and component level Mock service, exist in the prior art EasyMock,
The Development Frameworks such as Jmock, Mockito, PowerMock.And for the Mock service of system testing grade, then it needs in some frames
On the basis of plug-in unit, it could be realized for needing the external interface service of Mock to carry out personalized customization.
The either Mock service of which kind, the flow that structure Mock service is tested are roughly the same.Fig. 1 is existing
The flow diagram of Mock service is built in technology.As shown in Figure 1, the flow mainly includes the following steps that:A1, the tested side of analysis
Method, component or interface;A2, personalized Mock service script exploitation is carried out;A3, tested method, component or interface call Mock clothes
Business;A4, Mock service script is changed or developed again for different scenes;A5, tested method, component or interface call modification or
Again the Mock service developed.
In realizing process of the present invention, inventor has found that at least there are the following problems in the prior art:First, existing structure
The method that Mock service is tested is poorly suitable under the complex scenes such as integration testing or system testing.This is because existing
Technology is that data (input parameter, output parameter) are written in Mock scripts.With increasing for business scenario, required exploitation
Mock scripts are more and more.So, Mock service is introduced not only without improving testing efficiency, instead due to excessively relying on
Mock service is delayed testing progress.Second, as business scenario becomes increasingly complex changeable, simple, quick system testing grade
Mock service is increasingly required.However, how to build simple, quick Mock service, there are no provide in the prior art
Solution.
Invention content
In view of this, the embodiment of the present invention provides a kind of Mock method and apparatus, the Mock scripts of primary development can be made
The Mock demands of different test scenes are coped with, that is, realize that a Mock interface can return to different Mock according to actual test scene and return
Value is returned, without developing different Mock scripts for different test scenes, so as to build simple, quick Mock service.
To achieve the above object, one side according to the ... of the embodiment of the present invention provides a kind of Mock methods.
The Mock methods of the embodiment of the present invention include:Receive the request for calling Mock interfaces;The request includes:Input ginseng
Number;To the input parameter and from database, the result set that can return to of dynamic loading parses;According to preset matching
Rule matches the input parameter after parsing and the result set that can return to after parsing;The Mock for meeting matching rule is returned
Value is back to the system for calling Mock interfaces.
Optionally, the matching rule is:The correspondence of one or more value parameters and Mock return values.
Optionally, the result set that can return to of the input parameter and dynamic loading is parsed, including:It will be described defeated
Enter Parameter analysis of electrochemical into the first operable object;The result set that can return to of the dynamic loading is parsed into the second operable object.
Optionally, the method further includes:Before receiving the request for calling Mock interfaces, according to the outside of system under test (SUT)
It relies on interface specification and generates the script for calling Mock interfaces.
Optionally, the method further includes:Before receiving the request for calling Mock interfaces, according to the outside of system under test (SUT)
Interface specification is relied on to set matching rule with page format and can return to result set.
To achieve the above object, another aspect according to the ... of the embodiment of the present invention provides a kind of Mock devices.
The Mock devices of the embodiment of the present invention include:Receiving module, for receiving the request for calling Mock interfaces;It is described to ask
Ask including:Input parameter;Parsing module, for the input parameter and from database dynamic loading can return to result
Collection is parsed;Matching module, for according to preset matching rule to after parsing input parameter and parsing after can return to
Result set is matched;Output module calls the Mock interfaces to be for the Mock return values that meet matching rule to be back to
System.
Optionally, the matching rule is:The correspondence of one or more value parameters and Mock return values.
Optionally, the parsing module includes:First resolution unit can be grasped for the input parameter to be parsed into first
Make object;Second resolution unit, for the result set that can return to of the dynamic loading to be parsed into the second operable object.
Optionally, described device further includes:Script customized module, for relying on interface specification according to the external of system under test (SUT)
Generate the script for calling Mock interfaces.
Optionally, described device further includes:Matching rule setting module, for relying on interface according to the external of system under test (SUT)
Specification sets matching rule with page format;Result set setting module, for relying on interface specification according to the external of system under test (SUT)
Result set is can return to page format setting.
To achieve the above object, according to the ... of the embodiment of the present invention in another aspect, providing a kind of electronic equipment.
The electronic equipment of the embodiment of the present invention includes:One or more processors;And memory, for storing one
Or multiple programs;When one or more of programs are executed by one or more of processors so that one or more of
Processor realizes the Mock methods of the embodiment of the present invention.
To achieve the above object, another aspect according to the ... of the embodiment of the present invention, provides a kind of computer-readable medium.
The computer-readable medium of the embodiment of the present invention, is stored thereon with computer program, which is characterized in that described program
The Mock methods of the embodiment of the present invention are realized when being executed by processor.
One embodiment in foregoing invention has the following advantages that or advantageous effect:Asking for Mock interfaces is called by reception
Ask, and by the request input parameter and dynamic loading can return to result set parsed and to parsing after
Input parameter matched the separation, it can be achieved that data and script with the result set that can return to after parsing so that primary development
Mock scripts cope with the Mock demands of different test scenes, realize that a Mock interface can be according to actual test scene
Different Mock return values are returned to, without developing different Mock scripts for different test scenes, so that developer
Simple, quick Mock service can be built, and then is freed from complicated script exploitation, is concentrated one's energy in system testing
On, risk of the system under test (SUT) in joint debugging test is reduced, ensures the quality of system under test (SUT).
Further effect possessed by above-mentioned non-usual optional mode adds hereinafter in conjunction with specific implementation mode
With explanation.
Description of the drawings
Attached drawing does not constitute inappropriate limitation of the present invention for more fully understanding the present invention.Wherein:
Fig. 1 is the schematic diagram of the flow diagram of structure Mock service in the prior art;
Fig. 2 is the key step schematic diagram of Mock methods according to the ... of the embodiment of the present invention;
Fig. 3 is the flow diagram according to the ... of the embodiment of the present invention for obtaining the paid interface Mock return values of order;
Fig. 4 is the main comprising modules schematic diagram of Mock devices according to the ... of the embodiment of the present invention;
Fig. 5 is the structural schematic diagram of the computer system of the electronic equipment for realizing the embodiment of the present invention.
Specific implementation mode
It explains to the exemplary embodiment of the present invention below in conjunction with attached drawing, including the various of the embodiment of the present invention
Details should think them only exemplary to help understanding.Therefore, those of ordinary skill in the art should recognize
It arrives, various changes and modifications can be made to the embodiments described herein, without departing from scope and spirit of the present invention.Together
The description to known function and structure is omitted for clarity and conciseness in sample in following description.
Fig. 2 is the key step schematic diagram of Mock methods according to the ... of the embodiment of the present invention.As shown in Fig. 2, the present invention is implemented
The Mock methods of example mainly include the following steps that:
Step S1, the request for calling Mock interfaces is received;The request includes:Input parameter.
Before step S1, the Mock methods of the embodiment of the present invention may also include the steps of:According to the outer of system under test (SUT)
Portion relies on interface specification and generates the script for calling Mock interfaces.It should be pointed out that the calling Mock in the embodiment of the present invention connects
The script of mouth is distinct from Mock scripts in the prior art.The Mock scripts of the prior art are written with input parameter and Mock is returned
Value is returned, therefore input parameter and Mock return values cannot be changed during script use.If changing input parameter or Mock
Return value can only then change Mock scripts.And in embodiments of the present invention, call the script of Mock interfaces both to be returned not comprising Mock
Value is returned, does not also include matching rule, to realize the separation of data and script.
Further, before step S1, the Mock methods of the embodiment of the present invention further include following steps:According to system under test (SUT)
The external interface specification that relies on matching rule is set with page format and can return to result set.By with page format setting
With rule and it can return to result set so that system testers can quickly and easily set different according to actual business requirement
Mock return values, without changing Mock scripts.
Step S2, to the input parameter and from database, the result set that can return to of dynamic loading parses.
Further, step S2 is specifically included:The input parameter is parsed into the first operable object;The dynamic is filled
The result set that can return to carried is parsed into the second operable object.
Step S3, the input parameter after parsing and the result set that can return to after parsing are carried out according to preset matching rule
Matching.
Further, the matching rule is:The correspondence of one or more value parameters and Mock return values.Work as matching
When rule includes a value parameter, then matched with the correspondence of Mock return values according to this value parameter.When
When matching rule includes multiple value parameters, then according to the setting of multiple value parameters sequence repeatedly matched, i.e., elder generation according to
Father node parameter is matched, and is met father node parameter request and is matched according still further to child node parameter.By introducing classification ginseng
The matching rule of numberization can realize input parameter and can return to the accurate matching of result set.
Step S4, the Mock return values for meeting matching rule are back to the system for calling Mock interfaces.
For a further understanding of the Mock methods of the embodiment of the present invention, below to obtain the paid interface Mock return values of order
Flow for illustrate.Fig. 3 is that the flow according to the ... of the embodiment of the present invention for obtaining the paid interface Mock return values of order is shown
It is intended to.As shown in figure 3, the flow of the paid interface Mock return values of the acquisition order is as follows:
B1, the script for calling Mock interfaces is generated according to the paid interface specification of order.
B2, result set and matching rule can return to page format setting Mock interfaces;The matching rule includes
Two value parameters:The means of payment, payment are enumerated.Wherein, the means of payment is father node parameter, and payment is enumerated as child node ginseng
Number.
B3, the request for calling Mock interfaces is received;The request includes:Input parameter.
B4, to the input parameter and from database, the result set that can return to of dynamic loading parses.
B5, the input parameter after parsing and the result set that can return to after parsing are once matched according to the means of payment.
If a successful match, enters step B6;Otherwise, error message is returned to the system for calling Mock interfaces.
B6, for primary matched as a result, enumerating carry out Secondary Match according to payment.If Secondary Match success, enters
Step B7;If it fails to match, error message is returned to the system for calling Mock interfaces.
B7, the Mock return values of Secondary Match are back to the system for calling Mock interfaces.
In embodiments of the present invention, the request of Mock interfaces is called by reception, and by the input in the request
Parameter and dynamic loading can return to result set parsed and to after parsing input parameter and parsing after can return to knot
Fruit collection is matched the separation, it can be achieved that data and script so that the Mock scripts of primary development cope with different checkout areas
The Mock demands of scape realize that a Mock interface can return to different Mock return values according to actual test scene, are not necessarily to needle
Different test scenes are developed with different Mock scripts, so that developer can build simple, quick Mock service,
And then freed from complicated script exploitation, it concentrates one's energy in system testing, reduces system under test (SUT) in joint debugging test
Risk, ensure the quality of system under test (SUT).
Fig. 4 is the main comprising modules schematic diagram of Mock devices according to the ... of the embodiment of the present invention.As shown in figure 4, of the invention
The Mock devices 400 of embodiment include mainly:
Receiving module 401, for receiving the request for calling Mock interfaces;The request includes:Input parameter.
Parsing module 402, for the input parameter and from database dynamic loading can return to result set into
Row parsing.Further, parsing module 402 includes:First resolution unit, the second resolution unit.Wherein, the first resolution unit is used for
The input parameter is parsed into the first operable object, the second resolution unit is used to the dynamic loading can return to result
Collection is parsed into the second operable object.
Matching module 403, for according to preset matching rule to after parsing input parameter and parsing after can return to
Result set is matched.Further, the matching rule is:One or more value parameters are corresponding with Mock return values to close
System.By introducing the matching rule of value parameter, capable of realizing input parameter and can return to the accurate matching of result set.
Output module 404, for the Mock return values for meeting matching rule to be back to the system for calling Mock interfaces.
Further, the Mock devices in the embodiment of the present invention further include:Script customized module.Script customized module, is used for
According to the external script for relying on interface specification and generating calling Mock interfaces of system under test (SUT).It is pointed out that script custom mold
The script of the calling Mock interfaces of block customization is distinct from Mock scripts in the prior art.The Mock scripts of the prior art are written
Input parameter and Mock return values, therefore during script use cannot change input parameter and Mock return values.If wanted
Input parameter or Mock return values are changed, then can only change Mock scripts.And in embodiments of the present invention, call Mock interfaces
Script does not both include Mock return values, does not include matching rule, to realize the separation of data and script yet.
Further, the Mock devices in the embodiment of the present invention further include:Matching rule setting module, result set set mould
Block.Wherein, matching rule setting module is used to set matching according to the external interface specification that relies on of system under test (SUT) with page format
Rule, result set setting module are used to can return to result according to the external interface specification that relies on of system under test (SUT) with page format setting
Collection.
In embodiments of the present invention, the request for calling Mock interfaces is received by receiving module, and passes through parsing module pair
It is described that the result set that can return to of input parameter and dynamic loading for including is asked to be parsed, by matching module to parsing after
Input parameter and parsing after the result set that can return to matched, realize a Mock interface can be according to practical business scene
Different Mock return values are returned, the shape that traditional Mock service needs repeatedly exploitation script for different business scene has been broken
State.In turn so that developer can build simple, quick Mock service, reduce system under test (SUT) in joint debugging test
Risk ensure that the quality of system under test (SUT).
In another aspect, the embodiment of the present invention additionally provides a kind of electronic equipment.The electronic equipment of the embodiment of the present invention includes:
One or more processors;And memory, for storing one or more programs;When one or more of programs are by institute
State one or more processors execution so that one or more of processors realize the Mock methods of the embodiment of the present invention.
Fig. 5 is the structural schematic diagram of the computer system of the electronic equipment for realizing the embodiment of the present invention.Shown in Fig. 5
Electronic equipment is only an example, should not bring any restrictions to the function and use scope of the embodiment of the present application.
As shown in figure 5, computer system 500 includes central processing unit (CPU) 501, it can be read-only according to being stored in
Program in memory (ROM) 502 or be loaded into the program in random access storage device (RAM) 503 from storage section 508 and
Execute various actions appropriate and processing.In RAM 503, also it is stored with system 500 and operates required various programs and data.
CPU 501, ROM 502 and RAM 503 are connected with each other by bus 504.Input/output (I/O) interface 505 is also connected to always
Line 504.
Further, computer system 500 further include be connected to I/O interfaces 505 with lower component:
Importation 506 including keyboard, mouse etc.;Including such as cathode-ray tube (CRT), liquid crystal display (LCD)
And the output par, c 507 of loud speaker etc.;Storage section 508 including hard disk etc.;And including such as LAN card, modulation /demodulation
The communications portion 509 of the network interface cards such as device.Communications portion 509 executes communication process via the network of such as internet.Driving
Device 510 is also according to needing to be connected to I/O interfaces 505.Detachable media 511, such as disk, CD, magneto-optic disk, semiconductor storage
Device etc. is mounted on driver 510, as needed in order to be mounted into as needed from the computer program read thereon
Storage section 508.
Further, according to embodiments of the present invention, the process of Mock methods description may be implemented as computer software programs.
For example, the embodiment of the present invention includes a kind of computer program products comprising carry computer on a computer-readable medium
Program, the computer program include the program code of the Mock methods for executing the embodiment of the present invention.In such embodiment
In, which can be downloaded and installed by communications portion 509 from network, and/or from 511 quilt of detachable media
Installation.When the computer program is executed by central processing unit (CPU) 501, the department of computer science in the embodiment of the present invention is executed
The above-mentioned function that system limits.
It should be noted that in embodiments of the present invention, the computer-readable medium can be computer-readable signal
Medium or computer readable storage medium either the two arbitrarily combine.Computer readable storage medium for example can be with
It is but not limited to system, device or the device of electricity, magnetic, optical, electromagnetic, infrared ray or semiconductor, or the arbitrary above combination.
The more specific example of computer readable storage medium can include but is not limited to:Electrical connection with one or more conducting wires,
Portable computer diskette, hard disk, random access storage device (RAM), read-only memory (ROM), erasable type may be programmed read-only deposit
Reservoir (EPROM or flash memory), optical fiber, portable compact disc read-only memory (CD-ROM), light storage device, magnetic memory
Part or above-mentioned any appropriate combination.In embodiments of the present invention, can be any include computer readable storage medium
Or the tangible medium of storage program, which can be commanded execution system, device, and either device uses or in connection makes
With.And in this application, computer-readable signal media may include propagating in a base band or as a carrier wave part
Data-signal, wherein carrying computer-readable program code.Diversified forms may be used in the data-signal of the propagation, packet
Include but be not limited to electromagnetic signal, optical signal or above-mentioned any appropriate combination.Computer-readable signal media can also be
Any computer-readable medium other than computer readable storage medium, which can send, propagate or
Transmission for by instruction execution system, device either device use or program in connection.Computer-readable medium
On include program code can transmit with any suitable medium, including but not limited to:Wirelessly, electric wire, optical cable, RF etc.,
Or above-mentioned any appropriate combination.
Flow chart and block diagram shown in the drawings, it is illustrated that according to the method, apparatus and computer of various embodiments of the invention
The architecture, function and operation in the cards of program product.In this regard, each box in flowchart or block diagram can be with
A part for a module, program segment, or code is represented, a part for above-mentioned module, program segment, or code includes one or more
A executable instruction for implementing the specified logical function.It should also be noted that in some implementations as replacements, in box
The function of being marked can also occur in a different order than that indicated in the drawings.For example, two boxes succeedingly indicated are real
It can be basically executed in parallel on border, they can also be executed in the opposite order sometimes, this is depending on involved function.
It is also noted that the combination of each box and box in block diagram or flow chart, can use function or behaviour as defined in executing
The dedicated hardware based system made is realized, can also be realized using a combination of dedicated hardware and computer instructions.
Involved module can be realized by way of software in the embodiment of the present invention, can also pass through the side of hardware
Formula is realized.Described module can also be arranged in the processor, for example, can be described as:A kind of processor includes receiving
Module, parsing module, matching module, output module.Wherein, the title of these modules is not constituted under certain conditions to the mould
The restriction of block itself, for example, receiving module is also described as " receiving from the system under test (SUT) connected and calling Mock interfaces
The module of request ".
Another aspect, the embodiment of the present invention additionally provide a kind of computer-readable medium, which can be with
It is included in the electronic equipment described in above-described embodiment;Can also be individualism, and without be incorporated the equipment in.On
It states computer-readable medium and carries one or more program, when said one or multiple programs are by the electronic equipment
When execution, the Mock methods of above-described embodiment are realized:Receive the request for calling Mock interfaces;The request includes:Input parameter;
To the input parameter and from database, the result set that can return to of dynamic loading parses;According to preset matching rule
Input parameter after parsing and the result set that can return to after parsing are matched;The Mock return values for meeting matching rule are returned
It is back to the system for calling Mock interfaces.
The said goods can perform the method that the embodiment of the present invention is provided, and has the corresponding function module of execution method and has
Beneficial effect.The not technical detail of detailed description in the present embodiment, reference can be made to the method that the embodiment of the present invention is provided.
Above-mentioned specific implementation mode, does not constitute limiting the scope of the invention.Those skilled in the art should be bright
It is white, design requirement and other factors are depended on, various modifications, combination, sub-portfolio and replacement can occur.It is any
Modifications, equivalent substitutions and improvements made by within the spirit and principles in the present invention etc., should be included in the scope of the present invention
Within.
Claims (12)
1. a kind of Mock methods, which is characterized in that the method includes:
Receive the request for calling Mock interfaces;The request includes:Input parameter;
To the input parameter and from database, the result set that can return to of dynamic loading parses;
The input parameter after parsing and the result set that can return to after parsing are matched according to preset matching rule;
The Mock return values for meeting matching rule are back to the system for calling Mock interfaces.
2. according to the method described in claim 1, it is characterized in that, the matching rule is:One or more value parameters with
The correspondence of Mock return values.
3. according to the method described in claim 1, it is characterized in that, can return to knot to the input parameter and dynamic loading
Fruit collection is parsed, including:
The input parameter is parsed into the first operable object;
The result set that can return to of the dynamic loading is parsed into the second operable object.
4. according to the method described in claim 1, it is characterized in that, the method further includes:Mock interfaces are called receiving
Before request, according to the external script for relying on interface specification and generating calling Mock interfaces of system under test (SUT).
5. according to the method described in claim 1, it is characterized in that, the method further includes:
Before receiving the request for calling Mock interfaces, set with page format according to the external interface specification that relies on of system under test (SUT)
Matching rule and it can return to result set.
6. a kind of Mock devices, which is characterized in that described device includes:
Receiving module, for receiving the request for calling Mock interfaces;The request includes:Input parameter;
Parsing module, for the result set that can return to of dynamic loading to parse to the input parameter and from database;
Matching module, for according to preset matching rule to after parsing input parameter and parsing after can return to result set into
Row matching;
Output module, for the Mock return values for meeting matching rule to be back to the system for calling Mock interfaces.
7. device according to claim 6, which is characterized in that the matching rule is:One or more value parameters with
The correspondence of Mock return values.
8. device according to claim 6, which is characterized in that the parsing module includes:
First resolution unit, for the input parameter to be parsed into the first operable object;
Second resolution unit, for the result set that can return to of the dynamic loading to be parsed into the second operable object.
9. device according to claim 6, which is characterized in that described device further includes:
Script customized module, for the external script for relying on interface specification and generating calling Mock interfaces according to system under test (SUT).
10. device according to claim 6, which is characterized in that described device further includes:
Matching rule setting module, for setting matching rule according to the external interface specification that relies on of system under test (SUT) with page format
Then;
Result set setting module, for can return to result according to the external interface specification that relies on of system under test (SUT) with page format setting
Collection.
11. a kind of electronic equipment, which is characterized in that including:
One or more processors;And
Memory, for storing one or more programs;
When one or more of programs are executed by one or more of processors so that one or more of processors are real
The now method as described in claim 1 to 5 is any.
12. a kind of computer-readable medium, is stored thereon with computer program, which is characterized in that described program is held by processor
The method as described in any in claim 1 to 5 is realized when row.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710266212.8A CN108733554A (en) | 2017-04-21 | 2017-04-21 | Mock method and apparatus |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710266212.8A CN108733554A (en) | 2017-04-21 | 2017-04-21 | Mock method and apparatus |
Publications (1)
Publication Number | Publication Date |
---|---|
CN108733554A true CN108733554A (en) | 2018-11-02 |
Family
ID=63933473
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201710266212.8A Pending CN108733554A (en) | 2017-04-21 | 2017-04-21 | Mock method and apparatus |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN108733554A (en) |
Cited By (12)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110083533A (en) * | 2019-04-16 | 2019-08-02 | 贝壳技术有限公司 | Data processing method and device based on Mock service |
CN111400178A (en) * | 2020-03-13 | 2020-07-10 | 深圳前海环融联易信息科技服务有限公司 | Automatic interface number making method and device, computer equipment and storage medium |
CN111629014A (en) * | 2019-02-27 | 2020-09-04 | 北京嘀嘀无限科技发展有限公司 | Request agent implementation method, implementation device, server and storage medium |
CN111752625A (en) * | 2020-06-23 | 2020-10-09 | 京东数字科技控股有限公司 | Method and device for interface mock |
CN112052152A (en) * | 2019-06-06 | 2020-12-08 | 北京京东尚科信息技术有限公司 | A method and device for simulating testing |
CN112383434A (en) * | 2020-11-17 | 2021-02-19 | Oppo广东移动通信有限公司 | Interface simulation method and device for network request, electronic equipment and storage medium |
CN113127345A (en) * | 2021-04-06 | 2021-07-16 | 北京字跳网络技术有限公司 | Application testing method and device, electronic equipment and storage medium |
CN113449022A (en) * | 2020-03-27 | 2021-09-28 | 北京沃东天骏信息技术有限公司 | Method and device for processing service request |
CN113791971A (en) * | 2021-08-13 | 2021-12-14 | 唯品会(广州)软件有限公司 | A kind of Mock testing method, apparatus, equipment and computer readable medium |
CN113821445A (en) * | 2021-10-11 | 2021-12-21 | 中国银行股份有限公司 | Mock testing method and device for mobile application |
CN114553929A (en) * | 2022-01-10 | 2022-05-27 | 多点生活(成都)科技有限公司 | Recording playback enhancement method and device for recording and calling dynamic Mock |
CN115248768A (en) * | 2021-04-27 | 2022-10-28 | 京东科技控股股份有限公司 | Test method and apparatus |
Citations (11)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1503168A (en) * | 2002-11-22 | 2004-06-09 | 深圳市中兴通讯股份有限公司 | Automatic test method for system products |
CN101141319A (en) * | 2007-05-23 | 2008-03-12 | 中兴通讯股份有限公司 | Function operation packaging based automatization test script implementing method and apparatus |
CN101221504A (en) * | 2008-01-23 | 2008-07-16 | 中兴通讯股份有限公司 | Test script processing method and its scheduling and executing system |
CN101770423A (en) * | 2009-12-25 | 2010-07-07 | 中兴通讯股份有限公司 | Test data generation method and test system |
CN102110050A (en) * | 2010-12-16 | 2011-06-29 | 上海泰捷通信技术有限公司 | Method for automatically testing communication terminal module |
US8245194B2 (en) * | 2006-10-18 | 2012-08-14 | International Business Machines Corporation | Automatically generating unit test cases which can reproduce runtime problems |
CN103186467A (en) * | 2011-12-31 | 2013-07-03 | 北京新媒传信科技有限公司 | Method and device for verifying data correctness |
CN105446865A (en) * | 2014-07-09 | 2016-03-30 | 阿里巴巴集团控股有限公司 | Test method and device under multi-environment |
CN105515883A (en) * | 2014-09-22 | 2016-04-20 | 阿里巴巴集团控股有限公司 | Test method and system |
CN106484624A (en) * | 2016-10-21 | 2017-03-08 | 天津海量信息技术股份有限公司 | The method of testing of interface automatic test |
CN106528393A (en) * | 2015-09-09 | 2017-03-22 | 北京京东尚科信息技术有限公司 | Method and device for Mock testing of WebService |
-
2017
- 2017-04-21 CN CN201710266212.8A patent/CN108733554A/en active Pending
Patent Citations (11)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1503168A (en) * | 2002-11-22 | 2004-06-09 | 深圳市中兴通讯股份有限公司 | Automatic test method for system products |
US8245194B2 (en) * | 2006-10-18 | 2012-08-14 | International Business Machines Corporation | Automatically generating unit test cases which can reproduce runtime problems |
CN101141319A (en) * | 2007-05-23 | 2008-03-12 | 中兴通讯股份有限公司 | Function operation packaging based automatization test script implementing method and apparatus |
CN101221504A (en) * | 2008-01-23 | 2008-07-16 | 中兴通讯股份有限公司 | Test script processing method and its scheduling and executing system |
CN101770423A (en) * | 2009-12-25 | 2010-07-07 | 中兴通讯股份有限公司 | Test data generation method and test system |
CN102110050A (en) * | 2010-12-16 | 2011-06-29 | 上海泰捷通信技术有限公司 | Method for automatically testing communication terminal module |
CN103186467A (en) * | 2011-12-31 | 2013-07-03 | 北京新媒传信科技有限公司 | Method and device for verifying data correctness |
CN105446865A (en) * | 2014-07-09 | 2016-03-30 | 阿里巴巴集团控股有限公司 | Test method and device under multi-environment |
CN105515883A (en) * | 2014-09-22 | 2016-04-20 | 阿里巴巴集团控股有限公司 | Test method and system |
CN106528393A (en) * | 2015-09-09 | 2017-03-22 | 北京京东尚科信息技术有限公司 | Method and device for Mock testing of WebService |
CN106484624A (en) * | 2016-10-21 | 2017-03-08 | 天津海量信息技术股份有限公司 | The method of testing of interface automatic test |
Cited By (15)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111629014B (en) * | 2019-02-27 | 2023-03-24 | 北京嘀嘀无限科技发展有限公司 | Request agent implementation method, implementation device, server and storage medium |
CN111629014A (en) * | 2019-02-27 | 2020-09-04 | 北京嘀嘀无限科技发展有限公司 | Request agent implementation method, implementation device, server and storage medium |
CN110083533A (en) * | 2019-04-16 | 2019-08-02 | 贝壳技术有限公司 | Data processing method and device based on Mock service |
CN112052152A (en) * | 2019-06-06 | 2020-12-08 | 北京京东尚科信息技术有限公司 | A method and device for simulating testing |
CN111400178A (en) * | 2020-03-13 | 2020-07-10 | 深圳前海环融联易信息科技服务有限公司 | Automatic interface number making method and device, computer equipment and storage medium |
CN113449022A (en) * | 2020-03-27 | 2021-09-28 | 北京沃东天骏信息技术有限公司 | Method and device for processing service request |
CN111752625A (en) * | 2020-06-23 | 2020-10-09 | 京东数字科技控股有限公司 | Method and device for interface mock |
CN112383434A (en) * | 2020-11-17 | 2021-02-19 | Oppo广东移动通信有限公司 | Interface simulation method and device for network request, electronic equipment and storage medium |
CN112383434B (en) * | 2020-11-17 | 2023-08-08 | Oppo广东移动通信有限公司 | Interface simulation method and device for network request, electronic equipment and storage medium |
CN113127345A (en) * | 2021-04-06 | 2021-07-16 | 北京字跳网络技术有限公司 | Application testing method and device, electronic equipment and storage medium |
CN115248768A (en) * | 2021-04-27 | 2022-10-28 | 京东科技控股股份有限公司 | Test method and apparatus |
CN113791971A (en) * | 2021-08-13 | 2021-12-14 | 唯品会(广州)软件有限公司 | A kind of Mock testing method, apparatus, equipment and computer readable medium |
CN113821445A (en) * | 2021-10-11 | 2021-12-21 | 中国银行股份有限公司 | Mock testing method and device for mobile application |
CN114553929A (en) * | 2022-01-10 | 2022-05-27 | 多点生活(成都)科技有限公司 | Recording playback enhancement method and device for recording and calling dynamic Mock |
CN114553929B (en) * | 2022-01-10 | 2024-04-12 | 多点生活(成都)科技有限公司 | Recording playback enhancement method and device for recording call dynamic Mock |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108733554A (en) | Mock method and apparatus | |
CN109446099A (en) | Automatic test cases generation method, device, medium and electronic equipment | |
CN110032511A (en) | A kind of interface test method and interface testing equipment | |
CN113553257B (en) | Test method, device, storage medium and electronic equipment | |
CN109815107A (en) | The method and apparatus of automatic test | |
CN109582317A (en) | Method and apparatus for debugging boarding application | |
CN109815105A (en) | Applied program testing method and device based on Btrace | |
CA3059719C (en) | Payment processing method, device, medium and electronic device | |
CN108694120A (en) | The method and apparatus of testing service component | |
CN110659870A (en) | Business audit test method, device, equipment and storage medium | |
CN113220561A (en) | Test case management method, device, equipment and medium | |
CN113760736A (en) | Test method, device and system | |
CN109947423A (en) | Code generating method, device, terminal and medium | |
CN105893235B (en) | A kind of emulation test method, device and server | |
CN109766228A (en) | Verification method and device on a kind of line based on interface | |
CN107347093A (en) | Collocation method and device for distributed server system | |
CN111666097A (en) | Capability domination method and device based on service scene | |
CN107741906A (en) | Monetary fund system automatic testing method, device, equipment and storage medium | |
CN109117360A (en) | A kind of method and apparatus of processed offline business datum | |
CN109861875A (en) | The test method and device of application program | |
US12120251B2 (en) | System, method and apparatus for developing smart contract | |
CN107562629B (en) | Method and device for testing | |
CN117112393A (en) | Debugging method, device, electronic device and storage medium for application program | |
CN110262841A (en) | The method and apparatus that a kind of pair of bytecode is enhanced | |
CN115526587A (en) | Method and device for generating customs message |
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 |