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

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

Info

Publication number
CN110798376A
CN110798376A CN201910953958.5A CN201910953958A CN110798376A CN 110798376 A CN110798376 A CN 110798376A CN 201910953958 A CN201910953958 A CN 201910953958A CN 110798376 A CN110798376 A CN 110798376A
Authority
CN
China
Prior art keywords
interface
tested
information
state
code
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201910953958.5A
Other languages
Chinese (zh)
Inventor
严长友
魏建亮
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Suning Cloud Computing Co Ltd
Original Assignee
Suning Cloud Computing 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 Suning Cloud Computing Co Ltd filed Critical Suning Cloud Computing Co Ltd
Priority to CN201910953958.5A priority Critical patent/CN110798376A/en
Publication of CN110798376A publication Critical patent/CN110798376A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/08Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters
    • H04L43/0823Errors, e.g. transmission errors
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/50Testing arrangements

Abstract

The application relates to an interface testing method, an interface testing device, computer equipment and a storage medium. The method comprises the following steps: acquiring interface information of an interface to be tested from a database, wherein the interface information comprises interface path data and input parameters of the interface to be tested; generating network address information of the interface to be tested according to the interface path data; accessing the interface to be tested according to the network address information, inputting the input parameters into the interface to be tested, and acquiring a status code and an error code returned by the interface to be tested; and obtaining the interface state information of the interface to be tested according to the state code and the error code. By adopting the method, the interface testing time can be shortened, and the interface testing efficiency can be improved.

Description

Interface testing method and device, computer equipment and storage medium
Technical Field
The present application relates to the field of computer technologies, and in particular, to an interface testing method and apparatus, a computer device, and a storage medium.
Background
After the server-side system is released and started, the release personnel need to know whether the relevant interfaces are developed and released or not and whether the interface states are normal or not, and then the interfaces need to be tested.
However, in the current common mode, after the interfaces are released, a tester verifies whether the functions of each released interface are normal one by one according to an interface requirement list to be released, the related testers with known versions and functions are not required to participate in the test, the labor cost is high, the functions of each interface need to be verified manually one by one according to the interface list, the response speed is low, and the efficiency is low.
Disclosure of Invention
In view of the above, it is necessary to provide an interface testing method, an apparatus, a computer device, and a storage medium capable of improving interface testing efficiency.
An interface testing method, the method comprising: acquiring interface information of an interface to be tested from a database, wherein the interface information comprises interface path data and input parameters of the interface to be tested; generating network address information of the interface to be tested according to the interface path data; accessing the interface to be tested according to the network address information, inputting the input parameters into the interface to be tested, and acquiring a status code and an error code returned by the interface to be tested; and obtaining the interface state information of the interface to be tested according to the state code and the error code.
In an embodiment, the obtaining interface status information of the interface to be tested according to the status code and the error code includes: when the state code is inconsistent with the preset state code, or when the state code is consistent with the preset state code and the error code is a non-null value, determining that the interface state of the interface to be tested is abnormal; when the state code is consistent with the preset state code and the error code is a null value, determining that the interface state of the interface to be tested is normal; the interface state information comprises first information representing that the interface state is abnormal or second information representing that the interface state is normal.
In an embodiment, the obtaining interface information of the interface to be tested from the database includes: initializing interface information of an interface to be tested into a database to obtain an interface information list; and acquiring the interface information from the interface information list.
In an embodiment, the obtaining interface information from the interface information list includes: acquiring an interface information list from a database; selecting one interface to be tested from the interface information list as a current interface to be tested; acquiring interface information of a current interface to be tested;
the method further comprises the following steps: after the interface state information of the current interface to be tested is obtained, obtaining an undetected interface to be tested in an interface information list as a new interface to be tested, and entering a step of generating network address information of the interface to be tested according to interface path data; until the interface state information of all the interfaces to be tested in the interface information list is obtained.
In one embodiment, the method further comprises: recording interface state information of all interfaces to be tested in an interface information list to obtain an interface state information list, wherein the interface state information list comprises interface path data and interface state information of all the interfaces to be tested; and displaying an interface state information list.
In one embodiment, the interface is a RESTful interface.
An interface test apparatus, the apparatus comprising:
the acquisition module is used for acquiring interface information of the interface to be tested from the database, wherein the interface information comprises interface path data and input parameters of the interface to be tested;
the path module is used for generating network address information of the interface to be tested according to the interface path data;
the interface testing module is used for accessing the interface to be tested according to the network address information, inputting the input parameters into the interface to be tested and acquiring the status code and the error code returned by the interface to be tested;
and the interface state module is used for obtaining the interface state information of the interface to be tested according to the state code and the error code.
A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the following steps when executing the computer program: acquiring interface information of an interface to be tested from a database, wherein the interface information comprises interface path data and input parameters of the interface to be tested; generating network address information of the interface to be tested according to the interface path data; accessing the interface to be tested according to the network address information, inputting the input parameters into the interface to be tested, and acquiring a status code and an error code returned by the interface to be tested; and obtaining the interface state information of the interface to be tested according to the state code and the error code.
A computer-readable storage medium, on which a computer program is stored which, when executed by a processor, carries out the steps of: acquiring interface information of an interface to be tested from a database, wherein the interface information comprises interface path data and input parameters of the interface to be tested; generating network address information of the interface to be tested according to the interface path data; accessing the interface to be tested according to the network address information, inputting the input parameters into the interface to be tested, and acquiring a status code and an error code returned by the interface to be tested; and obtaining the interface state information of the interface to be tested according to the state code and the error code.
The interface testing method, the device, the computer equipment and the storage medium acquire the interface information of the interface to be tested from the database, wherein the interface information comprises interface path data and input parameters of the interface to be tested; the network address information of the interface to be tested is generated by the interface path data, the interface to be tested is accessed according to the network address information, the state code and the error code returned by the interface to be tested are obtained by inputting the corresponding input parameters into the interface to be tested, the interface is tested without the operation of verifying the function of the interface, and the response speed is higher; and the interface state information of the interface to be tested is obtained according to the state code and the error code returned by the interface to be tested, and the method is simple and convenient in process, high in speed and high in efficiency. By adopting the scheme of the embodiment, the access and the test to the interface can be realized through the corresponding interface path data and the input parameters, and the interface state is judged according to the returned state code and the error code, so that the interface test time is effectively shortened, and the interface test efficiency is improved.
Drawings
FIG. 1 is a diagram of an application environment of a method for interface testing in one embodiment;
FIG. 2 is a flow chart illustrating a method for testing an interface according to an embodiment;
FIG. 3 is a flowchart illustrating the step of obtaining interface information according to one embodiment;
FIG. 4 is a flowchart illustrating an interface testing method according to another embodiment;
FIG. 5 is a block diagram of an interface test apparatus according to an embodiment;
FIG. 6 is a diagram illustrating an internal structure of a computer device according to an embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
It will be understood that, as used herein, the terms "first," "second," and the like may be used herein to describe various elements, but these elements are not limited by these terms. These terms are only used to distinguish one element from another. For example, a first client may be referred to as a second client, and similarly, a second client may be referred to as a first client, without departing from the scope of the present application. Both the first client and the second client are clients, but they are not the same client. Further, it is understood that the term "or/and" as used herein describes an association relationship of associated objects, meaning that three relationships may exist, e.g., a or/and B, may mean: a exists alone, A and B exist simultaneously, and B exists alone. The character "/" generally indicates that the former and latter associated objects are in an "or" relationship.
The interface testing method provided by the application can be applied to the application environment shown in fig. 1. The application environment includes a terminal 102, a server 104, and a database device 106, and the terminal 102, the server 104, and the database device 106 may be communicatively connected via a network. The network system formed by the terminal 102, the server 104 and the database device 106 may be based on the internet, may also be based on a local area network, and may also be based on a combination network of the internet and the local area network, which is not described herein again.
The terminal 102 may be, but is not limited to, various personal computers, laptops, smartphones, tablets, and portable wearable devices. Meanwhile, fig. 1 shows a case where the number of the terminals 102 is one, but the present application does not limit the number of the terminals 102, and more or fewer terminals may be included. The terminal 102 runs an application program, which may be an interface test application program, a communication application program or other application programs; the server 104 may be implemented as a stand-alone server or a server cluster composed of a plurality of servers; database device 106 includes a plurality of databases or database clusters.
The network is used to implement network connections between the terminal 102 and the server 104, the server 104 and the database device 106, and the like, and may include various types of wired or wireless networks. The network may include the internet, a local area network ("LAN"), a wide area network ("WAN"), an intranet, a mobile phone network, a Virtual Private Network (VPN), a cellular or other mobile communication network, bluetooth, NFC, or any combination thereof.
In one embodiment, as shown in fig. 2, an interface testing method is provided, which is described by taking the application of the method to the server in fig. 1 as an example, and includes the following steps:
step 202, obtaining interface information of the interface to be tested from a database, wherein the interface information comprises interface path data and input parameters of the interface to be tested.
The interface information of the interface to be tested can be pre-stored in the database in advance, the interface information can include a plurality of items of information such as an interface name, an interface code, interface path data and input parameters of the interface to be tested, each interface to be tested has corresponding interface path data and input parameters, and the input parameters are preset input parameters for testing the interface.
Specifically, interface information of an interface to be tested is obtained from a database, wherein the interface information at least comprises interface path data and input parameters of the interface to be tested; the interface to be tested may include one interface or a plurality of interfaces, and when there are a plurality of interfaces to be tested, the interface information list of the interfaces to be tested is acquired from the database, and the acquired interface information list is loaded into the memory of the server.
And step 204, generating network address information of the interface to be tested according to the interface path data.
The network address information is a uniform resource locator of the interface to be tested.
Specifically, preset IP port data is stored in the server, the preset IP port data is generally the same for each interface to be tested, and the uniform resource locator of the interface to be tested can be spliced by the interface path data and the preset IP port data.
For example, if the interface to be tested is a commodity directory interface, the interface path data is gcms-api-getCategory, the preset IP port data is http:// dev.cnsuning.com:8080, and the interface path data and the preset IP port data are spliced to obtain the uniform resource locator of the commodity directory interface: http:// dev. cnsung.com: 8080/gctest-admin/sys/service/exec. do? The implCode is gcms-api-getCategory, wherein gctest-admin is a preset project name, and sys/service/exec.do is a preset fixed execution path, which can be ignored; in this embodiment, the preset project name and the preset fixed execution path are generally the same for any one of the interfaces to be tested.
And step 206, accessing the interface to be tested according to the network address information, inputting the input parameters into the interface to be tested, and acquiring the status code and the error code returned by the interface to be tested.
The status code returned by the interface to be tested can be a numerical value, and the error code can be a null value or a non-null value.
Specifically, remote access to the interface to be tested is realized according to the uniform resource locator of the interface to be tested, and preset input parameters for testing are input into the interface to be tested, so that the test of the interface to be tested is realized. For example, the interface to be tested is a commodity catalog interface, the input parameter may be a customer number { "custo no": 1000000000"}, and the input parameter is input into the interface to be tested, namely, through http:// dev. And inputting input parameters into the commodity directory interface, returning a state code and an error code to the interface to be detected, and acquiring the state code and the error code.
And step 208, obtaining interface state information of the interface to be tested according to the state code and the error code.
The interface state information of the interface to be tested is used for representing the interface state, the interface state may be abnormal or normal, the interface state is normal, the interface state indicates that the interface is published and the interface function is normal, and the interface state is abnormal, the interface state indicates that the interface is not published or the interface function is abnormal.
Specifically, the state code is compared with a preset state code, and when the state code is inconsistent with the preset state code, the interface state is judged to be abnormal; when the state code is consistent with the preset state code, checking the obtained error code, and when the error code is a non-null value, judging that the interface state is still abnormal; when the error code is null, the interface state is determined to be normal.
In the interface test method, interface information of an interface to be tested is obtained from a database, and the interface information comprises interface path data and input parameters of the interface to be tested; the network address information of the interface to be tested is generated by the interface path data, the interface to be tested is accessed according to the network address information, the state code and the error code returned by the interface to be tested are obtained by inputting the corresponding input parameters into the interface to be tested, the interface is tested without the operation of verifying the function of the interface, and the response speed is higher; and the interface state information of the interface to be tested is obtained according to the state code and the error code returned by the interface to be tested, and the method is simple and convenient in process, high in speed and high in efficiency. By adopting the scheme of the embodiment, the access and the test to the interface can be realized through the corresponding interface path data and the input parameters, and the interface state is judged according to the returned state code and the error code, so that the interface test time is effectively shortened, and the interface test efficiency is improved; meanwhile, in the embodiment, related testers with known versions and functions do not need to participate in the test, so that the labor cost is reduced.
In an embodiment, the obtaining interface status information of the interface to be tested according to the status code and the error code includes:
when the state code is inconsistent with the preset state code, or when the state code is consistent with the preset state code and the error code is a non-null value, determining that the interface state of the interface to be tested is abnormal;
when the state code is consistent with the preset state code and the error code is a null value, determining that the interface state of the interface to be tested is normal;
here, the preset status code may be set to 200. Specifically, if the status code is not 200, the interface status of the interface to be tested is abnormal; if the state code is 200, but the error code is a non-null value, the interface state of the interface to be tested is abnormal; if the status code is 200 and the error code is null, the interface status of the interface to be tested is normal.
The interface state information comprises first information representing that the interface state is abnormal or second information representing that the interface state is normal.
Here, the first information and the second information may be characters or numerical values characterizing the state of the interface.
In this embodiment, the interface state of the interface to be tested is determined according to the status code and the error code returned by the interface to be tested, and the method is simple and convenient in process, fast in speed and high in efficiency.
In an embodiment, as shown in fig. 3, the obtaining interface information of the interface to be tested from the database includes:
step 302, initializing interface information of an interface to be tested into a database to obtain an interface information list;
the interface information of the interface to be tested may include a plurality of items of information such as an interface name, an interface code, interface path data, and an input parameter of the interface to be tested, and the interface code, the interface path data, and the input parameter of each interface to be tested are associated with each other.
Specifically, an interface information list is created in the database according to the interface information of the interfaces to be tested, and the interface information list can be set to an automatic updating mode, so that the newly added interfaces to be tested are automatically added.
Step 304, obtaining the interface information from the interface information list.
Specifically, the interface information list may be acquired from a database; selecting one interface to be tested from the interface information list as a current interface to be tested; acquiring interface information of a current interface to be tested; or, a plurality of interfaces to be tested can be selected from the interface information list at one time, and the interface information of the plurality of interfaces to be tested can be obtained.
In the embodiment, the interface information list in the database is called, so that the one-by-one circulation traversal test or batch test of the interfaces to be tested in the interface information list can be realized, and the test efficiency is effectively improved.
In one embodiment, the method further comprises: recording interface state information of all interfaces to be tested in the interface information list to obtain an interface state information list, wherein the interface state information list comprises interface path data and interface state information of all the interfaces to be tested in the interface information list; here, the interface state information list may further include an interface code uniquely corresponding to each interface to be tested.
And displaying an interface state information list, specifically, displaying the interface state information list on a page for displaying the interface state information obtained after testing the interface, so that maintenance personnel can observe and monitor conveniently.
In this embodiment, by checking the interface state information list, the maintainer can quickly grasp whether the states of the interfaces are normal after the interfaces are released and delivered, and if the states of the interfaces are abnormal, the interface states can be quickly fed back to the research and development staff to adopt corresponding coping strategies.
In one embodiment, as shown in FIG. 4, the method includes:
step 402, initializing interface information of an interface to be tested into a database to obtain an interface information list;
step 404, obtaining an interface information list from a database;
step 406, selecting an undetected interface to be tested from the interface information list as a current interface to be tested;
step 408, acquiring interface information of the current interface to be tested, wherein the interface information comprises interface path data and input parameters of the current interface to be tested;
step 410, generating the network address information of the current interface to be tested according to the interface path data;
step 412, accessing the current interface to be tested according to the network address information, inputting the input parameters into the current interface to be tested, and acquiring a status code and an error code returned by the current interface to be tested;
step 414, obtaining the interface state information of the current interface to be tested according to the state code and the error code;
step 416, determining whether interface state information of all interfaces to be tested in the interface information list is obtained, if not, returning to step 406, and if so, entering step 418.
Step 418, recording interface state information of all interfaces to be tested in the interface information list to obtain an interface state information list, wherein the interface state information list comprises interface path data and interface state information of each interface to be tested;
step 420, displaying the interface state information list.
In this embodiment, interface information of the interfaces to be tested is initialized into the database to obtain an interface information list, all the interfaces to be tested in the interface information list are tested in a cycle traversal mode one by one until interface state information of all the interfaces to be tested in the interface information list is obtained, interface state information of all the interfaces to be tested in the interface information list is recorded to obtain an interface state information list, and the interface state information list is sent to a page to be displayed.
In one embodiment, the interface is a RESTful interface.
The RESTful interface is an interface design theory of a relatively mature set of Internet application programs at present, and refers to an interface meeting the RESTful interface design theory.
Rest (representational State transfer) describes an architectural style network system, such as a network application. The most important REST principle of web applications is that the interaction between the client and the server is stateless between requests. Each request from a client to a server must contain the information necessary to understand the request. Therefore, the REST refers to a group of architecture constraints and principles, and an application or a design meeting the constraints and principles is RESTful, that is, RESTful is a design style and a development mode of a network application, and is suitable for a scene in which a mobile internet manufacturer serves as an service enabling interface.
It should be understood that although the various steps in the flow charts of fig. 2-4 are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in the exact order shown and described, and may be performed in other orders, unless explicitly stated otherwise. Moreover, at least some of the steps in fig. 2-4 may include multiple sub-steps or multiple stages that are not necessarily performed at the same time, but may be performed at different times, and the order of performance of the sub-steps or stages is not necessarily sequential, but may be performed in turn or alternating with other steps or at least some of the sub-steps or stages of other steps.
In one embodiment, as shown in fig. 5, there is provided an interface test apparatus including: an acquisition module 502, a path module 504, an interface test module 506, and an interface status module 508, wherein:
an obtaining module 502, configured to obtain interface information of an interface to be tested from a database, where the interface information includes interface path data and input parameters of the interface to be tested;
a path module 504, configured to generate network address information of the interface to be tested according to the interface path data;
the interface testing module 506 is used for accessing the interface to be tested according to the network address information, inputting the input parameters into the interface to be tested, and acquiring the status code and the error code returned by the interface to be tested;
and the interface state module 508 is configured to obtain interface state information of the interface to be tested according to the state code and the error code.
In one embodiment, the interface status module 508 includes:
the interface state exception unit is used for determining that the interface state of the interface to be tested is abnormal when the state code is inconsistent with the preset state code or when the state code is consistent with the preset state code and the error code is a non-null value;
the interface state normal unit is used for determining that the interface state of the interface to be tested is normal when the state code is consistent with the preset state code and the error code is a null value;
the interface state information comprises first information representing that the interface state is abnormal or second information representing that the interface state is normal.
In one embodiment, the obtaining module 502 includes:
the interface information list unit is used for initializing the interface information of the interface to be tested into a database to obtain an interface information list;
and the interface information acquisition unit is used for acquiring the interface information from the interface information list.
In one embodiment, the interface information obtaining unit is further configured to obtain an interface information list from a database; selecting one interface to be tested from the interface information list as a current interface to be tested; and acquiring interface information of the current interface to be tested.
The above apparatus further comprises:
the cyclic test module is used for acquiring an undetected interface to be tested as a new interface to be tested in the interface information list after the interface state information of the current interface to be tested is acquired, and entering the step of generating the network address information of the interface to be tested according to the interface path data; until the interface state information of all the interfaces to be tested in the interface information list is obtained.
In one embodiment, the above apparatus further comprises:
the recording module is used for recording interface state information of all to-be-tested interfaces in the interface information list to obtain an interface state information list, and the interface state information list comprises interface path data and interface state information of all to-be-tested interfaces;
and the display module is used for displaying the interface state information list.
In one embodiment, the interface is a RESTful interface.
For the specific definition of the interface testing device, reference may be made to the definition of the interface testing method above, and details are not described here. The modules in the interface testing device can be wholly or partially implemented by software, hardware and a combination thereof. The modules can be embedded in a hardware form or independent from a processor in the computer device, and can also be stored in a memory in the computer device in a software form, so that the processor can call and execute operations corresponding to the modules.
In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as shown in fig. 6. The computer device includes a processor, a memory, a network interface, and a database connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The database of the computer device is used for storing interface status data. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement an interface testing method.
Those skilled in the art will appreciate that the architecture shown in fig. 6 is merely a block diagram of some of the structures associated with the disclosed aspects and is not intended to limit the computing devices to which the disclosed aspects apply, as particular computing devices may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
In one embodiment, a computer device is provided, comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, the processor implementing the following steps when executing the computer program: acquiring interface information of an interface to be tested from a database, wherein the interface information comprises interface path data and input parameters of the interface to be tested; generating network address information of the interface to be tested according to the interface path data; accessing the interface to be tested according to the network address information, inputting the input parameters into the interface to be tested, and acquiring a status code and an error code returned by the interface to be tested; and obtaining the interface state information of the interface to be tested according to the state code and the error code.
In an embodiment, when the processor executes the computer program to implement the step of obtaining the interface state information of the interface to be tested according to the state code and the error code, the following steps are specifically implemented: when the state code is inconsistent with the preset state code, or when the state code is consistent with the preset state code and the error code is a non-null value, determining that the interface state of the interface to be tested is abnormal; when the state code is consistent with the preset state code and the error code is a null value, determining that the interface state of the interface to be tested is normal; the interface state information comprises first information representing that the interface state is abnormal or second information representing that the interface state is normal.
In an embodiment, when the processor executes the computer program to implement the step of obtaining the interface information of the interface to be tested from the database, the following steps are specifically implemented: initializing interface information of an interface to be tested into a database to obtain an interface information list; and acquiring the interface information from the interface information list.
In one embodiment, when the processor executes the computer program to implement the step of obtaining the interface information from the interface information list, the following steps are specifically implemented: acquiring an interface information list from a database; selecting one interface to be tested from the interface information list as a current interface to be tested; acquiring interface information of a current interface to be tested; the method further comprises the following steps: after the interface state information of the current interface to be tested is obtained, obtaining an undetected interface to be tested in an interface information list as a new interface to be tested, and entering a step of generating network address information of the interface to be tested according to interface path data; until the interface state information of all the interfaces to be tested in the interface information list is obtained.
In one embodiment, the processor, when executing the computer program, further performs the steps of: recording interface state information of all interfaces to be tested in an interface information list to obtain an interface state information list, wherein the interface state information list comprises interface path data and interface state information of all the interfaces to be tested; and displaying an interface state information list.
In one embodiment, the interface described above is implemented as a RESTful interface when the processor executes the computer program.
In one embodiment, a computer-readable storage medium is provided, having a computer program stored thereon, which when executed by a processor, performs the steps of: acquiring interface information of an interface to be tested from a database, wherein the interface information comprises interface path data and input parameters of the interface to be tested; generating network address information of the interface to be tested according to the interface path data; accessing the interface to be tested according to the network address information, inputting the input parameters into the interface to be tested, and acquiring a status code and an error code returned by the interface to be tested; and obtaining the interface state information of the interface to be tested according to the state code and the error code.
In an embodiment, when the computer program is executed by the processor to implement the step of obtaining the interface state information of the interface to be tested according to the state code and the error code, the following steps are specifically implemented: when the state code is inconsistent with the preset state code, or when the state code is consistent with the preset state code and the error code is a non-null value, determining that the interface state of the interface to be tested is abnormal; when the state code is consistent with the preset state code and the error code is a null value, determining that the interface state of the interface to be tested is normal; the interface state information comprises first information representing that the interface state is abnormal or second information representing that the interface state is normal.
In one embodiment, when the computer program is executed by the processor to implement the step of obtaining the interface information of the interface to be tested from the database, the following steps are specifically implemented: initializing interface information of an interface to be tested into a database to obtain an interface information list; and acquiring the interface information from the interface information list.
In one embodiment, when the computer program is executed by the processor to implement the step of obtaining the interface information from the interface information list, the following steps are specifically implemented: acquiring an interface information list from a database; selecting one interface to be tested from the interface information list as a current interface to be tested; acquiring interface information of a current interface to be tested; the method further comprises the following steps: after the interface state information of the current interface to be tested is obtained, obtaining an undetected interface to be tested in an interface information list as a new interface to be tested, and entering a step of generating network address information of the interface to be tested according to interface path data; until the interface state information of all the interfaces to be tested in the interface information list is obtained.
In one embodiment, the computer program when executed by the processor further performs the steps of: recording interface state information of all interfaces to be tested in an interface information list to obtain an interface state information list, wherein the interface state information list comprises interface path data and interface state information of all the interfaces to be tested; and displaying an interface state information list.
In one embodiment, the computer program when executed by the processor implements the above described interface as a RESTful interface.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium used in the embodiments provided herein may include non-volatile and/or volatile memory, among others. Non-volatile memory can include read-only memory (ROM), Programmable ROM (PROM), Electrically Programmable ROM (EPROM), Electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDRSDRAM), Enhanced SDRAM (ESDRAM), Synchronous Link DRAM (SLDRAM), Rambus Direct RAM (RDRAM), direct bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
The technical features of the above embodiments can be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the above embodiments are not described, but should be considered as the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present patent shall be subject to the appended claims.

Claims (10)

1. An interface testing method, the method comprising:
acquiring interface information of an interface to be tested from a database, wherein the interface information comprises interface path data and input parameters of the interface to be tested;
generating network address information of the interface to be tested according to the interface path data;
accessing the interface to be tested according to the network address information, inputting the input parameters into the interface to be tested, and acquiring a status code and an error code returned by the interface to be tested;
and obtaining the interface state information of the interface to be tested according to the state code and the error code.
2. The method of claim 1, wherein obtaining interface status information of the interface to be tested according to the status code and the error code comprises:
when the state code is inconsistent with a preset state code, or when the state code is consistent with the preset state code and the error code is a non-null value, determining that the interface state of the interface to be tested is abnormal;
when the state code is consistent with a preset state code and the error code is a null value, determining that the interface state of the interface to be tested is normal;
the interface state information comprises first information representing that the interface state is abnormal or second information representing that the interface state is normal.
3. The method according to claim 1 or 2, wherein the obtaining interface information of the interface to be tested from the database comprises:
initializing the interface information of the interface to be tested into a database to obtain an interface information list;
and acquiring the interface information from the interface information list.
4. The method of claim 3, wherein the obtaining the interface information from the interface information list comprises:
acquiring the interface information list from a database;
selecting one interface to be tested from the interface information list as a current interface to be tested;
acquiring interface information of the current interface to be tested;
the method further comprises the following steps:
after the interface state information of the current interface to be tested is obtained, obtaining an undetected interface to be tested in the interface information list as a new interface to be tested, and entering the step of generating the network address information of the interface to be tested according to the interface path data;
until the interface state information of all the interfaces to be tested in the interface information list is obtained.
5. The method of claim 4, further comprising:
recording interface state information of all interfaces to be tested in the interface information list to obtain an interface state information list, wherein the interface state information list comprises interface path data and interface state information of all the interfaces to be tested;
and displaying the interface state information list.
6. The method of claim 1, wherein the interface is a RESTful interface.
7. An interface testing apparatus, the apparatus comprising:
the system comprises an acquisition module, a test module and a test module, wherein the acquisition module is used for acquiring interface information of an interface to be tested from a database, and the interface information comprises interface path data and input parameters of the interface to be tested;
the path module is used for generating the network address information of the interface to be tested according to the interface path data;
the interface testing module is used for accessing the interface to be tested according to the network address information, inputting the input parameters into the interface to be tested and acquiring a state code and an error code returned by the interface to be tested;
and the interface state module is used for obtaining the interface state information of the interface to be tested according to the state code and the error code.
8. The apparatus of claim 7, wherein the interface status module comprises:
the interface state exception unit is used for determining that the interface state of the interface to be tested is abnormal when the state code is inconsistent with a preset state code or when the state code is consistent with the preset state code and the error code is a non-null value;
the interface state normal unit is used for determining that the interface state of the interface to be tested is normal when the state code is consistent with a preset state code and the error code is a null value;
the interface state information comprises first information representing that the interface state is abnormal or second information representing that the interface state is normal.
9. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the steps of the method of any of claims 1 to 7 are implemented when the computer program is executed by the processor.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method of any one of claims 1 to 7.
CN201910953958.5A 2019-10-09 2019-10-09 Interface testing method and device, computer equipment and storage medium Pending CN110798376A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910953958.5A CN110798376A (en) 2019-10-09 2019-10-09 Interface testing method and device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910953958.5A CN110798376A (en) 2019-10-09 2019-10-09 Interface testing method and device, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN110798376A true CN110798376A (en) 2020-02-14

Family

ID=69440137

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910953958.5A Pending CN110798376A (en) 2019-10-09 2019-10-09 Interface testing method and device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN110798376A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112653599A (en) * 2020-12-21 2021-04-13 广州爱浦路网络技术有限公司 Interface error information reporting method, system, device and storage medium
CN114070763A (en) * 2020-07-29 2022-02-18 富泰华工业(深圳)有限公司 Improved REST protocol-based test method, client, server and medium
CN114113711A (en) * 2021-11-30 2022-03-01 武汉天喻信息产业股份有限公司 Method and system for multi-interface parallel test
CN115941546A (en) * 2022-11-29 2023-04-07 重庆长安汽车股份有限公司 System interface monitoring method and device, electronic equipment and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107122258A (en) * 2017-04-18 2017-09-01 上海雷腾软件股份有限公司 Method and apparatus for the state code check of test interface
CN109254916A (en) * 2018-08-30 2019-01-22 郑州云海信息技术有限公司 A kind of method and server of the visualization RestFul interface testing relying on injection based on Spring
CN109446071A (en) * 2018-09-26 2019-03-08 深圳壹账通智能科技有限公司 Interface test method, interface test device, electronic equipment and storage medium
CN109446072A (en) * 2018-09-27 2019-03-08 深圳壹账通智能科技有限公司 The generation method and device of test script
CN109495334A (en) * 2017-09-13 2019-03-19 杭州海康威视系统技术有限公司 A kind of test method and device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107122258A (en) * 2017-04-18 2017-09-01 上海雷腾软件股份有限公司 Method and apparatus for the state code check of test interface
CN109495334A (en) * 2017-09-13 2019-03-19 杭州海康威视系统技术有限公司 A kind of test method and device
CN109254916A (en) * 2018-08-30 2019-01-22 郑州云海信息技术有限公司 A kind of method and server of the visualization RestFul interface testing relying on injection based on Spring
CN109446071A (en) * 2018-09-26 2019-03-08 深圳壹账通智能科技有限公司 Interface test method, interface test device, electronic equipment and storage medium
CN109446072A (en) * 2018-09-27 2019-03-08 深圳壹账通智能科技有限公司 The generation method and device of test script

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114070763A (en) * 2020-07-29 2022-02-18 富泰华工业(深圳)有限公司 Improved REST protocol-based test method, client, server and medium
CN114070763B (en) * 2020-07-29 2023-09-26 富泰华工业(深圳)有限公司 Test method, client, server and medium based on improved REST protocol
CN112653599A (en) * 2020-12-21 2021-04-13 广州爱浦路网络技术有限公司 Interface error information reporting method, system, device and storage medium
CN114113711A (en) * 2021-11-30 2022-03-01 武汉天喻信息产业股份有限公司 Method and system for multi-interface parallel test
CN115941546A (en) * 2022-11-29 2023-04-07 重庆长安汽车股份有限公司 System interface monitoring method and device, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
CN110798376A (en) Interface testing method and device, computer equipment and storage medium
CN109302522B (en) Test method, test device, computer system, and computer medium
CN109032824A (en) Database method of calibration, device, computer equipment and storage medium
CN107733708B (en) Equipment parameter configuration method and device, computer equipment and storage medium
CN110908909B (en) Automatic test method, device, storage medium and equipment
CN108848000B (en) Network request testing method and device, computer equipment and storage medium
CN109542712B (en) Server pressure testing method and device, computer equipment and storage medium
CN109726134B (en) Interface test method and system
CN110941555B (en) Test case recommendation method and device, computer equipment and storage medium
CN110888797A (en) Test data generation method and device, computer equipment and storage medium
CN110704312A (en) Pressure testing method and device, computer equipment and storage medium
CN112527397A (en) Method and device for modifying basic input output system options and computer equipment
CN115422048A (en) Link stability testing method and device, computer equipment and storage medium
CN110618819A (en) Method and device for automatically deploying WINPE system in batches and computer equipment
CN114385485A (en) Interface test method, device, equipment and storage medium
CN109788052B (en) Server configuration remote query method, device, terminal and storage medium
CN109067605B (en) Storage subsystem fault diagnosis method and device, terminal and storage medium
CN111984520A (en) Buried point testing method, computer device and computer-readable storage medium
CN108399125B (en) Automatic testing method and device, computer equipment and storage medium
CN111159025B (en) Application program interface testing method and device, computer equipment and storage medium
CN112559352A (en) Interface test method, device, equipment and storage medium
CN111782447A (en) Batch test updating method and device based on SSH service and computer equipment
CN112612706A (en) Automated testing method, computer device and storage medium
CN110187890B (en) Project deployment method, electronic equipment and storage medium
CN113806209A (en) Interface testing method, frame, computer device and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20200214