CN109743222A - A kind of data test method and relevant device - Google Patents

A kind of data test method and relevant device Download PDF

Info

Publication number
CN109743222A
CN109743222A CN201811598912.8A CN201811598912A CN109743222A CN 109743222 A CN109743222 A CN 109743222A CN 201811598912 A CN201811598912 A CN 201811598912A CN 109743222 A CN109743222 A CN 109743222A
Authority
CN
China
Prior art keywords
mock
network request
target
request
target network
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
Application number
CN201811598912.8A
Other languages
Chinese (zh)
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.)
Shanghai Rui Jia Information Technology Co Ltd
NETWORK TECHNOLOGY (SHANGHAI) Co Ltd
Original Assignee
Shanghai Rui Jia Information Technology Co Ltd
NETWORK TECHNOLOGY (SHANGHAI) 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 Shanghai Rui Jia Information Technology Co Ltd, NETWORK TECHNOLOGY (SHANGHAI) Co Ltd filed Critical Shanghai Rui Jia Information Technology Co Ltd
Priority to CN201811598912.8A priority Critical patent/CN109743222A/en
Publication of CN109743222A publication Critical patent/CN109743222A/en
Pending legal-status Critical Current

Links

Abstract

The embodiment of the invention provides a kind of data test method and relevant devices, can be during network test, without changing code or arriving mock test data using third party's tool was both available.This method comprises: mock platform receives target network request, the target network request is the network request that client is sent, and target network request intercepts for the client and controls default network agent and is determined as being sent to the network request of the mock platform;The mock platform judges whether the target network request is mock test request;If, then the mock data corresponding with target network request stored in database are sent to the client by the mock platform, it is tested so that the client is based on mock data corresponding with target network request, the corresponding mock data of multiple network requests being stored in the database including requesting corresponding mock data with the target network.

Description

A kind of data test method and relevant device
Technical field
The present invention relates to testing field, in particular to a kind of data test method and relevant device.
Background technique
In the test process to project, certain services are stable not as good as official release on line, often occur not visiting Situations such as asking, and the source of these service datas is all third party, when testing certain special scenes, can not effectively prepare to survey Data are tried to guarantee to carry out comprehensive use-case covering to test item.
This is solved the problems, such as by way of mock data in industry at present, class that there are many kinds of existing mock data methods, Such as mock data are written in code, or intercept network request using Open-Source Tools, by way of modifying return parameters Realize mock data, most common method is to build a mock server, passes through the handles such as domain name or configuration in modification code Request is directed on the mock server put up to be realized using mock service.
But these common methods require to carry out mock data through modification code or in the way of tool etc., no The tester to lack in ability suitable for code.
Summary of the invention
The embodiment of the invention provides a kind of data test method and relevant device, can during network test, Without changing code or arriving mock test data using third party's tool was both available.
First aspect of the embodiment of the present invention provides a kind of data test method, comprising:
Mock platform receives target network request, the network request that the target network request sends for client, and institute It states target network request and intercepts for the client and control default network agent and be determined as being sent to the net of the mock platform Network request;
The mock platform judges whether the target network request is mock test request;
If so, the mock platform sends out the mock data corresponding with target network request stored in database It send to the client, is tested so that the client is based on mock data corresponding with target network request, The multiple network requests being stored with including requesting corresponding mock data with the target network in the database are corresponding Mock data.
Optionally, the target network request carries header contents of target component and/or target, and the mock is flat Platform judges whether the target network request is that mock test request includes:
The mock platform judges in the target component or the target header contents and default mapping relations Whether parameter matches, and the default mapping relations are the corresponding relationship of test parameter or header contents and mock data;
If the target component or the target header contents are matched with the parameter in the default mapping relations, The mock platform determines that the target network request is mock test request;
If the parameter in the target component or the target header contents and the default mapping relations mismatches, Then the mock platform determines that the target network request is not the mock test request;
Or,
The mock platform judges in the target component and the target header contents and default mapping relations Whether parameter matches, and the default mapping relations are the corresponding relationship of test parameter and header contents and mock data;
If the target component and the target header contents are matched with the parameter in the default mapping relations, The mock platform determines that the target network request is mock test request;
If the parameter in the target component and the target header contents and the default mapping relations mismatches, Then the mock platform determines that the target network request is not mock test request.
Optionally, when the mock platform determines that the target network request is not mock test request, the method Further include:
The mock platform by the target network request be sent to server-side so that the server-side return with it is described Target network requests corresponding service data to the client.
Second aspect of the embodiment of the present invention provides a kind of data test method, comprising:
Client interception target network request;
The client controls default network agent and judges whether the target network request is to be sent to mock platform Network request;
If so, target network request is sent to the mock platform by the client, so that the mock Platform is requested what is stored in database with the target network when determining the target network request is mock test request Corresponding mock data return to the client, are stored in the database including corresponding with target network request The corresponding mock data of multiple network requests including mock data;
The client, which is based on the target network, requests corresponding mock data to be tested.
Optionally, the default network agent of client control judges whether target network request is to be sent to mock platform Network request include:
The client control the default network agent judge the transmission address of target network request with it is described Whether the network address of mock platform matches;
If so, the client determines that the target network request is the network request for being sent to the mock platform;
If it is not, then the client determines that the target network request is not asked to be sent to the network of the mock platform It asks.
Optionally, when the client determines that the target network request is not asked to be sent to the network of the mock platform When asking, the method also includes:
Target network request is sent to server-side by the client, so that the server-side returns and the mesh Mark the corresponding service data of network request;
The client executes corresponding operation according to service data corresponding with target network request.
The third aspect of the embodiment of the present invention provides a kind of mock platform, comprising:
Receiving unit, for receiving target network request, the target network request is the network request that client is sent, And the target network request intercepts for the client and controls default network agent and is determined as being sent to the mock platform Network request;
Judging unit, for judging whether the target network request is mock test request;
Transmission unit, for will be stored in database and institute when target network request is mock test request Stating target network requests corresponding mock data to be sent to the client, so that the client is based on and the target network Network requests corresponding mock data to be tested, and is stored in the database including corresponding with target network request The corresponding mock data of multiple network requests including mock data.
Optionally, the target network request carries header contents of target component and/or target, and the judgement is single Member is specifically used for:
Judge whether the target component or the target header contents match with the parameter in default mapping relations, The default mapping relations are the corresponding relationship of test parameter or header contents and mock data;
If the target component or the target header contents are matched with the parameter in the default mapping relations, Determine that the target network request is mock test request;
If the parameter in the target component or the target header contents and the default mapping relations mismatches, Then determine that the target network request is not the mock test request;
Or,
Judge whether the target component and the target header contents match with the parameter in default mapping relations, The default mapping relations are the corresponding relationship of test parameter and header contents and mock data;
If the target component and the target header contents are matched with the parameter in the default mapping relations, Determine that the target network request is mock test request;
If the parameter in the target component and the target header contents and the default mapping relations mismatches, Then determine that the target network request is not mock test request.
Optionally, when target network request is not mock test request, the transmission unit is also used to:
Target network request is sent to server-side, is requested so that the server-side is returned with the target network Corresponding service data is to the client.
Fourth aspect of the embodiment of the present invention provides a kind of client, comprising:
Interception unit is used for interception target network request;
Judging unit judges whether the target network request is to be sent to mock platform for controlling default network agent Network request;
Transmission unit, for inciting somebody to action when target network request is not to be sent to the network request of the mock platform Target network request is sent to the mock platform, so that the mock platform is determining that the target network request is When mock test request, the mock data corresponding with target network request stored in database are returned into the client It holds, the multiple network requests pair being stored in the database including requesting corresponding mock data with the target network The mock data answered;
Test cell, for requesting corresponding mock data to be tested based on the target network.
Optionally, the judging unit is specifically used for:
Control the net that the default network agent judges the transmission address and the mock platform of the target network request Whether network address matches;
If so, determining that the target network request is the network request for being sent to the mock platform;
If not, it is determined that the target network request is not the network request for being sent to the mock platform.
Optionally, when target network request is not to be sent to the network request of the mock platform, the transmission Unit is also used to:
Target network request is sent to server-side, is requested so that the server-side is returned with the target network Corresponding service data;
The test cell is also used to request corresponding service data execution is corresponding to grasp according to the target network Make.
The 5th aspect of the embodiment of the present invention provides a kind of processor, and the processor is for running computer program, institute The step of executing the data test method as described in above-mentioned various aspects when stating computer program operation.
The 6th aspect of the embodiment of the present invention provides a kind of computer readable storage medium, is stored thereon with computer journey Sequence, it is characterised in that: the computer program is when being executed by processor described in above-mentioned various aspects the step of data test method.
In view of the foregoing it is apparent that in embodiment provided by the invention, during network test, it is only necessary to client End is by presetting the determining network request for being sent to mock platform of network agent, and whether mock platform determines the network request later For mock test request, if so, mock platform is corresponding with mock data according to network request pre-stored in database The corresponding mock test data of mock test request is sent to client by relationship, and client is surveyed according to mock test data Examination, thus, it is possible to during network test, without changing code or arriving mock using third party's tool was both available Test data, at the same can be to avoid network test when change code, and the case where generate loophole in the production line.
Detailed description of the invention
Fig. 1 is one embodiment schematic diagram of data test method provided in an embodiment of the present invention;
Fig. 2 is another embodiment schematic diagram of data test method provided in an embodiment of the present invention;
Fig. 3 is another embodiment schematic diagram of data test method provided in an embodiment of the present invention;
Fig. 4 is the embodiment schematic diagram of mock platform provided in an embodiment of the present invention;
Fig. 5 is the embodiment schematic diagram of client provided in an embodiment of the present invention;
Fig. 6 is the hardware structural diagram of server provided in an embodiment of the present invention.
Specific embodiment
The embodiment of the invention provides a kind of data test method and relevant device, can during network test, Without changing code or arriving mock test data using third party's tool was both available.
Description and claims of this specification and term " first ", " second ", " third ", " in above-mentioned attached drawing The (if present)s such as four " are to be used to distinguish similar objects, without being used to describe a particular order or precedence order.It should manage The data that solution uses in this way are interchangeable under appropriate circumstances, so that the embodiments described herein can be in addition to illustrating herein Or the sequence other than the content of description is implemented.In addition, term " includes " and " having " and their any deformation, it is intended that Cover it is non-exclusive include, for example, containing the process, method, system, product or equipment of a series of steps or units need not limit In step or unit those of is clearly listed, but may include be not clearly listed or for these process, methods, produce The other step or units of product or equipment inherently.
Data test method of the invention is illustrated from the angle of mock platform below, which can be clothes Business device, the service unit being also possible in server, specifically without limitation.
Referring to Fig. 1, Fig. 1 is the embodiment schematic diagram of data test method provided in an embodiment of the present invention, comprising:
101, mock platform receives target network request.
In the present embodiment, during carrying out network test, mock platform can receive target network request, the target Network request is the network request that client is sent, and target network request is that client intercepts and controls default network agent It is determined as being sent to the network request of mock platform.
102, mock platform judges whether target network request is mock test request, if so, 103 are thened follow the steps, if It is no, then follow the steps 104.
In the present embodiment, mock platform receive target network request after, it can be determined that the target network request be No is mock test request, if target network request is mock test request, 103 is thened follow the steps, if the target network is asked It asks not for mock test request, thens follow the steps 104.It is specifically described below:
Header contents of target component and/or target are carried in target network request, mock platform judges target Whether network request is that mock test request includes:
Mock platform judges whether header contents of target component or target match with the parameter in default mapping relations, Default mapping relations are the corresponding relationship of test parameter or header contents and mock data;
If header contents of target component or target are matched with the parameter in default mapping relations, mock platform is determined Target network request is mock test request;
If the parameter in header contents of target component or target and default mapping relations mismatches, mock platform is true The network request that sets the goal is not mock test request;
Or,
Mock platform judges whether header contents of target component and target match with the parameter in default mapping relations, Default mapping relations are the corresponding relationship of test parameter and header contents and mock data;
If header contents of target component and target are matched with the parameter in default mapping relations, mock platform is determined Target network request is mock test request;
If the parameter in target component and the target header contents and default mapping relations mismatches, mock is flat It is mock test request that platform, which determines target network request not,.
That is, mock platform can be in advance in database purchase mock data, and by the mock data and network request Test parameter and/or the header content of middle carrying carry out mapping preservation, after getting target network request, Ke Yiti Take the default mapping stored in target component and/or target header contents, with database for carrying in target network request Test parameter in relationship is matched with header contents, to determine whether target network request is that mock test is asked It asks, when target network request is mock test request, executes step 103, when target network request is not tested for mock When request, step 104 is executed.
It should be noted that can only carry target component in target network request, target header can also be only carried Head content, can also carry header contents of target component and target simultaneously, as long as the default mapping stored in database is closed It is corresponding with the information carried in target network request, that is to say, that carry target component when in target network request When, mapping relations of the mapping relations between test parameter and corresponding mock data are preset, are carried when in target network request When header contents of target, mapping relations of the mapping relations between header contents and mock data are preset, target is worked as When carrying header contents of target component and target in network request, presetting mapping relations is then test parameter and header head Mapping relations between content and corresponding mock data.
103, the mock data corresponding with target network request stored in database are sent to client by mock platform, It is tested so that client is based on mock data corresponding with target network request.
It, can will be in database when mock platform determines that target network request is mock test request in the present embodiment The mock data corresponding with target network request of storage are sent to client, so that client is based on requesting with target network Corresponding mock data are tested, and are stored with including requesting corresponding mock data with target network in the database The corresponding mock data of multiple network requests.That is, when the target component and/or header that are carried in target network request When the test parameter and/or successful header content matchings in default mapping relations stored in head content and database, then Mock data corresponding with target network request are sent to client.
104, other operations are executed.
In the present embodiment, when mock platform determines target network request for mock test request, mock platform can be with Target network request is sent to server-side, so that the server-side returns to service data corresponding with target network request extremely Client.That is, when header contents of target component and/or target and mock platform for being carried in target network request Database in test parameter and/or unsuccessful header content matchings in the default mapping relations that store when, by the mesh Mark network request is forwarded.
In view of the foregoing it is apparent that passing through network request pre-stored in database in embodiment provided by the invention With the corresponding relationship of mock data, it can mock data are got, without carrying out the change of code or using third Square tool was both available to arrive mock data, at the same can be to avoid network test when change code, and generate leakage in the production line The case where hole.
Data test method in the embodiment of the present invention is illustrated from the angle of mock platform above, below from client Angle data test method in the embodiment of the present invention is illustrated, which can be server, or service Service unit in device, specifically without limitation.
Referring to Fig. 2, Fig. 2 is another embodiment schematic diagram of data test method provided in an embodiment of the present invention, comprising:
201, client interception target network request.
In the present embodiment, client can with interception target network request, herein specifically do not limit how interception target network Request, such as interception service can be set, network request is intercepted.
202, the default network agent of client control judges whether target network request is the network for being sent to mock platform Request, if so, 203 are thened follow the steps, if it is not, thening follow the steps 205.
In the present embodiment, client can preset default network agent, control default network agent later and judge mesh Mark whether network request is the network request for being sent to mock platform, if so, 203 are thened follow the steps, if it is not, thening follow the steps 205.It is specifically described below:
Client controls default network agent and judges whether target network request is the network request for being sent to mock platform Include:
Client controls the network address that default network agent judges the transmission address and mock platform of target network request Whether match;
If so, client determines that target network request is the network request for being sent to mock platform;
If it is not, then client determines that target network request is not the network request for being sent to mock platform.
That is, client can by control default network agent judge target network request transmission address and Whether the network address of mock platform matches, to determine whether target network request is the network request for being sent to mock platform, When the transmission address of target network request and the network address of mock platform match, client can determine the target network Network request is the network request for being sent to mock platform, conversely, client determines that target network request is not to be sent to mock The network request of platform.
203, target network request is sent to mock platform by client, so that mock platform is determining that target network asks When asking as mock test request, the mock data corresponding with target network request stored in database are returned into client.
In the present embodiment, client, can be with when determining target network request is to be sent to the network request of mock platform Target network request is sent to mock platform, mock platform judges target network request, to determine the target Whether network request is mock test request, if target network request is mock test request, by what is stored in database Corresponding with target network request mock data return to client, be stored in the database of the mock platform including with target network Network requests the corresponding mock data of multiple network requests including corresponding mock data.
204, client requests corresponding mock data to be tested based on target network.
In the present embodiment, client the target network for receiving the return of mock platform request corresponding mock data it Afterwards, it can be tested based on the mock data.
205, other operations are executed.
In the present embodiment, when it is to be sent to the network request of mock platform that client, which determines target network request not, visitor Target network request is sent to server-side by family end, so that server-side returns to service data corresponding with target network request, Client executes corresponding operation according to service data corresponding with target network request.
In view of the foregoing it is apparent that being stored in the database of mock platform in advance in embodiment provided by the invention Network request is sent to mock platform by default network agent by the corresponding mock data of each network request, client, and The mock data corresponding with target network request stored in mock platform database are obtained, to realize the mock in test process Data acquisition, it is possible thereby to during network test, without changing code or using third party's tool both available To mock test data, at the same can be to avoid network test when change code, and the case where generate loophole in the production line.
Referring to Fig. 3, Fig. 3 is another embodiment schematic diagram of data test method provided in an embodiment of the present invention, comprising:
301, client interception target network request.
302, the default network agent of client control judges whether target network request is the test for being sent to mock platform Request, if so, 303 are thened follow the steps, if it is not, thening follow the steps 308.
303, target network request is sent to mock platform by client.
It should be noted that step 301 is similar to step 203 with the step 201 in Fig. 2 to step 303, it is above-mentioned into Detailed description is gone, specific details are not described herein again.
304, mock platform receives target network request.
305, mock platform judges whether target network request is mock test request, if so, 306 are thened follow the steps, if It is no, then follow the steps 308.
306, the mock data corresponding with target network request stored in database are sent to client by mock platform.
It should be noted that step 304 is to step 306 and the step 101 in Fig. 1 to 103 similar, it is above-mentioned to have carried out in detail Describe in detail bright, specific details are not described herein again.
307, client requests corresponding mock data to be tested based on target network.
It should be noted that step 307 is similar with the step 204 in Fig. 2, it is above-mentioned that detailed description has been carried out, specifically Details are not described herein again.
308, other operations are executed.
In the present embodiment, when it is to be sent to the test request of mock platform that client, which determines target network request not, The target network can be requested to be sent to server-side, server-side can return to the target network and request corresponding service data extremely Client, client execute corresponding operation when receiving the target network corresponding service data of request;When mock platform When determining target network request not for mock test request, which can be requested be forwarded to server-side, server-side The target network, which can be returned, requests corresponding service data to client, and client is receiving target network request correspondence Service data when, execute corresponding operation.
In view of the foregoing it is apparent that default network agent is arranged in client in the embodiment of the present invention, needs are sent to The network request of mock platform is sent to mock platform, and mock platform determines whether network request is mock test request, when The mock corresponding with network request stored when mock platform determines that the network request is mock test request, in returned data library To client, client is based on mock test data and is tested test data.It is possible thereby to during network test, nothing Need to change code or both available to mock test data using third party's tool, at the same can be to avoid network test when change The case where moving code, and generating loophole in the production line.
Data test method provided in an embodiment of the present invention is illustrated above, below with reference to Fig. 4 and Fig. 5 to this hair The mock platform and client that bright embodiment provides are illustrated.
Referring to Fig. 4, Fig. 4 is a kind of embodiment schematic diagram of mock platform provided in an embodiment of the present invention, comprising:
Receiving unit 401, for receiving target network request, the target network request is that the network that client is sent is asked It asks, and target network request is that the client intercepts and controls default network agent and be determined as being sent to the mock and puts down The network request of platform;
Judging unit 402, for judging whether the target network request is mock test request;
Transmission unit 403, for when target network request is mock test request, will be stored in database with The target network requests corresponding mock data to be sent to the client, so that the client is based on and the target The corresponding mock data of network request are tested, and are stored in the database including corresponding with target network request The corresponding mock data of multiple network requests including mock data.
Optionally, the target network request carries header contents of target component and/or target, and the judgement is single Member 402 is specifically used for:
Judge whether the target component or the target header contents match with the parameter in default mapping relations, The default mapping relations are the corresponding relationship of test parameter or header contents and mock data;
If the target component or the target header contents are matched with the parameter in the default mapping relations, Determine that the target network request is mock test request;
If the parameter in the target component or the target header contents and the default mapping relations mismatches, Then determine that the target network request is not the mock test request;
Or,
Judge whether the target component and the target header contents match with the parameter in default mapping relations, The default mapping relations are the corresponding relationship of test parameter and header contents and mock data;
If the target component and the target header contents are matched with the parameter in the default mapping relations, Determine that the target network request is mock test request;
If the parameter in the target component and the target header contents and the default mapping relations mismatches, Then determine that the target network request is not mock test request.
Optionally, when target network request is not mock test request, the transmission unit 403 is also used to:
Target network request is sent to server-side, is requested so that the server-side is returned with the target network Corresponding service data is to the client.
Interactive mode in mock platform in the present embodiment between each unit retouching in embodiment as illustrated in the foregoing fig. 1 It states, specific details are not described herein again.
In view of the foregoing it is apparent that passing through network request pre-stored in database in embodiment provided by the invention With the corresponding relationship of mock data, it can mock data are got, it is possible thereby to during network test, without change Code or using third party's tool both it is available arrive mock test data, while can be to avoid network test when change generation Code, and the case where generate loophole in the production line.
Referring to Fig. 5, Fig. 5 is a kind of embodiment schematic diagram of client provided in an embodiment of the present invention, comprising:
Interception unit 501 is used for interception target network request;
Judging unit 502 judges whether the target network request is to be sent to mock for controlling default network agent The network request of platform;
Transmission unit 503, for when the target network request be sent to the mock platform network request when, Target network request is sent to the mock platform, so that the mock platform is determining the target network request When for mock test request, the mock data corresponding with target network request stored in database are returned into the client It holds, the multiple network requests pair being stored in the database including requesting corresponding mock data with the target network The mock data answered;
Test cell 504, for requesting corresponding mock data to be tested based on the target network.
Optionally, the judging unit 502 is specifically used for:
Control the net that the default network agent judges the transmission address and the mock platform of the target network request Whether network address matches;
If so, determining that the target network request is the network request for being sent to the mock platform;
If not, it is determined that the target network request is not the network request for being sent to the mock platform.
Optionally, when target network request is not to be sent to the network request of the mock platform, the transmission Unit 503 is also used to:
Target network request is sent to server-side, is requested so that the server-side is returned with the target network Corresponding service data;
The test cell is also used to request corresponding service data execution is corresponding to grasp according to the target network Make.
The description in interactive mode such as aforementioned embodiment illustrated in fig. 2 in client in the present embodiment between each unit, It is specific that details are not described herein again.
In view of the foregoing it is apparent that being stored in the database of mock platform in advance in embodiment provided by the invention Network request is sent to mock platform by default network agent by the corresponding mock data of each network request, client, and The mock data corresponding with target network request stored in mock platform database are obtained, to realize the mock in test process Data acquisition, it is possible thereby to during network test, without changing code or using third party's tool both available To mock test data, at the same can be to avoid network test when change code, and the case where generate loophole in the production line.
Referring to Fig. 5, Fig. 5 is a kind of hardware structural diagram of server provided in an embodiment of the present invention, the server 500 can generate bigger difference because configuration or performance are different, may include one or more central processing units (central processing units, CPU) 522 (for example, one or more processors) and memory 532, one Or (such as one or more mass memories are set the storage medium 530 of more than one storage application program 542 or data 544 It is standby).Wherein, memory 532 and storage medium 530 can be of short duration storage or persistent storage.It is stored in the journey of storage medium 530 Sequence may include one or more modules (diagram does not mark), and each module may include to a series of fingers in server Enable operation.Further, central processing unit 522 can be set to communicate with storage medium 530, execute on server 500 Series of instructions operation in storage medium 530.
Server 500 can also include one or more power supplys 526, one or more wired or wireless networks Interface 550, one or more input/output interfaces 558, and/or, one or more operating systems 541, such as Windows ServerTM, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM etc..
The step as performed by mock platform or client can be based on the server knot shown in fig. 5 in above-described embodiment Structure.
It is apparent to those skilled in the art that for convenience and simplicity of description, the system of foregoing description, The specific work process of device and unit, can refer to corresponding processes in the foregoing method embodiment, and details are not described herein.
The embodiment of the invention also provides a kind of storage mediums, are stored thereon with program, when which is executed by processor Realize the data test method.
The embodiment of the invention also provides a kind of processor, the processor is for running program, wherein described program fortune The data test method is executed when row.
The embodiment of the invention also provides a kind of equipment, equipment includes processor, memory and stores on a memory simultaneously The program that can be run on a processor, processor realize any reality in the corresponding embodiment of above-mentioned Fig. 1 or Fig. 2 when executing program Apply mode.
Equipment herein can be server, PC, PAD, mobile phone etc..
The present invention also provides a kind of computer program products, when executing on data test equipment, are adapted for carrying out State any embodiment in the corresponding embodiment of Fig. 1 or Fig. 2.
It should be understood by those skilled in the art that, the embodiment of the present invention can provide as method, system or computer program Product.Therefore, complete hardware embodiment, complete software embodiment or reality combining software and hardware aspects can be used in the present invention Apply the form of example.Moreover, it wherein includes the computer of computer usable program code that the present invention, which can be used in one or more, The computer program implemented in usable storage medium (including but not limited to magnetic disk storage, CD-ROM, optical memory etc.) produces The form of product.
The present invention be referring to the method for the embodiment of the present invention, equipment (system) and computer program product flow chart and/ Or block diagram describes.It should be understood that each process that can be realized by computer program instructions in flowchart and/or the block diagram and/ Or the combination of the process and/or box in box and flowchart and/or the block diagram.It can provide these computer program instructions To general purpose computer, special purpose computer, Embedded Processor or other programmable data processing devices processor to generate one A machine so that by the instruction that the processor of computer or other programmable data processing devices executes generate for realizing The device for the function of being specified in one or more flows of the flowchart and/or one or more blocks of the block diagram.
These computer program instructions, which may also be stored in, is able to guide computer or other programmable data processing devices with spy Determine in the computer-readable memory that mode works, so that it includes referring to that instruction stored in the computer readable memory, which generates, Enable the manufacture of device, the command device realize in one box of one or more flows of the flowchart and/or block diagram or The function of being specified in multiple boxes.
These computer program instructions also can be loaded onto a computer or other programmable data processing device, so that counting Series of operation steps are executed on calculation machine or other programmable devices to generate computer implemented processing, thus in computer or The instruction executed on other programmable devices is provided for realizing in one or more flows of the flowchart and/or block diagram one The step of function of being specified in a box or multiple boxes.
In a typical configuration, calculating equipment includes one or more processors (CPU), input/output interface, net Network interface and memory.
Memory may include the non-volatile memory in computer-readable medium, random access memory (RAM) and/ Or the forms such as Nonvolatile memory, such as read-only memory (ROM) or flash memory (flash RAM).Memory is computer-readable Jie The example of matter.
Computer-readable medium includes permanent and non-permanent, removable and non-removable media can be by any method Or technology come realize information store.Information can be computer readable instructions, data structure, the module of program or other data. The example of the storage medium of computer includes, but are not limited to phase change memory (PRAM), static random access memory (SRAM), moves State random access memory (DRAM), other kinds of random access memory (RAM), read-only memory (ROM), electric erasable Programmable read only memory (EEPROM), flash memory or other memory techniques, read-only disc read only memory (CD-ROM) (CD-ROM), Digital versatile disc (DVD) or other optical storage, magnetic cassettes, magnetic tape disk storage or other magnetic storage devices or Any other non-transmission medium, can be used for storage can be accessed by a computing device information.As defined in this article, computer Readable medium does not include temporary computer readable media (transitory media), such as the data-signal and carrier wave of modulation.
It should also be noted that, the terms "include", "comprise" or its any other variant are intended to nonexcludability Include, so that the process, method, commodity or the equipment that include a series of elements label not only include those element labels, It but also including other elements that are not explicitly listed label, or further include for this process, method, commodity or equipment Intrinsic element label.In the absence of more restrictions, the element label limited by sentence "including a ...", and It is not precluded in the process, method including element label, commodity or equipment that there is also other identical element labels.
It will be understood by those skilled in the art that the embodiment of the present invention can provide as method, system or computer program product. Therefore, complete hardware embodiment, complete software embodiment or embodiment combining software and hardware aspects can be used in the present invention Form.It is deposited moreover, the present invention can be used to can be used in the computer that one or more wherein includes computer usable program code The shape for the computer program product implemented on storage media (including but not limited to magnetic disk storage, CD-ROM, optical memory etc.) Formula.
The above is only the embodiment of the present invention, are not intended to restrict the invention.To those skilled in the art, The invention may be variously modified and varied.It is all within the spirit and principles of the present invention made by any modification, equivalent replacement, Improve etc., it should be included within scope of the presently claimed invention.

Claims (16)

1. a kind of data test method characterized by comprising
Mock platform receives target network request, the network request that the target network request sends for client, and the mesh Mark network request is that the client intercepts and controls default network agent and be determined as being sent to the network of the mock platform and asks It asks;
The mock platform judges whether the target network request is mock test request;
If so, the mock data corresponding with target network request stored in database are sent to by the mock platform The client is tested so that the client is based on mock data corresponding with target network request, described The multiple network requests being stored with including requesting corresponding mock data with the target network in database are corresponding Mock data.
2. the method according to claim 1, wherein the target network request carry target component and/or Header contents of target, the mock platform judge whether the target network request is that mock test request includes:
The mock platform judges the parameter in the target component or the target header contents and default mapping relations Whether match, the default mapping relations are the corresponding relationship of test parameter or header contents and mock data;
It is described if the target component or the target header contents are matched with the parameter in the default mapping relations Mock platform determines that the target network request is mock test request;
If the parameter in the target component or the target header contents and the default mapping relations mismatches, institute It states mock platform and determines that the target network request is not the mock test request;
Or,
The mock platform judges the parameter in the target component and the target header contents and default mapping relations Whether match, the default mapping relations are the corresponding relationship of test parameter and header contents and mock data;
It is described if the target component and the target header contents are matched with the parameter in the default mapping relations Mock platform determines that the target network request is mock test request;
If the parameter in the target component and the target header contents and the default mapping relations mismatches, institute It states mock platform and determines that the target network request is not mock test request.
3. method according to claim 1 or 2, which is characterized in that when the mock platform determines that the target network is asked When asking not as mock test request, the method also includes:
Target network request is sent to server-side by the mock platform, so that the server-side returns and the target The corresponding service data of network request is to the client.
4. a kind of data test method characterized by comprising
Client interception target network request;
The client controls default network agent and judges whether the target network request is the network for being sent to mock platform Request;
If so, target network request is sent to the mock platform by the client, so that the mock platform It is corresponding with target network request by what is stored in database when determining the target network request is mock test request Mock data return to the client, be stored in the database including mock number corresponding with target network request According to the corresponding mock data of multiple network requests inside;
The client, which is based on the target network, requests corresponding mock data to be tested.
5. according to the method described in claim 4, it is characterized in that, the client, which controls default network agent, judges target network Whether network request is to be sent to the network request of mock platform to include:
The client controls the default network agent and judges that the transmission address of the target network request and the mock are flat Whether the network address of platform matches;
If so, the client determines that the target network request is the network request for being sent to the mock platform;
If it is not, then the client determines that the target network request is not the network request for being sent to the mock platform.
6. method according to claim 4 or 5, which is characterized in that when the client determines the target network request Be be sent to the mock platform network request when, the method also includes:
Target network request is sent to server-side by the client, so that the server-side returns and the target network Network requests corresponding service data;
The client executes corresponding operation according to service data corresponding with target network request.
7. a kind of mock platform characterized by comprising receiving unit, for receiving target network request, the target network Request is the network request that client is sent, and target network request is that the client intercepts and controls default network generation Reason is determined as being sent to the network request of the mock platform;
Judging unit, for judging whether the target network request is mock test request;
Transmission unit, for when target network request is mock test request, by being stored in database with the mesh The corresponding mock data of mark network request are sent to the client, so that the client is based on asking with the target network It asks corresponding mock data to be tested, is stored in the database including mock number corresponding with target network request According to the corresponding mock data of multiple network requests inside.
8. mock platform according to claim 7, which is characterized in that the target network request carries target component And/or header contents of target, the judging unit are specifically used for:
Judge whether the target component or the target header contents match with the parameter in default mapping relations, it is described Default mapping relations are the corresponding relationship of test parameter or header contents and mock data;
If the target component or the target header contents are matched with the parameter in the default mapping relations, it is determined that The target network request is mock test request;
If the parameter in the target component or the target header contents and the default mapping relations mismatches, really The fixed target network request is not the mock test request;
Or,
Judge whether the target component and the target header contents match with the parameter in default mapping relations, it is described Default mapping relations are the corresponding relationship of test parameter and header contents and mock data;
If the target component and the target header contents are matched with the parameter in the default mapping relations, it is determined that The target network request is mock test request;
If the parameter in the target component and the target header contents and the default mapping relations mismatches, really The fixed target network request is not mock test request.
9. mock platform according to claim 7 or 8, which is characterized in that when target network request is not surveyed for mock When examination request, the transmission unit is also used to:
Target network request is sent to server-side, so that server-side return is corresponding with target network request Service data to the client.
10. a kind of client characterized by comprising
Interception unit is used for interception target network request;
Judging unit judges whether the target network request is the net for being sent to mock platform for controlling default network agent Network request;
Transmission unit will be described for when target network request is not to be sent to the network request of the mock platform Target network request is sent to the mock platform, so that the mock platform is determining that the target network request is mock When test request, the mock data corresponding with target network request stored in database are returned into the client, institute It is corresponding to state the multiple network requests being stored with including requesting corresponding mock data with the target network in database Mock data;
Test cell, for requesting corresponding mock data to be tested based on the target network.
11. client according to claim 10, which is characterized in that the judging unit is specifically used for:
Control the default network agent with judging the transmission address of the target network request and the network of the mock platform Whether location matches;
If so, determining that the target network request is the network request for being sent to the mock platform;
If not, it is determined that the target network request is not the network request for being sent to the mock platform.
12. client described in 0 or 11 according to claim 1, which is characterized in that when target network request is not to be sent to When the network request of the mock platform, the transmission unit is also used to:
Target network request is sent to server-side, so that server-side return is corresponding with target network request Service data;
The test cell is also used to execute corresponding operation according to service data corresponding with target network request.
13. a kind of processor, which is characterized in that the processor is for running computer program, the computer program operation The step of any one of Shi Zhihang such as claims 1 to 3 the method.
14. a kind of processor, which is characterized in that the processor is for running computer program, the computer program operation The step of any one of Shi Zhihang such as claim 4 to 6 the method.
15. a kind of computer readable storage medium, is stored thereon with computer program, it is characterised in that: the computer program It is realized when being executed by processor such as the step of any one of claims 1 to 3 the method.
16. a kind of computer readable storage medium, is stored thereon with computer program, it is characterised in that: the computer program It is realized when being executed by processor such as the step of any one of claim 4 to 6 the method.
CN201811598912.8A 2018-12-25 2018-12-25 A kind of data test method and relevant device Pending CN109743222A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811598912.8A CN109743222A (en) 2018-12-25 2018-12-25 A kind of data test method and relevant device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811598912.8A CN109743222A (en) 2018-12-25 2018-12-25 A kind of data test method and relevant device

Publications (1)

Publication Number Publication Date
CN109743222A true CN109743222A (en) 2019-05-10

Family

ID=66359892

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811598912.8A Pending CN109743222A (en) 2018-12-25 2018-12-25 A kind of data test method and relevant device

Country Status (1)

Country Link
CN (1) CN109743222A (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110362491A (en) * 2019-07-17 2019-10-22 广州市有车以后信息科技有限公司 A kind of mock test method and test device based on go-between's agent skill group
CN110413526A (en) * 2019-07-30 2019-11-05 北京达佳互联信息技术有限公司 A kind of request processing method, device, server and equipment
CN110489322A (en) * 2019-07-08 2019-11-22 中国平安财产保险股份有限公司 MOCK test method, device, computer equipment and storage medium
CN111131436A (en) * 2019-12-20 2020-05-08 广州品唯软件有限公司 Method and device for quickly searching proxy and readable storage medium
CN112035344A (en) * 2020-08-13 2020-12-04 天津智融创新科技发展有限公司 Multi-scenario test method, device, equipment and computer readable storage medium
CN112769655A (en) * 2021-03-02 2021-05-07 北京百家科技集团有限公司 Network variation testing method, device and system

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107368405A (en) * 2016-05-11 2017-11-21 腾讯科技(北京)有限公司 Test system, method of testing, mock platforms, blocker and client
CN108040045A (en) * 2017-12-07 2018-05-15 百度在线网络技术(北京)有限公司 Generation method, device, server and the storage medium of flowing of access file
CN108199921A (en) * 2017-12-29 2018-06-22 上海瑞家信息技术有限公司 The method, apparatus and storage medium of a kind of simulation test
CN108345535A (en) * 2017-12-26 2018-07-31 阿里巴巴集团控股有限公司 Mock test methods, device and equipment
US20180288187A1 (en) * 2015-12-08 2018-10-04 Alibaba Group Holding Limited Access request conversion method and apparatus

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20180288187A1 (en) * 2015-12-08 2018-10-04 Alibaba Group Holding Limited Access request conversion method and apparatus
CN107368405A (en) * 2016-05-11 2017-11-21 腾讯科技(北京)有限公司 Test system, method of testing, mock platforms, blocker and client
CN108040045A (en) * 2017-12-07 2018-05-15 百度在线网络技术(北京)有限公司 Generation method, device, server and the storage medium of flowing of access file
CN108345535A (en) * 2017-12-26 2018-07-31 阿里巴巴集团控股有限公司 Mock test methods, device and equipment
CN108199921A (en) * 2017-12-29 2018-06-22 上海瑞家信息技术有限公司 The method, apparatus and storage medium of a kind of simulation test

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110489322A (en) * 2019-07-08 2019-11-22 中国平安财产保险股份有限公司 MOCK test method, device, computer equipment and storage medium
CN110362491A (en) * 2019-07-17 2019-10-22 广州市有车以后信息科技有限公司 A kind of mock test method and test device based on go-between's agent skill group
CN110362491B (en) * 2019-07-17 2020-02-21 广州市有车以后信息科技有限公司 Mock testing method and testing device based on man-in-the-middle agent technology
CN110413526A (en) * 2019-07-30 2019-11-05 北京达佳互联信息技术有限公司 A kind of request processing method, device, server and equipment
CN111131436A (en) * 2019-12-20 2020-05-08 广州品唯软件有限公司 Method and device for quickly searching proxy and readable storage medium
CN111131436B (en) * 2019-12-20 2022-08-30 广州品唯软件有限公司 Method and device for quickly searching proxy and readable storage medium
CN112035344A (en) * 2020-08-13 2020-12-04 天津智融创新科技发展有限公司 Multi-scenario test method, device, equipment and computer readable storage medium
CN112769655A (en) * 2021-03-02 2021-05-07 北京百家科技集团有限公司 Network variation testing method, device and system
CN112769655B (en) * 2021-03-02 2022-08-12 北京百家科技集团有限公司 Network variation testing method, device and system

Similar Documents

Publication Publication Date Title
CN109743222A (en) A kind of data test method and relevant device
US11048620B2 (en) Distributed system test device
CN106487850B (en) The methods, devices and systems of mirror image are obtained under a kind of cloud environment
CN107395659A (en) A kind of method and device of service handling and common recognition
CN110597730B (en) Automatic test case generation method and system based on scene method
CN108933713A (en) The method, apparatus and service server of sandbox debugging are realized based on shadow link
CN104767655B (en) A kind of analog result detection method and device
CN109815119A (en) A kind of test method and device of APP link channel
CN104778123B (en) A kind of method and device of detecting system performance
US10241902B2 (en) Systems and methods for benchmark based cross platform service demand prediction
CN108734317A (en) Net about vehicle order information processing method and processing device
CN106878370A (en) The update method and equipment of a kind of local cache
CN109583223A (en) A kind of detection method and device of pair of big data security deployment
CN110083533A (en) Data processing method and device based on Mock service
CN115486026A (en) Quantum computing machine learning of security threats
CN108052444A (en) A kind of method and apparatus of performance test for mobile application
De A Study on Chaos Engineering for improving Cloud Software Quality and Reliability
CN109597627A (en) A kind of component mounting method, device, storage medium and processor
CN109495435A (en) The firewall update method and device of server
CN107463450A (en) The data processing method and device of container
US10635982B2 (en) Optimizing spatiotemporal computational problems
CN109656825A (en) The method and device of fine arts resource processing, electronic equipment, storage medium
CN108306961A (en) A kind of file block method for down loading and device
CN106293778A (en) The packaging method of application program installation kit and device
CN103488530B (en) A kind of lock moving method and device

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
RJ01 Rejection of invention patent application after publication

Application publication date: 20190510

RJ01 Rejection of invention patent application after publication