CN111597120B - Interface test apparatus, method, electronic device, and computer-readable storage medium - Google Patents

Interface test apparatus, method, electronic device, and computer-readable storage medium Download PDF

Info

Publication number
CN111597120B
CN111597120B CN202010458393.6A CN202010458393A CN111597120B CN 111597120 B CN111597120 B CN 111597120B CN 202010458393 A CN202010458393 A CN 202010458393A CN 111597120 B CN111597120 B CN 111597120B
Authority
CN
China
Prior art keywords
interface
module
data
protocol
tested
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.)
Active
Application number
CN202010458393.6A
Other languages
Chinese (zh)
Other versions
CN111597120A (en
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.)
Industrial and Commercial Bank of China Ltd ICBC
Original Assignee
Industrial and Commercial Bank of China Ltd ICBC
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 Industrial and Commercial Bank of China Ltd ICBC filed Critical Industrial and Commercial Bank of China Ltd ICBC
Priority to CN202010458393.6A priority Critical patent/CN111597120B/en
Publication of CN111597120A publication Critical patent/CN111597120A/en
Application granted granted Critical
Publication of CN111597120B publication Critical patent/CN111597120B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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/3696Methods or tools to render software testable

Abstract

The present disclosure provides an interface test apparatus, comprising: the data management module is used for managing and storing test data for testing a plurality of interfaces, wherein the interface protocols of the interfaces at least comprise two types; the protocol realization module is used for determining a protocol realization sub-module corresponding to the tested interface from a protocol library and sending interface definition and messages of the tested interface to the protocol realization sub-module so that the protocol realization sub-module can communicate with a tested system according to the interface definition and the messages and a target protocol, thereby completing the call of the tested interface, wherein the protocol library comprises a plurality of protocol realization sub-modules for realizing different types of protocols; the assertion module is used for analyzing and judging the returned data of the tested interface according to the assertion expression and determining the invoking result of the tested interface; and the flow control module is used for executing a flow control instruction according to the interface test flow according to the judging result of the assertion module, wherein the interface test flow comprises a plurality of test interfaces.

Description

Interface test apparatus, method, electronic device, and computer-readable storage medium
Technical Field
The present disclosure relates to the field of computer technology, and more particularly, to an interface testing apparatus, an interface testing method, an electronic device, and a computer-readable storage medium.
Background
The interface test is a test for testing interfaces between components of a system, and is mainly used for testing interfaces between the system and other external systems and interfaces between all sub-modules in the system. Part of the test works are to check the correctness of the interface parameter transfer, the correctness of the interface function realization, the correctness of the output result, and the integrity and rationality of fault tolerance processing for various abnormal conditions. A complete business scenario often requires the invocation of different interfaces to multiple systems.
In the process of implementing the disclosed concept, the inventor finds that at least the following problems exist in the related art: as software systems become more complex, the types of protocols that test interfaces are also increasing, the linkages between interfaces are also increasing, and thus the requirements on testers are becoming higher.
Disclosure of Invention
In view of this, the present disclosure provides an interface testing apparatus, an interface testing method, an electronic device, and a computer-readable storage medium.
One aspect of the present disclosure provides an interface test apparatus, comprising: the data management module is used for managing and storing test data for testing a plurality of interfaces, wherein the interface protocols of the interfaces at least comprise two types; the protocol realization module is used for determining a protocol realization sub-module corresponding to the tested interface from a protocol library and sending the interface definition and the message of the tested interface to the protocol realization sub-module so that the protocol realization sub-module communicates with a tested system according to the interface definition and the message and a target protocol, thereby completing the calling of the tested interface, wherein the protocol library comprises a plurality of protocol realization sub-modules for realizing different types of protocols; the assertion module is used for analyzing and judging the returned data of the tested interface according to the assertion expression and determining the calling result of the tested interface; and the flow control module is used for executing a flow control instruction according to the interface test flow according to the judging result of the assertion module, wherein the interface test flow comprises a plurality of test interfaces.
According to an embodiment of the present disclosure, the protocol library defines and opens a standard of an implementation sub-module of a protocol so that the protocol implementation sub-module satisfying the implementation standard can be added to the protocol library.
According to an embodiment of the present disclosure, the assertion module includes: the interpreter module is used for acquiring the assertion expression and outputting tree operation logic; and the executor module is used for acquiring the tree-shaped operation logic and the return data of the tested interface and calculating the judging result of success or failure of the calling of the tested interface according to the tree-shaped operation logic and the return data of the tested interface.
According to an embodiment of the disclosure, the flow control module is configured to define a subsequent call flow corresponding to the tested interface when the call is successful and failed.
According to an embodiment of the present disclosure, the data management module includes a key-value structure data pool for storing test data in a key-value structure of a parameter name and a parameter value for reading and editing by other modules; and the data generation and processing module is used for generating corresponding data according to a predefined test instruction or processing the data.
According to an embodiment of the disclosure, the data management module further includes a read parameter file module, configured to read parameters from a target parameter file and store the read parameters into the key-value structure data pool; and the return data processing module is used for analyzing the output message of the tested interface, extracting data and storing the extracted data into the key value structure data pool.
According to an embodiment of the present disclosure, the data management module further includes a message parameterization module, configured to identify a parameterized portion in an input message of the tested interface, and replace parameters in the parameterized portion with corresponding data in the key structure data pool.
Another aspect of the present disclosure provides an interface testing method, including: managing and storing test data for testing a plurality of interfaces through a data management module, wherein interface protocols of the plurality of interfaces at least comprise two types; executing an interface calling flow according to the interface testing flow; determining a protocol realization sub-module corresponding to a tested interface from a protocol library through a protocol realization module, and sending interface definition and a message of the tested interface to the protocol realization sub-module so that the protocol realization sub-module communicates with a tested system according to the interface definition and the message and a target protocol, thereby completing the calling of the tested interface, wherein the protocol library comprises a plurality of protocol realization sub-modules for realizing different types of protocols; analyzing and judging the returned data of the tested interface according to the assertion expression by the assertion module, and determining the calling result of the tested interface; and executing a flow control instruction according to an interface test flow by a flow control module according to the judging result of the assertion module, wherein the interface test flow comprises a plurality of test interfaces.
Another aspect of the present disclosure provides an electronic device, comprising: one or more processors; and a memory for storing one or more instructions that, when executed by the one or more processors, cause the one or more processors to perform the functions of the apparatus as described above.
Another aspect of the present disclosure provides a computer-readable storage medium having stored thereon executable instructions that when executed by a processor cause the processor to perform the functions of the apparatus as described above.
Another aspect of the present disclosure provides a computer program comprising computer executable instructions which when executed are for implementing a method as described above.
According to the embodiment of the disclosure, the interface testing device is provided, and a quick and simple multi-interface testing scene is realized through unified data management, protocol library, assertion expression and flow control. The tester only needs to pay attention to the logic of the service scene and the input and output data of the interface, and does not need to master the implementation details of different protocols, so that the development difficulty of a test program is simplified. Therefore, the technical problem that a tester needs to master various interface protocols and has high technical requirements on the tester when the interface is tested in the related technology is at least partially solved.
Drawings
The above and other objects, features and advantages of the present disclosure will become more apparent from the following description of embodiments thereof with reference to the accompanying drawings in which:
FIG. 1 schematically illustrates an exemplary system architecture to which interface test apparatus and methods may be applied, according to an embodiment of the present disclosure;
FIG. 2 schematically illustrates a block diagram of a data management module according to an embodiment of the disclosure;
FIG. 3 schematically illustrates a block diagram of a protocol implementation module according to an embodiment of the disclosure;
FIG. 4 schematically illustrates a block diagram of an assertion module according to an embodiment of the disclosure;
FIG. 5 schematically illustrates a schematic diagram of tree arithmetic logic;
FIG. 6 schematically illustrates a schematic diagram of a flow control module execution according to an embodiment of the present disclosure;
FIG. 7 schematically illustrates a flow chart of an interface testing method according to an embodiment of the disclosure;
FIG. 8 schematically illustrates a flow chart of an interface testing method according to an embodiment of the disclosure; and
fig. 9 schematically illustrates a block diagram of a computer system suitable for implementing the interface test apparatus and methods described above, in accordance with an embodiment of the present disclosure.
Detailed Description
Hereinafter, embodiments of the present disclosure will be described with reference to the accompanying drawings. It should be understood that the description is only exemplary and is not intended to limit the scope of the present disclosure. In the following detailed description, for purposes of explanation, numerous specific details are set forth in order to provide a thorough understanding of the embodiments of the present disclosure. It may be evident, however, that one or more embodiments may be practiced without these specific details. In addition, in the following description, descriptions of well-known structures and techniques are omitted so as not to unnecessarily obscure the concepts of the present disclosure.
The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the disclosure. The terms "comprises," "comprising," and/or the like, as used herein, specify the presence of stated features, steps, operations, and/or components, but do not preclude the presence or addition of one or more other features, steps, operations, or components.
All terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art unless otherwise defined. It should be noted that the terms used herein should be construed to have meanings consistent with the context of the present specification and should not be construed in an idealized or overly formal manner.
Where expressions like at least one of "A, B and C, etc. are used, the expressions should generally be interpreted in accordance with the meaning as commonly understood by those skilled in the art (e.g.," a system having at least one of A, B and C "shall include, but not be limited to, a system having a alone, B alone, C alone, a and B together, a and C together, B and C together, and/or A, B, C together, etc.). Where a formulation similar to at least one of "A, B or C, etc." is used, in general such a formulation should be interpreted in accordance with the ordinary understanding of one skilled in the art (e.g. "a system with at least one of A, B or C" would include but not be limited to systems with a alone, B alone, C alone, a and B together, a and C together, B and C together, and/or A, B, C together, etc.).
In order to complete the test of a service scene, a tester generally needs to master the implementation details of different protocols to complete the development of an interface test program and a script. In addition, because the calling methods, result verification and abnormality detection means of different protocol interfaces are different, the respective test programs are also large in different diameters, and in order to multiplex or combine different interfaces for testing, the test programs of the different interfaces often need to be modified and adapted, so that the test efficiency is low. Further, in the related art, linkage between different interfaces is difficult, linkage between interfaces includes data linkage and flow linkage, and a subsequent calling interface and input data are determined according to an execution result of a previous interface. In order to meet the complex business scenario, testers often need to implement complex data management, result judgment and flow control codes in the test program.
To solve the following difficulties encountered in the interface test in the related art, including: 1. the types of protocols are multiple, and the development difficulty of scripts is high; 2. the test script specifications are not uniform and are difficult to multiplex; 3. the linkage between interfaces is difficult. The method and the device can reduce development difficulty of the test script, improve multiplexing capability of the script, and simplify data association and flow association of transaction linkage. The tester can quickly start and implement the interface test by focusing on the logic of the service scene and the input and output data of the interface without focusing on complex protocol implementation, flow and data management.
Embodiments of the present disclosure provide an interface test apparatus, including: the data management module is used for managing and storing test data for testing a plurality of interfaces, wherein the interface protocols of the interfaces at least comprise two types; the protocol realization module is used for determining a protocol realization sub-module corresponding to the tested interface from a protocol library and sending interface definition and messages of the tested interface to the protocol realization sub-module so that the protocol realization sub-module can communicate with a tested system according to the interface definition and the messages and a target protocol, thereby completing the call of the tested interface, wherein the protocol library comprises a plurality of protocol realization sub-modules for realizing different types of protocols; the assertion module is used for analyzing and judging the returned data of the tested interface according to the assertion expression and determining the invoking result of the tested interface; and the flow control module is used for executing a flow control instruction according to the interface test flow according to the judging result of the assertion module, wherein the interface test flow comprises a plurality of test interfaces.
Fig. 1 schematically illustrates an exemplary system architecture to which interface test apparatus and methods may be applied according to embodiments of the present disclosure.
As shown in fig. 1, the system architecture according to this embodiment may include an interface test apparatus 100 and a system under test 200.
Interface test apparatus 100 may include a data management module 101, a protocol implementation module 102, an assertion module 103, and a flow control module 104.
The data management module 101 is configured to manage and store test data for testing a plurality of interfaces, where interface protocols of the plurality of interfaces include at least two types.
According to embodiments of the present disclosure, the data management module 101 may include a data pool with a key structure for storing test data, and the data management module 101 may implement the following functions: (1) The parameterization function of the message is realized, and before the interface is called, the data management module 101 replaces the parameter part in the message input by the interface with the data in the data pool; (2) The data management module 101 obtains appointed data from the interface output message and puts the appointed data into a data pool as subsequent interface test data so as to realize data transmission among multiple interfaces; (3) The data management module 101 reads data from the specified data file and puts the data into a data pool; (4) The data management module 101 provides data generation and data processing functions.
The protocol implementation module 102 is configured to determine a protocol implementation sub-module corresponding to the tested interface from a protocol library, and send an interface definition and a message of the tested interface to the protocol implementation sub-module, so that the protocol implementation sub-module communicates with the tested system according to the interface definition and the message and a target protocol, thereby completing the call of the tested interface, where the protocol library includes a plurality of protocol implementation sub-modules for implementing different types of protocols.
According to embodiments of the present disclosure, protocol implementation module 102 includes implementation of various protocol details, which initiate interface calls based on interfaces and messages defined by the tester.
The assertion module 103 is configured to parse and determine returned data of the tested interface according to the assertion expression, and determine a result of the tested interface call.
According to embodiments of the present disclosure, the assertion module 103 may input an assertion expression, parse and judge returned data of the interface according to the assertion expression, and determine a result of the interface call.
The flow control module 104 is configured to execute a flow control instruction according to an interface test flow according to a result determined by the assertion module, where the interface test flow includes a plurality of test interfaces.
According to an embodiment of the disclosure, the flow control module 104 may input the flow control instructions "jump to" and "exit" and execute the flow control instructions according to the determination result of the assertion module, and jump to the corresponding flow.
A tester can use the interface test device 100 to interact with the tested system 200 through a network to receive or send messages and the like, so as to realize a quick and simple multi-interface test scene.
The interface testing method provided by the embodiment of the disclosure may be executed by the terminal device, or may be executed by other terminal devices different from the terminal device. Accordingly, the interface testing apparatus provided by the embodiments of the present disclosure may be disposed in a terminal device, or disposed in another terminal device different from the terminal device.
According to the embodiment of the disclosure, the interface testing device is provided, and a quick and simple multi-interface testing scene is realized through unified data management, protocol library, assertion expression and flow control. The tester only needs to pay attention to the logic of the service scene and the input and output data of the interface, and does not need to master the implementation details of different protocols, so that the development difficulty of a test program is simplified. Therefore, the technical problem that a tester needs to master various interface protocols and has high technical requirements on the tester when the interface is tested in the related technology is at least partially solved.
Fig. 2 schematically illustrates a block diagram of a data management module according to an embodiment of the disclosure.
As shown in fig. 2, the data management module 101 may include a key-value structure data pool 201, a data generation and processing module 202, a read parameter file module 203, a return data processing module 204, and a message parameterization module 205. It should be noted that the data management module 101 may include one or more of a key-value structure data pool 201, a data generation and processing module 202, a read parameter file module 203, a return data processing module 204, and a message parameterization module 205.
The key structure data pool 201 stores data in a key structure of parameter name-parameter value, and the stored data can be read and edited by other modules.
The data generation and processing module 202 may generate corresponding data according to instructions predefined by the tester or process the data. Specifically, the data generation functions include, but are not limited to: generating a random number, current time, randomly generating an identity card number and a global unique value; data processing functions include, but are not limited to: string concatenation and interception, digital signature, encryption and decryption, hash value, and mathematical operation (addition, subtraction, multiplication and division).
The read parameter file module 203 may read parameters from a specified parameter file and store the parameters in the key-value structure data pool 201, and the file format may be JSON, EXCEL, XML format or other formats.
The return data processing module 204 may parse the output message of the interface, and store the extracted data in the key-value structure data pool 201 according to the method specified by the tester. The specific description is as follows: (1) When the return message of the interface is in a text form, a tester can locate target data in the return message by specifying a method of front text and rear text of the data to be searched, and intercept and store the target data in a data pool; (2) When the message returned by the interface is in the form of an object, the tester can acquire the attribute value through the attribute name of the appointed data and store the attribute value in the data pool.
The message parameterization module 205 may identify parameterized portions of the message and replace parameters in the parameterized portions with corresponding data in the key structure data pool 201.
According to an embodiment of the present disclosure, for example, the parameterized portion in the message is expressed in the form of $ {.} (parameter name in the middle of the bracket), for example: the module identifies the part as a section to be parameterized and the parameter name is Param, and the module searches the data pool for the data value with the key name of Param and replaces the parameterized part in the message.
According to the embodiment of the disclosure, a tester does not need data management, and only needs to pay attention to logic of a service scene and input and output data of an interface, so that the interface test can be started and implemented quickly.
Fig. 3 schematically illustrates a block diagram of a protocol implementation module according to an embodiment of the disclosure.
As shown in fig. 3, the protocol implementation module 102 may include an interface executor module 301 and a protocol library 302.
According to the embodiments of the present disclosure, the protocol implementation module 102 may support multiple protocols, provide a unified test method for a tester for different protocols, write a definition and a message of a tested interface for the tester, and the protocol implementation module 102 is responsible for completing the interface call, where the interface definition may include two parts: (1) a protocol type of the interface, such as the HTTP protocol; (2) Protocol specific properties such as URL and HEADER, BODY in HTTP protocol.
The interface executor module 301 may find a corresponding protocol implementation sub-module from the protocol library 302 according to the interface defined by the tester, and send the interface definition and the message to the protocol implementation sub-module to initiate an interface call.
The protocol library 302 includes a plurality of protocol implementation sub-modules, and each protocol implementation sub-module completes the communication between the respective protocol and the tested system according to the input interface definition and message, and completes the interface call. The protocol library 302 may contain implementations of, for example, HTTP protocol, JDBC protocol, DUBBO protocol, 8583 protocol, MQ protocol.
The protocol library 302 may define and open standards for implementing sub-modules of the protocol, and protocol implementing sub-modules meeting the standards may be added to the protocol library.
According to the embodiment of the disclosure, the protocol library defines and opens the standard of the protocol realization submodule so as to meet the standard, and the protocol realization submodule can be added into the protocol library, so that the problems of multiple protocol types and high script development difficulty are solved.
Fig. 4 schematically illustrates a block diagram of an assertion module according to an embodiment of the disclosure.
As shown in fig. 4, assertion module 103 may include an interpreter module 401 and an executor module 402.
The interpreter module 401 is configured to obtain the predicate expression and output tree operation logic.
The executor module 402 is configured to obtain the tree-like operation logic and the return data of the tested interface, and calculate a determination result of success or failure of the tested interface according to the tree-like operation logic and the return data of the tested interface.
The input to the interpreter module 401 is an predicate expression, outputting tree operation logic (as shown in fig. 5, fig. 5 schematically shows a schematic diagram of tree operation logic). The predicate expression is a logical operation, the final operation result is a boolean value, TRUE and FALSE represent the success and failure of the interface call, respectively. Formally, predicate expressions are divided into two classes of expressions: a connection expression and a termination expression. The specific description is as follows: (1) The join expression refers to logical operators, and or respectively; (2) The termination expression is an operation, the operation result is a boolean value, and four supported termination expressions are provided: (a) The return message is text, the appointed value is found in the message, the operation result is TRUE, otherwise, the operation result is FALSE; (b) The return message is a text, the appointed value is not found in the message, the operation result is TRUE, and otherwise, the operation result is FALSE; (c) The return message is an object, if the attribute value in the message is equal to the appointed value, the operation result is TRUE, otherwise, the operation result is FALSE; (d) The return message is an object, and if the attribute value in the message is not equal to the specified value, TRUE is returned, otherwise FALSE.
The input to the executor module 402 is a tree arithmetic logic and interface return message, first calculate the boolean value of each termination expression, then calculate the final boolean value of the operation connection expression, as a result of the success or failure determination of the interface call.
Fig. 6 schematically illustrates a schematic diagram of flow control module execution according to an embodiment of the present disclosure.
As shown in fig. 6, the flow control module supports "jump to" and "exit" instructions, and the tester can define different subsequent call flows when a call succeeds and fails. As shown in fig. 6, the interface call 1 and the interface call N define a flow control instruction for the failure condition respectively, when the interface call 1 fails, the exit instruction is executed, the test is exited, when the interface call N fails, the jump to 2 instruction is executed, the test case jumps to the interface call 2 to continue to execute, and if the flow control instruction is not defined, the test case is executed according to the flow sequence.
The flow control module can define the corresponding follow-up call flow when the call succeeds and fails, and the test is carried out according to the test flow, so that the linkage between the interfaces is simple. The method and the device have the advantages of reducing development difficulty of test scripts, improving multiplexing capability of the scripts, and simplifying data association and flow association of transaction linkage.
Fig. 7 schematically illustrates a flow chart of an interface testing method according to an embodiment of the disclosure.
As shown in fig. 7, the method includes operations S701 to S705.
In operation S701, test data for testing a plurality of interfaces, the interface protocols of which include at least two types, are managed and stored by a data management module.
In operation S702, an interface call flow is performed according to the interface test flow.
In operation S703, a protocol implementation sub-module corresponding to the tested interface is determined from a protocol library by the protocol implementation module, and an interface definition and a message of the tested interface are sent to the protocol implementation sub-module, so that the protocol implementation sub-module communicates with the tested system according to the interface definition and the message and with a target protocol, thereby completing the call of the tested interface, wherein the protocol library comprises a plurality of protocol implementation sub-modules for implementing different types of protocols.
In operation S704, the result of the call of the tested interface is determined by analyzing and judging the returned data of the tested interface according to the assertion expression by the assertion module.
In operation S705, the flow control module executes the flow control instruction according to the interface test flow according to the result determined by the assertion module, where the interface test flow includes a plurality of test interfaces.
The method illustrated in fig. 7 is further described below with reference to fig. 8 in conjunction with an exemplary embodiment.
Fig. 8 schematically illustrates a flow chart of an interface testing method according to an embodiment of the disclosure.
As shown in fig. 8, the method includes operations S801 to S809.
In operation S801, data is read from a specified file and then saved to a data pool of the device.
In operation S802, the execution of the interface call flow is started in order.
In operation S803, the data processing instruction called by the interface is executed, new data is generated and stored in the data pool, or the data in the data pool is processed.
In operation S804, the parameter part of the interface input message is replaced, and a final interface input message is generated.
In operation S805, an interface call is initiated according to the interface definition and the input message.
In operation S806, a result judgment is performed according to the assertion expression and the return message of the interface.
In operation S807, a return data processing instruction is executed, and part of the data in the return message is extracted according to the instruction content and stored in the data pool.
In operation S808, the flow control instruction is executed to jump to the next interface call to be executed, and if the flow control instruction is not defined, to jump to the next interface call in sequence.
In operation S809, it is determined whether there is a next interface call to be implemented, if yes, the operation jumps to operation S802, if no, the interface test is ended.
According to the embodiment of the disclosure, unified data management, protocol library, assertion expression and flow control are realized by using the interface testing device, and a rapid and simple multi-interface testing scene is realized. The tester only needs to pay attention to the logic of the service scene and the input and output data of the interface, and does not need to master the implementation details of different protocols, so that the development difficulty of a test program is simplified. Therefore, the technical problem that a tester needs to master various interface protocols and has high technical requirements on the tester when the interface is tested in the related technology is at least partially solved.
In embodiments of the present disclosure, any number of the provided modules and sub-modules, or at least some of the functionality of any number, may be implemented in one module. Any one or more of the modules and sub-modules according to embodiments of the present disclosure may be implemented as split into multiple modules. Any one or more of the modules and sub-modules according to embodiments of the present disclosure may be implemented at least in part as a hardware circuit, such as a Field Programmable Gate Array (FPGA), a Programmable Logic Array (PLA), a system on a chip, a system on a substrate, a system on a package, an Application Specific Integrated Circuit (ASIC), or in hardware or firmware in any other reasonable manner of integrating or packaging the circuits, or in any one of or in any suitable combination of three of software, hardware, and firmware. Alternatively, one or more of the modules and sub-modules according to embodiments of the present disclosure may be at least partially implemented as computer program modules that, when executed, perform the corresponding functions.
For example, any of the data management module 101, the protocol implementation module 102, the assertion module 103, and the flow control module 104 may be combined and implemented in one module/unit/subunit, or any of the modules/units/subunits may be split into a plurality of modules/units/subunits. Alternatively, at least some of the functionality of one or more of these modules/units/sub-units may be combined with at least some of the functionality of other modules/units/sub-units and implemented in one module/unit/sub-unit. According to embodiments of the present disclosure, at least one of the data management module 101, the protocol implementation module 102, the assertion module 103, and the flow control module 104 may be implemented, at least in part, as hardware circuits, such as Field Programmable Gate Arrays (FPGAs), programmable Logic Arrays (PLAs), systems on a chip, systems on a substrate, systems on a package, application Specific Integrated Circuits (ASICs), or as hardware or firmware in any other reasonable manner of integrating or packaging the circuits, or as any one of or a suitable combination of any of the three. Alternatively, at least one of the data management module 101, the protocol implementation module 102, the assertion module 103, and the flow control module 104 may be implemented at least partially as a computer program module, which when executed may perform the corresponding functions.
It should be noted that, in the embodiment of the present disclosure, the interface testing device portion corresponds to the interface testing method portion in the embodiment of the present disclosure, and the description of the interface testing method portion specifically refers to the interface testing device portion, which is not described herein again.
The embodiment of the disclosure also provides an electronic device, including: one or more processors; and a memory for storing one or more instructions that, when executed by the one or more processors, cause the one or more processors to implement the functionality of the interface test apparatus as described above.
Embodiments of the present disclosure also provide a computer-readable storage medium having stored thereon executable instructions that, when executed by a processor, cause the processor to implement the functions of the interface test apparatus as described above.
Fig. 9 schematically illustrates a block diagram of a computer system suitable for implementing the interface test apparatus and methods described above, in accordance with an embodiment of the present disclosure. The computer system illustrated in fig. 9 is merely an example, and should not be construed as limiting the functionality and scope of use of the embodiments of the present disclosure.
As shown in fig. 9, a computer system 900 according to an embodiment of the present disclosure includes a processor 901, which can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) 902 or a program loaded from a storage portion 908 into a Random Access Memory (RAM) 903. The processor 901 may include, for example, a general purpose microprocessor (e.g., a CPU), an instruction set processor and/or an associated chipset and/or a special purpose microprocessor (e.g., an Application Specific Integrated Circuit (ASIC)), or the like. Processor 901 may also include on-board memory for caching purposes. Processor 901 may include a single processing unit or multiple processing units for performing the different actions of the method flows according to embodiments of the present disclosure.
In the RAM 903, various programs and data necessary for the operation of the system 900 are stored. The processor 901, the ROM 902, and the RAM 903 are connected to each other by a bus 904. The processor 901 performs various operations of the method flow according to the embodiments of the present disclosure by executing programs in the ROM 902 and/or the RAM 903. Note that the program may be stored in one or more memories other than the ROM 902 and the RAM 903. The processor 901 may also perform various operations of the method flow according to embodiments of the present disclosure by executing programs stored in the one or more memories.
According to an embodiment of the disclosure, the system 900 may also include an input/output (I/O) interface 905, the input/output (I/O) interface 905 also being connected to the bus 904. The system 900 may also include one or more of the following components connected to the I/O interface 905: an input section 906 including a keyboard, a mouse, and the like; an output portion 907 including a display such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and a speaker; a storage portion 908 including a hard disk or the like; and a communication section 909 including a network interface card such as a LAN card, a modem, or the like. The communication section 909 performs communication processing via a network such as the internet. The drive 910 is also connected to the I/O interface 905 as needed. A removable medium 911 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is installed as needed on the drive 910 so that a computer program read out therefrom is installed into the storage section 908 as needed.
According to embodiments of the present disclosure, the method flow according to embodiments of the present disclosure may be implemented as a computer software program. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable storage medium, the computer program comprising program code for performing the method shown in the flowcharts. In such an embodiment, the computer program may be downloaded and installed from the network via the communication portion 909 and/or installed from the removable medium 911. The above-described functions defined in the system of the embodiments of the present disclosure are performed when the computer program is executed by the processor 901. The systems, devices, apparatus, modules, units, etc. described above may be implemented by computer program modules according to embodiments of the disclosure.
The present disclosure also provides a computer-readable storage medium that may be embodied in the apparatus/device/system described in the above embodiments; or may exist alone without being assembled into the apparatus/device/system. The computer-readable storage medium carries one or more programs which, when executed, implement methods in accordance with embodiments of the present disclosure.
According to embodiments of the present disclosure, the computer-readable storage medium may be a non-volatile computer-readable storage medium. Examples may include, but are not limited to: a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this disclosure, a computer-readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
For example, according to embodiments of the present disclosure, the computer-readable storage medium may include ROM 902 and/or RAM 903 and/or one or more memories other than ROM 902 and RAM 903 described above.
The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions. Those skilled in the art will appreciate that the features recited in the various embodiments of the disclosure and/or in the claims may be combined in various combinations and/or combinations, even if such combinations or combinations are not explicitly recited in the disclosure. In particular, the features recited in the various embodiments of the present disclosure and/or the claims may be variously combined and/or combined without departing from the spirit and teachings of the present disclosure. All such combinations and/or combinations fall within the scope of the present disclosure.
The embodiments of the present disclosure are described above. However, these examples are for illustrative purposes only and are not intended to limit the scope of the present disclosure. Although the embodiments are described above separately, this does not mean that the measures in the embodiments cannot be used advantageously in combination. The scope of the disclosure is defined by the appended claims and equivalents thereof. Various alternatives and modifications can be made by those skilled in the art without departing from the scope of the disclosure, and such alternatives and modifications are intended to fall within the scope of the disclosure.

Claims (10)

1. An interface testing apparatus, comprising:
the data management module is used for managing and storing test data for testing a plurality of interfaces, wherein interface protocols of the interfaces at least comprise two types;
the protocol realization module is used for determining a protocol realization sub-module corresponding to a tested interface from a protocol library and sending interface definition and a message of the tested interface to the protocol realization sub-module so that the protocol realization sub-module communicates with a tested system according to the interface definition and the message and with a target protocol, thereby completing the calling of the tested interface, wherein the protocol library comprises a plurality of protocol realization sub-modules for realizing different types of protocols;
the assertion module is used for analyzing and judging the returned data of the tested interface according to the assertion expression and determining the result called by the tested interface; and
and the flow control module is used for executing flow control instructions according to the interface test flow according to the judging result of the assertion module, wherein the interface test flow comprises a plurality of test interfaces.
2. The apparatus of claim 1, wherein the protocol library defines and opens standards for implementing sub-modules of protocols such that protocol implementing sub-modules meeting the implementing standards can join the protocol library.
3. The apparatus of claim 1 or 2, wherein the asserting module comprises:
the interpreter module is used for acquiring the assertion expression and outputting tree operation logic; and
and the executor module is used for acquiring the tree-shaped operation logic and the return data of the tested interface and calculating the judging result of success or failure of the tested interface call according to the tree-shaped operation logic and the return data of the tested interface.
4. The apparatus according to claim 1 or 2, wherein the flow control module is configured to define a subsequent call flow corresponding to the tested interface when the call succeeds and fails.
5. The apparatus of claim 1 or 2, wherein the data management module comprises:
the key value structure data pool is used for storing test data in a key value structure of a parameter name and a parameter value for reading and editing by other modules; and
and the data generation and processing module is used for generating corresponding data according to a predefined test instruction or processing the data.
6. The apparatus of claim 5, wherein the data management module further comprises:
the read parameter file module is used for reading parameters from a target parameter file and storing the parameters into the key value structure data pool; and
and the return data processing module is used for analyzing the output message of the tested interface, extracting data and storing the extracted data into the key value structure data pool.
7. The apparatus of claim 6, wherein the data management module further comprises:
and the message parameterization module is used for identifying a parameterized part in the input message of the tested interface and replacing parameters in the parameterized part by corresponding data in the key value structure data pool.
8. An interface testing method, comprising:
managing and storing test data for testing a plurality of interfaces through a data management module, wherein interface protocols of the plurality of interfaces at least comprise two types;
executing an interface calling flow according to the interface testing flow;
determining a protocol realization sub-module corresponding to a tested interface from a protocol library through a protocol realization module, and sending interface definition and a message of the tested interface to the protocol realization sub-module so that the protocol realization sub-module communicates with a tested system according to the interface definition and the message and a target protocol, thereby completing the call of the tested interface, wherein the protocol library comprises a plurality of protocol realization sub-modules for realizing different types of protocols;
analyzing and judging the returned data of the tested interface according to the assertion expression by the assertion module, and determining the result called by the tested interface; and
and executing a flow control instruction according to an interface test flow by a flow control module according to the judging result of the assertion module, wherein the interface test flow comprises a plurality of test interfaces.
9. An electronic device, comprising:
one or more processors;
a memory for storing one or more instructions,
wherein the one or more instructions, when executed by the one or more processors, cause the one or more processors to perform the functions of the apparatus of any of claims 1 to 7.
10. A computer readable storage medium having stored thereon executable instructions which when executed by a processor cause the processor to perform the functions of the apparatus of any of claims 1 to 7.
CN202010458393.6A 2020-05-26 2020-05-26 Interface test apparatus, method, electronic device, and computer-readable storage medium Active CN111597120B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010458393.6A CN111597120B (en) 2020-05-26 2020-05-26 Interface test apparatus, method, electronic device, and computer-readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010458393.6A CN111597120B (en) 2020-05-26 2020-05-26 Interface test apparatus, method, electronic device, and computer-readable storage medium

Publications (2)

Publication Number Publication Date
CN111597120A CN111597120A (en) 2020-08-28
CN111597120B true CN111597120B (en) 2023-07-04

Family

ID=72190599

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010458393.6A Active CN111597120B (en) 2020-05-26 2020-05-26 Interface test apparatus, method, electronic device, and computer-readable storage medium

Country Status (1)

Country Link
CN (1) CN111597120B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114238065A (en) * 2020-09-09 2022-03-25 马上消费金融股份有限公司 Test processing method, device, equipment and readable storage medium
CN112732551A (en) * 2020-12-01 2021-04-30 武汉虹信科技发展有限责任公司 Automatic test method and system for radio frequency indexes
CN114554537B (en) * 2022-02-25 2024-01-23 中国人民解放军国防科技大学 MAC component consistency test method based on software communication system structure
CN117007898B (en) * 2023-10-07 2023-12-08 深圳市好盈科技股份有限公司 Method and device for testing aging state of target electronic speed regulator

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102694701A (en) * 2012-06-13 2012-09-26 青岛海信传媒网络技术有限公司 Testing method and system based on message
CN109933522A (en) * 2019-01-25 2019-06-25 畅捷通信息技术股份有限公司 A kind of test method, test macro and storage medium automating use-case
WO2020000706A1 (en) * 2018-06-25 2020-01-02 平安科技(深圳)有限公司 Database comparison-based interface testing method and system, device and storage medium

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10002069B2 (en) * 2016-09-23 2018-06-19 International Business Machines Corporation Automated testing of application program interface

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102694701A (en) * 2012-06-13 2012-09-26 青岛海信传媒网络技术有限公司 Testing method and system based on message
WO2020000706A1 (en) * 2018-06-25 2020-01-02 平安科技(深圳)有限公司 Database comparison-based interface testing method and system, device and storage medium
CN109933522A (en) * 2019-01-25 2019-06-25 畅捷通信息技术股份有限公司 A kind of test method, test macro and storage medium automating use-case

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
吴振宇 ; 顾晓明 ; 李翔 ; .协议可扩展的软件接口测试工具的研究与实现.数字技术与应用.2017,(第12期),全文. *

Also Published As

Publication number Publication date
CN111597120A (en) 2020-08-28

Similar Documents

Publication Publication Date Title
CN111597120B (en) Interface test apparatus, method, electronic device, and computer-readable storage medium
CN111143087B (en) Interface calling method, device, storage medium and server
CN110750592B (en) Data synchronization method, device and terminal equipment
CN112463729B (en) Data file warehousing method and device, electronic equipment and medium
CN109325744B (en) Payment processing method, payment processing device, payment processing medium and electronic equipment
CN112732499A (en) Test method and device based on micro-service architecture and computer system
CN114826639B (en) Application attack detection method and device based on function call chain tracking
CN111338716A (en) Data processing method and device based on rule engine and terminal equipment
CN115599401A (en) Publishing method, device, equipment and medium of user-defined model
CN112506781B (en) Test monitoring method, device, electronic equipment, storage medium and program product
CN115203178A (en) Data quality inspection method and device, electronic equipment and storage medium
CN114116509A (en) Program analysis method, program analysis device, electronic device, and storage medium
CN113742235A (en) Method and device for checking codes
CN113656313A (en) Automatic test processing method and device
CN112181816A (en) Interface testing method and device based on scene, computer equipment and medium
CN111338968A (en) Project function module debugging method, device, medium and electronic equipment
CN111679885A (en) Method, device, medium and electronic equipment for determining virtual machine drift
US10169181B2 (en) Efficient validation of transactional memory in a computer processor
CN110825438B (en) Method and device for simulating data processing of artificial intelligence chip
CN115757303B (en) Index tracking method and device in distributed system
CA3059719C (en) Payment processing method, device, medium and electronic device
CN112948269B (en) Information processing method, information processing apparatus, electronic device, and readable storage medium
CN114064484A (en) Interface testing method and device, electronic equipment and readable storage medium
CN116795684A (en) Automatic test method, device, terminal equipment and medium of interface
CN114510422A (en) Service execution method, device, computer equipment and storage medium

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
GR01 Patent grant
GR01 Patent grant