CN112162923A - Interface testing method and device - Google Patents
Interface testing method and device Download PDFInfo
- Publication number
- CN112162923A CN112162923A CN202011025107.3A CN202011025107A CN112162923A CN 112162923 A CN112162923 A CN 112162923A CN 202011025107 A CN202011025107 A CN 202011025107A CN 112162923 A CN112162923 A CN 112162923A
- Authority
- CN
- China
- Prior art keywords
- test data
- interface
- data
- response data
- target test
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000012360 testing method Methods 0.000 title claims abstract description 302
- 230000004044 response Effects 0.000 claims abstract description 212
- 238000000034 method Methods 0.000 claims abstract description 31
- 238000004891 communication Methods 0.000 claims description 19
- 238000004590 computer program Methods 0.000 claims description 14
- 230000005540 biological transmission Effects 0.000 description 8
- 238000010586 diagram Methods 0.000 description 8
- 230000008569 process Effects 0.000 description 4
- 238000010998 test method Methods 0.000 description 4
- 230000009471 action Effects 0.000 description 3
- 238000012545 processing Methods 0.000 description 3
- 238000005516 engineering process Methods 0.000 description 2
- 230000002035 prolonged effect Effects 0.000 description 2
- 238000013500 data storage Methods 0.000 description 1
- 239000000835 fiber Substances 0.000 description 1
- 230000006870 function Effects 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 230000003993 interaction Effects 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 230000002093 peripheral effect Effects 0.000 description 1
- 239000004065 semiconductor Substances 0.000 description 1
- 239000007787 solid Substances 0.000 description 1
- 238000012546 transfer Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3668—Software testing
- G06F11/3672—Test management
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3668—Software testing
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F21/00—Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
- G06F21/60—Protecting data
- G06F21/602—Providing cryptographic facilities or services
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Computer Hardware Design (AREA)
- Quality & Reliability (AREA)
- Health & Medical Sciences (AREA)
- Bioethics (AREA)
- General Health & Medical Sciences (AREA)
- Computer Security & Cryptography (AREA)
- Software Systems (AREA)
- Debugging And Monitoring (AREA)
Abstract
The embodiment of the application provides an interface testing method and device, and relates to the technical field of computers, wherein the method comprises the following steps: the interface request address and the test data can be obtained, an interface corresponding to the interface request address is called, the test data is transmitted, and first response data corresponding to the test data is obtained. And then determining second response data corresponding to the test data according to the corresponding relation between the pre-stored test data and the response data. When the first response data is the same as the second response data, it is determined that the interface is available for transmitting the test data. Based on the scheme, a large number of corresponding relations between the test data and the response data can be stored in advance, whether the interface can be used for transmitting the test data or not is determined according to the corresponding relations between the test data and the response data which are stored in advance, the response data corresponding to the test data do not need to be manually created one by a user in real time, and the efficiency of interface testing is improved.
Description
Technical Field
The present application relates to the field of computer technologies, and in particular, to a method and an apparatus for testing an interface.
Background
Nowadays, interface technology is widely applied to data interaction between systems within an enterprise or a company, and thus, the security of data transmission through the interface is under great pressure. At present, in order to ensure the security of data transmission of an interface, whether the interface used for data transmission is available is tested in advance, and a test task is executed in advance when the task is transmitted each time.
The method for testing the interface at present mainly includes that when test data are transmitted, a user needs to manually create response data corresponding to the test data in real time, then whether the response data of the test data in actual transmission are consistent with the response data corresponding to the test data created by the user is compared, if so, the interface is determined to be available for transmitting the test data, and otherwise, the interface is determined not to be available for transmitting the test data.
In the interface testing method, each time a piece of test data is acquired, a user needs to manually create a piece of response data corresponding to the test data. However, as the task of interface transmission increases, so does the test data. If the user creates the response data corresponding to the test data one by one in real time, the time for interface test is greatly prolonged, and the user experience is influenced.
Disclosure of Invention
An object of the embodiments of the present application is to provide a method and an apparatus for testing an interface, so as to improve efficiency of interface testing. The specific technical scheme is as follows:
in a first aspect, a method for testing an interface is provided, where the method includes:
acquiring an interface request address and target test data;
calling an interface corresponding to the interface request address, and transmitting the target test data to obtain first response data corresponding to the target test data;
determining second response data corresponding to the target test data according to a corresponding relation between pre-stored test data and response data;
determining that the interface is available to transmit the target test data when the first response data is the same as the second response data.
Optionally, before acquiring the interface request address and the target test data, the method further includes:
acquiring a preset file through a preset interface; the preset file comprises a corresponding relation between the test data and the response data;
and storing the corresponding relation between the test data and the response data.
Optionally, before acquiring the interface request address and the target test data, the method further includes:
acquiring an encryption and decryption algorithm and a key corresponding to the encryption and decryption algorithm, and storing the encryption and decryption algorithm and the key;
the calling an interface corresponding to the interface request address, transmitting the target test data, and obtaining first response data corresponding to the target test data includes:
encrypting the target test data by using the encryption and decryption algorithm and the secret key to obtain encrypted data;
calling an interface corresponding to the interface request address, and transmitting the encrypted data to obtain third response data;
and decrypting the third response data by using the encryption and decryption algorithm and the secret key to obtain first response data corresponding to the target test data.
Optionally, the invoking an interface corresponding to the interface request address, transmitting the target test data, and obtaining first response data corresponding to the target test data includes:
and calling an interface corresponding to the interface request address, and transmitting the target test data after waiting for a preset time length to obtain first response data corresponding to the target test data.
In a second aspect, there is provided an interface testing apparatus, the apparatus comprising:
the calling module is used for calling an interface corresponding to the interface request address, transmitting the target test data and obtaining first response data corresponding to the target test data;
the first determining module is used for determining second response data corresponding to the target test data according to the corresponding relation between the pre-stored test data and the response data;
a second determining module to determine that the interface is available to transmit the target test data when the first response data is the same as the second response data.
Optionally, the apparatus further comprises:
the second acquisition module is used for acquiring a preset file through a preset interface; the preset file comprises a corresponding relation between the test data and the response data;
and the storage module is used for storing the corresponding relation between the test data and the response data.
Optionally, the apparatus further comprises:
the third acquisition module is used for acquiring an encryption and decryption algorithm and a key corresponding to the encryption and decryption algorithm and storing the encryption and decryption algorithm and the key;
the calling module comprises:
the encryption submodule is used for encrypting the target test data by using the encryption and decryption algorithm and the secret key to obtain encrypted data;
the calling submodule is used for calling an interface corresponding to the interface request address and transmitting the encrypted data to obtain third response data;
and the decryption submodule is used for decrypting the third response data by using the encryption and decryption algorithm and the secret key to obtain first response data corresponding to the target test data.
Optionally, the calling module is specifically configured to:
and calling an interface corresponding to the interface request address, and transmitting the target test data after waiting for a preset time length to obtain first response data corresponding to the target test data.
In a third aspect, an electronic device is provided, which includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory complete communication with each other through the communication bus;
a memory for storing a computer program;
a processor for implementing the method steps of the first aspect when executing the program stored in the memory.
In a fourth aspect, a computer-readable storage medium is provided, having stored thereon a computer program which, when being executed by a processor, carries out the method steps of the first aspect.
In a fifth aspect, there is provided a computer program product comprising instructions which, when run on a computer, cause the computer to perform the method of the first aspect described above.
According to the interface test method and device provided by the embodiment of the application, the interface request address and the test data can be obtained, the interface corresponding to the interface request address is called, the test data is transmitted, and the first response data corresponding to the test data is obtained. And then determining second response data corresponding to the test data according to the corresponding relation between the pre-stored test data and the response data. When the first response data is the same as the second response data, it is determined that the interface is available for transmitting the test data. Based on the scheme, a large number of corresponding relations between the test data and the response data can be stored in advance, whether the interface can be used for transmitting the test data or not is determined according to the corresponding relations between the test data and the response data which are stored in advance, the response data corresponding to the test data do not need to be manually created one by a user in real time, and the efficiency of interface testing is improved.
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 application 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, it is obvious that the drawings in the following description are only some embodiments of the present application, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a schematic flowchart of an interface testing method according to an embodiment of the present application;
fig. 2 is another schematic flow chart of an interface testing method according to an embodiment of the present disclosure;
fig. 3 is a schematic flowchart of another interface testing method according to an embodiment of the present disclosure;
fig. 4 is a fourth flowchart illustrating an interface testing method according to an embodiment of the present application;
fig. 5 is a schematic diagram of a system setup phase of an interface testing method according to an embodiment of the present application;
fig. 6 is a schematic diagram of a preset interface setting stage of an interface testing method according to an embodiment of the present application;
fig. 7 is a schematic diagram of an interface testing phase of an interface testing method according to an embodiment of the present application;
fig. 8 is a schematic structural diagram of an interface testing apparatus according to an embodiment of the present disclosure;
fig. 9 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 application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, 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 application.
In the prior art, when an interface is tested, each time a piece of test data is obtained, a user needs to manually create a piece of response data corresponding to the test data. However, as the task of interface transmission increases, so does the test data. If the user creates the response data corresponding to the test data one by one in real time, the time for interface test is greatly prolonged, and the user experience is influenced.
In order to solve the above problem, an embodiment of the present application provides an interface testing method. Referring to fig. 1, fig. 1 is a schematic flowchart of an interface testing method according to an embodiment of the present disclosure. For convenience of understanding, the following explanation of the interface testing method provided in the embodiments of the present application is provided by taking an electronic device as an execution subject, and is not limited. The method comprises the following steps.
In the embodiment of the application, the electronic device can acquire the interface request address and the target test data input by the user. The interface request address may indicate an address of a specific interface that a user needs to call, such as a Uniform Resource Locator (URL); the target test data is data input by a user for transmission, for example, the target test data may be a telephone number, a numerical code, or the like. The embodiments of the present application are not particularly limited herein.
And 102, calling an interface corresponding to the interface request address, and transmitting the target test data to obtain first response data corresponding to the target test data.
In the embodiment of the application, after the electronic device acquires the interface request address and the target test data, the electronic device can call the interface corresponding to the interface request address and transmit the target test data to obtain the first response data corresponding to the target test data. For example, when the target test data is a telephone number, the interface is called to transmit the telephone number, and response data corresponding to the telephone number is obtained, where the response data may be some attribute information such as a home location and an operator of the telephone number. The embodiment of the present application does not specifically limit the types of the target test data and the first response data.
And 103, determining second response data corresponding to the target test data according to the corresponding relation between the pre-stored test data and the response data.
In this embodiment, the electronic device may determine second response data corresponding to the target test data according to a correspondence between the pre-stored test data and the response data. For example, the corresponding relationship between the pre-stored test data and the response data is: the correspondence between test data 1 and response data 100, and the correspondence between test data 2 and response data 200; the correspondence of test data 3 to response data 300; the correspondence of the test data 100 and the response data 10000, and the like. If the target test data is the test data 3, the second response data corresponding to the target test data may be determined to be the response data 300 according to the correspondence between the pre-stored test data and the response data.
And step 104, when the first response data is the same as the second response data, determining that the interface can be used for transmitting the target test data.
In the embodiment of the application, after the electronic device obtains the first response data and the second response data, whether the first response data and the second response data are the same is compared. When the first response data is the same as the second response data, it is determined that the interface can be used to transmit the target test data. For example, when the target test data is test data 1, if the first response data is response data 100 and the second response data is also response data 100, it may be determined that the interface may be used to transmit test data 1.
In an alternative embodiment, when the first response data and the second response data are not the same, then the interface is determined to be unavailable for transmitting the target test data. For example, when the target test data is test data 1, the obtained first response data is response data 200, and the corresponding second response data is response data 100, and since the first response data and the second response data are different, it is determined that the interface cannot be used for transmitting test data 1 at this time.
According to the interface test method provided by the embodiment of the application, the interface request address and the test data can be obtained, the interface corresponding to the interface request address is called, the test data is transmitted, and the first response data corresponding to the test data is obtained. And then determining second response data corresponding to the test data according to the corresponding relation between the pre-stored test data and the response data. When the first response data is the same as the second response data, it is determined that the interface is available for transmitting the test data. Based on the scheme, a large number of corresponding relations between the test data and the response data can be stored in advance, whether the interface can be used for transmitting the test data or not is determined according to the corresponding relations between the test data and the response data which are stored in advance, the response data corresponding to the test data do not need to be manually created one by a user in real time, and the efficiency of interface testing is improved.
In an embodiment of the present application, before the interface request address and the target test data are obtained, a corresponding relationship between the test data and the response data may also be obtained through a preset interface. Specifically referring to fig. 2, fig. 2 is another schematic flow chart of an interface testing method provided in the embodiment of the present application, where the method includes the following steps:
In the embodiment of the application, the electronic device may obtain the preset file through the preset interface, where the preset file includes a corresponding relationship between the test data and the response data. For example, the user may create a plurality of correspondence relationships between the test data and the response data in advance, such as a correspondence relationship between test data 1 and response data 100; the correspondence of test data 2 to response data 200; the correspondence of test data 3 to response data 300; the correspondence between the test data 100 and the response data 10000, and the like; then, the user can store the pre-created corresponding relationship between the plurality of test data and the response data into a preset file, and then the preset file can be directly imported into the electronic equipment through a preset interface, so that the purpose of importing the test data and the response data in batches is achieved, the condition that the user needs to manually create the response data corresponding to the test data in real time during interface testing is avoided, and the efficiency of interface testing is improved.
In the embodiment of the application, after the electronic device obtains the corresponding relationship between the test data and the response data through the preset interface, the corresponding relationship between the test data and the response data can be stored.
And step 204, calling an interface corresponding to the interface request address, and transmitting the target test data to obtain first response data corresponding to the target test data. Step 204 corresponds to step 102.
At step 206, when the first response data is the same as the second response data, it is determined that the interface can be used to transmit the target test data. Step 206 corresponds to step 104.
In the interface testing method provided by the embodiment of the application, the corresponding relation between the test data and the response data can be imported in batches in advance, the corresponding relation between the test data and the response data can be stored, whether the interface can be used for transmitting the test data or not can be determined according to the corresponding relation between the pre-stored test data and the pre-stored response data, the response data corresponding to the test data is not required to be manually created one by a user in real time, and the efficiency of interface testing is improved.
In another embodiment, when the test data is transmitted by the calling interface to obtain the corresponding response data, the test data and the corresponding response data may be encrypted and decrypted. Specifically referring to fig. 3, fig. 3 is a schematic flow chart of an interface testing method according to an embodiment of the present application, where the method includes the following steps:
In the embodiment of the application, before the electronic device obtains the interface request address and the target test data, the electronic device may further obtain an encryption and decryption algorithm and a key corresponding to the encryption and decryption algorithm, and store the encryption and decryption algorithm and the key. For example, the encryption and decryption algorithm may be a symmetric encryption algorithm, i.e. a key for encryption may also be used as a key for decryption. The embodiment of the present application is not particularly limited to the type of encryption/decryption algorithm.
And 303, encrypting the target test data by using an encryption and decryption algorithm and a secret key to obtain encrypted data.
In the embodiment of the application, the electronic device can encrypt the target test data by using the encryption and decryption algorithm and the secret key which are obtained and stored in advance to obtain the encrypted data. For example, when the target test data is the phone number 18321212, the phone number is encrypted by using an encryption and decryption algorithm and a key, and the encrypted phone number is the adswaw.
And step 304, calling an interface corresponding to the interface request address, and transmitting the encrypted data to obtain third response data.
In the embodiment of the application, after encrypting the target test data to obtain the encrypted data, the electronic device may call an interface corresponding to the interface request address to transmit the encrypted data to obtain third response data corresponding to the encrypted data. For example, when the target test data is test data 1, the test data 1 is encrypted to obtain encrypted data s, and the encrypted data s is transmitted to obtain corresponding third response data.
And 305, decrypting the third response data by using an encryption and decryption algorithm and a secret key to obtain first response data corresponding to the target test data.
In this embodiment of the application, after the third response data is obtained, the third response data may be decrypted by using the encryption and decryption algorithm and the key, so as to obtain the first response data corresponding to the target test data. For example, when the obtained third response data is response data sqq, it is decrypted by using an encryption/decryption algorithm and a key to obtain response data 100, and at this time, response data 100 is used as first response data corresponding to the target test data.
And step 306, determining second response data corresponding to the target test data according to the corresponding relation between the pre-stored test data and the response data. Step 306 corresponds to step 103.
When the first response data is the same as the second response data, it is determined that the interface can be used to transmit the target test data, step 307. Step 307 corresponds to step 104.
In the interface testing method provided by the embodiment of the application, the electronic device can acquire the encryption and decryption algorithm and the key corresponding to the encryption and decryption algorithm in advance, and then transfer the corresponding interface to transmit the test data to obtain the response data, the encryption and decryption algorithm and the key can be used for carrying out encryption and decryption processing on the test data and the response data, and for some test data containing sensitive information, the encryption and decryption processing is carried out on the test data, so that the security of test data transmission can be improved.
In another embodiment, the electronic device may further transmit the test data after waiting for a preset time period after calling the corresponding interface, so as to obtain response data corresponding to the test data. Specifically referring to fig. 4, fig. 4 is a fourth schematic flow chart of an interface testing method provided in the embodiment of the present application, where the method includes the following steps:
In the embodiment of the application, after the electronic device calls the interface corresponding to the interface request address, the electronic device may wait for a preset time period and then transmit the target test data to obtain the first response data corresponding to the target test data. The preset time duration may be a time duration defined by a user, and may be, for example, 3 seconds or 5 seconds. The condition of interface request overtime can be simulated by waiting for the preset time length, so that the difficulty of the interface test task is reduced.
In step 404, it is determined that the interface can be used for transmitting the target test data when the first response data is the same as the second response data. Step 404 corresponds to step 104.
The interface testing method provided by the embodiment of the present application is described in detail below with reference to fig. 5 to 7. The specific interface test method comprises a system setting stage, a preset interface setting stage and an interface test stage. Fig. 5 is a schematic diagram of a system setup phase of an interface testing method according to an embodiment of the present disclosure, fig. 6 is a schematic diagram of a preset interface setup phase of an interface testing method according to an embodiment of the present disclosure, and fig. 7 is a schematic diagram of an interface testing phase of an interface testing method according to an embodiment of the present disclosure.
The system setting stage comprises the following steps:
The preset interface setting stage comprises the following steps:
The interface testing stage comprises the following steps:
And 708, decrypting the third response data by using an encryption and decryption algorithm and a secret key to obtain first response data corresponding to the target test data.
In step 710, when the first response data and the second response data are the same, it is determined that the interface can be used to transmit the target test data.
The description of the parts of fig. 5-7 is relatively simple and reference may be made in particular to the description of fig. 1-4 above.
According to the interface test method provided by the embodiment of the application, the interface request address and the test data can be obtained, the interface corresponding to the interface request address is called, the test data is transmitted, and the first response data corresponding to the test data is obtained. And then determining second response data corresponding to the test data according to the corresponding relation between the pre-stored test data and the response data. When the first response data is the same as the second response data, it is determined that the interface is available for transmitting the test data. Based on the scheme, a large number of corresponding relations between the test data and the response data can be stored in advance, whether the interface can be used for transmitting the test data or not is determined according to the corresponding relations between the test data and the response data which are stored in advance, the response data corresponding to the test data do not need to be manually created one by a user in real time, and the efficiency of interface testing is improved.
Based on the same technical concept, an embodiment of the present application further provides an interface testing apparatus, as shown in fig. 8, the apparatus includes:
a first obtaining module 801, configured to obtain an interface request address and target test data;
a calling module 802, configured to call an interface corresponding to the interface request address, and transmit target test data to obtain first response data corresponding to the target test data;
a first determining module 803, configured to determine, according to a correspondence between pre-stored test data and response data, second response data corresponding to the target test data;
a second determining module 804, configured to determine that the interface can be used for transmitting the target test data when the first response data is the same as the second response data.
Optionally, the interface testing apparatus may further include:
the second acquisition module is used for acquiring a preset file through a preset interface; the preset file comprises a corresponding relation between the test data and the response data;
and the storage module is used for storing the corresponding relation between the test data and the response data.
Optionally, the interface testing apparatus may further include:
the third acquisition module is used for acquiring the encryption and decryption algorithm and the key corresponding to the encryption and decryption algorithm and storing the encryption and decryption algorithm and the key;
the calling module 802 may include:
the encryption submodule is used for encrypting the target test data by using an encryption and decryption algorithm and a secret key to obtain encrypted data;
the calling submodule is used for calling an interface corresponding to the interface request address and transmitting the encrypted data to obtain third response data;
and the decryption submodule is used for decrypting the third response data by using an encryption and decryption algorithm and a secret key to obtain first response data corresponding to the target test data.
Optionally, the invoking module 802 may be specifically configured to:
and calling an interface corresponding to the interface request address, and transmitting the target test data after waiting for a preset time length to obtain first response data corresponding to the target test data.
The interface testing device provided by the embodiment of the application can acquire the interface request address and the testing data, call the interface corresponding to the interface request address, and transmit the testing data to obtain the first response data corresponding to the testing data. And then determining second response data corresponding to the test data according to the corresponding relation between the pre-stored test data and the response data. When the first response data is the same as the second response data, it is determined that the interface is available for transmitting the test data. Based on the scheme, a large number of corresponding relations between the test data and the response data can be stored in advance, whether the interface can be used for transmitting the test data or not is determined according to the corresponding relations between the test data and the response data which are stored in advance, the response data corresponding to the test data do not need to be manually created one by a user in real time, and the efficiency of interface testing is improved.
The embodiment of the present application further provides an electronic device, as shown in fig. 9, which includes a processor 901, a communication interface 902, a memory 903, and a communication bus 904, where the processor 901, the communication interface 902, and the memory 903 complete mutual communication through the communication bus 904,
a memory 903 for storing computer programs;
the processor 901 is configured to implement the steps in any of the above embodiments of the interface testing method when executing the program stored in the memory 903.
By the electronic equipment provided by the embodiment of the application, the interface request address and the test data can be obtained, the interface corresponding to the interface request address is called, the test data is transmitted, and the first response data corresponding to the test data is obtained. And then determining second response data corresponding to the test data according to the corresponding relation between the pre-stored test data and the response data. When the first response data is the same as the second response data, it is determined that the interface is available for transmitting the test data. Based on the scheme, a large number of corresponding relations between the test data and the response data can be stored in advance, whether the interface can be used for transmitting the test data or not is determined according to the corresponding relations between the test data and the response data which are stored in advance, the response data corresponding to the test data do not need to be manually created one by a user in real time, and the efficiency of interface testing is improved.
The communication bus mentioned in the network device may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. 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 network device and other devices.
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; the Integrated Circuit may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA), or other Programmable logic devices, discrete Gate or transistor logic devices, or discrete hardware components.
Based on the same technical concept, embodiments of the present application further provide a computer-readable storage medium, where a computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, the computer program implements any step of the interface testing method.
Based on the same technical concept, embodiments of the present application also provide a computer program product containing instructions, which when run on a computer, causes the computer to perform any one of the steps of the above interface testing method.
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 application 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, for the apparatus, the electronic device, the computer-readable storage medium, and the computer program product embodiments, since they are substantially similar to the method embodiments, the description is relatively simple, and for the relevant points, reference may be made to the partial description of the method embodiments.
The above description is only for the preferred embodiment of the present application, and is not intended to limit the scope of the present application. Any modification, equivalent replacement, improvement and the like made within the spirit and principle of the present application are included in the protection scope of the present application.
Claims (10)
1. An interface testing method, the method comprising:
acquiring an interface request address and target test data;
calling an interface corresponding to the interface request address, and transmitting the target test data to obtain first response data corresponding to the target test data;
determining second response data corresponding to the target test data according to a corresponding relation between pre-stored test data and response data;
determining that the interface is available to transmit the target test data when the first response data is the same as the second response data.
2. The method of claim 1, further comprising, prior to obtaining the interface request address and the target test data:
acquiring a preset file through a preset interface; the preset file comprises a corresponding relation between the test data and the response data;
and storing the corresponding relation between the test data and the response data.
3. The method of claim 1, further comprising, prior to obtaining the interface request address and the target test data:
acquiring an encryption and decryption algorithm and a key corresponding to the encryption and decryption algorithm, and storing the encryption and decryption algorithm and the key;
the calling an interface corresponding to the interface request address, transmitting the target test data, and obtaining first response data corresponding to the target test data includes:
encrypting the target test data by using the encryption and decryption algorithm and the secret key to obtain encrypted data;
calling an interface corresponding to the interface request address, and transmitting the encrypted data to obtain third response data;
and decrypting the third response data by using the encryption and decryption algorithm and the secret key to obtain first response data corresponding to the target test data.
4. The method of claim 1, wherein the invoking the interface corresponding to the interface request address, transmitting the target test data, and obtaining first response data corresponding to the target test data comprises:
and calling an interface corresponding to the interface request address, and transmitting the target test data after waiting for a preset time length to obtain first response data corresponding to the target test data.
5. An interface testing apparatus, the apparatus comprising:
the first acquisition module is used for acquiring an interface request address and target test data;
the calling module is used for calling an interface corresponding to the interface request address, transmitting the target test data and obtaining first response data corresponding to the target test data;
the first determining module is used for determining second response data corresponding to the target test data according to the corresponding relation between the pre-stored test data and the response data;
a second determining module to determine that the interface is available to transmit the target test data when the first response data is the same as the second response data.
6. The apparatus of claim 5, further comprising:
the second acquisition module is used for acquiring a preset file through a preset interface; the preset file comprises a corresponding relation between the test data and the response data;
and the storage module is used for storing the corresponding relation between the test data and the response data.
7. The apparatus of claim 5, further comprising:
the third acquisition module is used for acquiring an encryption and decryption algorithm and a key corresponding to the encryption and decryption algorithm and storing the encryption and decryption algorithm and the key;
the calling module comprises:
the encryption submodule is used for encrypting the target test data by using the encryption and decryption algorithm and the secret key to obtain encrypted data;
the calling submodule is used for calling an interface corresponding to the interface request address and transmitting the encrypted data to obtain third response data;
and the decryption submodule is used for decrypting the third response data by using the encryption and decryption algorithm and the secret key to obtain first response data corresponding to the target test data.
8. The apparatus of claim 5, wherein the invoking module is specifically configured to:
and calling an interface corresponding to the interface request address, and transmitting the target test data after waiting for a preset time length to obtain first response data corresponding to the target test data.
9. 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 of claims 1 to 4 when executing a program stored in the memory.
10. 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 claims 1 to 4.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011025107.3A CN112162923A (en) | 2020-09-25 | 2020-09-25 | Interface testing method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011025107.3A CN112162923A (en) | 2020-09-25 | 2020-09-25 | Interface testing method and device |
Publications (1)
Publication Number | Publication Date |
---|---|
CN112162923A true CN112162923A (en) | 2021-01-01 |
Family
ID=73864027
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202011025107.3A Pending CN112162923A (en) | 2020-09-25 | 2020-09-25 | Interface testing method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112162923A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113342689A (en) * | 2021-07-01 | 2021-09-03 | 中诚信征信有限公司 | Automatic testing method and device for interface, electronic equipment and storage medium |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20140282436A1 (en) * | 2013-03-14 | 2014-09-18 | International Business Machines Corporation | Testing a software interface for a streaming hardware device |
CN105099811A (en) * | 2015-06-03 | 2015-11-25 | 北京金山安全软件有限公司 | Interface testing method and device |
CN107729243A (en) * | 2017-10-12 | 2018-02-23 | 上海携程金融信息服务有限公司 | API automated testing method, system, equipment and storage medium |
CN107797911A (en) * | 2016-09-02 | 2018-03-13 | 北京京东尚科信息技术有限公司 | Method and apparatus for testing HTTP interface |
CN109710533A (en) * | 2018-12-29 | 2019-05-03 | 亚信科技(中国)有限公司 | A kind of interface test method, device and server |
CN109739700A (en) * | 2018-12-12 | 2019-05-10 | 中国联合网络通信集团有限公司 | A kind of interface test method and device |
-
2020
- 2020-09-25 CN CN202011025107.3A patent/CN112162923A/en active Pending
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20140282436A1 (en) * | 2013-03-14 | 2014-09-18 | International Business Machines Corporation | Testing a software interface for a streaming hardware device |
CN105099811A (en) * | 2015-06-03 | 2015-11-25 | 北京金山安全软件有限公司 | Interface testing method and device |
CN107797911A (en) * | 2016-09-02 | 2018-03-13 | 北京京东尚科信息技术有限公司 | Method and apparatus for testing HTTP interface |
CN107729243A (en) * | 2017-10-12 | 2018-02-23 | 上海携程金融信息服务有限公司 | API automated testing method, system, equipment and storage medium |
CN109739700A (en) * | 2018-12-12 | 2019-05-10 | 中国联合网络通信集团有限公司 | A kind of interface test method and device |
CN109710533A (en) * | 2018-12-29 | 2019-05-03 | 亚信科技(中国)有限公司 | A kind of interface test method, device and server |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113342689A (en) * | 2021-07-01 | 2021-09-03 | 中诚信征信有限公司 | Automatic testing method and device for interface, electronic equipment and storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN112039826B (en) | Login method and device applied to applet end, electronic equipment and readable medium | |
CN111914279B (en) | Efficient and accurate privacy intersection system, method and device | |
CN113381984A (en) | Data processing method, device and system, electronic equipment and storage medium | |
US9665732B2 (en) | Secure Download from internet marketplace | |
CN111858769B (en) | Data use method, device, node equipment and storage medium | |
CN110445768B (en) | Login method and device and electronic equipment | |
CN113642239B (en) | Federal learning modeling method and system | |
CN112650954B (en) | Block chain data sharing method, device, equipment and storage medium | |
US9355232B2 (en) | Methods for governing the disclosure of restricted data | |
CN113761498A (en) | Third party login information hosting method, system, equipment and storage medium | |
CN108540591B (en) | Address book management method, address book management device and electronic equipment | |
CN114239026A (en) | Information desensitization conversion processing method, device, computer equipment and storage medium | |
CN112887087B (en) | Data management method and device, electronic equipment and readable storage medium | |
CN112162923A (en) | Interface testing method and device | |
CN114040411A (en) | Equipment binding method and device, electronic equipment and storage medium | |
CN112948857A (en) | Document processing method and device | |
CN110457959B (en) | Information transmission method and device based on Trust application | |
CN114116448A (en) | Pressure testing method and device of application program, storage medium and computer equipment | |
CN111090850B (en) | Authentication system, method and device | |
CN111444451B (en) | Document acquisition method and device, electronic equipment and readable storage medium | |
CN113987471A (en) | Executable file execution method and device, electronic equipment and computer readable medium | |
CN109254855B (en) | Registration method and device of parameter transmission protocol and electronic equipment | |
CN113205302A (en) | Data interaction method, device, equipment and storage medium | |
CN109862015B (en) | Information transmission method and device | |
CN113094212B (en) | Video backup method and device and video backup system |
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 |