CN116303080A - Interface testing method, device, electronic equipment and storage medium - Google Patents

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

Info

Publication number
CN116303080A
CN116303080A CN202310343685.9A CN202310343685A CN116303080A CN 116303080 A CN116303080 A CN 116303080A CN 202310343685 A CN202310343685 A CN 202310343685A CN 116303080 A CN116303080 A CN 116303080A
Authority
CN
China
Prior art keywords
interface
tested
processing result
log
result
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
CN202310343685.9A
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.)
Guangzhou Cubesili Information Technology Co Ltd
Original Assignee
Guangzhou Cubesili 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 Guangzhou Cubesili Information Technology Co Ltd filed Critical Guangzhou Cubesili Information Technology Co Ltd
Priority to CN202310343685.9A priority Critical patent/CN116303080A/en
Publication of CN116303080A publication Critical patent/CN116303080A/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
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3692Test management for test results analysis
    • 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/3696Methods or tools to render software testable
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/30Computing systems specially adapted for manufacturing

Landscapes

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

Abstract

The application relates to the technical field of interface testing, and provides an interface testing method, an interface testing device, electronic equipment and a storage medium, wherein the method comprises the following steps: acquiring an interface test request; determining an interface to be tested and a test case of the interface to be tested according to the interface test request; acquiring a work log generated by an interface to be tested in a production environment; the work log comprises first request data for calling the interface to be tested in the production environment and a first calling result responded by the interface to be tested according to the first request data; according to the test case, inputting the first request data to the interface to be tested, and obtaining a second calling result of the response of the interface to be tested; and comparing the first calling result with the second calling result to obtain a test result of the interface to be tested. According to the method and the device, the working log in the production environment is used as the test data of the interface to be tested, so that the production environment can be simulated, the test data do not need to be written manually, and the interface test efficiency is improved.

Description

Interface testing method, device, electronic equipment and storage medium
Technical Field
The embodiment of the application relates to the technical field of interface testing and network live broadcasting, in particular to an interface testing method, an interface testing device, electronic equipment and a storage medium.
Background
With the increasing development of computer technology, more and more systems are provided for providing various application functions for people, and in order to ensure the running stability of the system, the interfaces of the system are usually tested correspondingly in the development process. The interface test is a test performed on an interface between systems. Interface testing is mainly used to detect the interactive interfaces between systems and between subsystems within the system. For example, in live broadcast applications, it is necessary to test an interface object presentation interface of a live broadcast room interface to ensure that the interface object presentation interface calls, receives an interface object, and presents an interface notification message.
In the related art, in the process of performing interface test, it is often necessary to manually input test data of an interface to be tested, and then manually compare test results of the interface to check whether the call of the interface meets the requirements, so that the test efficiency of the interface is low.
Disclosure of Invention
The embodiment of the application provides an interface testing method, an interface testing device, electronic equipment and a storage medium, which can improve the interface testing efficiency, and the technical scheme is as follows:
in a first aspect, an embodiment of the present application provides an interface testing method, including the following steps:
acquiring an interface test request; determining an interface to be tested and a test case of the interface to be tested according to the interface test request;
acquiring a work log generated by an interface to be tested in a production environment; the work log comprises first request data for calling the interface to be tested in the production environment and a first calling result responded by the interface to be tested according to the first request data;
according to the test case, inputting the first request data to the interface to be tested, and obtaining a second calling result of the response of the interface to be tested; and comparing the first calling result with the second calling result to obtain a test result of the interface to be tested.
In a second aspect, an embodiment of the present application provides an interface testing apparatus, including:
the test request acquisition module is used for acquiring an interface test request; determining an interface to be tested and a test case of the interface to be tested according to the interface test request;
the work log acquisition module is used for acquiring a work log generated by the interface to be tested in a production environment; the work log comprises first request data for calling the interface to be tested in the production environment and a first calling result responded by the interface to be tested according to the first request data;
the test result obtaining module is used for inputting the first request data to the interface to be tested according to the test case to obtain a second calling result of the response of the interface to be tested; and comparing the first calling result with the second calling result to obtain a test result of the interface to be tested.
In a third aspect, embodiments of the present application provide an electronic device, a processor, a memory and a computer program stored in the memory and executable on the processor, the processor implementing the steps of the method as in the first aspect when the computer program is executed.
In a fourth aspect, embodiments of the present application provide a computer-readable storage medium storing a computer program which, when executed by a processor, performs steps as the method of the first aspect.
According to the embodiment of the application, the interface test request is acquired; determining an interface to be tested and a test case of the interface to be tested according to the interface test request; acquiring a work log generated by an interface to be tested in a production environment; the work log comprises first request data for calling the interface to be tested in the production environment and a first calling result responded by the interface to be tested according to the first request data; according to the test case, inputting the first request data to the interface to be tested, and obtaining a second calling result of the response of the interface to be tested; and comparing the first calling result with the second calling result to obtain a test result of the interface to be tested. According to the method and the device, the working log in the production environment is used as the test data of the interface to be tested, so that the production environment can be simulated, the test data do not need to be written manually, and the interface test efficiency is improved.
For a better understanding and implementation, the technical solutions of the present application are described in detail below with reference to the accompanying drawings.
Drawings
Fig. 1 is a flow chart of an interface testing method according to an embodiment of the present application;
FIG. 2 is a schematic diagram of collecting a log of an interface to be tested according to one embodiment of the present application;
FIG. 3 is a schematic diagram of collecting a log of an interface to be tested according to another embodiment of the present application;
fig. 4 is a schematic structural diagram of an interface testing device according to an embodiment of the present application;
fig. 5 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
Reference will now be made in detail to exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, the same numbers in different drawings refer to the same or similar elements, unless otherwise indicated. The implementations described in the following exemplary examples are not representative of all implementations consistent with the present application. Rather, they are merely examples of apparatus and methods consistent with some aspects of the present application as detailed in the accompanying claims.
The terminology used in the present application is for the purpose of describing particular embodiments only and is not intended to be limiting of the present application. As used in this application and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It should also be understood that the term "and/or" as used herein refers to and encompasses any or all possible combinations of one or more of the associated listed items.
It should be understood that although the terms first, second, third, etc. may be used herein to describe various information, these information should not be limited by these terms. These terms are only used to distinguish one type of information from another. For example, a first message may also be referred to as a second message, and similarly, a second message may also be referred to as a first message, without departing from the scope of the present application. The word "if"/"if" as used herein may be interpreted as "at … …" or "at … …" or "in response to a determination", depending on the context.
For better understanding of the technical solutions of the present application, a few interface testing methods in the technology are briefly described here.
In the related art, the request information needs to be manually input to the interface to be tested, the interface to be tested outputs the processing result, and then whether the processing result is consistent with the response information corresponding to the request information is compared, namely whether the logic processing function of the interface to be tested is abnormal is tested. If the interface to be tested is called in the production environment, the external interface needs to be called, in the test environment, the request information needs to be manually input into the interface to be tested, the interface to be tested calls the external interface to acquire a call return value output by the external interface, then the call return value is processed, a processing result is output, and whether the processing result is consistent with response information corresponding to the request information is compared.
According to the scheme, the test data of the interface to be tested is required to be manually input, and then the test result of the interface is manually compared, so that the test efficiency of the interface is low. Meanwhile, the service needs to be called by relying on an interface provided by an external interface, and if the external interface works abnormally, the test of the interface to be tested cannot be performed.
For this purpose, the application provides an interface testing method for automatic testing of interfaces. The method can be applied between the client device and the interface test platform. The client device may be a mobile phone, a tablet computer, a computer, etc. Taking a client device as a mobile phone, various applications required by users, such as a live broadcast application, a video application, a game application, and the like, can be installed in the client device.
Referring to fig. 1, fig. 1 is a flowchart of an interface testing method according to an embodiment of the present application, where the method includes the following steps:
s10: acquiring an interface test request; and determining the interface to be tested and the test case of the interface to be tested according to the interface test request.
The interface test request is a request for a user to perform interface test on a preset interface. The interface test request may include interface information of an interface that the user needs to test, and specifically, the interface test request includes an identifier of an interface to be tested. The identifier of the interface to be tested may be an interface name, an interface type or an interface address of the interface to be tested.
Test case information refers to a set of test inputs, execution conditions, and expected results that are formulated for a particular target so that a program path or verification meets a particular requirement, and may include an interface name, a request manner, a request address, a request parameter, and a return parameter of an interface to be tested. The request parameter may include data input to the interface to be tested, and the return parameter may include an expected result returned by the interface to be tested after receiving the request parameter.
In the embodiment of the application, when a user needs to test the interface to be tested, the user can log in the interface test platform through an account number and a password, and trigger an interface test request for the interface to be tested through a user interaction interface provided by the interface test platform.
After the interface test platform obtains the interface test request, the interface test request can be directly analyzed, so that the identification of the interface to be tested in the interface test request is obtained, and the interface to be tested is determined according to the identification of the interface to be tested. Meanwhile, the test case of the interface to be tested can be determined according to the identification of the interface to be tested. Specifically, the test case of the interface to be tested can be obtained from the test case library according to the identifier of the interface to be tested. Wherein, the test cases of each interface are prestored in the test case library. Optionally, before the user initiates the interface test request, the user may further edit the test case on line on the test case editing interface provided by the interface test platform. Correspondingly, the interface test platform receives and stores test cases edited by a user for the interface to be tested.
S20: acquiring a work log generated by an interface to be tested in a production environment; the work log comprises first request data for calling the interface to be tested in the production environment and a first calling result responded by the interface to be tested according to the first request data.
The production environment is a real online environment, and formally provides an environment for external services. The work log is a file for recording the calling condition of the interface when the interface to be tested is called by a service calling party in the production environment or when the interface to be tested calls an external interface in the production environment. The calling condition comprises first request data received by the interface to be tested and a first calling result responded by the interface to be tested according to the first request data.
S30: according to the test case, inputting the first request data to the interface to be tested, and obtaining a second calling result of the response of the interface to be tested; and comparing the first calling result with the second calling result to obtain a test result of the interface to be tested.
The first calling result is a processing result of the interface to be tested after processing the first request data in the production environment, and the second calling result is a processing result of the interface to be tested after processing the first request data in the test environment.
In the embodiment of the application, the test result of the interface to be tested is obtained by comparing whether the first call result is the same as the second call result.
By applying the embodiment of the application, the interface test request is acquired; determining an interface to be tested and a test case of the interface to be tested according to the interface test request; acquiring a work log generated by an interface to be tested in a production environment; the work log comprises first request data for calling the interface to be tested in the production environment and a first calling result responded by the interface to be tested according to the first request data; according to the test case, inputting the first request data to the interface to be tested, and obtaining a second calling result of the response of the interface to be tested; and comparing the first calling result with the second calling result to obtain a test result of the interface to be tested. According to the method and the device, the working log in the production environment is used as the test data of the interface to be tested, so that the production environment can be simulated, the test data do not need to be written manually, and the interface test efficiency is improved.
In an alternative embodiment, steps S1 to S2 are included before step S20, specifically as follows:
s1: collecting first request data for calling an interface to be tested in a production environment, and a first calling result and a log tracking identifier generated by the interface to be tested after the first request data is received; generating a first log of the interface to be tested according to the first request data, the first calling result and the log tracking identifier;
s2: and storing the first log through an interface log storage system to serve as a work log generated by the interface to be tested in a production environment.
Referring to fig. 2, in a production environment, a service caller 10 calls an interface 20 to be tested, the service caller 10 sends first request data to the interface 20 to be tested, the interface 20 to be tested receives the first request data, and a first call result and a log tracking identifier are generated. Wherein the service invoker 10 may be a client device. Specifically, the service caller 10 invokes the interface under test 20, for example, the interface under test Z, and the format of the first log is: { class Z, method, params pz, resp rz, traceId ID }, wherein pz is the first request data, rz is the first call result, and ID is the log tracking identifier.
The interface log storage system 30 is used for storing a work log for recording the calling condition of each interface in the production environment. Specifically, the interface log storage system is a distributed storage search component elastesearch. The elastesearch is a distributed, high-expansion and high-real-time search and data analysis engine. The method can conveniently enable a large amount of data to have the capabilities of searching, analyzing and exploring. When the interface to be tested is tested, the distributed storage search component elastic search can be used for efficiently acquiring the test data of the interface to be tested.
The work log of the interface 20 to be tested in the production environment is collected in real time so as to be used as the test data of the interface 20 to be tested in the test environment.
In an alternative embodiment, the first call result includes at least one first processing result and a third processing result; the first processing result is a processing result of the interface to be tested after processing the first request data in the production environment, the third processing result is a processing result of the interface to be tested after processing the calling return value fed back by the external interface based on the first processing result, wherein the first processing result is used as the input of at least one external interface in the production environment, and the external interface is called; the first log includes a first sub-log, a second sub-log, and a third sub-log. Step S1, including steps S11-S13, is specifically as follows:
s11: collecting first request data of calling an interface to be tested in a production environment, and at least one first processing result and a log tracking identifier generated by the interface to be tested after the first request data is received; and generating a first sub-log of the interface to be tested according to the first request data, at least one first processing result and the log tracking identifier.
Referring to fig. 3, in the production environment, if the interface 20 to be tested needs to call at least one external interface 40 after the interface 20 to be tested is called by the service caller 10, the first call result includes at least one first processing result and a third processing result, the third processing result is response data finally returned to the service caller 10, and the first processing result is request data of the interface to be tested for calling at least one external interface 40.
Specifically, the interface under test 20 invokes an external interface 40, such as external interface a, the format of the first sub-log is: { class Z, method queryZ, params pz, resp pa, traceId ID }, wherein pz is the first request data, pa is the first processing result, and ID is the log tracking identifier. The interface to be tested 20 calls the external interface 30, such as the external interface A, B, C, and the formats of the first sub-logs are respectively: { class Z, method queryZ, params pz, resp pa, pb, pc, traceId ID }, wherein pz is the first request data, pa, pb, pc are the first processing results.
S12: collecting at least one external interface which is called by an interface to be tested in a production environment according to a first processing result, and calling return values generated by the external interface after the external interface receives the first processing result; and generating a second sub-log of the interface to be tested according to the first processing result, the calling return value and the log tracking identifier.
Specifically, the interface under test 20 invokes an external interface 40, such as external interface a, with the second sub-log being in the format of: { class A, method queryA, params pa, resp ra, traceId ID }, where pa is the first processing result and ra is the call return value. Optionally, the interface to be tested 20 invokes the external interface 30, for example, the external interface A, B, C, and the formats of the second sub-logs are respectively: { class A, method queryA, params pa, resp ra, traceId ID }, { class B, method queryA, params pb, resp rb, traceId }, { class C, method queryC, params pc, resp rc, traceId ID }, ra, rb, rc are call return values.
S13: collecting a third processing result after the interface to be tested in the production environment receives the call return value and processes the call return value; and generating a third sub-log of the interface to be tested according to the call return value, the third processing result and the log tracking identifier.
Specifically, the interface under test 20 invokes an external interface 40, such as external interface a, and the third sub-log is in the format of: { class: Z, method: queryZ, params: ra, resp: rz, traceId: ID }. Here, rz is a third processing result after the call return value ra is processed. The interface under test 20 invokes the external interface 30, e.g., the external interface A, B, C, and the third sub-log is in the format of: { class: Z, method: queryZ, params: ra, rb, rc, resp: rz, traceId: ID }.
In the embodiment of the application, the work log of the interface 20 to be tested in the production environment is collected in real time so as to be used as the test data of the interface 20 to be tested in the test environment.
In an alternative embodiment, step S20 includes steps S201 to S203, which are specifically as follows:
s201: acquiring a fourth log from the interface log storage system; the fourth log is any log in the interface log storage system;
s202: judging whether the fourth log is one log of the interface to be tested;
s203: if yes, determining all logs including the log tracking identification in the interface log storage system as work logs generated by the interface to be tested in the production environment according to the log tracking identification of the fourth log.
In the embodiment of the application, any log is acquired from the interface log storage system, the tracking identifier in the log is identified, and if the tracking identifier is the tracking identifier of the interface to be tested, the working log generated by the interface to be tested under the production environment can be automatically and quickly acquired according to the tracking identifier.
In an alternative embodiment, the first call result includes a first processing result, where the first processing result is a processing result of the interface to be tested after processing the first request data in the production environment; the second call result includes a second processing result, where the second processing result is a processing result of the interface to be tested after processing the first request data in the test environment, and step S30 includes steps S301 to S302, specifically includes the following steps:
s301: if the second processing result is consistent with the first processing result, determining that the interface to be tested is successfully tested;
s302: if the second processing result is inconsistent with the first processing result, determining that the test of the interface to be tested fails.
In the embodiment of the application, if the interface to be tested is called by the service calling party, the interface to be tested does not need to call an external interface. Specifically, in the production environment, the interface Z to be tested is a service interface for inquiring the amount of the order, the service caller sends first request data to the interface Z to be tested, the first request data includes an order number, and the interface to be tested outputs the amount of the order corresponding to the order number to the service caller according to the order number.
By comparing whether the second processing result is consistent with the first processing result, whether the logic processing function of the interface to be tested is normal or not can be automatically and quickly determined.
In an alternative embodiment, the first call result includes at least one first processing result and a third processing result; the first processing result is a processing result of the interface to be tested after processing the first request data in the production environment, the third processing result is a processing result of the interface to be tested after processing the calling return value fed back by the external interface based on the first processing result, wherein the first processing result is used as the input of at least one external interface in the production environment, and the external interface is called;
the second calling result comprises a second processing result and a fourth processing result, the second processing result is a processing result of the interface to be tested after processing the first request data in the test environment, the fourth processing result is a processing result of the interface to be tested after processing the calling return value fed back by the external interface based on the second processing result, the second processing result is taken as at least one input of the external interface in the test environment, and the external interface is called. Step S30, including steps S303 to S305, is specifically as follows:
s303: if the second processing result is consistent with the first processing result, judging whether the fourth processing result is consistent with the third processing result;
s304: if the fourth processing result is consistent with the third processing result, determining that the interface to be tested is successfully tested;
s305: and if the fourth processing result is inconsistent with the third processing result, determining that the test of the interface to be tested fails.
In the embodiment of the application, if the interface to be tested is called by the service calling party, the interface to be tested needs to call at least the external interface. Specifically, in the production environment, the to-be-tested interface Z is a service interface for inquiring the amount of an order, the service caller sends first request data to the to-be-tested interface Z, the first request data pz includes an order number, the to-be-tested interface outputs the order amount rz corresponding to the order number according to the order number, the external interface A, B, C needs to be called, the external interface a is a service interface for acquiring the price of the order commodity, the external interface B is a service interface for acquiring the preferential benefit of the user activity, the external interface C is a service interface for acquiring freight, the to-be-tested interface outputs first processing results pa, pb and pc according to the order number, the first processing results pa, pb and pc are respectively used as input of the external interface A, B, C, the external interface A, B, C is called, the external interface A, B, C outputs call return values ra and rb and the to-be-tested interface according to the first processing results pa, pb and pc, and the third processing results rz are output to the service caller by the to be-tested interface.
And comparing whether the second processing result is consistent with the first processing result or not, and if the second processing result is inconsistent with the first processing result, testing the interface to be tested successfully. If the second processing result is consistent with the first processing result, continuously comparing whether the fourth processing result is consistent with the third processing result, thereby automatically and quickly determining whether the logic processing function of the interface to be tested is normal.
Referring to fig. 4, fig. 4 is a schematic structural diagram of an interface testing device according to an embodiment of the present application. The apparatus may be implemented as all or part of a computer device by software, hardware, or a combination of both. The interface testing device 4 provided in the embodiment of the present application includes:
a test request acquisition module 41, configured to acquire an interface test request; determining an interface to be tested and a test case of the interface to be tested according to the interface test request;
a work log obtaining module 42, configured to obtain a work log generated by the interface to be tested in the production environment; the work log comprises first request data for calling the interface to be tested in the production environment and a first calling result responded by the interface to be tested according to the first request data;
the test result obtaining module 43 is configured to input the first request data to the interface to be tested according to the test case, and obtain a second call result of the response of the interface to be tested; and comparing the first calling result with the second calling result to obtain a test result of the interface to be tested.
It should be noted that, when the interface testing device provided in the above embodiment performs the virtual face generating method, only the division of the above functional modules is used for illustration, in practical application, the above functional allocation may be performed by different functional modules according to needs, that is, the internal structure of the device is divided into different functional modules, so as to complete all or part of the functions described above. In addition, the interface testing device and the interface testing method provided in the foregoing embodiments belong to the same concept, which embody detailed implementation procedures in the method embodiments, and are not described herein again.
Referring to fig. 5, fig. 5 is a schematic structural diagram of an electronic device provided in the present application. As shown in fig. 5, the electronic device 21 may include: a processor 210, a memory 211, and a computer program 212 stored in the memory 211 and executable on the processor 210, for example: an interface test program; the processor 210, when executing the computer program 212, implements the steps of the embodiments described above.
Wherein the processor 210 may include one or more processing cores. The processor 210 performs various functions of the computer device 21 and processes data by executing or executing instructions, programs, code sets, or instruction sets stored in the memory 211, and invoking data in the memory 211, using various interfaces and lines to connect various parts within the computer device 21, alternatively, the processor 210 may be implemented in at least one hardware form of digital signal processing (Digital Signal Processing, DSP), field-programmable gate array (Field-Programmable Gate Array, FPGA), programmable logic array (Programble Logic Array, PLA). The processor 210 may integrate one or a combination of several of a central processing unit (Central Processing Unit, CPU), an image processor (Graphics Processing Unit, GPU), and a modem, etc. The CPU mainly processes an operating system, a user interface, an application program and the like; the GPU is used for rendering and drawing the content required to be displayed by the touch display screen; the modem is used to handle wireless communications. It will be appreciated that the modem may not be integrated into the processor 210 and may be implemented by a single chip.
The Memory 211 may include a random access Memory (Random Access Memory, RAM) or a Read-Only Memory (Read-Only Memory). Optionally, the memory 211 includes a non-transitory computer readable medium (non-transitory computer-readable storage medium). Memory 211 may be used to store instructions, programs, code sets, or instruction sets. The memory 211 may include a storage program area and a storage data area, wherein the storage program area may store instructions for implementing an operating system, instructions for at least one function (such as touch instructions, etc.), instructions for implementing the above-described various method embodiments, etc.; the storage data area may store data or the like referred to in the above respective method embodiments. The memory 211 may optionally also be at least one storage device located remotely from the aforementioned processor 210.
The embodiment of the present application further provides a computer storage medium, where a plurality of instructions may be stored, where the instructions are adapted to be loaded and executed by a processor, and the specific implementation procedure may refer to the specific description of the foregoing embodiment, and details are not repeated herein.
It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-described division of the functional units and modules is illustrated, and in practical application, the above-described functional distribution may be performed by different functional units and modules according to needs, i.e. the internal structure of the apparatus is divided into different functional units or modules to perform all or part of the above-described functions. The functional units and modules in the embodiment may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit, where the integrated units may be implemented in a form of hardware or a form of a software functional unit. In addition, specific names of the functional units and modules are only for convenience of distinguishing from each other, and are not used for limiting the protection scope of the present application. The specific working process of the units and modules in the above system may refer to the corresponding process in the foregoing method embodiment, which is not described herein again.
In the foregoing embodiments, the descriptions of the embodiments are emphasized, and in part, not described or illustrated in any particular embodiment, reference is made to the related descriptions of other embodiments.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
In the embodiments provided in the present invention, it should be understood that the disclosed apparatus/terminal device and method may be implemented in other manners. For example, the apparatus/terminal device embodiments described above are merely illustrative, e.g., the division of modules or units is merely a logical function division, and there may be additional divisions when actually implemented, e.g., multiple units or components may be combined or integrated into another system, or some features may be omitted or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection via interfaces, devices or units, which may be in electrical, mechanical or other forms.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed over a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in the embodiments of the present invention may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units may be implemented in hardware or in software functional units.
The integrated modules/units, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer readable storage medium. Based on such understanding, the present invention may implement all or part of the flow of the method of the above embodiment, or may be implemented by a computer program to instruct related hardware, where the computer program may be stored in a computer readable storage medium, and when the computer program is executed by a processor, the steps of each method embodiment described above may be implemented. Wherein the computer program comprises computer program code, which may be in the form of source code, object code, executable files or in some intermediate form, etc.
The present invention is not limited to the above-described embodiments, but, if various modifications or variations of the present invention are not departing from the spirit and scope of the present invention, the present invention is intended to include such modifications and variations as fall within the scope of the claims and the equivalents thereof.

Claims (10)

1. An interface testing method is characterized by comprising the following steps:
acquiring an interface test request; determining an interface to be tested and a test case of the interface to be tested according to the interface test request;
acquiring a work log generated by the interface to be tested in a production environment; the work log comprises first request data for calling the interface to be tested in a production environment and a first calling result responded by the interface to be tested according to the first request data;
according to the test case, the first request data is input to the interface to be tested, and a second calling result of the interface to be tested is obtained; and comparing the first calling result with the second calling result to obtain a test result of the interface to be tested.
2. The interface testing method according to claim 1, wherein:
the first calling result comprises a first processing result, wherein the first processing result is a processing result obtained after the interface to be tested processes the first request data in a production environment; the second calling result comprises a second processing result, wherein the second processing result is a processing result obtained after the interface to be tested processes the first request data in a test environment;
the step of comparing the first calling result with the second calling result to obtain the test result of the interface to be tested includes:
if the second processing result is consistent with the first processing result, determining that the interface to be tested is successfully tested;
and if the second processing result is inconsistent with the first processing result, determining that the test of the interface to be tested fails.
3. The interface testing method according to claim 1, wherein:
the first calling result comprises at least one first processing result and a third processing result; the first processing result is a processing result after the interface to be tested processes the first request data in a production environment, the third processing result is a processing result after the interface to be tested processes a calling return value fed back by the external interface based on the first processing result in the production environment by taking the first processing result as at least one input of the external interface;
the second calling result comprises a second processing result and a fourth processing result, the second processing result is a processing result after the interface to be tested processes the first request data in a test environment, the fourth processing result is a processing result after the interface to be tested uses the second processing result as at least one external interface in the test environment, the external interface is called, and the calling return value fed back by the external interface based on the second processing result is processed;
the step of comparing the first calling result with the second calling result to obtain the test result of the interface to be tested includes:
if the second processing result is consistent with the first processing result, judging whether the fourth processing result is consistent with the third processing result;
if the fourth processing result is consistent with the third processing result, determining that the interface to be tested is successfully tested;
and if the fourth processing result is inconsistent with the third processing result, determining that the test of the interface to be tested fails.
4. A method of interface testing according to any one of claims 1 to 3, wherein:
before the step of obtaining the work log generated by the interface to be tested in the production environment, the method comprises the following steps:
collecting first request data for calling the interface to be tested in a production environment, and a first calling result and a log tracking identifier generated by the interface to be tested after the interface to be tested receives the first request data; generating a first log of the interface to be tested according to the first request data, the first calling result and the log tracking identifier;
and storing the first log through an interface log storage system to serve as a work log generated by the interface to be tested in a production environment.
5. The interface testing method according to claim 4, wherein:
the first calling result comprises at least one first processing result and a third processing result; the first processing result is a processing result after the interface to be tested processes the first request data in a production environment, the third processing result is a processing result after the interface to be tested processes a calling return value fed back by the external interface based on the first processing result in the production environment by taking the first processing result as at least one input of the external interface;
the first log comprises a first sub-log, a second sub-log and a third sub-log;
the method comprises the steps that first request data of an interface to be tested are collected in a production environment, and after the first request data are received by the interface to be tested, a first calling result and a log tracking identifier are generated; generating a first log of the interface to be tested according to the first request data, the first calling result and the log tracking identifier, wherein the step comprises the following steps:
collecting first request data for calling the interface to be tested in a production environment, and at least one first processing result and a log tracking identifier generated by the interface to be tested after the interface to be tested receives the first request data; generating a first sub-log of the interface to be tested according to the first request data, the at least one first processing result and the log tracking identifier;
collecting at least one external interface which is called by the interface to be tested in the production environment according to the first processing result and a call return value generated by the external interface after the external interface receives the first processing result; generating a second sub-log of the interface to be tested according to the first processing result, the calling return value and the log tracking identifier;
collecting a third processing result obtained after the interface to be tested in the production environment receives the call return value and processes the call return value; and generating a third sub-log of the interface to be tested according to the call return value, the third processing result and the log tracking identifier.
6. The interface testing method according to claim 4, wherein:
the step of obtaining the work log generated by the interface to be tested in the production environment comprises the following steps:
acquiring a fourth log from the interface log storage system; the fourth log is any log in the interface log storage system;
judging whether the fourth log is one log of the interface to be tested;
if yes, determining all logs including the log tracking identifier in the interface log storage system as work logs generated by the interface to be tested in a production environment according to the log tracking identifier of the fourth log.
7. An interface testing apparatus, comprising:
the test request acquisition module is used for acquiring an interface test request; determining an interface to be tested and a test case of the interface to be tested according to the interface test request;
the work log acquisition module is used for acquiring the work log generated by the interface to be tested in the production environment; the work log comprises first request data for calling the interface to be tested in a production environment and a first calling result responded by the interface to be tested according to the first request data;
the test result obtaining module is used for inputting the first request data to the interface to be tested according to the test case to obtain a second calling result of the interface to be tested response; and comparing the first calling result with the second calling result to obtain a test result of the interface to be tested.
8. The interface testing apparatus of claim 7, wherein:
the test result obtaining module comprises:
the first comparison unit is used for determining that the interface to be tested is successfully tested if the second processing result is consistent with the first processing result;
and the second comparison unit is used for determining that the test of the interface to be tested fails if the second processing result is inconsistent with the first processing result.
9. An electronic device, comprising: a processor, a memory and a computer program stored in the memory and executable on the processor, characterized in that the processor implements the steps of the method according to any one of claims 1 to 6 when the computer program is executed.
10. A computer readable storage medium storing a computer program, characterized in that the computer program when executed by a processor implements the steps of the method according to any one of claims 1 to 6.
CN202310343685.9A 2023-03-31 2023-03-31 Interface testing method, device, electronic equipment and storage medium Pending CN116303080A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310343685.9A CN116303080A (en) 2023-03-31 2023-03-31 Interface testing method, device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310343685.9A CN116303080A (en) 2023-03-31 2023-03-31 Interface testing method, device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN116303080A true CN116303080A (en) 2023-06-23

Family

ID=86781449

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310343685.9A Pending CN116303080A (en) 2023-03-31 2023-03-31 Interface testing method, device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN116303080A (en)

Similar Documents

Publication Publication Date Title
CN109669795B (en) Crash information processing method and device
CN108256118B (en) Data processing method, device, system, computing equipment and storage medium
CN109618176B (en) Processing method, equipment and storage medium for live broadcast service
CN110798380B (en) Data acquisition method, system, device, test equipment and test server
CN110569159A (en) Baffle generation method, device, equipment and computer storage medium
CN112035344A (en) Multi-scenario test method, device, equipment and computer readable storage medium
CN111045879A (en) Pressure test report generation method and device and storage medium
CN113434396A (en) Interface test method, device, equipment, storage medium and program product
CN112948224A (en) Data processing method, device, terminal and storage medium
CN114546830A (en) Regression testing method, regression testing device, electronic equipment and storage medium
CN114265737A (en) System migration integrity detection method and device and electronic equipment
CN115052037B (en) Client detection method, device, storage medium and equipment
CN113238935A (en) Application testing method, system, device, medium, and computer program product
CN113282460A (en) Distributed alarm system, method and device
CN110674023A (en) Interface testing method and device
CN112988589A (en) Interface testing method, device and system
CN116738091A (en) Page monitoring method and device, electronic equipment and storage medium
CN108377357B (en) Visual platform call method and device
CN116303080A (en) Interface testing method, device, electronic equipment and storage medium
CN114389969A (en) Client test method and device, electronic equipment and storage medium
CN112214532A (en) Service data auditing method and related device
CN106547679B (en) Script management method and script management platform
CN111708684B (en) Recording method and device for page access and computer system
CN113674246B (en) Method, device, electronic equipment and storage medium for auditing picture files
CN114818645B (en) Automatic report generation method, device, equipment and medium based on data body

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