CN110727589A - Test method, device and equipment - Google Patents

Test method, device and equipment Download PDF

Info

Publication number
CN110727589A
CN110727589A CN201910943956.8A CN201910943956A CN110727589A CN 110727589 A CN110727589 A CN 110727589A CN 201910943956 A CN201910943956 A CN 201910943956A CN 110727589 A CN110727589 A CN 110727589A
Authority
CN
China
Prior art keywords
network test
mock
path
domain name
test request
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
CN201910943956.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.)
Beijing Chuangxin Journey Network Technology Co Ltd
Original Assignee
Beijing Chuangxin Journey Network Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Chuangxin Journey Network Technology Co Ltd filed Critical Beijing Chuangxin Journey Network Technology Co Ltd
Priority to CN201910943956.8A priority Critical patent/CN110727589A/en
Publication of CN110727589A publication Critical patent/CN110727589A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3684Test management for test design, e.g. generating new test cases
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites

Abstract

The invention provides a test method, a test device and test equipment. The testing method comprises the steps of obtaining a first network testing request; determining whether the domain name and the path of the first network test request are matched with the domain name and the path of a second network test request which needs to be sent to the mock server; the second network test request is any one of prestored network test requests which need to be sent to the mock server; if so, replacing the domain name and the path of the first network test request with the domain name and the path of the mock server; sending the replaced first network test request to the mock server; and receiving a first network test response returned by the mock server, wherein the first network test response comprises simulation data. The method realizes independent mock service control on different requests.

Description

Test method, device and equipment
Technical Field
The present invention relates to computer software technologies, and in particular, to a test method, device, and apparatus.
Background
In the research and development and test of internet companies, when a third-party service is unavailable or when a server interface is not developed, a client or a tester wants to develop the third-party service simultaneously, so that a data request of an interface needs to be simulated, that is, simulated data is returned to a client by using a mock server.
Generally, in a general mock service, a client configures a domain name of a mock server, and all requests sent by the client are sent to the mock server after being replaced by the domain name of the mock server. If the mock server is configured to perform mock on the request, the mock server returns the simulation data to the client, and if the mock server is not configured to perform mock on the request, the mock server forwards the request of the client to the real server, so that the client obtains the real data.
The above method has a problem that, when the request of the client includes requests corresponding to at least two domain names, all domain names of all the requests are replaced with domain names of the mock server and then sent to the mock server, and if the mock server is configured with mock for the request, the mock server returns analog data to all the requests, so that the request corresponding to any one of the at least two domain names cannot be forwarded.
Disclosure of Invention
The invention provides a test method, a test device and test equipment, which realize independent mock service control on different requests.
In a first aspect, the present invention provides a testing method, applied to a client, including:
acquiring a first network test request;
determining whether the domain name and the path of the first network test request are matched with the domain name and the path of a second network test request which needs to be sent to a mock server; the second network test request is any one of prestored network test requests which need to be sent to the mock server;
if so, replacing the domain name and the path of the first network test request with the domain name and the path of the mock server;
sending the replaced first network test request to the mock server;
and receiving a first network test response returned by the mock server, wherein the first network test response comprises simulation data.
Optionally, the determining whether the domain name and the path of the first network test request are matched with the domain name and the path of the second network test request that needs to be sent to the mock server includes:
determining whether the client side starts a one-key mock function;
and if the one-key mock function is not started, determining whether the domain name and the path of the first network test request are matched with the domain name and the path of a second network test request which needs to be sent to the mock server.
Optionally, the determining whether the client starts a one-key mock function includes:
determining a one-key mock state identifier of the client;
and determining whether to start the one-key mock function according to the one-key mock state identifier.
Optionally, the method further includes:
if the domain name and the path of the first network test request are not matched with the domain name and the path of the second network test request, sending the first network request to a real target server corresponding to the domain name and the path of the first network request;
and receiving a second network test response returned by the real target server, wherein the second network test response comprises real data.
Optionally, before the obtaining of the first network test request, the method further includes:
receiving a configuration instruction, wherein the configuration instruction carries the second network test request;
and storing the second network test request to a database.
Optionally, the obtaining the first network test request includes:
and starting network monitoring and intercepting the monitored first network test request.
Optionally, the first network test request further includes a request parameter;
the determining whether the domain name and the path of the first network test request are matched with the domain name and the path of the second network test request which needs to be sent to the mock server includes:
and determining whether the domain name, the path and the request parameters of the first network test request are matched with the domain name, the path and the request parameters of a second network test request which needs to be sent to the mock server.
In a second aspect, the present invention provides a test apparatus comprising:
the acquisition module is used for acquiring a first network test request;
the matching module is used for determining whether the domain name and the path of the first network test request are matched with the domain name and the path of a second network test request which needs to be sent to the mock server; the second network test request is any one of prestored network test requests which need to be sent to the mock server;
the replacing module is used for replacing the domain name and the path of the first network test request with the domain name and the path of the mock server when the domain name and the path of the first network test request are matched with the domain name and the path of the second network test request which needs to be sent to the mock server;
the sending module is used for sending the replaced first network test request to the mock server;
and the receiving module is used for receiving a first network test response returned by the mock server, wherein the first network test response comprises simulation data.
Optionally, the matching module is configured to:
determining whether the client side starts a one-key mock function;
and if the one-key mock function is not started, determining whether the domain name and the path of the first network test request are matched with the domain name and the path of a second network test request which needs to be sent to the mock server.
Optionally, the matching module is configured to:
determining a one-key mock state identifier of the client;
and determining whether to start the one-key mock function according to the one-key mock state identifier.
Optionally, the sending module is further configured to:
if the domain name and the path of the first network test request are not matched with the domain name and the path of the second network test request, sending the first network request to a real target server corresponding to the domain name and the path of the first network request;
the receiving module is further configured to:
and receiving a second network test response returned by the real target server, wherein the second network test response comprises real data.
Optionally, the apparatus further comprises:
the configuration module is used for receiving a configuration instruction, and the configuration instruction carries the second network test request;
and the storage module is used for storing the second network test request to a database.
Optionally, the obtaining module is configured to:
and starting network monitoring and intercepting the monitored first network test request.
Optionally, the first network test request further includes a request parameter;
the matching module is used for:
and determining whether the domain name, the path and the request parameters of the first network test request are matched with the domain name, the path and the request parameters of a second network test request which needs to be sent to the mock server.
In a third aspect, the present invention provides a test apparatus, comprising a memory and a processor; the memory is connected with the processor;
the memory for storing a computer program;
the processor is configured to implement the testing method according to any one of the above first aspects when the computer program is executed.
In a fourth aspect, the present invention provides a storage medium having stored thereon a computer program which, when executed by a processor, implements a testing method as described in any one of the first aspects above.
The invention provides a test method, a test device and test equipment, wherein a first network test request is obtained; determining whether the domain name and the path of the first network test request are matched with the domain name and the path of a second network test request which needs to be sent to the mock server; the second network test request is any one of prestored network test requests which need to be sent to the mock server; if so, replacing the domain name and the path of the first network test request with the domain name and the path of the mock server; sending the replaced first network test request to the mock server; and receiving a first network test response returned by the mock server, wherein the first network test response comprises simulation data. The method realizes the mock control on the first network test request at the client, and can realize the independent mock service control for the requests of different domain names and paths. The method enables the tester to select the request needing mock more conveniently and intuitively at the client, and more intuitively checks which service the request result comes from, without influencing the judgment of the test result. In addition, the method also avoids the problem that the mock server forwards the certificate trust which may exist.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to these drawings without creative efforts.
FIG. 1 is a schematic diagram of an application scenario of a testing method according to the present invention;
FIG. 2 is a first flowchart illustrating a testing method according to the present invention;
FIG. 3 is a second flowchart illustrating a testing method according to the present invention;
FIG. 4 is a functional diagram of a client according to the present invention;
FIG. 5 is a third schematic flow chart of a testing method according to the present invention;
FIG. 6 is a schematic structural diagram of a testing apparatus according to the present invention;
fig. 7 is a schematic structural diagram of a testing apparatus provided in the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Fig. 1 is a schematic view of an application scenario of a testing method provided by the present invention. As shown in fig. 1, the client 10 may be a terminal device used by a tester, such as a mobile phone, a tablet computer, etc., and the tester may send a network request to be tested through operations on the client 10; the mock server 20 is configured to provide response data corresponding to the network request to the client, where the corresponding data is analog data; the real target server 30 is a server to which the network request sent by the client 10 actually corresponds, that is, a server to which the domain name in the network request of the client 10 corresponds.
The testing method provided by the invention is applied to the client 10, and is characterized in that a first network testing request is obtained at the client 10, whether the domain name and the path of the first network testing request are matched with the domain name and the path of a second network testing request needing to be sent to the mock server 20 is judged, and when the domain name and the path of the first network testing request are matched, the domain name and the path of the first network testing request are replaced by the domain name and the path of the mock server 20 and are sent to the mock server 20, so that the simulation data returned by the mock server 20 are obtained. And when the network domain name and the path are not matched, the first network test request is directly sent to a real target server corresponding to the domain name and the path of the first network test request so as to obtain real data. Thereby realizing the control of whether the network test request needs to be mock at the client 10 side. The following describes the test method provided by the present invention with reference to specific examples.
Fig. 2 is a first schematic flow chart of a testing method provided by the present invention. The method can be executed by a testing device, and the testing device can be a client terminal such as a terminal device. As shown in fig. 2, the method includes:
s201, obtaining a first network test request.
In this embodiment, the first network test request is any request sent by a client in a test process of a tester, and the manner in which the client obtains the first network test request may be varied, for example, network monitoring is started at the client, and the monitored first network test request is intercepted.
In practical application, a switch of the mock service can be set on the client, and a tester can turn on or off the switch of the mock service. If the switch of the mock service of the client is turned on, the client can monitor and intercept the first network test request in the above mode. If the switch of the mock service is closed, the client does not monitor and intercept the first network test request, and the first network test request is sent to the requested real target server according to a normal request sending flow.
S202, determining whether the domain name and the path of the first network test request are matched with the domain name and the path of a second network test request which needs to be sent to the mock server; the second network test request is any one of prestored network test requests which need to be sent to the mock server.
The second network test request to be sent to the mock server may be data preset and stored in a database, and a tester may determine in advance which requests need to be sent to the mock server to obtain simulation data and which requests need to be sent to a real target server to obtain real data, and set in advance. The tester can set a plurality of network test requests which need to be sent to the mock server according to actual needs, and the second network test request can be any one of the network test requests. After a tester opens a switch of the mock service, the client can obtain the pre-stored data of the network test request which needs to be sent to the mock server from the database, and the pre-stored data comprises the domain name and the path of the network test request.
And S203, if the first network test request is matched with the mock server, replacing the domain name and the path of the first network test request with the domain name and the path of the mock server.
S204, sending the replaced first network test request to the mock server;
s205, receiving a first network test response returned by the mock server, wherein the first network test response comprises simulation data.
And if the domain name and the path of the first network test request are matched with the domain name and the path of the second network test request which needs to be sent to the mock server, the first network test request is a network test request which needs to be sent to the mock server and is preset by a tester. Therefore, the domain name and the path of the first network test request are replaced by the domain name and the path of the mock server, then the client can send the replaced first network test request to the mock server and receive the first network test response returned by the mock server, and the first network test response is the simulation data corresponding to the first network test request and provided by the mock server. In the process, since the client determines that the first network test request is a request for mock according to the matching of the domain name and the path, the mock server directly returns the simulation data without further judgment after receiving the first network test request.
Optionally, in the method, a tester may configure a domain name and a path of a mock server at a client, so that when replacement is needed, the domain name and the path requested by the first network are replaced with the domain name and the path of the mock server. Or the domain names and paths of a plurality of mock servers can be configured, and when a second network request needing to be configured and sent to the mock server is configured in advance, the mock server needing to be sent is specified to be one of the plurality of mock servers, so that the client can control different requests to be sent to different mock servers.
Optionally, the method further includes:
and S206, if the domain name and the path of the first network test request are not matched with the domain name and the path of the second network test request, sending the first network request to a real target server corresponding to the domain name and the path of the first network request.
And S207, receiving a second network test response returned by the real target server, wherein the second network test response comprises real data.
And if the domain name and the path of the first network test request are not matched with the domain name and the path of the second network test request which needs to be sent to the mock server, the first network test request is not the network test request which needs to be sent to the mock server and is preset by the tester. Therefore, the first network test is directly sent to the real target server, and the second network test response returned by the real target server is received, wherein the second network test corresponds to the real data provided by the real target server and corresponding to the first network test request.
In the test method provided by the embodiment, a first network test request is obtained; determining whether the domain name and the path of the first network test request are matched with the domain name and the path of a second network test request which needs to be sent to the mock server; the second network test request is any one of prestored network test requests which need to be sent to the mock server; if so, replacing the domain name and the path of the first network test request with the domain name and the path of the mock server; sending the replaced first network test request to the mock server; and receiving a first network test response returned by the mock server, wherein the first network test response comprises simulation data. The method realizes the mock control on the first network test request at the client, and can realize the independent mock service control for the requests of different domain names and paths. The method enables the tester to select the request needing mock more conveniently and intuitively at the client, and more intuitively checks which service the request result comes from, without influencing the judgment of the test result.
Meanwhile, the client side directly sends the first network test request to the real target server when the network test requests are not matched, and the forwarding of the network test request by the mock server is not needed, so that the problem of certificate trust possibly brought by the forwarding of the mock server is avoided. In addition, the method realizes the forwarding request at the client, and has lower cost compared with the forwarding realized by a mock server in the prior art.
The realization idea of the mock is mainly to replace the linked domain name and path, so the function is embedded in the network monitoring module, the interface is redirected by adopting a proxy protocol mode, the realization logic of the network request does not need to be concerned in the mock service, and the coupling in the logic is avoided.
In the above embodiments, mock control of a network request from a client is realized by matching a domain name and a path, and in order to further improve the usability of the method in practical application, the invention provides another testing method. Fig. 3 is a schematic flow chart of a testing method according to the present invention. As shown in fig. 3, on the basis of fig. 2, determining in S202 whether the domain name and the path of the first network test request match with the domain name and the path of the second network test request that needs to be sent to the mock server, may further include:
s301, determining whether the client side starts a one-key mock function.
In the above embodiment, the tester may configure the network test request that needs to be executed with mock in advance, but if all the requests need to be executed with mock in some time period, the tester needs to execute a large amount of configuration in advance, and therefore, the embodiment provides a one-key mock function at the client.
Optionally, determining whether the client starts the one-key mock function may include:
determining a one-key mock state identifier of the client; and determining whether to start the one-key mock function according to the one-key mock state identifier.
In practical applications, the client may provide a switch with a one-key mock function, and the tester may turn on the switch with the one-key mock function, that is, the switch with the one-key mock function is turned on, that is, the switch with the one-key mock function is turned off corresponding to setting the one-key mock state identifier to a corresponding numerical value, for example, setting the state identifier to 1 or true, and setting the one-key mock state identifier to 0 or false. Thus, whether the one-key mock function is turned on or not can be determined by determining the one-key mock state identifier.
And S303, if the one-key mock function is not started, determining whether the domain name and the path of the first network test request are matched with the domain name and the path of the second network test request which needs to be sent to the mock server.
In the case that the one-key mock function is turned on, the client will send the fixed data information of the one-key mock function, for example, request _ key, which is a unique identifier: request parameter query: request link url: request http _ method: mock replaces linked mock _ key: and storing the domain name and the path into a database, so that any network test request of the client is subjected to domain name and path replacement and then forwarded to the mock server to obtain the simulation data.
And under the condition that the one-key mock function is not opened, further matching the domain name and the path of the first network test request with the domain name and the path of a second network test request which is stored in the database and needs to be sent to the mock server to determine that the first network test request is sent to the mock server or the real target server.
The testing method provided in this embodiment, on the basis of the embodiment shown in fig. 1, further includes determining whether the client starts a one-key mock function, and if the one-key mock function is not started, determining whether the domain name and the path of the first network test request are matched with the domain name and the path of the second network test request that needs to be sent to the mock server. By providing the one-key mock function at the client, the convenience of mock control at the client is further improved.
On the basis of the above embodiment, the present invention further provides a test method for realizing mock of any interface request sent by the client. Specifically, the first network test request carries a request parameter in addition to a domain name and a parameter, where the request parameter is a service-related request parameter other than a bottom-layer parameter. Determining whether the domain name and the path of the first network test request are matched with the domain name and the path of the second network test request which needs to be sent to the mock server in S202 may include:
and determining whether the domain name, the path and the request parameters of the first network test request are matched with the domain name, the path and the request parameters of a second network test request which needs to be sent to the mock server.
Because there may be requests with the same domain name and path but different request parameters in the network test request sent by the client, in order to implement mock control for each request, in this embodiment, the domain name, path and request parameters of the first network test request are matched with the domain name, path and request parameters of the second network test request that needs to be sent to the mock server. By matching the domain name, the path and the request parameter, the request link carrying a certain custom parameter can be targeted to carry out individual mock.
Fig. 4 is a functional diagram of a client according to the present invention. As shown in fig. 4, a developer/tester may turn on or off a one-button mock function through a client, and may add/remove a single-link mock support with a parameter or add/remove a single-link mock support without a parameter through the client.
Specifically, a developer/tester performs corresponding configuration on a configuration page of a client, and the client receives a configuration instruction, wherein the configuration instruction carries the second network test request; and storing the second network test request to a database. Here, the second network test request may be the above-described link with or without parameters. For example, by clicking the view Mock service button, the added Mock link information, i.e., the network test request information, can be viewed by entering the Mock service list page.
The development/test personnel can also view all mock data through the client side or search and view according to the path. After the client starts the mock service, the network monitoring is opened, all current request information is obtained in real time, and when a request is initiated and a corresponding return result is received, the corresponding information is stored in a database, for example: the domain name Host, the connection URL, the Request mode Method, the parameter specifications, the Request header, the Response state Status, the Response header, the Response Data and other Request information help the tester to quickly identify whether problems exist in the current Request process. In addition, a request list for network monitoring is opened, the monitored requests are checked, and data can be classified and screened according to conditions such as domain names and paths. For example, a certain item of requested data can be selected to add Mock support, for example, by left-sliding or right-sliding addition, and the data is spliced and processed into a data format supported by the Mock service, so as to store the database.
The testing method provided by the present invention is described below with reference to specific examples, taking an Android client as an example, and fig. 5 is a schematic flow chart of the testing method provided by the present invention.
As shown in fig. 5, when an Android client is implemented, a method for implementing tangent plane programming is used to perform data request instrumentation on the client, so as to intercept a network test request of the client, cache all request addresses of the client, then screen the cached request through a mock state library, that is, a mock state control page in an interface-mock state, and add a network interceptor for processing mock logic through network request instrumentation to determine whether the network test request meets a mock condition, that is, determine whether the network test request is matched with pre-stored data in the database, if the network test request meets the mock condition, replace a domain name and a path and send the domain name and the path to a mock server, and if the network test request does not meet the mock condition, send the domain name and the path to a real target server according to an original address. For all requests of the client, the requests only need to be requested once, and the requests can appear in the mock state control page, so that development/testing personnel can manage the mock state of the requests. The implementation mode adopts a tangent plane programming idea, and realizes the effects of zero perception and low coupling on the service level through code instrumentation.
Fig. 6 is a schematic structural diagram of a testing apparatus according to the present invention. As shown in fig. 6, the test apparatus 60 includes:
an obtaining module 601, configured to obtain a first network test request;
a matching module 602, configured to determine whether a domain name and a path of the first network test request match a domain name and a path of a second network test request that needs to be sent to the mock server; the second network test request is any one of prestored network test requests which need to be sent to the mock server;
a replacing module 603, configured to replace the domain name and the path of the first network test request with the domain name and the path of the mock server when the domain name and the path of the first network test request match with the domain name and the path of the second network test request that needs to be sent to the mock server;
a sending module 604, configured to send the replaced first network test request to the mock server;
a receiving module 605, configured to receive a first network test response returned by the mock server, where the first network test response includes simulation data.
Optionally, the matching module 602 is configured to:
determining whether the client side starts a one-key mock function;
and if the one-key mock function is not started, determining whether the domain name and the path of the first network test request are matched with the domain name and the path of the second network test request which needs to be sent to the mock server.
Optionally, the matching module 602 is configured to:
determining a one-key mock state identifier of the client;
and determining whether to start the one-key mock function according to the one-key mock state identifier.
Optionally, the sending module 604 is further configured to:
if the domain name and the path of the first network test request are not matched with the domain name and the path of the second network test request, sending the first network request to a real target server corresponding to the domain name and the path of the first network request;
the receiving module 605 is further configured to:
and receiving a second network test response returned by the real target server, wherein the second network test response comprises real data.
Optionally, the apparatus further comprises:
a configuration module 606, configured to receive a configuration instruction, where the configuration instruction carries the second network test request;
the storage module 607 is configured to store the second network test request in a database.
Optionally, the obtaining module 601 is configured to:
and starting network monitoring and intercepting the monitored first network test request.
Optionally, the first network test request further includes a request parameter;
the matching module 602 is configured to:
and determining whether the domain name, the path and the request parameters of the first network test request are matched with the domain name, the path and the request parameters of a second network test request which needs to be sent to the mock server.
The testing apparatus provided in this embodiment may be used to implement the testing method in the above method embodiments, and the implementation principle and the technical effect are similar, which are not described herein again.
Fig. 7 is a schematic structural diagram of a testing apparatus provided in the present invention. As shown in fig. 7, the test apparatus 70 includes a memory 701 and a processor 702; the memory 701 is coupled to the processor 702.
A memory 701 for storing a computer program;
a processor 702 for implementing the testing method according to any of the above embodiments when the computer program is executed.
The invention provides a storage medium having stored thereon a computer program which, when executed by a processor, implements a testing method as in any of the embodiments described above.
Those of ordinary skill in the art will understand that: all or a portion of the steps of implementing the above-described method embodiments may be performed by hardware associated with program instructions. The program may be stored in a computer-readable storage medium. When executed, the program performs steps comprising the method embodiments described above; and the aforementioned storage medium includes: various media that can store program codes, such as ROM, RAM, magnetic or optical disks.
Finally, it should be noted that: the above embodiments are only used to illustrate the technical solution of the present invention, and not to limit the same; while the invention has been described in detail and with reference to the foregoing embodiments, it will be understood by those skilled in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some or all of the technical features may be equivalently replaced; and the modifications or the substitutions do not make the essence of the corresponding technical solutions depart from the scope of the technical solutions of the embodiments of the present invention.

Claims (10)

1. A testing method is applied to a client side, and is characterized by comprising the following steps:
acquiring a first network test request;
determining whether the domain name and the path of the first network test request are matched with the domain name and the path of a second network test request which needs to be sent to a mock server; the second network test request is any one of prestored network test requests which need to be sent to the mock server;
if so, replacing the domain name and the path of the first network test request with the domain name and the path of the mock server;
sending the replaced first network test request to the mock server;
and receiving a first network test response returned by the mock server, wherein the first network test response comprises simulation data.
2. The method of claim 1, wherein the determining whether the domain name and the path of the first network test request match those of a second network test request to be sent to a mock server comprises:
determining whether the client side starts a one-key mock function;
and if the one-key mock function is not started, determining whether the domain name and the path of the first network test request are matched with the domain name and the path of a second network test request which needs to be sent to the mock server.
3. The method of claim 2, wherein the determining whether the client starts a one-key mock function comprises:
determining a one-key mock state identifier of the client;
and determining whether to start the one-key mock function according to the one-key mock state identifier.
4. The method of claim 1, further comprising:
if the domain name and the path of the first network test request are not matched with the domain name and the path of the second network test request, sending the first network request to a real target server corresponding to the domain name and the path of the first network request;
and receiving a second network test response returned by the real target server, wherein the second network test response comprises real data.
5. The method of claim 1, wherein prior to obtaining the first network test request, the method further comprises:
receiving a configuration instruction, wherein the configuration instruction carries the second network test request;
and storing the second network test request to a database.
6. The method of any of claims 1-5, wherein obtaining the first network test request comprises:
and starting network monitoring and intercepting the monitored first network test request.
7. The method according to any of claims 1-5, wherein the first network test request further comprises a request parameter;
the determining whether the domain name and the path of the first network test request are matched with the domain name and the path of the second network test request which needs to be sent to the mock server includes:
and determining whether the domain name, the path and the request parameters of the first network test request are matched with the domain name, the path and the request parameters of a second network test request which needs to be sent to the mock server.
8. A test apparatus, comprising:
the acquisition module is used for acquiring a first network test request;
the matching module is used for determining whether the domain name and the path of the first network test request are matched with the domain name and the path of a second network test request which needs to be sent to the mock server; the second network test request is any one of prestored network test requests which need to be sent to the mock server;
the replacing module is used for replacing the domain name and the path of the first network test request with the domain name and the path of the mock server when the domain name and the path of the first network test request are matched with the domain name and the path of the second network test request which needs to be sent to the mock server;
the sending module is used for sending the replaced first network test request to the mock server;
and the receiving module is used for receiving a first network test response returned by the mock server, wherein the first network test response comprises simulation data.
9. A test apparatus comprising a memory and a processor; the memory is connected with the processor;
the memory for storing a computer program;
the processor for, when being executed by a computer program, implementing the testing method according to any one of the preceding claims 1-7.
10. A storage medium having stored thereon a computer program for implementing a testing method according to any one of claims 1-7 when being executed by a processor.
CN201910943956.8A 2019-09-30 2019-09-30 Test method, device and equipment Pending CN110727589A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910943956.8A CN110727589A (en) 2019-09-30 2019-09-30 Test method, device and equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910943956.8A CN110727589A (en) 2019-09-30 2019-09-30 Test method, device and equipment

Publications (1)

Publication Number Publication Date
CN110727589A true CN110727589A (en) 2020-01-24

Family

ID=69218681

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910943956.8A Pending CN110727589A (en) 2019-09-30 2019-09-30 Test method, device and equipment

Country Status (1)

Country Link
CN (1) CN110727589A (en)

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111427766A (en) * 2020-02-20 2020-07-17 北京齐尔布莱特科技有限公司 Request processing method and device and proxy server
CN111865679A (en) * 2020-07-14 2020-10-30 北京自如信息科技有限公司 Data simulation method, device, equipment and readable storage medium
CN111953775A (en) * 2020-08-12 2020-11-17 吉林亿联银行股份有限公司 Data transmission method and device
CN112035344A (en) * 2020-08-13 2020-12-04 天津智融创新科技发展有限公司 Multi-scenario test method, device, equipment and computer readable storage medium
CN112685321A (en) * 2021-01-11 2021-04-20 河南中原消费金融股份有限公司 Method, system and storage medium for testing microservice
CN113204477A (en) * 2021-03-31 2021-08-03 北京达佳互联信息技术有限公司 Application testing method and device, electronic equipment and storage medium
CN113377678A (en) * 2021-07-13 2021-09-10 挂号网(杭州)科技有限公司 Test environment switching method and device, electronic equipment and storage medium
CN114650276A (en) * 2022-02-24 2022-06-21 北京健康之家科技有限公司 Service request processing method, electronic equipment terminal and storage medium
CN114666301A (en) * 2020-12-22 2022-06-24 深圳Tcl新技术有限公司 APP testing method and system based on mock server

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090234861A1 (en) * 2005-09-14 2009-09-17 Jorey Ramer Using mobile application data within a monetization platform
CN106294113A (en) * 2015-06-03 2017-01-04 阿里巴巴集团控股有限公司 A kind of creation method based on programmable type testing service and device
CN107547312A (en) * 2017-09-21 2018-01-05 广州四三九九信息科技有限公司 Applied program testing method and system

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090234861A1 (en) * 2005-09-14 2009-09-17 Jorey Ramer Using mobile application data within a monetization platform
CN106294113A (en) * 2015-06-03 2017-01-04 阿里巴巴集团控股有限公司 A kind of creation method based on programmable type testing service and device
CN107547312A (en) * 2017-09-21 2018-01-05 广州四三九九信息科技有限公司 Applied program testing method and system

Cited By (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111427766A (en) * 2020-02-20 2020-07-17 北京齐尔布莱特科技有限公司 Request processing method and device and proxy server
CN111427766B (en) * 2020-02-20 2023-08-18 北京齐尔布莱特科技有限公司 Request processing method and device and proxy server
CN111865679A (en) * 2020-07-14 2020-10-30 北京自如信息科技有限公司 Data simulation method, device, equipment and readable storage medium
CN111953775A (en) * 2020-08-12 2020-11-17 吉林亿联银行股份有限公司 Data transmission method and device
CN112035344A (en) * 2020-08-13 2020-12-04 天津智融创新科技发展有限公司 Multi-scenario test method, device, equipment and computer readable storage medium
CN114666301A (en) * 2020-12-22 2022-06-24 深圳Tcl新技术有限公司 APP testing method and system based on mock server
CN112685321A (en) * 2021-01-11 2021-04-20 河南中原消费金融股份有限公司 Method, system and storage medium for testing microservice
CN113204477A (en) * 2021-03-31 2021-08-03 北京达佳互联信息技术有限公司 Application testing method and device, electronic equipment and storage medium
CN113204477B (en) * 2021-03-31 2024-01-12 北京达佳互联信息技术有限公司 Application testing method and device, electronic equipment and storage medium
CN113377678A (en) * 2021-07-13 2021-09-10 挂号网(杭州)科技有限公司 Test environment switching method and device, electronic equipment and storage medium
CN114650276A (en) * 2022-02-24 2022-06-21 北京健康之家科技有限公司 Service request processing method, electronic equipment terminal and storage medium

Similar Documents

Publication Publication Date Title
CN110727589A (en) Test method, device and equipment
US10812513B1 (en) Correlation and consolidation holistic views of analytic data pertaining to a malware attack
US9967366B2 (en) Internet of things (IoT) API platform
CN110519380B (en) Data access method and device, storage medium and electronic equipment
CN110990205B (en) Interface call testing method, device and computer readable storage medium
CN105808399B (en) Remote debugging method and device
CN110765024A (en) Simulation test method, simulation test device, electronic equipment and computer-readable storage medium
CN109618176B (en) Processing method, equipment and storage medium for live broadcast service
CN110311837B (en) Online service availability detection method and device and computer equipment
CN109586969A (en) Content distributing network disaster recovery method, device, computer equipment and storage medium
CN110519409B (en) Domain name dynamic configuration method, device, equipment and storage medium
CN112565406B (en) Gray release method, gray release system and electronic equipment
CN108683668A (en) Resource checksum method, apparatus, storage medium and equipment in content distributing network
US9485140B2 (en) Automatic proxy setting modification
US20230328138A1 (en) Cloud Platform and Bucket Management Method for Object Storage Service Provided by Cloud Platform
CN112559350A (en) Debugging method, device and equipment for front-end development page and storage medium
CN112000518A (en) Application program fault risk processing method, device and system, terminal and equipment
CN112115103B (en) File address display method and device, electronic equipment and readable storage medium
CN113438336B (en) Network request method, device, equipment and storage medium
CN113535723A (en) Multi-tenant database management and control method, system and storage medium
CN115396501B (en) Information processing method and device, electronic equipment and readable storage medium
CN113268308A (en) Information processing method, device and storage medium
CN114301872B (en) Domain name based access method and device, electronic equipment and storage medium
CN102870117B (en) Acquisition method and apparatus for service information
CN112583891B (en) Interface document acquisition method and device and server

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: 20200124

RJ01 Rejection of invention patent application after publication