CN103399776A - Creation method and system for reusable MOCK - Google Patents
Creation method and system for reusable MOCK Download PDFInfo
- Publication number
- CN103399776A CN103399776A CN2013101593349A CN201310159334A CN103399776A CN 103399776 A CN103399776 A CN 103399776A CN 2013101593349 A CN2013101593349 A CN 2013101593349A CN 201310159334 A CN201310159334 A CN 201310159334A CN 103399776 A CN103399776 A CN 103399776A
- Authority
- CN
- China
- Prior art keywords
- mock
- reusable
- file
- url
- client
- 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
Links
Images
Landscapes
- Information Transfer Between Computers (AREA)
Abstract
The invention provides a creation method and system for reusable MOCK. According the creation method and system for the reusable MOCK, the reusable MOCK and configuration files are created though setting of a fixed local URL of the reusable MOCK, and the configuration files are used for being matched with returning files automatically according to elements and attributes which are contained in demand files of a client side and are stored in the reusable MOCK. The reusable MOCK is created at a time and is suitable for a plurality of different demand files, the purpose that the MOCK is created at a time and is used repeatedly is achieved, therefore, work efficiency is improved, and the probability of rehandling is reduced.
Description
Technical field
The present invention relates to the interface testing field of computer software testing, particularly a kind of reusable MOCK creation method and system.
Background technology
Interface testing is a kind of test of test system components interface.Interface testing is mainly for detection of between external system and system and the interaction point between inner subsystems.The emphasis of test is the exchange that will check data, transmits and the control and management process, and the mutual logic dependence between system etc.
In actual test process, some behavior of real object (for example is difficult to be triggered, some abnormality test data, if produced by normal business operation, probability is very little), perhaps real object in fact also non-existent (for example, and other development group or and new hardware come into contacts with) etc.
Summary of the invention
The object of the present invention is to provide a kind of reusable MOCK creation method and system, can once create reusable MOCK, described reusable MOCK is applicable to a plurality of different demand files, to increase work efficiency, lowers the duplication of labour.
For addressing the above problem, the invention provides a kind of reusable MOCK creation method, comprising:
This locality that reusable MOCK is set is URL fixedly;
Create reusable MOCK and configuration file, described configuration file is used for arriving corresponding backspace file according to the contained element of the demand file of client and Auto-Matching Attribute, and described configuration file is stored in reusable MOCK.
Further, in said method, this locality that reusable MOCK is set is fixedly in the step of URL, and this locality that the URL of the demand file of client is changed into to reusable MOCK is URL fixedly.
Further, in said method, this locality that reusable MOCK is set is fixedly in the step of URL, in described client change HOST address so that the described request file transfer to the fixing URL in this locality of reusable MOCK.
Further, in said method, described client-requested file is the XML demand file.
According to another side of the present invention, provide a kind of reusable MOCK to create system, comprising:
URL arranges module, be used to the fixing URL in this locality that reusable MOCK is set;
Creation module, be used to creating reusable MOCK and configuration file, described configuration file is used for arriving corresponding backspace file according to the contained element of the demand file of client and Auto-Matching Attribute, and described configuration file is stored in reusable MOCK.
Further, in said system, described URL arranges module, and this locality that changes into reusable MOCK for the URL of the demand file by client is URL fixedly.
Further, in said system, described URL arranges module, in client change HOST address so that the described request file transfer to the fixing URL in this locality of reusable MOCK.
Further, in said system, described client-requested file is the XML demand file.
Compared with prior art, the present invention this locality by reusable MOCK is set is URL fixedly, create reusable MOCK and configuration file, described configuration file is used for arriving corresponding backspace file according to the contained element of the demand file of client and Auto-Matching Attribute, and described configuration file is stored in reusable MOCK, described reusable MOCK has once created, be applicable to a plurality of different demand files, realize once creating, repeatedly use, to increase work efficiency, lower the duplication of labour.
The accompanying drawing explanation
Fig. 1 is the schematic diagram of existing conventional interface;
Fig. 2 is the schematic diagram of traditional MOCK;
Fig. 3 is the process flow diagram of the reusable MOCK creation method of one embodiment of the invention;
Fig. 4 is the schematic diagram of the reusable MOCK of one embodiment of the invention.
Embodiment
For above-mentioned purpose of the present invention, feature and advantage can be become apparent more, the present invention is further detailed explanation below in conjunction with the drawings and specific embodiments.
Embodiment mono-
As shown in Figures 3 and 4, the invention provides a kind of reusable MOCK creation method, comprise step S1~step S3.
Step S1, this locality that reusable MOCK is set is URL fixedly.Concrete, Mock is exactly in test process, for some, is not easy the object of constructing or being not easy to obtain, and with a virtual object, creates so that the method for testing of testing.As shown in Figure 1, existing conventional interface, send demand file by client to WebService, and then WebService sends response according to demand file to client.As shown in Figure 2, traditional MOCK can exist a plurality of on WebService, and a traditional MOCK is corresponding with a client.As shown in Figure 4, the present embodiment can simulate that WebService receives and process the different XML request of being sent by different URL clients, and returns to corresponding XML file, for test data creation and test environment, builds supplying method, saves time.
In one embodiment of the invention, step S1 comprises:
This locality that the URL of the demand file of client is changed into to reusable MOCK is URL fixedly.Concrete, the this locality that the URL of the demand file of the client sent to reusable MOCK in test process can be changed into to reusable MOCK is URL fixedly, for example, while testing certain functional module, need to be linked to certain test environment/WEB application system, and this test environment/WEB application system is still unavailable at present, or can't access.For test is proceeded down, this locality that the request address that when test sent is modified to reusable MOCK is URL fixedly.For example, during test, need be linked to Ctrip(and take journey) network address, this locality that now request address is changed into to reusable MOCK is URL fixedly.So just can save the test duration, in Development of Module to be tested, submit well when test to, not need to wait for that other module interfaces that are closely related with this function have developed aptitude test.
In another embodiment of the present invention, step S1 comprises:
In described client change HOST address so that the described request file transfer to the fixing URL in this locality of reusable MOCK.
Step S2, create reusable MOCK and configuration file, and described configuration file is used for arriving corresponding backspace file according to the contained element of the demand file of client and Auto-Matching Attribute, and described configuration file is stored in reusable MOCK.Concrete, in described simulation backspace file, comprised required element and the attribute of described request file, in subsequent step, by transmission, simulate backspace file like this, just can simply create fast similar test data after demand file is sent to reusable MOCK, reusable MOCK can be according to the element in demand file and attribute, make coupling, find corresponding simulation backspace file, and be back to client.
The present embodiment can improve the MOCK reusability and reduce the duplication of labour, for a plurality of different interface testings, as shown in Figure 4, only need a MOCK interface, just can send corresponding simulation backspace file to the demand file of different clients and respond, as send corresponding XML simulation backspace file client is responded.
Embodiment bis-
The present invention also provides another kind of reusable MOCK to create system, comprises that URL arranges module 1, creation module 2.
In one embodiment of the invention, described URL arranges module, and this locality that changes into reusable MOCK for the URL of the demand file by client is URL fixedly.Concrete, the this locality that the URL of the demand file of the client sent to reusable MOCK in test process can be changed into to reusable MOCK is URL fixedly, for example, while testing certain functional module, need to be linked to certain test environment/WEB application system, and this test environment/WEB application system is still unavailable at present, or can't access.For test is proceeded down, this locality that the request address that when test sent is modified to reusable MOCK is URL fixedly.For example, during test, need be linked to the network address of Ctrip, this locality that now request address is changed into to reusable MOCK is URL fixedly.So just can save the test duration, in Development of Module to be tested, submit well when test to, not need to wait for that other module interfaces that are closely related with this function have developed aptitude test.
In another embodiment of the present invention, described URL arranges module, in client change HOST address so that the described request file transfer to the fixing URL in this locality of reusable MOCK.
The present embodiment can improve the MOCK reusability and reduce the duplication of labour, for a plurality of different interface testings, as shown in Figure 4, only need a MOCK interface, just can send corresponding simulation backspace file to the demand file of different clients and respond, as send corresponding XML simulation backspace file client is responded.
In sum, the present invention this locality by reusable MOCK is set is URL fixedly, create the simulation backspace file that the element contained with the demand file of client and Attribute Relative are answered, the element that storage described request file is contained and the corresponding relation of attribute and simulation backspace file are in described reusable MOCK, and described reusable MOCK has once created, and is applicable to a plurality of different demand files, realize once creating, repeatedly use, to increase work efficiency, lower the duplication of labour.
In this instructions, each embodiment adopts the mode of going forward one by one to describe, and what each embodiment stressed is and the difference of other embodiment that between each embodiment, identical similar part is mutually referring to getting final product.For the disclosed system of embodiment, owing to corresponding to the method disclosed in Example, so description is fairly simple, relevant part partly illustrates and gets final product referring to method.
The professional can also further recognize, unit and the algorithm steps of each example of describing in conjunction with embodiment disclosed herein, can realize with electronic hardware, computer software or the combination of the two, for the interchangeability of hardware and software clearly is described, composition and the step of each example described in general manner according to function in the above description.These functions are carried out with hardware or software mode actually, depend on application-specific and the design constraint of technical scheme.The professional and technical personnel can specifically should be used for realizing described function with distinct methods to each, but this realization should not thought and exceeds scope of the present invention.
Obviously, those skilled in the art can carry out various changes and modification and not break away from the spirit and scope of the present invention invention.Like this, if within of the present invention these were revised and modification belongs to the scope of the claims in the present invention and equivalent technologies thereof, the present invention also was intended to comprise these change and modification.
Claims (8)
1. a reusable MOCK creation method, is characterized in that, comprising:
This locality that reusable MOCK is set is URL fixedly;
Create reusable MOCK and configuration file, described configuration file is used for arriving corresponding backspace file according to the contained element of the demand file of client and Auto-Matching Attribute, and described configuration file is stored in reusable MOCK.
2. reusable MOCK creation method as claimed in claim 1, is characterized in that, this locality that reusable MOCK is set is fixedly in the step of URL, and this locality that the URL of the demand file of client is changed into to reusable MOCK is URL fixedly.
3. reusable MOCK creation method as claimed in claim 1, is characterized in that, this locality that reusable MOCK is set is fixedly in the step of URL, in described client change HOST address so that the described request file transfer to the fixing URL in this locality of reusable MOCK.
4. reusable MOCK creation method as claimed in claim 1, is characterized in that, described client-requested file is the XML demand file.
5. a reusable MOCK creates system, it is characterized in that, comprising:
URL arranges module, be used to the fixing URL in this locality that reusable MOCK is set;
Creation module, be used to creating reusable MOCK and configuration file, described configuration file is used for arriving corresponding backspace file according to the contained element of the demand file of client and Auto-Matching Attribute, and described configuration file is stored in reusable MOCK.
6. reusable MOCK as claimed in claim 5 creates system, it is characterized in that, described URL arranges module, and this locality that changes into reusable MOCK for the URL of the demand file by client is URL fixedly.
7. reusable MOCK as claimed in claim 5 creates system, it is characterized in that, described URL arranges module, in client change HOST address so that the described request file transfer to the fixing URL in this locality of reusable MOCK.
8. reusable MOCK as claimed in claim 5 creates system, it is characterized in that, described client-requested file is the XML demand file.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201310159334.9A CN103399776B (en) | 2013-05-02 | 2013-05-02 | Reusable MOCK creation method and system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201310159334.9A CN103399776B (en) | 2013-05-02 | 2013-05-02 | Reusable MOCK creation method and system |
Publications (2)
Publication Number | Publication Date |
---|---|
CN103399776A true CN103399776A (en) | 2013-11-20 |
CN103399776B CN103399776B (en) | 2016-07-20 |
Family
ID=49563410
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201310159334.9A Expired - Fee Related CN103399776B (en) | 2013-05-02 | 2013-05-02 | Reusable MOCK creation method and system |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN103399776B (en) |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104679648A (en) * | 2013-12-02 | 2015-06-03 | 中国银联股份有限公司 | Cross-application automatic testing method |
CN107122292A (en) * | 2016-10-21 | 2017-09-01 | 北京小度信息科技有限公司 | A kind of method and system of analog service |
CN107179984A (en) * | 2016-03-10 | 2017-09-19 | 北京京东尚科信息技术有限公司 | A kind of interface mock methods and interface test method |
CN108388519A (en) * | 2018-03-19 | 2018-08-10 | 车智互联(北京)科技有限公司 | Mock test methods based on SpringBoot services |
CN109491905A (en) * | 2018-11-02 | 2019-03-19 | 北京金山云网络技术有限公司 | Head end test method, apparatus and electronic equipment |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102202289A (en) * | 2011-04-13 | 2011-09-28 | 张�林 | Method and system for remote calling software and hardware resources through mobile terminal |
CN102231738A (en) * | 2011-06-24 | 2011-11-02 | 华中科技大学 | Data communication method for virtual experimental platform |
-
2013
- 2013-05-02 CN CN201310159334.9A patent/CN103399776B/en not_active Expired - Fee Related
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102202289A (en) * | 2011-04-13 | 2011-09-28 | 张�林 | Method and system for remote calling software and hardware resources through mobile terminal |
CN102231738A (en) * | 2011-06-24 | 2011-11-02 | 华中科技大学 | Data communication method for virtual experimental platform |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104679648A (en) * | 2013-12-02 | 2015-06-03 | 中国银联股份有限公司 | Cross-application automatic testing method |
CN107179984A (en) * | 2016-03-10 | 2017-09-19 | 北京京东尚科信息技术有限公司 | A kind of interface mock methods and interface test method |
CN107122292A (en) * | 2016-10-21 | 2017-09-01 | 北京小度信息科技有限公司 | A kind of method and system of analog service |
CN108388519A (en) * | 2018-03-19 | 2018-08-10 | 车智互联(北京)科技有限公司 | Mock test methods based on SpringBoot services |
CN109491905A (en) * | 2018-11-02 | 2019-03-19 | 北京金山云网络技术有限公司 | Head end test method, apparatus and electronic equipment |
Also Published As
Publication number | Publication date |
---|---|
CN103399776B (en) | 2016-07-20 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN106843828B (en) | Interface display and loading method and device | |
CN104391725B (en) | Page display method and page presentation device | |
US8127237B2 (en) | Active business client | |
CN104572293B (en) | The implementation method of medical image diagosis system based on BS structures | |
CN101122921B (en) | Method forming tree-shaped display structure based on ajax and html | |
US10228977B2 (en) | Managing distributed analytics on device groups | |
EP3161610B1 (en) | Optimized browser rendering process | |
CN104965757A (en) | Virtual machine live migration method, virtual machine migration management apparatus, and virtual machine live migration system | |
CN105786405A (en) | Online upgrading method, device and system | |
CN104081395A (en) | User interface for accessing documents from a computing device | |
CN101615177A (en) | At structural self-defined report implementation method of server/browser and device | |
US20140081901A1 (en) | Sharing modeling data between plug-in applications | |
CN108509207A (en) | The cross-system of WEB application program is installed | |
CN103399776A (en) | Creation method and system for reusable MOCK | |
CN104572084B (en) | User interface generation and data distributing method, device in card business | |
US9401957B2 (en) | System and method for synchronization between servers | |
CN102999608A (en) | System and method for tree table demonstration of large data | |
CN109614093B (en) | Visual intelligent contract system and intelligent contract processing method | |
US20150089415A1 (en) | Method of processing big data, apparatus performing the same and storage media storing the same | |
CN109597640B (en) | Account management method, device, equipment and medium for application program | |
CN102272751A (en) | Data integrity in a database environment through background synchronization | |
CN103701909A (en) | Rapid generation method and system for video application | |
CN106462561A (en) | Optimized browser render process | |
CN103019556A (en) | Quick help information display system and quick help information display method | |
JP7369229B2 (en) | How to change the skin of the mini program page, devices and electronic devices |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C41 | Transfer of patent application or patent right or utility model | ||
TA01 | Transfer of patent application right |
Effective date of registration: 20160302 Address after: 200335 Shanghai city Changning District Admiralty Road No. 968 Building No. 16 10 floor Applicant after: Shanghai Ctrip Business Co.,Ltd. Address before: 200335 Shanghai Changning District Fuquan Road No. 99 Applicant before: CTRIP COMPUTER TECHNOLOGY (SHANGHAI) Co.,Ltd. |
|
C14 | Grant of patent or utility model | ||
GR01 | Patent grant | ||
CF01 | Termination of patent right due to non-payment of annual fee |
Granted publication date: 20160720 |
|
CF01 | Termination of patent right due to non-payment of annual fee |