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

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

Info

Publication number
CN112199300A
CN112199300A CN202011270783.7A CN202011270783A CN112199300A CN 112199300 A CN112199300 A CN 112199300A CN 202011270783 A CN202011270783 A CN 202011270783A CN 112199300 A CN112199300 A CN 112199300A
Authority
CN
China
Prior art keywords
interface
test
tested
return value
layer
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.)
Granted
Application number
CN202011270783.7A
Other languages
Chinese (zh)
Other versions
CN112199300B (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.)
New H3C Big Data Technologies Co Ltd
Original Assignee
New H3C Big Data Technologies 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 New H3C Big Data Technologies Co Ltd filed Critical New H3C Big Data Technologies Co Ltd
Priority to CN202011270783.7A priority Critical patent/CN112199300B/en
Publication of CN112199300A publication Critical patent/CN112199300A/en
Application granted granted Critical
Publication of CN112199300B publication Critical patent/CN112199300B/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/3672Test management
    • G06F11/3692Test management for test results analysis

Abstract

The embodiment of the invention provides an interface testing method and device, electronic equipment and a storage medium, and relates to the technical field of computers. The method comprises the following steps: and receiving an interface test instruction, wherein the interface test instruction is used for instructing to carry out interface test on the interface to be tested. And then acquiring a target test case corresponding to the interface to be tested from the test case layer, wherein the test case layer comprises a plurality of interface test cases, calling a method layer packaging method to acquire test data corresponding to the interface type of the interface to be tested from the data layer through the target test case, and the data layer stores the test data corresponding to each interface type. And then selecting test parameters required by testing the interface to be tested from test data corresponding to the interface type of the interface to be tested, and testing the interface of the interface to be tested based on the test parameters and a method layer packaging method. The test efficiency can be improved.

Description

Interface testing method and device, electronic equipment and storage medium
Technical Field
The present invention relates to the field of computer technologies, and in particular, to an interface testing method and apparatus, an electronic device, and a storage medium.
Background
With the development of the software industry, under the condition of rapid development, the necessity of rapid testing is higher and higher in order to ensure the quality of software. In the process of software development, whether the functions of the interface are normal or not is directly related to the usability of the software, so that the realization of the quick test of the interface is particularly important.
At present, when an interface test is performed, a test case needs to be written, a Uniform Resource Locator (URL) and a test parameter of the interface to be tested are manually input, then a browser is simulated to send a request based on the test case and the test parameter, and whether the interface function is normal is judged according to a received response condition. That is, each time an interface test is performed on one interface, the test parameters need to be manually set, which results in low efficiency of the interface test.
Disclosure of Invention
An object of the embodiments of the present invention is to provide an interface testing method and apparatus, an electronic device, and a storage medium, so as to improve efficiency of interface testing. The specific technical scheme is as follows:
in a first aspect, an embodiment of the present application provides an interface testing method, including:
receiving an interface test instruction, wherein the interface test instruction is used for instructing to carry out interface test on an interface to be tested;
acquiring a target test case corresponding to the interface to be tested from a test case layer, wherein the test case layer comprises test cases of a plurality of interfaces;
calling a method layer packaging method to obtain test data corresponding to the interface type of the interface to be tested from a data layer by the target test case, wherein the test data corresponding to each interface type is stored in the data layer;
selecting test parameters required for testing the interface to be tested from test data corresponding to the interface type of the interface to be tested;
and performing interface test on the interface to be tested based on the test parameters and the method layer packaging method.
In a possible implementation manner, the interface testing the interface to be tested based on the test parameters and the method layer packaging method includes:
sending a test request to the interface to be tested based on the request method of the method layer packaging, wherein the test request carries the test parameters;
receiving an actual return value of the interface to be tested;
and checking the actual return value to determine an interface test result.
In a possible implementation manner, the verifying the actual return value and determining an interface test result includes:
calling an assertion method of the method layer package, and acquiring an expected return value from test data corresponding to the interface type of the interface to be tested;
and comparing the actual return value with the expected return value by the assertion method to obtain the interface test result.
In a possible implementation manner, after calling the assertion method of the method layer package and obtaining an expected return value from the test data corresponding to the interface type of the interface to be tested, the method further includes:
analyzing the expected return value into dictionary type data, wherein the dictionary type data is stored in a key-value pair form;
analyzing each item of data included in the expected return value of the dictionary type into a character string format;
comparing the actual return value with the expected return value by the assertion method to obtain the interface test result, including:
and comparing the expected return value in the character string format with the actual return value by the assertion method to obtain the interface test result.
In a possible implementation manner, the test data corresponding to each interface type in the data layer is stored in a yaml file format.
In a second aspect, an embodiment of the present application provides an interface testing apparatus, including:
the interface testing device comprises a receiving module, a testing module and a testing module, wherein the receiving module is used for receiving an interface testing instruction which is used for indicating to carry out interface testing on an interface to be tested;
the acquisition module is used for acquiring a target test case corresponding to the interface to be tested from a test case layer, and the test case layer comprises test cases of a plurality of interfaces;
the obtaining module is further configured to call a method layer packaging method to obtain test data corresponding to the interface type of the interface to be tested from a data layer through the target test case, where the test data corresponding to each interface type is stored in the data layer;
the selection module is used for selecting test parameters required by testing the interface to be tested from the test data corresponding to the interface type of the interface to be tested;
and the test module is used for carrying out interface test on the interface to be tested based on the test parameters and the method layer packaging method.
In a possible implementation manner, the test module is specifically configured to:
sending a test request to the interface to be tested based on the request method of the method layer packaging, wherein the test request carries the test parameters;
receiving an actual return value of the interface to be tested;
and checking the actual return value to determine an interface test result.
In a possible implementation manner, the test module is specifically configured to:
calling an assertion method of the method layer package, and acquiring an expected return value from test data corresponding to the interface type of the interface to be tested;
and comparing the actual return value with the expected return value by the assertion method to obtain the interface test result.
In a possible implementation manner, the test module is specifically further configured to parse the expected return value into dictionary-type data; analyzing each item of data included in the expected return value of the dictionary type into a character string format; the data of the dictionary type is data stored in a key-value pair mode;
the test module is specifically configured to compare the expected return value in the string format with the actual return value by using the assertion method, so as to obtain the interface test result.
In a possible implementation manner, the test data corresponding to each interface type in the data layer is stored in a yaml file format.
In a third aspect, an embodiment of the present application further provides an electronic device, including a processor, a communication interface, a memory, and a communication bus, where the processor, the communication interface, and the memory complete mutual communication through the communication bus;
a memory for storing a computer program;
and the processor is used for realizing any one of the steps of the interface testing method when executing the program stored in the memory.
In a fourth aspect, the present application further provides a computer-readable storage medium, in which a computer program is stored, and when the computer program is executed by a processor, the interface testing method described in the first aspect is implemented.
In a fifth aspect, embodiments of the present application further provide a computer program product containing instructions, which when run on a computer, cause the computer to execute the interface testing method described in the first aspect.
By adopting the interface testing method, the device, the electronic equipment and the storage medium provided by the embodiment of the application, after the interface testing instruction is received, the target test case corresponding to the interface to be tested can be obtained from the test case layer, the method for packaging the method layer is called to obtain the test data corresponding to the type of the interface to be tested from the data layer through the target test case, the test parameters required by testing the interface to be tested are selected from the test data, and then the interface to be tested is subjected to interface testing. Because the test data corresponding to each interface type is stored in the data layer, the test parameters can be directly obtained from the data layer when the interface is tested, the user does not need to input the test parameters when the interface is tested every time, and the test cases and the method are respectively packaged in the test case layer and the method layer, can be directly called when the interface is tested, and can improve the test efficiency.
Of course, not all advantages described above need to be achieved at the same time in the practice of any one product or method of the present application.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art that other embodiments can be obtained by using the drawings without creative efforts.
Fig. 1 is a flowchart of an interface testing method according to an embodiment of the present disclosure;
fig. 2 is a flowchart of another interface testing method provided in the embodiment of the present application;
fig. 3 is a schematic structural diagram of a test system according to an embodiment of the present disclosure;
fig. 4 is a schematic structural diagram of an interface testing apparatus according to an embodiment of the present disclosure;
fig. 5 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
In order to improve the efficiency of interface testing, an embodiment of the present application provides an interface testing method, where the method is applied to an electronic device, and as shown in fig. 1, the method includes:
s101, receiving an interface test instruction, wherein the interface test instruction is used for indicating to carry out interface test on an interface to be tested.
The interface test instruction can be triggered by a user, and the interface test instruction can carry the URL of the interface to be tested.
S102, obtaining a target test case corresponding to the interface to be tested from the test case layer.
The test case layer comprises a plurality of test cases of interfaces. The Test Case (Test Case) is a description of a Test task for testing an interface.
The test case layer is a layer for writing test cases by users, and each interface can be provided with one or more test cases according to test requirements.
S103, calling a method for method layer packaging through the target test case to obtain test data corresponding to the interface type of the interface to be tested from the data layer.
And test data corresponding to each interface type is stored in the data layer. The user can write general test data of the interface type in a data layer in advance through an interface document according to each interface type, write non-general test data corresponding to each interface in the interface type, and store the general test data and the non-general test data of the interface type corresponding to the interface type.
S104, selecting test parameters required by testing the interface to be tested from the test data corresponding to the interface type of the interface to be tested.
By calling the method of method layer packaging, the test parameters required for executing the method, namely the parameters required for interface test of the interface to be tested, can be selected from the test data corresponding to the interface to be tested.
In one embodiment, the required test parameters may be automatically selected from the test data corresponding to the interface to be tested by a method layer packaging method.
In another embodiment, the test data corresponding to the interface type of the interface to be tested may be displayed, so that the user selects the required test data from the test data, and then the test data selected by the user is used as the test parameters required for testing the interface to be tested.
And S105, performing interface test on the interface to be tested based on the test parameters and the method layer packaging method.
By adopting the interface testing method provided by the embodiment of the application, after the interface testing instruction is received, the target test case corresponding to the interface to be tested can be obtained from the test case layer, the method for packaging the method layer is called to obtain the test data corresponding to the type of the interface to be tested from the data layer through the target test case, the test parameters required by testing the interface to be tested are selected from the test data, and then the interface to be tested is subjected to interface testing. Because the test data corresponding to each interface type is stored in the data layer, the test parameters can be directly obtained from the data layer when the interface is tested, the user does not need to input the test parameters when the interface is tested every time, and the test cases and the method are respectively packaged in the test case layer and the method layer, can be directly called when the interface is tested, and can improve the test efficiency.
In another embodiment of the present invention, as shown in fig. 2, the step S105 of performing an interface test on the interface to be tested based on the test parameters and the method layer packaging method may specifically be implemented as the following steps:
s201, sending a test request to an interface to be tested based on a request method of method layer packaging, wherein the test request carries test parameters.
Various methods for interface testing can be packaged in the method layer, for example, the method layer may include a request method, an assertion method, a data parsing method, and the like. The request method may be a get request, a post request, or the like, but the request method in the embodiment of the present application is not limited thereto. The get request is used for requesting specified page information, and the post request is used for requesting to submit data, such as requesting to upload a file.
In the embodiment of the application, the interface to be tested may be a software interface, and the software interface may be an application program interface, an interactive interface between a user and a program, and the like.
The test parameters can be provided to the interface to be tested by sending a test request carrying the test parameters to the interface to be tested.
For example, if the registration interface of the application is tested, the test parameters may include a user name, a phone number, and a mailbox address. For example, the user name in the test parameters is test1, the phone number is 1560000000, and the mailbox address is test1@ qq.com, and after the test request carrying the test parameters is sent to the registration interface to be tested, the application program corresponding to the registration interface can verify whether the account can be registered according to the received test parameters.
S202, receiving an actual return value of the interface to be tested.
After the interface to be tested receives the test request carrying the test parameters, the function or program corresponding to the interface to be tested processes the test parameters and returns the result obtained by the processing, namely the actual return value of the interface to be tested.
Continuing with the example in the previous step, if the registration interface to be tested is normal and the user name, the phone number, and the mailbox address are not registered, the actual return value of the interface to be tested may be a value used to indicate that the verification of the registration information is successful.
If the registration interface needs to be further tested, after the registration is successful through the test parameters, a test request carrying the same test parameters may be sent to the registration interface again, and at this time, the actual return value of the test interface may be a prompt message for prompting that the user name already exists.
And S203, checking the actual return value and determining an interface test result.
In one embodiment, an assertion method of the method layer package may be called, and an expected return value may be obtained from test data corresponding to an interface type of an interface to be tested. And comparing the actual return value with the expected return value by the assertion method to obtain an interface test result.
The assertion method is used for judging whether the actual return value of the interface to be tested is consistent with the expected result. In the embodiment of the present application, an applicable assertion method may be encapsulated in a method layer in advance, and the embodiment of the present application does not limit the type of the assertion method.
If the actual return value is determined to be inconsistent with the expected return value through the assertion method, the interface test result can be determined to be that the interface to be tested has a problem; if the actual return value is determined to be consistent with the expected return value through the assertion method, it can be determined that the problem exists in the interface to be tested in the test.
By adopting the embodiment of the application, the assertion method is encapsulated in the method layer, so that a user does not need to add the assertion method into the test case when writing the test case, and the workload required by writing the case is saved. And the expected return value required by executing the assertion method is encapsulated in the data layer, so that the assertion method can be called, and the data multiplexing can be realized, so that a user does not need to write the expected return value in each interface test, and the test efficiency and the development efficiency can be improved.
In another embodiment of the present application, the test data corresponding to each interface type of the data layer may be stored in another yeet antenna markup language (yaml) file format.
In the testing process, an assertion method of the method layer package is called, after an expected return value is obtained from test data corresponding to an interface type of an interface to be tested, the expected return value can be analyzed into data of a dictionary type, and then each item of data included in the expected return value of the dictionary type is analyzed into a character string format. Furthermore, the expected return value and the actual return value in the character string format can be compared through an assertion method, and an interface test result is obtained.
The dictionary type data is stored in a key-value pair form, and the dictionary is a variable container model and can store any type of object. The dictionary can store a plurality of key-value pairs, each key-value pair comprises a key and a value which are divided by colons, the key-value pairs are divided by commas, and the data of the whole dictionary type is included in braces '{ }'.
Assuming that the expected return value includes the user's telephone number: 15600000000, mailbox address: test @ qq.com. The dictionary-type data into which the expected return value is converted is { phone number: 15600000000, email address: test @ qq.com }.
By adopting the method, because the format of the yaml file is simple, the user can conveniently set the test data, and the yaml file format has higher support degree on the key-value format and the array format, the preparation work of the user on the assertion data can be simplified by carrying out data format conversion on the expected return value of the yaml file format, and the test efficiency is improved.
The method provided by the embodiment of the application can be implemented by a test system as shown in fig. 3, where the test system includes an open source test framework Robot frame (hereinafter referred to as RF), a test case layer, a method layer, and a data layer, and a user can write a test case by using keywords of the RF framework and store the test case in the test case layer. And the user can implement method layer method packaging through the RF framework.
For specific functions of the test case layer, the method layer and the data layer, reference may be made to the related description in the above method embodiments, and details are not repeated here.
Based on the same technical concept, an embodiment of the present application further provides an interface testing apparatus, as shown in fig. 4, the apparatus includes:
a receiving module 401, configured to receive an interface test instruction, where the interface test instruction is used to instruct to perform an interface test on an interface to be tested;
an obtaining module 402, configured to obtain a target test case corresponding to an interface to be tested from a test case layer, where the test case layer includes test cases of multiple interfaces;
the obtaining module 402 is further configured to call a method layer packaging method to obtain, through the target test case, test data corresponding to the interface type of the interface to be tested from the data layer, where the test data corresponding to each interface type is stored in the data layer;
a selecting module 403, configured to select a test parameter required for testing the interface to be tested from test data corresponding to the interface type of the interface to be tested;
the test module 404 is configured to perform an interface test on the interface to be tested based on the test parameters and the method layer packaging method.
Optionally, the testing module 404 is specifically configured to:
sending a test request to an interface to be tested based on a request method of method layer packaging, wherein the test request carries test parameters;
receiving an actual return value of an interface to be tested;
and checking the actual return value to determine an interface test result.
Optionally, the testing module 404 is specifically configured to:
calling an assertion method of method layer packaging, and acquiring an expected return value from test data corresponding to the interface type of the interface to be tested;
and comparing the actual return value with the expected return value by an assertion method to obtain an interface test result.
Optionally, the testing module 404 is further configured to specifically parse the expected return value into dictionary-type data; analyzing each item of data included in the expected return value of the dictionary type into a character string format; the dictionary type data is stored in a key-value pair mode.
The testing module 404 is further configured to compare the expected return value in the string format with the actual return value by using an assertion method, so as to obtain an interface testing result.
Optionally, the test data corresponding to each interface type in the data layer is stored in a yaml file format.
By adopting the interface testing device provided by the embodiment of the application, after the interface testing instruction is received, the target test case corresponding to the interface to be tested can be obtained from the test case layer, the method for packaging the method layer is called to obtain the test data corresponding to the type of the interface to be tested from the data layer through the target test case, the test parameters required by testing the interface to be tested are selected from the test data, and then the interface to be tested is subjected to interface testing. Because the test data corresponding to each interface type is stored in the data layer, the test parameters can be directly obtained from the data layer when the interface is tested, the user does not need to input the test parameters when the interface is tested every time, and the test cases and the method are respectively packaged in the test case layer and the method layer, can be directly called when the interface is tested, and can improve the test efficiency.
An embodiment of the present invention further provides an electronic device, as shown in fig. 5, which includes a processor 501, a communication interface 502, a memory 503 and a communication bus 504, where the processor 501, the communication interface 502 and the memory 503 complete mutual communication through the communication bus 504,
a memory 503 for storing a computer program;
the processor 501, when executing the program stored in the memory 503, implements the following steps:
receiving an interface test instruction, wherein the interface test instruction is used for instructing to carry out interface test on an interface to be tested;
acquiring a target test case corresponding to an interface to be tested from a test case layer, wherein the test case layer comprises test cases of a plurality of interfaces;
through a target test case, calling a method layer packaging method to obtain test data corresponding to the interface type of the interface to be tested from a data layer, wherein the test data corresponding to each interface type is stored in the data layer;
selecting test parameters required by testing the interface to be tested from test data corresponding to the interface type of the interface to be tested;
and performing interface test on the interface to be tested based on the test parameters and the method layer packaging method.
The processor 501, which is also configured to implement other method steps in the above method embodiments, may refer to the contents in the method embodiments.
The communication bus mentioned in the electronic device may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown, but this does not mean that there is only one bus or one type of bus.
The communication interface is used for communication between the electronic equipment and other equipment.
The Memory may include a Random Access Memory (RAM) or a Non-Volatile Memory (NVM), such as at least one disk Memory. Optionally, the memory may also be at least one memory device located remotely from the processor.
The Processor may be a general-purpose Processor, including a Central Processing Unit (CPU), a Network Processor (NP), and the like; but also Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs) or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components.
In a further embodiment of the present invention, a computer-readable storage medium is further provided, in which a computer program is stored, and the computer program, when executed by a processor, implements the steps of any of the above-mentioned interface testing methods.
In a further embodiment of the present invention, there is also provided a computer program product containing instructions which, when run on a computer, cause the computer to perform any of the interface testing methods of the above embodiments.
In the above embodiments, the implementation may be wholly or partially realized by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loaded and executed on a computer, cause the processes or functions described in accordance with the embodiments of the invention to occur, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored in a computer readable storage medium or transmitted from one computer readable storage medium to another, for example, from one website site, computer, server, or data center to another website site, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, Digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device, such as a server, a data center, etc., that incorporates one or more of the available media. The usable medium may be a magnetic medium (e.g., floppy Disk, hard Disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., Solid State Disk (SSD)), among others.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
All the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, as for the device, the electronic apparatus and the storage medium embodiments, since they are substantially similar to the method embodiments, the description is relatively simple, and the relevant points can be referred to the partial description of the method embodiments.
The above description is only for the preferred embodiment of the present invention, and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention shall fall within the protection scope of the present invention.

Claims (12)

1. An interface testing method, comprising:
receiving an interface test instruction, wherein the interface test instruction is used for instructing to carry out interface test on an interface to be tested;
acquiring a target test case corresponding to the interface to be tested from a test case layer, wherein the test case layer comprises test cases of a plurality of interfaces;
calling a method layer packaging method to obtain test data corresponding to the interface type of the interface to be tested from a data layer by the target test case, wherein the test data corresponding to each interface type is stored in the data layer;
selecting test parameters required for testing the interface to be tested from test data corresponding to the interface type of the interface to be tested;
and performing interface test on the interface to be tested based on the test parameters and the method layer packaging method.
2. The method of claim 1, wherein the interface testing the interface to be tested based on the test parameters and the method of the method-layer package comprises:
sending a test request to the interface to be tested based on the request method of the method layer packaging, wherein the test request carries the test parameters;
receiving an actual return value of the interface to be tested;
and checking the actual return value to determine an interface test result.
3. The method of claim 2, wherein said verifying said actual return value and determining an interface test result comprises:
calling an assertion method of the method layer package, and acquiring an expected return value from test data corresponding to the interface type of the interface to be tested;
and comparing the actual return value with the expected return value by the assertion method to obtain the interface test result.
4. The method of claim 3, wherein after calling the assertion method of the method layer package to obtain the expected return value from the test data corresponding to the interface type of the interface to be tested, the method further comprises:
analyzing the expected return value into dictionary type data, wherein the dictionary type data is stored in a key-value pair form;
analyzing each item of data included in the expected return value of the dictionary type into a character string format;
comparing the actual return value with the expected return value by the assertion method to obtain the interface test result, including:
and comparing the expected return value in the character string format with the actual return value by the assertion method to obtain the interface test result.
5. The method of claim 1, wherein the test data corresponding to each interface type in the data layer is stored in a yaml file format.
6. An interface testing apparatus, comprising:
the interface testing device comprises a receiving module, a testing module and a testing module, wherein the receiving module is used for receiving an interface testing instruction which is used for indicating to carry out interface testing on an interface to be tested;
the acquisition module is used for acquiring a target test case corresponding to the interface to be tested from a test case layer, and the test case layer comprises test cases of a plurality of interfaces;
the obtaining module is further configured to call a method layer packaging method to obtain test data corresponding to the interface type of the interface to be tested from a data layer through the target test case, where the test data corresponding to each interface type is stored in the data layer;
the selection module is used for selecting test parameters required by testing the interface to be tested from the test data corresponding to the interface type of the interface to be tested;
and the test module is used for carrying out interface test on the interface to be tested based on the test parameters and the method layer packaging method.
7. The apparatus of claim 6, wherein the test module is specifically configured to:
sending a test request to the interface to be tested based on the request method of the method layer packaging, wherein the test request carries the test parameters;
receiving an actual return value of the interface to be tested;
and checking the actual return value to determine an interface test result.
8. The apparatus of claim 7, wherein the test module is specifically configured to:
calling an assertion method of the method layer package, and acquiring an expected return value from test data corresponding to the interface type of the interface to be tested;
and comparing the actual return value with the expected return value by the assertion method to obtain the interface test result.
9. The apparatus of claim 8,
the test module is specifically further configured to parse the expected return value into dictionary-type data; analyzing each item of data included in the expected return value of the dictionary type into a character string format; the data of the dictionary type is data stored in a key-value pair mode;
the test module is specifically configured to compare the expected return value in the string format with the actual return value by using the assertion method, so as to obtain the interface test result.
10. The apparatus of claim 6, wherein the test data corresponding to each interface type in the data layer is stored in a yaml file format.
11. An electronic device is characterized by comprising a processor, a communication interface, a memory and a communication bus, wherein the processor and the communication interface are used for realizing mutual communication by the memory through the communication bus;
a memory for storing a computer program;
a processor for implementing the method steps of any one of claims 1 to 5 when executing a program stored in the memory.
12. A computer-readable storage medium, characterized in that a computer program is stored in the computer-readable storage medium, which computer program, when being executed by a processor, carries out the method steps of any one of the claims 1-5.
CN202011270783.7A 2020-11-13 2020-11-13 Interface testing method and device, electronic equipment and storage medium Active CN112199300B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011270783.7A CN112199300B (en) 2020-11-13 2020-11-13 Interface testing method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011270783.7A CN112199300B (en) 2020-11-13 2020-11-13 Interface testing method and device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN112199300A true CN112199300A (en) 2021-01-08
CN112199300B CN112199300B (en) 2022-08-19

Family

ID=74033394

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011270783.7A Active CN112199300B (en) 2020-11-13 2020-11-13 Interface testing method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN112199300B (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113127347A (en) * 2021-04-14 2021-07-16 广联达科技股份有限公司 Interface testing method, device, equipment and readable storage medium
CN113254355A (en) * 2021-07-06 2021-08-13 云账户技术(天津)有限公司 GRPC interface testing method and device, electronic equipment and readable storage medium
CN113434419A (en) * 2021-06-29 2021-09-24 青岛海尔科技有限公司 Interface test case assertion method and device
CN113590407A (en) * 2021-09-29 2021-11-02 云账户技术(天津)有限公司 Interface testing method and device
CN116577685A (en) * 2023-07-13 2023-08-11 宁德时代新能源科技股份有限公司 Health detection method, data processing method, related device, equipment and medium

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107748717A (en) * 2017-09-26 2018-03-02 深圳市牛鼎丰科技有限公司 Automatic interface testing method, device, storage medium and computer equipment
CN107908541A (en) * 2017-07-26 2018-04-13 平安壹钱包电子商务有限公司 Interface test method, device, computer equipment and storage medium
CN109117368A (en) * 2018-07-27 2019-01-01 平安科技(深圳)有限公司 A kind of interface test method, electronic equipment and storage medium
CN109446068A (en) * 2018-09-26 2019-03-08 平安健康保险股份有限公司 Interface test method, device, computer equipment and storage medium
CN109522228A (en) * 2018-11-15 2019-03-26 深圳乐信软件技术有限公司 Interface automatic test data configuration method, apparatus, platform and storage medium
CN110471858A (en) * 2019-08-22 2019-11-19 腾讯科技(深圳)有限公司 Applied program testing method, device and storage medium
CN110569194A (en) * 2019-09-09 2019-12-13 五八有限公司 interface testing method and device, electronic equipment and storage medium
WO2020119434A1 (en) * 2018-12-15 2020-06-18 深圳壹账通智能科技有限公司 Method and apparatus for interface data processing, method and apparatus for automated testing, device, and medium
CN111782533A (en) * 2020-07-01 2020-10-16 江苏云柜网络技术有限公司 Test method, test device, electronic equipment and storage medium

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107908541A (en) * 2017-07-26 2018-04-13 平安壹钱包电子商务有限公司 Interface test method, device, computer equipment and storage medium
CN107748717A (en) * 2017-09-26 2018-03-02 深圳市牛鼎丰科技有限公司 Automatic interface testing method, device, storage medium and computer equipment
CN109117368A (en) * 2018-07-27 2019-01-01 平安科技(深圳)有限公司 A kind of interface test method, electronic equipment and storage medium
CN109446068A (en) * 2018-09-26 2019-03-08 平安健康保险股份有限公司 Interface test method, device, computer equipment and storage medium
CN109522228A (en) * 2018-11-15 2019-03-26 深圳乐信软件技术有限公司 Interface automatic test data configuration method, apparatus, platform and storage medium
WO2020119434A1 (en) * 2018-12-15 2020-06-18 深圳壹账通智能科技有限公司 Method and apparatus for interface data processing, method and apparatus for automated testing, device, and medium
CN110471858A (en) * 2019-08-22 2019-11-19 腾讯科技(深圳)有限公司 Applied program testing method, device and storage medium
CN110569194A (en) * 2019-09-09 2019-12-13 五八有限公司 interface testing method and device, electronic equipment and storage medium
CN111782533A (en) * 2020-07-01 2020-10-16 江苏云柜网络技术有限公司 Test method, test device, electronic equipment and storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
劳天等: "基于蚁群算法的软件接口测试用例生成", 《计算机工程与设计》 *

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113127347A (en) * 2021-04-14 2021-07-16 广联达科技股份有限公司 Interface testing method, device, equipment and readable storage medium
CN113127347B (en) * 2021-04-14 2024-02-13 广联达科技股份有限公司 Interface testing method, device, equipment and readable storage medium
CN113434419A (en) * 2021-06-29 2021-09-24 青岛海尔科技有限公司 Interface test case assertion method and device
CN113254355A (en) * 2021-07-06 2021-08-13 云账户技术(天津)有限公司 GRPC interface testing method and device, electronic equipment and readable storage medium
CN113254355B (en) * 2021-07-06 2021-11-02 云账户技术(天津)有限公司 GRPC interface testing method and device, electronic equipment and readable storage medium
CN113590407A (en) * 2021-09-29 2021-11-02 云账户技术(天津)有限公司 Interface testing method and device
CN113590407B (en) * 2021-09-29 2021-11-30 云账户技术(天津)有限公司 Interface testing method and device
CN116577685A (en) * 2023-07-13 2023-08-11 宁德时代新能源科技股份有限公司 Health detection method, data processing method, related device, equipment and medium
CN116577685B (en) * 2023-07-13 2023-12-01 宁德时代新能源科技股份有限公司 Health detection method, data processing method, related device, equipment and medium

Also Published As

Publication number Publication date
CN112199300B (en) 2022-08-19

Similar Documents

Publication Publication Date Title
CN112199300B (en) Interface testing method and device, electronic equipment and storage medium
CN108415832B (en) Interface automation test method, device, equipment and storage medium
CN110798380B (en) Data acquisition method, system, device, test equipment and test server
CN109446075B (en) Interface testing method and device
CN110879781B (en) Program debugging method, device, electronic equipment and computer readable storage medium
CN109299015B (en) Software testing method, device and system
CN107807841B (en) Server simulation method, device, equipment and readable storage medium
US10382313B2 (en) Test building for testing server operation
CN109344066B (en) Method, system and terminal for testing browser page
CN113127323A (en) Test method, test device, terminal equipment and storage medium
CN110569194A (en) interface testing method and device, electronic equipment and storage medium
CN113760729A (en) Code detection method and device
CN110955409A (en) Method and device for creating resources on cloud platform
CN113760763A (en) Software testing method, device, server and system
CN111694550A (en) Page display control method, device and system
CN112650689A (en) Test method, test device, electronic equipment and storage medium
CN115599683A (en) Automatic testing method, device, equipment and storage medium
CN116301866A (en) Cloud rendering method, device, equipment and storage medium based on custom software
CN111338928A (en) Chrome-based browser testing method and device
CN112395194B (en) Method and device for accessing test platform
CN114528214A (en) Unit testing method and device
CN108399223B (en) Data acquisition method and device and electronic equipment
CN115065627B (en) Parameter modification method and device, electronic equipment and storage medium
JP7320211B1 (en) Systems, methods and programs for testing website vulnerabilities
CN116304413A (en) Front-end page testing method and device, storage medium and processor

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