CN113760707A - Interface testing method, device, equipment and computer readable storage medium - Google Patents

Interface testing method, device, equipment and computer readable storage medium Download PDF

Info

Publication number
CN113760707A
CN113760707A CN202011012115.4A CN202011012115A CN113760707A CN 113760707 A CN113760707 A CN 113760707A CN 202011012115 A CN202011012115 A CN 202011012115A CN 113760707 A CN113760707 A CN 113760707A
Authority
CN
China
Prior art keywords
interface
group name
simulation service
service
simulation
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
CN202011012115.4A
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 Jingdong Century Trading Co Ltd
Beijing Wodong Tianjun Information Technology Co Ltd
Original Assignee
Beijing Jingdong Century Trading Co Ltd
Beijing Wodong Tianjun Information 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 Jingdong Century Trading Co Ltd, Beijing Wodong Tianjun Information Technology Co Ltd filed Critical Beijing Jingdong Century Trading Co Ltd
Priority to CN202011012115.4A priority Critical patent/CN113760707A/en
Publication of CN113760707A publication Critical patent/CN113760707A/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/3688Test management for test execution, e.g. scheduling of test suites
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/547Remote procedure calls [RPC]; Web services

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The present disclosure provides an interface testing method, apparatus, device and computer readable storage medium, the method comprising: acquiring a test request sent by a client, wherein the test request comprises at least one interface identifier to be edited; determining a target group name corresponding to an interface identifier to be edited in a preset group name mapping table according to the test request, wherein each interface identifier and a corresponding self-defined group name are stored in the group name mapping table in a correlated manner; calling a simulation service based on an RPC protocol corresponding to a target group name from a preset simulation service database according to the target group name in an interface to be edited; and performing interface test operation according to the simulation service corresponding to the target group name. There is no need to write analog services in the code for each interface. Therefore, the degree of code intrusion is not high. Moreover, when the simulation service needs to be modified, only the simulation service in the simulation service database needs to be modified, and the maintenance operation of the simulation service by a tester or a developer is simpler.

Description

Interface testing method, device, equipment and computer readable storage medium
Technical Field
The present disclosure relates to the field of computers, and in particular, to a method, an apparatus, a device and a computer readable storage medium for testing an interface.
Background
In the process of testing the software interface, situations that the testing environment is unstable, the interface is not developed and completed, certain specific data response return is simulated, the dependence of the service to be tested is complex and the like are often encountered. When the above situation occurs, the software interface test cannot be performed by using the real service. The interface needs to be simulated, and software interface testing is performed according to simulation service. However, the existing emulation operation (Mock), technology only aims at HTTP Protocol, and does not support Remote Procedure Call Protocol (RPC Protocol).
In order to solve the technical problems, in the prior art, the existing self-contained Mock function of an open source framework is generally utilized to perform parameter configuration to turn on a Mock switch, and each Mock interface needs to write an implementation class.
However, when the method is adopted to carry out interface simulation operation, the code invasion degree is higher. Moreover, each interface to be simulated needs to be written, and the maintenance of a tester or a developer is difficult.
Disclosure of Invention
The disclosure provides an interface testing method, an interface testing device, interface testing equipment and a computer readable storage medium, which are used for solving the technical problems that the existing interface simulation operation code based on an RPC protocol is high in intrusion degree and difficult to maintain.
A first aspect of the present disclosure is to provide an interface testing method, including:
acquiring a test request sent by a client, wherein the test request comprises at least one interface identifier to be edited;
determining a target group name corresponding to the interface identifier to be edited in a preset group name mapping table according to the test request, wherein each interface identifier and a corresponding self-defined group name are stored in the group name mapping table in an associated manner;
calling a simulation service based on an RPC protocol corresponding to the target group name from a preset simulation service database according to the target group name in the interface to be edited;
and performing interface test operation according to the simulation service corresponding to the target group name.
A second aspect of the present disclosure provides an interface testing apparatus, including:
the first obtaining module is used for obtaining a test request sent by a client, wherein the test request comprises at least one interface identifier to be edited;
a determining module, configured to determine, according to the test request, a target group name corresponding to the interface identifier to be edited in a preset group name mapping table, where each interface identifier and a corresponding custom group name are stored in the group name mapping table in an associated manner;
the first calling module is used for calling the simulation service based on the RPC protocol corresponding to the target group name from a preset simulation service database according to the target group name in the interface to be edited;
and the test module is used for carrying out interface test operation according to the simulation service corresponding to the target group name.
A third aspect of the present disclosure is to provide an interface test apparatus, including: a memory, a processor;
a memory; a memory for storing the processor-executable instructions;
wherein the processor is configured to invoke program instructions in the memory to perform the interface test method of the first aspect.
A fourth aspect of the present disclosure is to provide a computer-readable storage medium having stored therein computer-executable instructions for implementing the interface testing method according to the first aspect when executed by a processor.
According to the interface testing method, the device, the equipment and the computer readable storage medium, simulation services corresponding to a plurality of interfaces are stored in a simulation service database in advance, and each simulation service corresponds to a user-defined group name set by a user. Therefore, when the simulation service is called, the calling operation of the simulation service can be realized only by modifying the group name corresponding to the interface in the code. There is no need to write analog services in the code for each interface. Therefore, the degree of code intrusion is not high. Moreover, when the simulation service needs to be modified, only the simulation service in the simulation service database needs to be modified, and the maintenance operation of the simulation service by a tester or a developer is simpler.
Drawings
In order to more clearly illustrate the embodiments of the present disclosure 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 described below, and it is obvious that the drawings in the following description are some embodiments of the present disclosure, and other drawings can be obtained by those skilled in the art according to the drawings.
FIG. 1 is a schematic diagram of a network architecture upon which the present disclosure is based;
fig. 2 is a schematic flowchart of an interface testing method according to an embodiment of the present disclosure;
fig. 3 is a schematic flowchart of an interface testing method according to a second embodiment of the disclosure;
FIG. 4 is a schematic diagram of a display interface provided by an embodiment of the present disclosure;
fig. 5 is a schematic flowchart of an interface testing method according to a third embodiment of the present disclosure;
fig. 6 is a schematic structural diagram of an interface testing apparatus according to a fourth embodiment of the present disclosure;
fig. 7 is a schematic structural diagram of an interface testing apparatus according to a fifth embodiment of the present disclosure;
fig. 8 is a schematic structural diagram of an interface test apparatus according to a sixth embodiment of the present disclosure.
Detailed Description
To make the objects, technical solutions and advantages of the embodiments of the present disclosure more clear, the technical solutions of the embodiments of the present disclosure will be described clearly and completely with reference to the drawings in the embodiments of the present disclosure, and it is obvious that the described embodiments are some, but not all embodiments of the present disclosure. All other embodiments obtained based on the embodiments in the disclosure belong to the protection scope of the disclosure.
In order to solve the above-mentioned technical problems that the conventional interface simulation operation code based on the RPC protocol has a high intrusion degree and is difficult to maintain, the present disclosure provides an interface testing method, apparatus, device and computer readable storage medium.
It should be noted that the present disclosure provides an interface testing method, apparatus, device and computer readable storage medium that can be applied in various scenarios of Dubbo-based simulation operation.
In the interface testing process, in order to realize the simulation operation based on the RPC protocol, in the prior art, parameter configuration is generally performed on a Mock function carried by an open source frame, and a switch of the Mock function is adjusted to be in an on state. And writing a simulation service aiming at each interface needing to adopt the simulation service for test operation. However, the above methods tend to be highly invasive and difficult to maintain.
In the process of solving the above technical problem, the inventor found through research that, in order to avoid performing the writing operation of the simulation service in the process of each interface test, the simulation service database may be established in advance. The simulation service database stores simulation services corresponding to a plurality of interfaces, and each simulation service corresponds to a user-defined group name set by a user. Therefore, when the simulation service is called, the calling operation of the simulation service can be realized only by modifying the group name corresponding to the interface in the code. There is no need to write analog services in the code for each interface. Therefore, the code intrusion degree is not high, and the maintenance difficulty is not high.
Fig. 1 is a schematic diagram of a network architecture based on the present disclosure, and as shown in fig. 1, the network architecture based on the present disclosure at least includes: the server 1 is provided with a client, and the server 2 is provided with an interface testing device. The interface testing device 2 is written in C/C + +, Java, Shell or Python languages. The client 1 is in communication connection with the server 2, so that the client 1 can perform information interaction with the server 2.
Fig. 2 is a schematic flowchart of an interface testing method according to an embodiment of the present disclosure, and as shown in fig. 2, the method includes:
step 101, a test request sent by a client is obtained, wherein the test request comprises at least one interface identifier to be edited.
The execution subject of this embodiment is an interface testing device, which can be coupled to a server. The server is in communication connection with the server of the client, so that information interaction can be carried out with the client.
In this embodiment, when a tester needs to perform an interface test, a test request may be initiated on the client. Accordingly, the interface testing device may obtain a test request sent by the client, where the test request includes at least one interface identifier to be edited.
Step 102, according to the test request, determining a target group name corresponding to the interface identifier to be edited in a preset group name mapping table, wherein each interface identifier and a corresponding self-defined group name are stored in the group name mapping table in an associated manner.
In practical application, in the interface testing process, there may be problems that the real service testing environment corresponding to some interfaces is unstable, the interfaces are not developed and completed, a specific data response is returned, or the environment on which the real service depends is relatively complex, and at this time, the real service cannot be adopted for interface testing. Therefore, the simulation service corresponding to the real service can be constructed by mock technology. And then interface test operation can be carried out according to the simulation service.
In order to avoid manually writing simulation service implementation classes in the code by operation and maintenance personnel or testing personnel when the simulation service is constructed, a simulation service database can be constructed in advance. After the simulation operation of a certain real service is completed, the simulation service corresponding to the real service can be issued to the simulation service database for subsequent invocation. Wherein the simulation service is a simulation service based on the RPC protocol.
Accordingly, the group name corresponding to the simulation service may be a customized group name set by the user, which is different from the group name of the real service. For example, the group name of a real service may be xxxxa, and the corresponding custom group name of a simulated service may be xxxxb.
In this embodiment, since the customized group name is different from the group name of the real service, in practical application, the target group name corresponding to the interface identifier to be edited may be determined in a preset group name mapping table according to the test request. And the calling operation of the simulation service is realized by changing the group name.
As an implementable manner, a user can directly and manually modify the group name corresponding to each interface to be tested in the code according to actual requirements.
103, calling the simulation service based on the RPC protocol corresponding to the target group name from a preset simulation service database according to the target group name in the interface to be edited.
In this embodiment, after the target group name corresponding to the interface to be edited is determined, the simulation service based on the RPC protocol corresponding to the target group name may be called from a preset simulation service database.
And step 104, performing interface test operation according to the simulation service corresponding to the target group name.
In this embodiment, after the simulation service corresponding to the real service is obtained, the interface test operation may be performed according to the simulation service based on the RPC protocol.
In the interface testing method provided by this embodiment, simulation services corresponding to a plurality of interfaces are stored in a simulation service database in advance, and each simulation service corresponds to a user-defined group name set by a user. Therefore, when the simulation service is called, the calling operation of the simulation service can be realized only by modifying the group name corresponding to the interface in the code. There is no need to write analog services in the code for each interface. Therefore, the degree of code intrusion is not high. Moreover, when the simulation service needs to be modified, only the simulation service in the simulation service database needs to be modified, and the maintenance operation of the simulation service by a tester or a developer is simpler.
Fig. 3 is a schematic flowchart of an interface testing method according to a second embodiment of the present disclosure, and on the basis of the first embodiment, as shown in fig. 3, before step 102, the method further includes:
step 201, a simulation service creation request sent by a client is obtained, where the simulation service creation request includes a plurality of identifiers of interfaces to be simulated.
Step 202, according to the simulation service creation request, obtaining a resource package and dependency relationship information corresponding to each interface to be simulated from a preset data server.
And 203, building a simulation service corresponding to each interface to be simulated according to the resource package and the dependency relationship information.
And 204, acquiring a user-defined group name sent by the client aiming at each simulation service, wherein the user-defined group name is input by a user on the client.
And step 205, sending the simulation service and the user-defined group name corresponding to the simulation service to a preset simulation service database for storage.
In this embodiment, before obtaining the simulation service from the simulation service database and performing the interface test according to the simulation service, the simulation service database needs to be constructed. Specifically, a simulation service creation request sent by a client may be obtained, where the simulation service creation request includes a plurality of identifiers of interfaces to be simulated. The identifier of the interface to be simulated is the identifier of the interface which can not adopt real service to test at present.
Further, the resource package and the dependency relationship information corresponding to each interface to be simulated can be obtained from a preset data server according to the plurality of identifiers of the interfaces to be simulated. And simulating services corresponding to the real services required to be called by each interface to be simulated according to the resource package and the dependency relationship information component.
Aiming at each constructed simulation service, a user can set the group name of the simulation service according to actual requirements. Specifically, a custom group name sent by the client may be obtained, where the custom group name is input by the user on the client. It should be noted that the custom group name is different from the group name of the real service corresponding to the simulation service.
And sending the simulation service and the user-defined group name corresponding to the simulation service to a preset simulation service database for storage, and completing the construction operation of the simulation service database.
Specifically, the user can also perform management operation on the simulation service in the simulation service database through a preset console. Fig. 4 is a schematic view of a display interface provided in the embodiment of the present disclosure, and as shown in fig. 4, all simulation services in the current simulation service database may be displayed on the display interface, and a user may implement management operations on the simulation services through interface interaction. The management operation may specifically include adding a simulation service, deleting a simulation service, modifying a simulation service, querying a simulation service, and the like.
Further, on the basis of the first embodiment, after the step 205, the method further includes:
acquiring template information sent by a client, wherein the template information comprises access information and response information corresponding to the simulation service;
and sending the template information to a preset simulation service database for storage.
In this embodiment, for each constructed simulation service, the access information and the response information corresponding to the simulation service also need to be set. During the interface test process, the performance of the interface can be determined according to the response information fed back by the virtual service called by the interface.
Specifically, template information sent by the client may be obtained, where the template information includes access information and response information corresponding to the simulation service. The participation information and the response information are set by the user at the client. And sending the template information to a preset simulation service database, and performing associated storage with the corresponding simulation service. So that the test operation of the interface can be realized subsequently according to the template information.
Further, on the basis of the first embodiment, after the step 205, the method further includes:
and establishing the group name mapping table according to the user-defined group name corresponding to the simulation service and the interface identifier to be simulated corresponding to the simulation service.
In this embodiment, after the user-defined group name sent by the client is obtained, a group name mapping table may be established according to the user-defined group name and the to-be-simulated interface identifier corresponding to the simulation service. So that the determination of the target group name can be subsequently realized according to the group name mapping table.
According to the interface testing method provided by the embodiment, the simulation service database is constructed before the simulation service is acquired from the simulation service database and the interface test is performed according to the simulation service, so that the calling operation of the simulation service can be realized only by modifying the group name corresponding to the interface in the code subsequently. There is no need to write analog services in the code for each interface. Therefore, the degree of code intrusion is not high.
Further, on the basis of any of the above embodiments, the test request further includes target entry information, and step 104 specifically includes:
and acquiring response information corresponding to the target parameter information from a preset data server according to the target parameter information.
And sending the response information to the client.
In this embodiment, the test request may further include target entry information. When the interface is tested by using the simulation service based on the RPC protocol, the response information corresponding to the target parameter information can be acquired in the data server according to the target parameter information. And sending the response information to the client, so that the performance of the interface for calling the simulation service can be tested according to the response information.
According to the interface testing method provided by the embodiment, the response information corresponding to the target parameter information is acquired in the preset data server according to the target parameter information. And sending the response information to the client, thereby realizing the test operation of the interface.
Further, on the basis of any of the above embodiments, the test request further includes an identifier of an interface to be tested, and after step 101, the method further includes:
and calling a real service according to the interface to be tested corresponding to the interface to be tested identifier, and carrying out interface test operation according to the real service.
In this embodiment, in the testing process, there may be a case where a part of interfaces has been developed and the dependency relationship of the called real service is not complex, and therefore, the real service may be directly used for interface testing operation.
Specifically, the test request further includes an identifier of the interface to be tested. Correspondingly, the real service can be directly called according to the identifier of the interface to be tested, and the test operation of the interface to be tested can be carried out according to the real service.
Fig. 5 is a schematic flow chart of an interface testing method provided in a third embodiment of the present disclosure, and on the basis of any one of the above embodiments, as shown in fig. 5, the performing an interface testing operation according to the real service includes:
step 301, if it is detected that no response information is fed back when any real service exceeds a preset time threshold in the testing process, determining a target group name corresponding to an interface to be tested in a preset group name mapping table according to the interface to be tested corresponding to the real service.
And step 302, calling the simulation service based on the RPC protocol corresponding to the target group name from a preset simulation service database according to the target group name.
And 303, performing interface test operation according to the simulation service corresponding to the target group name.
In this embodiment, a part of real services may fail during the calling process, and response information cannot be given in time. At this time, in order to improve the efficiency of the interface test, the simulation service corresponding to the real service may be directly used to perform the interface test operation.
Specifically, if it is detected that no response information is fed back when any real service exceeds a preset time threshold in the test process, a target group name corresponding to an interface to be tested is determined in a preset group name mapping table according to the interface to be tested corresponding to the real service. And calling the simulation service based on the RPC protocol corresponding to the target group name from a preset simulation service database according to the target group name. And performing interface test operation according to the simulation service corresponding to the target group name.
According to the interface testing method provided by the embodiment, when the real service fails in the calling process and response information cannot be given in time, the simulation service corresponding to the real service is directly adopted to carry out interface testing operation, so that the efficiency of interface testing can be improved.
Fig. 6 is a schematic structural diagram of an interface testing apparatus according to a fourth embodiment of the present disclosure, and as shown in fig. 6, the interface testing apparatus includes: the device comprises a first obtaining module 41, a determining module 42, a first calling module 43, and a testing module 44, wherein the first obtaining module 41 is configured to obtain a testing request sent by a client, and the testing request includes at least one interface identifier to be edited. A determining module 42, configured to determine, according to the test request, a target group name corresponding to the interface identifier to be edited in a preset group name mapping table, where each interface identifier and a corresponding custom group name are stored in the group name mapping table in an associated manner. And a first calling module 43, configured to call, according to the target group name in the interface to be edited, a simulation service based on an RPC protocol corresponding to the target group name from a preset simulation service database. And the test module 44 is configured to perform an interface test operation according to the simulation service corresponding to the target group name.
Fig. 7 is a schematic structural diagram of an interface testing apparatus provided in a fifth embodiment of the present disclosure, and based on a fourth embodiment, as shown in fig. 7, the apparatus further includes: a second obtaining module 51, a third obtaining module 52, a constructing module 53, a group name obtaining module 54, and a first storing module 55. The second obtaining module 51 is configured to obtain a simulation service creation request sent by a client, where the simulation service creation request includes multiple identifiers of interfaces to be simulated. A third obtaining module 52, configured to obtain, according to the simulation service creation request, a resource package and dependency relationship information corresponding to each interface to be simulated from a preset data server. And the building module 53 is configured to build a simulation service corresponding to each interface to be simulated according to the resource package and the dependency relationship information. And a group name obtaining module 54, configured to obtain, for each simulation service, a customized group name sent by the client, where the customized group name is input by the user on the client. The first storage module 55 is configured to send the simulation service and the customized group name corresponding to the simulation service to a preset simulation service database for storage.
Further, on the basis of the fourth embodiment, the apparatus further includes:
the third acquisition module is used for acquiring template information sent by a client, wherein the template information comprises access information and response information corresponding to the simulation service;
and the second storage module is used for sending the template information to a preset simulation service database for storage.
Further, on the basis of the fourth embodiment, the apparatus further includes:
and the establishing module is used for establishing the group name mapping table according to the user-defined group name corresponding to the simulation service and the interface identifier to be simulated corresponding to the simulation service.
Further, on the basis of the fourth embodiment, the test request further includes target entry information, and the test module is configured to:
acquiring response information corresponding to the target participation information from a preset data server according to the target participation information;
and sending the response information to the client.
Further, on the basis of any of the above embodiments, the test request further includes an identifier of an interface to be tested, and the apparatus further includes:
and the second calling module is used for calling a real service according to the interface to be tested corresponding to the interface identification to be tested and carrying out interface test operation according to the real service.
Further, on the basis of any of the above embodiments, the second invoking module is configured to:
if it is detected that any real service does not feed back response information when exceeding a preset time threshold in the test process, determining a target group name corresponding to an interface to be tested in a preset group name mapping table according to the interface to be tested corresponding to the real service;
calling a simulation service based on an RPC protocol corresponding to the target group name from a preset simulation service database according to the target group name;
and performing interface test operation according to the simulation service corresponding to the target group name.
Fig. 8 is a schematic structural diagram of an interface test device according to a sixth embodiment of the present disclosure, and as shown in fig. 8, the interface test device includes: a memory 61, a processor 62;
a memory 61; a memory 61 for storing instructions executable by the processor 62;
wherein, the processor 62 is configured to call the program instructions in the memory 61 to execute the interface testing method according to any of the above embodiments.
And a memory 61 for storing programs. In particular, the program may include program code comprising computer operating instructions. The memory 61 may comprise a high-speed RAM memory, and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory.
The processor 62 may be a Central Processing Unit (CPU), an Application Specific Integrated Circuit (ASIC), or one or more Integrated circuits configured to implement the embodiments of the present disclosure.
Alternatively, in a specific implementation, if the memory 61 and the processor 62 are implemented independently, the memory 61 and the processor 62 may be connected to each other through a bus and perform communication with each other. The bus may be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, an Extended ISA (EISA) bus, or the like. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown in FIG. 8, but this is not intended to represent only one bus or type of bus.
Alternatively, in a specific implementation, if the memory 61 and the processor 62 are integrated on a chip, the memory 61 and the processor 62 may complete the same communication through an internal interface.
Yet another embodiment of the present disclosure further provides a computer-readable storage medium, in which computer-executable instructions are stored, and when the computer-executable instructions are executed by a processor, the computer-readable storage medium is used for implementing the interface testing method according to any one of the above embodiments.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working process of the apparatus described above may refer to the corresponding process in the foregoing method embodiment, and is not described herein again.
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 for illustrating the technical solutions of the present disclosure, and not for limiting the same; while the present disclosure has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art will understand 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 such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present disclosure.

Claims (16)

1. An interface testing method, comprising:
acquiring a test request sent by a client, wherein the test request comprises at least one interface identifier to be edited;
determining a target group name corresponding to the interface identifier to be edited in a preset group name mapping table according to the test request, wherein each interface identifier and a corresponding self-defined group name are stored in the group name mapping table in an associated manner;
calling a simulation service based on an RPC protocol corresponding to the target group name from a preset simulation service database according to the target group name in the interface to be edited;
and performing interface test operation according to the simulation service corresponding to the target group name.
2. The method according to claim 1, wherein before determining, according to the test request, a target group name corresponding to the group name in the interface to be edited in a preset group name mapping table, the method further comprises:
acquiring a simulation service creation request sent by a client, wherein the simulation service creation request comprises a plurality of identifiers of interfaces to be simulated;
acquiring a resource packet and dependency relationship information corresponding to each interface to be simulated from a preset data server according to the simulation service creation request;
establishing simulation service corresponding to each interface to be simulated according to the resource package and the dependency relationship information;
acquiring a user-defined group name sent by a client aiming at each simulation service, wherein the user-defined group name is input by a user on the client;
and sending the simulation service and the user-defined group name corresponding to the simulation service to a preset simulation service database for storage.
3. The method according to claim 2, wherein after sending the simulation service and the customized group name corresponding to the simulation service to a preset simulation service database for storage, the method further comprises:
acquiring template information sent by a client, wherein the template information comprises access information and response information corresponding to the simulation service;
and sending the template information to a preset simulation service database for storage.
4. The method according to claim 2, wherein after sending the simulation service and the customized group name corresponding to the simulation service to a preset simulation service database for storage, the method further comprises:
and establishing the group name mapping table according to the user-defined group name corresponding to the simulation service and the interface identifier to be simulated corresponding to the simulation service.
5. The method according to any one of claims 1 to 4, wherein the test request further includes target entry information, and the performing an interface test operation according to the simulation service corresponding to the target group name includes:
acquiring response information corresponding to the target participation information from a preset data server according to the target participation information;
and sending the response information to the client.
6. The method according to any one of claims 1 to 4, wherein the test request further includes an identifier of an interface to be tested, and after obtaining the test request sent by the client, the method further includes:
and calling a real service according to the interface to be tested corresponding to the interface to be tested identifier, and carrying out interface test operation according to the real service.
7. The method of claim 6, wherein the performing interface test operations according to the real service comprises:
if it is detected that any real service does not feed back response information when exceeding a preset time threshold in the test process, determining a target group name corresponding to an interface to be tested in a preset group name mapping table according to the interface to be tested corresponding to the real service;
calling a simulation service based on an RPC protocol corresponding to the target group name from a preset simulation service database according to the target group name;
and performing interface test operation according to the simulation service corresponding to the target group name.
8. An interface testing apparatus, comprising:
the first obtaining module is used for obtaining a test request sent by a client, wherein the test request comprises at least one interface identifier to be edited;
a determining module, configured to determine, according to the test request, a target group name corresponding to the interface identifier to be edited in a preset group name mapping table, where each interface identifier and a corresponding custom group name are stored in the group name mapping table in an associated manner;
the first calling module is used for calling the simulation service based on the RPC protocol corresponding to the target group name from a preset simulation service database according to the target group name in the interface to be edited;
and the test module is used for carrying out interface test operation according to the simulation service corresponding to the target group name.
9. The apparatus of claim 8, further comprising:
the second acquisition module is used for acquiring a simulation service creation request sent by a client, wherein the simulation service creation request comprises a plurality of to-be-simulated interface identifiers;
a third obtaining module, configured to obtain, according to the simulation service creation request, a resource package and dependency relationship information corresponding to each interface to be simulated from a preset data server;
the building module is used for building simulation services corresponding to the interfaces to be simulated according to the resource packages and the dependency relationship information;
the group name acquisition module is used for acquiring a user-defined group name sent by a client aiming at each simulation service, wherein the user-defined group name is input by a user on the client;
and the first storage module is used for sending the simulation service and the user-defined group name corresponding to the simulation service to a preset simulation service database for storage.
10. The apparatus of claim 9, further comprising:
the third acquisition module is used for acquiring template information sent by a client, wherein the template information comprises access information and response information corresponding to the simulation service;
and the second storage module is used for sending the template information to a preset simulation service database for storage.
11. The apparatus of claim 9, further comprising:
and the establishing module is used for establishing the group name mapping table according to the user-defined group name corresponding to the simulation service and the interface identifier to be simulated corresponding to the simulation service.
12. The apparatus of any one of claims 8-11, wherein the test request further includes target entry information, and the test module is configured to:
acquiring response information corresponding to the target participation information from a preset data server according to the target participation information;
and sending the response information to the client.
13. The apparatus according to any one of claims 8-11, wherein the test request further includes an identifier of an interface to be tested, the apparatus further comprising:
and the second calling module is used for calling a real service according to the interface to be tested corresponding to the interface identification to be tested and carrying out interface test operation according to the real service.
14. The apparatus of claim 13, wherein the second invoking module is configured to:
if it is detected that any real service does not feed back response information when exceeding a preset time threshold in the test process, determining a target group name corresponding to an interface to be tested in a preset group name mapping table according to the interface to be tested corresponding to the real service;
calling a simulation service based on an RPC protocol corresponding to the target group name from a preset simulation service database according to the target group name;
and performing interface test operation according to the simulation service corresponding to the target group name.
15. An interface test apparatus, comprising: a memory, a processor;
a memory; a memory for storing the processor-executable instructions;
wherein the processor is configured to invoke program instructions in the memory to perform the interface testing method of any of claims 1-7.
16. A computer-readable storage medium having computer-executable instructions stored thereon, which when executed by a processor, perform the interface testing method of any one of claims 1-7.
CN202011012115.4A 2020-09-23 2020-09-23 Interface testing method, device, equipment and computer readable storage medium Pending CN113760707A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011012115.4A CN113760707A (en) 2020-09-23 2020-09-23 Interface testing method, device, equipment and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011012115.4A CN113760707A (en) 2020-09-23 2020-09-23 Interface testing method, device, equipment and computer readable storage medium

Publications (1)

Publication Number Publication Date
CN113760707A true CN113760707A (en) 2021-12-07

Family

ID=78785837

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011012115.4A Pending CN113760707A (en) 2020-09-23 2020-09-23 Interface testing method, device, equipment and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN113760707A (en)

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106970873A (en) * 2017-01-10 2017-07-21 阿里巴巴集团控股有限公司 Mock method of testings, apparatus and system on line
CN107179984A (en) * 2016-03-10 2017-09-19 北京京东尚科信息技术有限公司 A kind of interface mock methods and interface test method
CN108427631A (en) * 2017-02-14 2018-08-21 北京京东尚科信息技术有限公司 A kind of application test systems, method, electronic equipment and readable storage medium storing program for executing
CN110032454A (en) * 2018-01-12 2019-07-19 北京京东尚科信息技术有限公司 Remote invocation method, system and relevant device and computer readable storage medium
CN110765024A (en) * 2019-10-29 2020-02-07 百度在线网络技术(北京)有限公司 Simulation test method, simulation test device, electronic equipment and computer-readable storage medium
CN110798380A (en) * 2019-10-23 2020-02-14 北京奇艺世纪科技有限公司 Data acquisition method, system, device, test equipment and test server
WO2020119434A1 (en) * 2018-12-15 2020-06-18 深圳壹账通智能科技有限公司 Method and apparatus for interface data processing, method and apparatus for automated testing, device, and medium
CN111338944A (en) * 2020-02-21 2020-06-26 北京字节跳动网络技术有限公司 Remote Procedure Call (RPC) interface test method, device, medium and equipment
CN111538606A (en) * 2020-04-27 2020-08-14 中国银行股份有限公司 Method, device and equipment for testing and simulating Dubbo interface

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107179984A (en) * 2016-03-10 2017-09-19 北京京东尚科信息技术有限公司 A kind of interface mock methods and interface test method
CN106970873A (en) * 2017-01-10 2017-07-21 阿里巴巴集团控股有限公司 Mock method of testings, apparatus and system on line
CN108427631A (en) * 2017-02-14 2018-08-21 北京京东尚科信息技术有限公司 A kind of application test systems, method, electronic equipment and readable storage medium storing program for executing
CN110032454A (en) * 2018-01-12 2019-07-19 北京京东尚科信息技术有限公司 Remote invocation method, system and relevant device and computer readable storage medium
WO2020119434A1 (en) * 2018-12-15 2020-06-18 深圳壹账通智能科技有限公司 Method and apparatus for interface data processing, method and apparatus for automated testing, device, and medium
CN110798380A (en) * 2019-10-23 2020-02-14 北京奇艺世纪科技有限公司 Data acquisition method, system, device, test equipment and test server
CN110765024A (en) * 2019-10-29 2020-02-07 百度在线网络技术(北京)有限公司 Simulation test method, simulation test device, electronic equipment and computer-readable storage medium
CN111338944A (en) * 2020-02-21 2020-06-26 北京字节跳动网络技术有限公司 Remote Procedure Call (RPC) interface test method, device, medium and equipment
CN111538606A (en) * 2020-04-27 2020-08-14 中国银行股份有限公司 Method, device and equipment for testing and simulating Dubbo interface

Similar Documents

Publication Publication Date Title
CN108108297B (en) Method and device for automatic testing
CN110765024B (en) Simulation test method, simulation test device, electronic equipment and computer readable storage medium
CN109800258B (en) Data file deployment method, device, computer equipment and storage medium
CN111597110B (en) Page test method and device, electronic equipment and storage medium
CN110955409B (en) Method and device for creating resources on cloud platform
CN110659206A (en) Simulation architecture establishing method, device, medium and electronic equipment based on microservice
CN112035344A (en) Multi-scenario test method, device, equipment and computer readable storage medium
CN112306881A (en) Simulation data generation method, device, equipment and storage medium
CN111045941B (en) Positioning method and device for user interface control and storage medium
CN112631590A (en) Component library generation method and device, electronic equipment and computer readable medium
CN113127108A (en) Service request processing method and device, storage medium and electronic equipment
CN111767229A (en) Performance test method, device and equipment
CN108345508B (en) Interface call testing method and device
US9329960B2 (en) Methods, systems, and computer readable media for utilizing abstracted user-defined data to conduct network protocol testing
CN112650689A (en) Test method, test device, electronic equipment and storage medium
CN111522536A (en) Method for calling programming language and related equipment thereof
CN113760707A (en) Interface testing method, device, equipment and computer readable storage medium
CN114745749A (en) Virtual network element testing method and device, electronic equipment and readable storage medium
CN114217927A (en) Thread calling method and device, computer equipment and storage medium
CN112181802A (en) Test method and device
CN113495498A (en) Simulation method, simulator, device, and medium for hardware device
CN110780864A (en) Control method and device for class method replacement, storage medium and electronic equipment
CN110895507B (en) Simulation test method and device, simulation server and storage medium
CN114385384B (en) Application programming interface calling method and related equipment
CN116304399B (en) Visual processing method, device and system for test cases

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