CN111078477A - Interface test method and device, storage medium and electronic equipment - Google Patents

Interface test method and device, storage medium and electronic equipment Download PDF

Info

Publication number
CN111078477A
CN111078477A CN201911108058.7A CN201911108058A CN111078477A CN 111078477 A CN111078477 A CN 111078477A CN 201911108058 A CN201911108058 A CN 201911108058A CN 111078477 A CN111078477 A CN 111078477A
Authority
CN
China
Prior art keywords
interface
tested
target baffle
request
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
CN201911108058.7A
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.)
Aisino Corp
Original Assignee
Aisino Corp
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 Aisino Corp filed Critical Aisino Corp
Priority to CN201911108058.7A priority Critical patent/CN111078477A/en
Publication of CN111078477A publication Critical patent/CN111078477A/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/22Detection or location of defective computer hardware by testing during standby operation or during idle time, e.g. start-up testing
    • G06F11/2205Detection or location of defective computer hardware by testing during standby operation or during idle time, e.g. start-up testing using arrangements specific to the hardware being tested
    • G06F11/221Detection or location of defective computer hardware by testing during standby operation or during idle time, e.g. start-up testing using arrangements specific to the hardware being tested to test buses, lines or interfaces, e.g. stuck-at or open line faults
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/22Detection or location of defective computer hardware by testing during standby operation or during idle time, e.g. start-up testing
    • G06F11/2205Detection or location of defective computer hardware by testing during standby operation or during idle time, e.g. start-up testing using arrangements specific to the hardware being tested
    • G06F11/2221Detection or location of defective computer hardware by testing during standby operation or during idle time, e.g. start-up testing using arrangements specific to the hardware being tested to test input/output devices or peripheral units
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/22Detection or location of defective computer hardware by testing during standby operation or during idle time, e.g. start-up testing
    • G06F11/2273Test methods

Landscapes

  • Engineering & Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Test And Diagnosis Of Digital Computers (AREA)

Abstract

The disclosure relates to a method, a device, a storage medium and an electronic device for interface testing, relating to the technical field of electronic information, and applied to a server, wherein the method comprises the following steps: the method comprises the steps of receiving a test request sent by a client through an interface to be tested, wherein the test request comprises a target baffle interface address, sending the test request to a target baffle interface indicated by the target baffle interface address so that the target baffle interface generates response data according to the test request, receiving the response data sent by the target baffle interface, and sending the response data to the interface to be tested. The server side is used as a reverse proxy between the interface to be tested and the corresponding baffle interface, so that the interface to be tested is tested, the interface to be tested does not need to depend on the arrangement of the baffle interface, and meanwhile, the baffle interface can be independently developed and arranged, and the efficiency of interface testing is improved.

Description

Interface test method and device, storage medium and electronic equipment
Technical Field
The present disclosure relates to the field of electronic information technologies, and in particular, to a method and an apparatus for interface testing, a storage medium, and an electronic device.
Background
With the continuous development of electronic information technology, more and more electronic devices are used for realizing various functions, and in order to ensure the normal functions and stable data transmission of the electronic devices, each interface of the electronic devices needs to be tested to check whether each interface can normally transmit data. In general, due to reasons such as cost and practical application environment, a complete test environment cannot be built when testing an interface, and in order to simulate a real interface, a plurality of baffle interfaces need to be developed to cover the real test environment, so as to test each interface on an electronic device. However, the deployment of the multiple baffle interfaces is complex, and when testing the interfaces, testers rely on the deployment of the external baffle interfaces, so that the use is inconvenient, and the efficiency of interface testing is reduced.
Disclosure of Invention
The present disclosure is directed to provide an interface testing method, apparatus, storage medium, and electronic device, for solving the problem of low interface testing efficiency in the prior art.
In order to achieve the above object, according to a first aspect of the embodiments of the present disclosure, there is provided an interface testing method applied to a server, the method including:
receiving a test request sent by a client through an interface to be tested, wherein the test request comprises a target baffle interface address;
sending the test request to a target baffle interface indicated by the target baffle interface address so that the target baffle interface generates response data according to the test request;
receiving the response data sent by the target baffle interface;
and sending the response data to the interface to be tested.
Optionally, the method further comprises:
receiving a registration request sent by a baffle interface, wherein the registration request comprises a baffle interface address and baffle interface information;
and storing the corresponding relation between the baffle interface address and the baffle interface information according to the registration request.
Optionally, the sending the test request to the target baffle interface indicated by the target baffle interface address includes:
determining target baffle interface information corresponding to the target baffle interface address according to the corresponding relation;
and sending the test request to the target baffle interface according to the target baffle interface information.
Optionally, the test request further includes an address of an interface to be tested, a request method, and request data, where the address of the interface to be tested is used to indicate the interface to be tested;
the sending the test request to the target baffle interface indicated by the target baffle interface address to enable the target baffle interface to generate response data according to the test request includes:
sending the test request to the target baffle interface so that the target baffle interface generates the response data according to the request method and the request data;
the sending the response data to the interface to be tested includes:
and sending the response data to the interface to be tested according to the address of the interface to be tested.
Optionally, after receiving the test request sent by the client through the interface to be tested, the method further includes:
storing the test request as a first test record;
after the receiving the response data sent by the target baffle interface, the method further comprises:
storing the response data in the first test record.
According to a second aspect of the embodiments of the present disclosure, there is provided an interface testing apparatus, applied to a server, the apparatus including:
the first receiving module is used for receiving a test request sent by a client through an interface to be tested, wherein the test request comprises a target baffle interface address;
the first sending module is used for sending the test request to a target baffle interface indicated by the target baffle interface address so that the target baffle interface generates response data according to the test request;
the second receiving module is used for receiving the response data sent by the target baffle interface;
and the second sending module is used for sending the response data to the interface to be tested.
Optionally, the apparatus further comprises:
the third receiving module is used for receiving a registration request sent by the baffle interface, wherein the registration request comprises a baffle interface address and baffle interface information;
and the storage module is used for storing the corresponding relation between the baffle interface address and the baffle interface information according to the registration request.
Optionally, the first sending module comprises:
the determining submodule is used for determining target baffle interface information corresponding to the target baffle interface address according to the corresponding relation;
and the sending submodule is used for sending the test request to the target baffle interface according to the target baffle interface information.
Optionally, the test request further includes an address of an interface to be tested, a request method, and request data, where the address of the interface to be tested is used to indicate the interface to be tested;
the first sending module is configured to:
sending the test request to the target baffle interface so that the target baffle interface generates the response data according to the request method and the request data;
the second sending module is configured to:
and sending the response data to the interface to be tested according to the address of the interface to be tested.
Optionally, the apparatus further comprises:
the record storage module is used for storing the test request as a first test record after receiving the test request sent by the client through the interface to be tested;
the record storage module is further configured to store the response data into the first test record after receiving the response data sent by the target baffle interface.
According to a third aspect of embodiments of the present disclosure, there is provided a computer readable storage medium having stored thereon a computer program which, when executed by a processor, performs the steps of the method of any one of the first aspects of the embodiments of the present disclosure.
According to a fourth aspect of the embodiments of the present disclosure, there is provided an electronic apparatus including:
a memory having a computer program stored thereon;
a processor for executing the computer program in the memory to implement the steps of the method of any one of the first aspect of the embodiments of the present disclosure.
According to the technical scheme, the server side firstly receives a test request sent by the client side through the interface to be tested, wherein the test request comprises a target baffle interface address, then sends the test request to the target baffle interface indicated by the target baffle interface address, so that the target baffle interface generates response data according to the test request, and sends the response data to the interface to be tested after receiving the response data sent by the target baffle interface. The server side is used as a reverse proxy between the interface to be tested and the corresponding baffle interface, so that the interface to be tested is tested, the interface to be tested does not need to depend on the arrangement of the baffle interface, and meanwhile, the baffle interface can be independently developed and arranged, and the efficiency of interface testing is improved.
Additional features and advantages of the disclosure will be set forth in the detailed description which follows.
Drawings
The accompanying drawings, which are included to provide a further understanding of the disclosure and are incorporated in and constitute a part of this specification, illustrate embodiments of the disclosure and together with the description serve to explain the disclosure without limiting the disclosure. In the drawings:
FIG. 1 is a block diagram illustrating a method of interface testing in accordance with an exemplary embodiment;
FIG. 2 is a flow diagram illustrating a method of interface testing in accordance with an exemplary embodiment;
FIG. 3 is a flow diagram illustrating another method of interface testing in accordance with an illustrative embodiment;
FIG. 4 is a flow diagram illustrating another method of interface testing in accordance with an illustrative embodiment;
FIG. 5 is a flow diagram illustrating another method of interface testing in accordance with an illustrative embodiment;
FIG. 6 is a block diagram illustrating an apparatus for interface testing in accordance with an exemplary embodiment;
FIG. 7 is a block diagram illustrating another apparatus for interface testing in accordance with an exemplary embodiment;
FIG. 8 is a block diagram illustrating another apparatus for interface testing in accordance with an exemplary embodiment;
FIG. 9 is a block diagram illustrating another apparatus for interface testing in accordance with an exemplary embodiment;
FIG. 10 is a block diagram illustrating an electronic device in accordance with an example embodiment.
Detailed Description
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the exemplary embodiments below are not intended to represent all implementations consistent with the present disclosure. Rather, they are merely examples of methods and apparatus consistent with certain aspects of the present disclosure, as detailed in the appended claims.
Before introducing the method, the apparatus, the storage medium, and the electronic device for interface testing provided by the present disclosure, an application scenario related to various embodiments of the present disclosure is first introduced. The application scenario includes an interface to be tested, a server, and a target barrier interface, which are provided on a client, and the structure of the application scenario is shown in fig. 1. The interface to be tested, the server and the target baffle interface can realize data interaction through Wireless communication technologies such as WLAN (English: Wireless Local Area Network), Bluetooth and ZigBee (Chinese: Zigbee protocol), and can also be connected through connection wires such as Network cables, optical fibers and serial port lines to realize data interaction. The server may be, for example, a server, and may include but is not limited to: an entity server, a server cluster or a cloud server, etc. The client to which the interface to be tested belongs may be a mobile terminal such as a smart phone, a tablet computer, a smart television, a PDA (Personal Digital Assistant, chinese), a portable computer, or a fixed terminal such as a desktop computer. In the embodiment of the present disclosure, a test request sent based on HTTP (english: Hyper Text transfer protocol, chinese: hypertext transfer protocol) is taken as an example for description, and the present disclosure does not limit this.
Fig. 2 is a flowchart illustrating a method for interface testing according to an exemplary embodiment, where the method is applied to a server side, as shown in fig. 2, and includes the following steps:
step 101, receiving a test request sent by a client through an interface to be tested, wherein the test request comprises a target baffle interface address.
For example, when testing an interface to be tested provided on a client, a tester may generate a test request on the client, send the test request to a server through the interface to be tested, and receive the test request by the server. The test request may include target baffle interface addresses for indicating different target baffle interfaces, and the target baffle interface may be understood as a destination interface to which the test request needs to be sent. The target baffle interface address may be one or more, correspondingly, the target baffle interface may be one or more, and the target baffle interface address of each target baffle interface is unique, that is, the target baffle interface and the target baffle interface address are in one-to-one correspondence. The target baffle interface address may be URN (Uniform Resource Name, chinese) or URL (Uniform Resource Locator, chinese), which can distinguish different target baffle interfaces. The test request may further include a request method, request data, and protocol version for requesting the target baffle interface to perform different operations. The request method may be, for example, put, get, post, delete, etc., the request data may be data that needs to be used when the request method is executed, and the protocol version of the test request may be, for example, HTTP/1.0, etc. Furthermore, the test request may also include an identifier of the interface to be tested, which can uniquely identify the interface to be tested, so that when the server receives multiple test requests, the server can determine, according to the identifier of the interface to be tested, which interface to be tested of the client sends the received test request. And when a plurality of clients exist, the test request can be determined to be sent by which interface to be tested of which client is according to the identification of the interface to be tested.
And 102, sending a test request to the target baffle interface indicated by the target baffle interface address so that the target baffle interface generates response data according to the test request.
And 103, receiving response data sent by the target baffle interface.
And 104, sending the response data to the interface to be tested.
For example, after receiving the test request, the server may parse the test request according to a preset rule to obtain a target baffle interface address, where the number of the target baffle interface addresses may be one or multiple. After the multiple baffle interfaces (including the target baffle interface) are developed respectively, the server only needs to record the respective baffle interface addresses of the multiple baffle interfaces, and then data transmission can be carried out between the server and different baffle interfaces. Therefore, each baffle interface can be developed and deployed independently, and the complexity of the development of the baffle interfaces is reduced. The plurality of baffle interfaces may be disposed on the same device (e.g., a server) or may be disposed on different devices, respectively. Further, after determining the corresponding target baffle interface according to the target baffle interface address in the test request, the server forwards the test request to the corresponding target baffle interface, so that the corresponding target baffle interface can generate response data according to the test request. The response data generated by the target baffle interface may include the execution status of the test request (for example, it may be execution success or failure), the execution result, the execution time (for example, 2 times), and the execution time of the test request. After the target baffle interface finishes the test request forwarded by the server, the generated response data is sent to the server, the server receives the response data sent by the target baffle interface and feeds the obtained response data back to the client through the interface to be tested, and after the client receives the response data, the client can judge whether the function of the interface to be tested is normal or not and whether the function meets the expected requirement or not by analyzing the response data. Therefore, the client can send the test request to the target baffle interface through the server without knowing the deployment of the external target baffle interface and receive the response data through the server, so that the interface test is realized and the test efficiency is improved.
Further, if there are multiple interfaces to be tested, after receiving multiple test requests, the server may analyze the multiple test requests according to a preset rule to obtain target baffle interface addresses (which may be one or more) corresponding to each test request in the multiple test requests, then determine corresponding target baffle interfaces according to the target baffle interface addresses included in the test requests, and forward the test requests to the corresponding target baffle interfaces. And after the target baffle interface corresponding to the test request completes the test request forwarded by the server, sending the generated response data to the server. At this time, the server receives a plurality of response data corresponding to the plurality of test requests, and can determine the interface to be tested corresponding to each response data according to the corresponding relationship between the interface to be tested and the test request (for example, the corresponding relationship stored in the server in advance), so that the response data sent by different target baffle interfaces are respectively fed back to the corresponding interfaces to be tested, and the test on the plurality of interfaces to be tested is completed.
In summary, in the present disclosure, a server first receives a test request sent by a client through an interface to be tested, where the test request includes a target baffle interface address, and then sends the test request to a target baffle interface indicated by the target baffle interface address, so that the target baffle interface generates response data according to the test request, and after receiving the response data sent by the target baffle interface, sends the response data to the interface to be tested. The server side is used as a reverse proxy between the interface to be tested and the corresponding baffle interface, so that the interface to be tested is tested, the interface to be tested does not need to depend on the arrangement of the baffle interface, and meanwhile, the baffle interface can be independently developed and arranged, and the efficiency of interface testing is improved.
Fig. 3 is a flow chart illustrating another method of interface testing according to an example embodiment, as shown in fig. 3, the method further comprising:
and 105, receiving a registration request sent by the baffle interface, wherein the registration request comprises a baffle interface address and baffle interface information.
And 106, storing the corresponding relation between the baffle interface address and the baffle interface information according to the registration request.
For example, after the barrier interface (including the target barrier interface and other barrier interfaces) is developed, a registration request may be sent to the server, where the registration request includes a barrier interface address and barrier interface information, and the barrier interface address can uniquely identify the barrier interface, and may be identified by URN or URL, etc. The baffle interface information may include: the time of creation, the protocol version, etc., wherein the time of creation is used to indicate the time at which the barrier interface is registered, and the protocol version is used to indicate the protocol of the test request that the barrier interface can obtain and its version (e.g., HTTP/1.0, indicating that the barrier interface can only obtain the test request in the format of HTTP/1.0). After receiving the registration request sent by the barrier interface, the server stores the corresponding relationship between the barrier interface address and the barrier interface information according to the registration request, for example, the corresponding relationship between the barrier interface address and the barrier interface information may be stored in a database pre-deployed on the server, or may be stored in other terminal devices accessible to the server through a network.
FIG. 4 is a flow chart illustrating another method of interface testing, according to an example embodiment, as shown in FIG. 4, step 102 includes:
step 1021, according to the corresponding relation, determining the target baffle interface information corresponding to the target baffle interface address.
And 1022, sending a test request to the target baffle interface according to the target baffle interface information.
In an example, after receiving a test request sent by an interface to be tested, the server first parses the obtained test request to obtain an address of a target baffle interface. And then determining target baffle interface information corresponding to the target baffle interface address according to the corresponding relation between the baffle interface address and the baffle interface information. If the format of the test request conforms to the format indicated by the protocol version in the target baffle interface information, the target baffle interface can process the test request, and the server side directly forwards the test request to the corresponding target baffle interface so that the target baffle interface processes the test request. If the format of the test request is not in accordance with the format indicated by the protocol version in the target baffle interface information, it indicates that the target baffle interface cannot directly process the test request sent by the server, at this time, the server can convert the test request into the format indicated by the protocol version in the target baffle interface information according to the target baffle interface information corresponding to the target baffle interface address, and then forward the converted test request to the corresponding target baffle interface, so that the target baffle interface processes the converted test request.
Optionally, the test request may further include an address of the interface to be tested, a request method, and request data, where the address of the interface to be tested is used to indicate the interface to be tested.
Step 102 comprises:
and sending a test request to the target baffle interface so that the target baffle interface generates response data according to the request method and the request data.
Step 104 comprises:
and sending the response data to the interface to be tested according to the address of the interface to be tested.
For example, the test request sent by the client to the server through the interface to be tested may include the address of the interface to be tested, the request method, and the request data, in addition to the target barrier interface address. The address of the interface to be tested can uniquely identify the interface to be tested, and can be identified by URN or URL and the like. The server side can determine which interface to be tested of the client side sends the test request according to the address of the interface to be tested in the test request, and further can determine which client side sends the test request when a plurality of client sides exist. The request method in the test request may be, for example, get, put, delete, head, and the like, and the target barrier interface may execute the request method according to the request data in the test request to generate the response data.
Specifically, the server receives a test request sent by an interface to be tested, and analyzes the obtained test request to obtain a target baffle interface address, an interface address to be tested, a request method and request data, and after determining a corresponding target baffle interface according to the target baffle interface address in the test request, the server sends the interface address to be tested, the request method and the request data to the corresponding target baffle interface, so that the target baffle interface can execute the request method according to the request data in the test request to generate response data. And the target baffle interface sends the generated response data to the server. And after receiving the response data, the server feeds the response data back to the corresponding interface to be tested according to the address of the interface to be tested, so that the client can judge whether the interface to be tested meets the expected requirement or not through the response data.
FIG. 5 is a flow chart illustrating another method of interface testing, according to an example embodiment, as shown in FIG. 5, after step 101, the method further comprising:
step 107, storing the test request as a first test record.
After step 103, the method further comprises:
step 108, storing the response data into the first test record.
For example, after receiving the test request sent by the interface to be tested, the server may store the test request as a first test record, for example, the first test record may be stored in a database pre-deployed on the server, or may be stored in other terminal devices accessible to the server through a network. The first test record may store, in addition to the test request, the storage time of the test request, the request identifier for distinguishing the plurality of test requests, and the like. Similarly, after receiving the response data sent by the target baffle interface, the server may also store the response data into the first test record, so that a tester can analyze the performance of each interface to be tested according to the content in the first test record.
In summary, in the present disclosure, a server first receives a test request sent by a client through an interface to be tested, where the test request includes a target baffle interface address, and then sends the test request to a target baffle interface indicated by the target baffle interface address, so that the target baffle interface generates response data according to the test request, and after receiving the response data sent by the target baffle interface, sends the response data to the interface to be tested. The server side is used as a reverse proxy between the interface to be tested and the corresponding baffle interface, so that the interface to be tested is tested, the interface to be tested does not need to depend on the arrangement of the baffle interface, and meanwhile, the baffle interface can be independently developed and arranged, and the efficiency of interface testing is improved.
Fig. 6 is a block diagram illustrating an interface testing apparatus according to an exemplary embodiment, and as shown in fig. 6, the apparatus 200 is applied to a server and includes:
the first receiving module 201 is configured to receive a test request sent by a client through an interface to be tested, where the test request includes an address of a target baffle interface.
The first sending module 202 is configured to send a test request to the target baffle interface indicated by the target baffle interface address, so that the target baffle interface generates response data according to the test request.
And the second receiving module 203 is configured to receive response data sent by the target baffle interface.
And a second sending module 204, configured to send the response data to the interface to be tested.
Fig. 7 is a block diagram illustrating another apparatus for interface testing according to an exemplary embodiment, and as shown in fig. 7, the apparatus 200 further includes:
a third receiving module 205, configured to receive a registration request sent by a barrier interface, where the registration request includes a barrier interface address and barrier interface information.
The storage module 206 is configured to store a corresponding relationship between the baffle interface address and the baffle interface information according to the registration request.
Fig. 8 is a block diagram illustrating another apparatus for interface testing according to an exemplary embodiment, where as shown in fig. 8, the first sending module 202 includes:
the determining submodule 2021 is configured to determine, according to the correspondence, target baffle interface information corresponding to the target baffle interface address.
The sending sub-module 2022 is configured to send a test request to the target baffle interface according to the target baffle interface information.
Optionally, the test request further includes an address of the interface to be tested, a request method, and request data, where the address of the interface to be tested is used to indicate the interface to be tested.
The first sending module 202 is configured to:
and sending a test request to the target baffle interface so that the target baffle interface generates response data according to the request method and the request data.
The second sending module 204 is configured to:
and sending the response data to the interface to be tested according to the address of the interface to be tested.
Fig. 9 is a block diagram illustrating another apparatus for interface testing according to an example embodiment, and as shown in fig. 9, the apparatus 200 further includes:
the record storage module 207 is configured to store the test request as a first test record after receiving the test request sent by the client through the interface to be tested.
And the record storage module 207 is further used for storing the response data into the first test record after receiving the response data sent by the target baffle interface.
With regard to the apparatus in the above-described embodiment, the specific manner in which each part performs the operation has been described in detail in the embodiment related to the method, and will not be described in detail here.
In summary, in the present disclosure, a server first receives a test request sent by a client through an interface to be tested, where the test request includes a target baffle interface address, and then sends the test request to a target baffle interface indicated by the target baffle interface address, so that the target baffle interface generates response data according to the test request, and after receiving the response data sent by the target baffle interface, sends the response data to the interface to be tested. The server side is used as a reverse proxy between the interface to be tested and the corresponding baffle interface, so that the interface to be tested is tested, the interface to be tested does not need to depend on the arrangement of the baffle interface, and meanwhile, the baffle interface can be independently developed and arranged, and the efficiency of interface testing is improved.
Fig. 10 is a block diagram illustrating an electronic device 1000 in accordance with an example embodiment. For example, the electronic device 1000 may be provided as a server. Referring to fig. 10, the electronic device 1000 includes a processor 1022, which may be one or more in number, and a memory 1032 for storing computer programs executable by the processor 1022. The computer programs stored in memory 1032 may include one or more modules that each correspond to a set of instructions. Further, the processor 1022 may be configured to execute the computer program to perform the above-mentioned method applied to the interface test of the server.
Additionally, the electronic device 1000 may also include a power component 1026 and a communication component 1050, the power component 1026 may be configured to perform power management for the electronic device 1000, and the communication component 1050 may be configured to enable communication for the electronic device 1000, e.g., wired or wireless communication. In addition, the electronic device 1000 may also include input/output (I/O) interfaces 1058. The electronic device 1000 may operate based on an operating system stored in memory 1032, such as a Windows Server, Mac OS XTM, UnixTM, Linux, and the like.
In another exemplary embodiment, a computer readable storage medium including program instructions, which when executed by a processor, implement the above-mentioned steps of the method applied to interface testing of a server, is also provided. For example, the computer readable storage medium may be the memory 1032 comprising program instructions executable by the processor 1022 of the electronic device 1000 to perform the method applied to the interface test of the server.
In another exemplary embodiment, a computer program product is also provided, which comprises a computer program executable by a programmable apparatus, the computer program having code portions for performing the above-mentioned method for interface testing applied to a service end when the computer program is executed by the programmable apparatus.
In summary, in the present disclosure, a server first receives a test request sent by a client through an interface to be tested, where the test request includes a target baffle interface address, and then sends the test request to a target baffle interface indicated by the target baffle interface address, so that the target baffle interface generates response data according to the test request, and after receiving the response data sent by the target baffle interface, sends the response data to the interface to be tested. The server side is used as a reverse proxy between the interface to be tested and the corresponding baffle interface, so that the interface to be tested is tested, the interface to be tested does not need to depend on the arrangement of the baffle interface, and meanwhile, the baffle interface can be independently developed and arranged, and the efficiency of interface testing is improved.
Although the preferred embodiments of the present disclosure have been described in detail with reference to the accompanying drawings, the present disclosure is not limited to the specific details of the embodiments, and other embodiments of the present disclosure can be easily conceived by those skilled in the art within the technical spirit of the present disclosure after considering the description and practicing the present disclosure, and all fall within the protection scope of the present disclosure.
It should be noted that the various technical features described in the above embodiments can be combined in any suitable way without contradiction, and in order to avoid unnecessary repetition, the disclosure does not need to be separately described in various possible combinations, and should be considered as the disclosure of the disclosure as long as the concepts of the disclosure are not violated.

Claims (12)

1. A method for interface test is applied to a server, and the method comprises the following steps:
receiving a test request sent by a client through an interface to be tested, wherein the test request comprises a target baffle interface address;
sending the test request to a target baffle interface indicated by the target baffle interface address so that the target baffle interface generates response data according to the test request;
receiving the response data sent by the target baffle interface;
and sending the response data to the interface to be tested.
2. The method of claim 1, further comprising:
receiving a registration request sent by a baffle interface, wherein the registration request comprises a baffle interface address and baffle interface information;
and storing the corresponding relation between the baffle interface address and the baffle interface information according to the registration request.
3. The method of claim 2, wherein said sending the test request to the target baffle interface indicated by the target baffle interface address comprises:
determining target baffle interface information corresponding to the target baffle interface address according to the corresponding relation;
and sending the test request to the target baffle interface according to the target baffle interface information.
4. The method of claim 1, wherein the test request further comprises an interface address to be tested, a request method, and request data, and the interface address to be tested is used to indicate the interface to be tested;
the sending the test request to the target baffle interface indicated by the target baffle interface address to enable the target baffle interface to generate response data according to the test request includes:
sending the test request to the target baffle interface so that the target baffle interface generates the response data according to the request method and the request data;
the sending the response data to the interface to be tested includes:
and sending the response data to the interface to be tested according to the address of the interface to be tested.
5. The method according to any one of claims 1-4, wherein after receiving the test request sent by the client through the interface to be tested, the method further comprises:
storing the test request as a first test record;
after the receiving the response data sent by the target baffle interface, the method further comprises:
storing the response data in the first test record.
6. An interface testing apparatus, applied to a server, the apparatus comprising:
the first receiving module is used for receiving a test request sent by a client through an interface to be tested, wherein the test request comprises a target baffle interface address;
the first sending module is used for sending the test request to a target baffle interface indicated by the target baffle interface address so that the target baffle interface generates response data according to the test request;
the second receiving module is used for receiving the response data sent by the target baffle interface;
and the second sending module is used for sending the response data to the interface to be tested.
7. The apparatus of claim 6, further comprising:
the third receiving module is used for receiving a registration request sent by the baffle interface, wherein the registration request comprises a baffle interface address and baffle interface information;
and the storage module is used for storing the corresponding relation between the baffle interface address and the baffle interface information according to the registration request.
8. The apparatus of claim 7, wherein the first sending module comprises:
the determining submodule is used for determining target baffle interface information corresponding to the target baffle interface address according to the corresponding relation;
and the sending submodule is used for sending the test request to the target baffle interface according to the target baffle interface information.
9. The apparatus of claim 6, wherein the test request further comprises an interface address to be tested, a request method, and request data, and the interface address to be tested is used to indicate the interface to be tested;
the first sending module is configured to:
sending the test request to the target baffle interface so that the target baffle interface generates the response data according to the request method and the request data;
the second sending module is configured to:
and sending the response data to the interface to be tested according to the address of the interface to be tested.
10. The apparatus according to any one of claims 6-9, further comprising:
the record storage module is used for storing the test request as a first test record after receiving the test request sent by the client through the interface to be tested;
the record storage module is further configured to store the response data into the first test record after receiving the response data sent by the target baffle interface.
11. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the steps of the method according to any one of claims 1 to 5.
12. An electronic device, comprising:
a memory having a computer program stored thereon;
a processor for executing the computer program in the memory to carry out the steps of the method of any one of claims 1 to 5.
CN201911108058.7A 2019-11-13 2019-11-13 Interface test method and device, storage medium and electronic equipment Pending CN111078477A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911108058.7A CN111078477A (en) 2019-11-13 2019-11-13 Interface test method and device, storage medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911108058.7A CN111078477A (en) 2019-11-13 2019-11-13 Interface test method and device, storage medium and electronic equipment

Publications (1)

Publication Number Publication Date
CN111078477A true CN111078477A (en) 2020-04-28

Family

ID=70310919

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911108058.7A Pending CN111078477A (en) 2019-11-13 2019-11-13 Interface test method and device, storage medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN111078477A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111782330A (en) * 2020-07-07 2020-10-16 赞同科技股份有限公司 Web application-based page data acquisition method, device and equipment

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108199921A (en) * 2017-12-29 2018-06-22 上海瑞家信息技术有限公司 The method, apparatus and storage medium of a kind of simulation test
CN108536578A (en) * 2017-03-06 2018-09-14 阿里巴巴集团控股有限公司 A kind of test method and device
CN109101430A (en) * 2018-08-24 2018-12-28 阿里巴巴集团控股有限公司 Test method, device and equipment
CN109446063A (en) * 2018-09-18 2019-03-08 深圳壹账通智能科技有限公司 Interface test method, device, computer equipment and storage medium
CN109522218A (en) * 2018-10-19 2019-03-26 平安科技(深圳)有限公司 Interface test method, device, computer equipment and storage medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108536578A (en) * 2017-03-06 2018-09-14 阿里巴巴集团控股有限公司 A kind of test method and device
CN108199921A (en) * 2017-12-29 2018-06-22 上海瑞家信息技术有限公司 The method, apparatus and storage medium of a kind of simulation test
CN109101430A (en) * 2018-08-24 2018-12-28 阿里巴巴集团控股有限公司 Test method, device and equipment
CN109446063A (en) * 2018-09-18 2019-03-08 深圳壹账通智能科技有限公司 Interface test method, device, computer equipment and storage medium
CN109522218A (en) * 2018-10-19 2019-03-26 平安科技(深圳)有限公司 Interface test method, device, computer equipment and storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
封琪;王贵鑫;: "Java技术框架的发展及其应用" *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111782330A (en) * 2020-07-07 2020-10-16 赞同科技股份有限公司 Web application-based page data acquisition method, device and equipment
CN111782330B (en) * 2020-07-07 2024-01-26 赞同科技股份有限公司 Page data acquisition method, device and equipment based on Web application

Similar Documents

Publication Publication Date Title
CN105391811A (en) DNS (domain name resolution) method, access method for application server, and terminal
CN106549989B (en) Data transmission method and system, user terminal and application server
CN108255701B (en) Scene testing method and mobile terminal
CN110377440B (en) Information processing method and device
CN104581785A (en) Wireless network testing method, testing device and mobile terminal
CN111930709B (en) Data storage method, apparatus, electronic device, and computer readable medium
CN107360036B (en) Network fault positioning method, terminal and server
US10123190B2 (en) System and method for testing a CoAP server
CN111078477A (en) Interface test method and device, storage medium and electronic equipment
CN107222365B (en) Data processing method and device and server
CN105812343A (en) Wearable service authentication method, cloud platform, wearable device and terminal
CN108737350B (en) Information processing method and client
CN111935316B (en) Method and device for acquiring front-end equipment catalog
CN115098052A (en) Screen projection method, device, equipment and storage medium
CN110225097B (en) Information processing method, device and storage medium
CN113986995A (en) Request distribution method and device, storage medium and electronic equipment
CN109756393B (en) Information processing method, system, medium, and computing device
CN113238944A (en) Test method, device and system
CN109086210B (en) Navigation information method and device for testing navigation application
CN105052207B (en) Information query method, equipment and system
CN106211269A (en) A kind of smart machine means of communication and device
CN111158661A (en) System interface docking method, device, medium and electronic equipment
CN103929508A (en) System and method for achieving binding of services and domain name resolution servers
CN115277506B (en) Load balancing equipment testing method and system
CN108718346A (en) A kind of method for processing resource 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