Interface testing method and device, equipment and storage medium
Patent Information
- Application Number
- CN202380010983.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-28
- Publication Date
- 2025-06-13
AI Technical Summary
When testing multiple interfaces of each application, the prior art needs to find the storage locations of each interface separately, resulting in low testing efficiency.
By displaying the application menu on the target platform interface, displaying the interface list and test interface in response to operations, sending test requests to the server based on the set interface parameters, and parsing the feedback data to display the test results.
You can directly test without looking for interface addresses, which significantly improves the efficiency of interface testing.
Smart Images

Figure CN120153366A_ABST
Abstract
Description
Interface testing method, device, equipment and storage medium Technical Field
[0001] The present application relates to the field of software testing technology, and in particular to an interface testing method, apparatus, device and storage medium. Background Art
[0002] As the functions of business systems gradually increase, more and more applications are installed in the business systems, which makes the testing of multiple interfaces of each application more and more complicated.
[0003] In related technologies, in order to solve the above-mentioned problem of complicated work in testing multiple interfaces of each application, when multiple interfaces of a certain application need to be tested, the storage location of each interface is found separately and each interface is tested separately.
[0004] However, each time an interface needs to be tested in the above method, the storage location of the interface needs to be found first, and then the test is performed. However, since different interfaces have different storage locations and are not easy to find, the test efficiency of the above method is low.
[0005] Summary of the Invention
[0006] The embodiments of the present application provide an interface testing method, apparatus, device, and storage medium that can greatly improve the efficiency of interface testing. The technical solution is as follows:
[0007] According to a first aspect of an embodiment of the present application, there is provided an interface testing method, the method comprising:
[0008] On the target platform interface, an application menu is displayed, which includes multiple applications to be tested;
[0009] In response to an operation on a target application in the application menu, displaying an interface list of the target application, wherein the interface list displays at least one interface and interface parameters of the target application;
[0010] In response to a test operation on a target interface among the at least one interface, displaying a test interface of the target interface, the test interface displaying interface parameters of the target interface;
[0011] Based on the target interface parameters set on the test interface, a test request of the target interface is sent to the server, where the test request is used to instruct the server to test the target interface based on the target interface parameters;
[0012] The feedback data from the server is parsed, and the test results of the target interface are displayed on the test interface.
[0013] In a possible implementation, the interface parameters of the target interface include an interface address and a request method. Sending a test request for the target interface to the server based on the target interface parameters set on the test interface includes:
[0014] In response to the test initiation operation, the test request of the target interface is sent to the server based on the target interface address set for the interface address and the target request mode set for the request mode in the test interface.
[0015] In a possible implementation, different request modes correspond to different request headers and request bodies.
[0016] In a possible implementation, after displaying the interface list of the target application in response to the operation on the target application in the application menu, the method further includes:
[0017] In response to an editing operation on any one of the at least one interface, displaying an editing interface of the interface, the editing interface displaying interface parameters of the interface;
[0018] Based on the editing operation in the editing interface, updated interface parameters are displayed in the interface list.
[0019] In a possible implementation, after displaying the interface list of the target application in response to the operation on the target application in the application menu, the method further includes:
[0020] In response to a deletion operation on any one of the at least one interface, the interface parameters of the interface are deleted from the interface list.
[0021] In a possible implementation, parsing the feedback data from the server and displaying the test results on the test interface include:
[0022] Parsing the feedback data from the server to obtain annotations for each string in the feedback data;
[0023] Each character string in the feedback data and the corresponding annotations are displayed on the test interface.
[0024] In a possible implementation, the method further includes:
[0025] If the target interface is tested in different request modes, based on the multiple feedback data returned in response to the different request modes, the difference data between the multiple feedback data are highlighted on the test interface.
[0026] According to a second aspect of an embodiment of the present application, there is provided an interface testing device, the device comprising:
[0027] A first display module is used to display an application menu on the target platform interface, where the application menu includes multiple applications to be tested;
[0028] A second display module is configured to display an interface list of a target application in the application menu in response to an operation on the target application, wherein the interface list displays at least one interface and interface parameters of the target application;
[0029] a third display module, configured to display a test interface of a target interface in response to a test operation on the target interface of the at least one interface, wherein the test interface displays interface parameters of the target interface;
[0030] A sending module, configured to send a test request of a target interface to a server based on the target interface parameters set on the test interface, wherein the test request is configured to instruct the server to test the target interface based on the target interface parameters;
[0031] The parsing module is used to parse the feedback data of the server and display the test results of the target interface on the test interface.
[0032] In a possible implementation, the sending module includes:
[0033] The initiating unit is used to respond to the test initiation operation and send the test request of the target interface to the server based on the target interface address set for the interface address and the target request mode set for the request mode in the test interface.
[0034] In a possible implementation, different request modes correspond to different request headers and request bodies.
[0035] In a possible implementation, the device further includes:
[0036] An editing module, configured to display an editing interface of the interface in response to an editing operation on any one of the at least one interface, wherein the editing interface displays interface parameters of the interface;
[0037] The updating module is used to display updated interface parameters in the interface list based on the editing operation in the editing interface.
[0038] In a possible implementation, the device further includes:
[0039] The deleting module is configured to delete the interface parameters of any interface from the interface list in response to a deletion operation on the at least one interface.
[0040] In a possible implementation, the parsing module includes:
[0041] A parsing unit, configured to parse the feedback data from the server to obtain annotations for each string in the feedback data;
[0042] The annotation unit is used to display each string segment in the feedback data and the corresponding annotation on the test interface.
[0043] In a possible implementation, the device further includes:
[0044] The return module is used to highlight the difference data between the multiple feedback data returned for the different request modes on the test interface if the test is performed on the target interface in different request modes.
[0045] According to a third aspect of an embodiment of the present application, a computer device is provided, which includes a processor and a memory, wherein the memory is used to store at least one program, and the at least one program is loaded by the processor and executes the above-mentioned interface testing method.
[0046] According to a fourth aspect of an embodiment of the present application, a computer-readable storage medium is provided, in which at least one program is stored. The at least one program is loaded and executed by a processor to implement the above-mentioned interface testing method.
[0047] According to a fifth aspect of an embodiment of the present application, a computer program product is provided, which includes at least one program segment, and the at least one program segment is loaded and executed by a processor to implement the above-mentioned interface testing method.
[0048] In an embodiment of the present application, an interface testing method is provided, in which the terminal directly tests each interface of each application deployed on the server by accessing the target platform, without having to search for the interface address of each interface of each application, thereby greatly improving the interface testing efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0050] FIG1 is a schematic diagram of an implementation environment provided according to an embodiment of the present application;
[0051] FIG2 is a flow chart of an interface test according to an embodiment of the present application;
[0052] FIG3 is a first schematic diagram of a target platform interface provided according to an embodiment of the present application;
[0053] FIG4 is a second schematic diagram of a target platform interface provided according to an embodiment of the present application;
[0054] FIG5 is a schematic diagram of an example flow of an interface test provided according to an embodiment of the present application;
[0055] FIG6 is a schematic diagram of a test interface provided according to an embodiment of the present application;
[0056] FIG7 is a schematic structural diagram of an interface testing device provided according to an embodiment of the present application;
[0057] FIG8 is a schematic structural diagram of a terminal provided according to an embodiment of the present application;
[0058] FIG9 is a schematic structural diagram of a server provided according to an embodiment of the present application. DETAILED DESCRIPTION
[0059] In order to make the objectives, technical solutions and advantages of this application clearer, the implementation methods of this application will be further described in detail below with reference to the accompanying drawings.
[0060] Exemplary embodiments will be described in detail herein, with examples illustrated in the accompanying drawings. In the following description, when referring to the drawings, identical numerals in different figures represent identical or similar elements, unless otherwise indicated. The embodiments described in the following exemplary embodiments are not intended to represent all embodiments consistent with the present application. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present application, as detailed in the appended claims.
[0061] In this application, the terms "first," "second," and the like are used to distinguish identical or similar items having substantially the same role and function. It should be understood that "first," "second," and "nth" do not have a logical or temporal dependency, nor do they limit the quantity or execution order. It should also be understood that although the following description uses the terms "first," "second," and the like to describe various elements, these elements should not be limited by these terms.
[0062] These terms are simply used to distinguish one element from another. For example, without departing from the scope of various examples, a first action can be referred to as a second action, and similarly, a second action can also be referred to as a first action. Both the first action and the second action can be actions, and in some cases, can be separate and different actions.
[0063] Here, at least one refers to one or more than one. For example, at least one action can be one action, two actions, three actions, or any other action that is an integer greater than or equal to one. And multiple refers to two or more than two. For example, multiple actions can be two actions, three actions, or any other action that is an integer greater than or equal to two.
[0064] It should be noted that the data (including but not limited to test data, such as interface testing, etc.) and signals involved in this application are authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions. For example, the interface parameter data involved in this application were obtained with full authorization.
[0065] FIG1 is a schematic diagram of an implementation environment provided according to an embodiment of the present application, which may include a terminal 101 and a server 102 .
[0066] A target platform and multiple applications to be tested are deployed in the server 102. The target platform is associated with the server's database so that when a terminal accesses the target platform through a web page or application, the interfaces of the multiple applications to be tested deployed in the server's database can be viewed and tested.
[0067] The terminal 101 may be a smart phone, a wearable device, a personal computer, a laptop, a tablet computer, a smart TV, a vehicle-mounted terminal, etc.
[0068] The server 102 may be a single server, a server cluster consisting of multiple servers, or a cloud processing center.
[0069] The terminal 102 is connected to the server 102 via a wired or wireless network.
[0070] In some embodiments, the wireless network or wired network uses standard communication technologies and / or protocols. The network is typically the Internet, but can also be any network, including but not limited to a local area network (LAN), a metropolitan area network (MAN), a wide area network (MAN), a mobile, wired or wireless network, a private network or any combination of a virtual private network. In some embodiments, technologies and / or formats including Hypertext Markup Language (HTML), Extensible Markup Language (XML), etc. are used to represent data exchanged over the network. In addition, conventional encryption technologies such as Secure Socket Layer (SSL), Transport Layer Security (TLS), Virtual Private Network (VPN), Internet Protocol Security (IPsec) can also be used to encrypt all or some links. In other embodiments, customized and / or dedicated data communication technologies can also be used to replace or supplement the above-mentioned data communication technologies.
[0071] FIG2 is a flow chart of an interface testing method provided according to an embodiment of the present application. As shown in FIG2 , the present application embodiment is described by taking application to a terminal as an example. The method includes the following steps:
[0072] In step 201, the terminal displays an application menu on the target platform interface, where the application menu includes a plurality of applications to be tested.
[0073] In some embodiments, the target platform interface can be accessed through an application or a web page.
[0074] In some embodiments, each application to be tested includes multiple interfaces (Application Programming Interface, API), each interface is provided with interface parameters such as interface name, interface address, and protocol request method, so that each interface of each application to be tested deployed on the server can be directly viewed and tested by accessing the target platform.
[0075] In some embodiments, the interface parameters also include an access mode, and the access mode includes whether permission is required or not. When the access mode of any interface is permission is required, the edit button, delete button, and test button corresponding to the interface are all grayed out, so that users cannot edit, delete, and test the interface. In some embodiments, when any interface allows all users to perform tests, the access mode of the interface is permission is not required. When any interface does not allow some users to perform tests, when a user without test permission views the interface in the interface list, the access mode of the interface is permission is permission is required, and the edit button, delete button, and test button corresponding to the interface are all grayed out.
[0076] In some embodiments, as shown in FIG3 , the application menu includes applications such as monitoring and operation and maintenance applications, test import applications, applink applications, access applications, big data applications, digital twin basic applications, and megarock applications.
[0077] In step 202, in response to an operation on a target application in the application menu, the terminal displays an interface list of the target application, wherein the interface list displays at least one interface and interface parameters of the target application.
[0078] The interface list includes an interface button, a search input box, a search button, a reset button, an add button, a delete button, an edit button, and a test button. The interface button is used to open the interface list, the search input box is used to display at least one of the interface parameters, the search button is used to search based on the content in the search input box, the reset button is used to delete the content in the search input box, the add button is used to open the add interface, the delete button is used to delete any interface in the interface list, the edit button is used to open the edit interface, and the test button is used to open the test interface.
[0079] In some embodiments, as shown in FIG4 , in response to the triggering operation of the interface button, an interface list is displayed on the target platform interface. In response to the input operation on the search input box, at least one of the interface name, access method, interface address, and protocol request method of any interface is displayed in the search input box. In response to the triggering operation of the search button, the interface corresponding to the interface name in the search input box and the interface name, access method, interface address, and protocol request method of the interface are displayed on the target platform interface. In response to the triggering operation of the reset button, the content in the search input box is deleted. In response to the triggering operation of the add button, the display jumps from the target platform interface to the add interface. In response to the input operation on the add interface, the interface name, access method, interface address, and protocol request method are displayed on the add interface. In response to the save operation on the add interface, the added interface and the parameters of the interface are displayed in the interface list.
[0080] In some embodiments, the search input box includes a first search input sub-box, a second search input sub-box, a third search input sub-box and a fourth search input sub-box. In response to an input operation on the first search input sub-box, any interface name is displayed in the first search input sub-box. In response to a trigger operation on the second search input sub-box, a drop-down list of access methods is displayed. In response to a trigger operation on any access method in the drop-down list of access methods, the access method is displayed in the second search input sub-box. In response to an input operation on the third search input sub-box, any interface address is displayed in the third search input sub-box. In response to a trigger operation on the fourth search input sub-box, a drop-down list of protocol request methods is displayed. In response to a trigger operation on any protocol request method in the drop-down list of protocol request methods, the protocol request method is displayed in the fourth search input sub-box. In response to a trigger operation on the search button, an interface that matches the content in the first search input sub-box, the second search input sub-box, the third search input sub-box and the fourth search input sub-box and the interface parameters of the interface are displayed on the target platform interface.
[0081] In some embodiments, the application menu is displayed on the side or in the middle of the target platform interface.
[0082] In some embodiments, an application menu is displayed on one side of the target platform interface, and in response to an operation on a target application in the application menu, an interface list of the target application is displayed on the other side of the target platform interface. For example, in response to a triggering operation on the megarock application on the target platform interface, the interface list of the megarock application is displayed on the target platform interface.
[0083] In step 203, in response to the test operation on the target interface among the at least one interface, the terminal displays a test interface of the target interface, where the test interface displays interface parameters of the target interface.
[0084] The test interface includes an interface name input box, an interface address input box, multiple protocol request methods, a request box, and a test request button. The request box includes a request body button and a request header button. The interface name input box displays the interface name, the interface address input box displays the interface address, and the request box displays the names and contents of the request header and request body.
[0085] In step 204, the terminal sends a target interface test request to the server based on the target interface parameters set on the test interface. The test request is used to instruct the server to test the target interface based on the target interface parameters.
[0086] In some embodiments, the above step 205 includes, if the target interface is tested in different request modes, highlighting the difference data between the multiple feedback data on the test interface based on the multiple feedback data returned in response to the different request modes.
[0087] In some embodiments, as shown in FIG4 , a custom test button is displayed on the target platform interface. In response to a trigger operation on the custom test button on the target platform interface, the target platform interface jumps to the custom test interface. In response to an input operation on the custom test interface, the custom interface name, access method, interface address, and protocol request method are displayed on the custom test interface. The terminal sends a test request to the server based on the custom interface name, access method, interface address, and protocol request method. Based on the first feedback data returned for the request method, in response to an adjustment operation on the protocol request method on the custom test interface, the interface name, access method, interface address, and adjusted protocol request method are displayed on the custom test interface. The terminal sends a test request to the server based on the interface name, access method, interface address, and protocol request method displayed on the custom test interface. Based on the second feedback data returned for the request method, if there is difference data between the first feedback data and the second feedback data, such as a different server address or port, the different server address or port is highlighted, for example, in bold font.
[0088] In step 205, the terminal parses the feedback data from the server and displays the test result of the target interface on the test interface.
[0089] Feedback data includes multiple character strings and response codes. Test results include the response code value, response time, transfer size, and annotations corresponding to the multiple character strings. Response time is determined by the terminal monitoring the server's response time, while transfer size is determined by the terminal monitoring the size of the data involved in the test.
[0090] The above steps 204 to 205 can also be implemented as follows: if the target interface is tested in different request modes, based on the multiple feedback data returned for the different request modes, the difference data between the multiple feedback data are highlighted on the test interface.
[0091] In some embodiments, as shown in FIG4 , a custom test button is displayed on the target platform interface. In response to a triggering operation on the custom test button on the target platform interface, the target platform interface jumps to the custom test interface. In response to an input operation on the custom test interface, the custom interface name, access method, interface address, and protocol request method are displayed on the custom test interface. Based on the custom interface name, access method, interface address, and protocol request method, the terminal sends a test request to the server to obtain first feedback data from the server. In response to an adjustment operation on the protocol request method of the custom test interface, the interface name, access method, interface address, and the adjusted protocol request method are displayed on the custom test interface. Based on the interface name, access method, interface address, and protocol request method displayed on the custom test interface, the terminal sends a test request to the server to obtain second feedback data from the server. If there is a difference between the first feedback data and the second feedback data, the terminal highlights the difference between the first feedback data and the second feedback data on the test interface based on the first feedback data and the second feedback data returned for the different request methods. For example, if the server address or port is different, the different server address or port is highlighted, for example, in bold font.
[0092] In the embodiment of the present application, the terminal directly tests each interface of each application deployed on the server by accessing the target platform, without having to look up the interface address of each interface of each application, thereby greatly improving the testing efficiency of the interface.
[0093] The embodiment shown in Figure 2 is a brief process of an embodiment of the present application. Below, the technical solution of the present application is further explained based on Figure 5. Figure 5 is a schematic flow chart of an example of an interface testing method provided according to an embodiment of the present application. In the embodiment of the present application, the interaction process between the application terminal and the server is used as an example to illustrate. The method includes the following steps:
[0094] In step 501, the terminal displays an application menu on the target platform interface, where the application menu includes a plurality of applications to be tested.
[0095] In some embodiments, the names of multiple applications to be tested are displayed in the application menu, and the multiple applications to be tested are sorted by size; or the multiple applications to be tested are sorted by first letters; or the multiple applications to be tested are sorted by the number of times they are opened; or the multiple applications to be tested are sorted according to the default test order.
[0096] In step 502, in response to an operation on a target application in the application menu, the terminal displays an interface list of the target application, wherein the interface list displays at least one interface and interface parameters of the target application.
[0097] In step 503, in response to the test operation on the target interface among the at least one interface, the terminal displays a test interface of the target interface, where the test interface displays interface parameters of the target interface.
[0098] Step 502 and step 503 are similar to step 202 and step 203 and are not described in detail.
[0099] In step 504, the terminal sends a target interface test request to the server based on the target interface parameters set on the test interface. The test request is used to instruct the server to test the target interface based on the target interface parameters.
[0100] In some embodiments, step 504 includes, in response to a test initiation operation, sending the test request for the target interface to the server based on the target interface address set for the interface address and the target request method set for the request method in the test interface.
[0101] In some embodiments, in response to a triggering operation on a test button corresponding to any interface in the interface list, the target platform interface jumps to the test interface corresponding to the interface, the interface name of the interface is displayed in the interface name input box of the test interface, the interface address of the interface is displayed in the interface address input box, and the protocol request method of the interface is in a selected state. In response to an input operation on the request body button, the name and content of the request body are displayed, and in response to an input operation on the request header button, the name and content of the request header are displayed. As shown in Figure 6, the protocol request methods include: POST, GET, PUT, DELETE, and OPIONS. In response to a triggering operation on a test button corresponding to any interface in the interface list, the target platform interface jumps to the test interface corresponding to the interface, the interface name "xxxxx" of the interface is displayed in the interface name input box of the test interface, the interface address "xxxxxx" of the interface is displayed in the interface address input box, and the protocol request method "GET" of the interface is in a selected state.
[0102] In some embodiments, in response to a trigger operation on a request header button, a request header name input box, a request header content box, and a delete button are displayed in the request box; in response to an input operation on the request header name input box, the request header name is displayed in the request header name input box; in response to an input operation on the request header content input box, the request header content is displayed in the request header content input box; in response to a trigger operation on the delete button, the request header name input box and the request header content box are deleted from the request box. As shown in FIG6 , in response to an input operation on the request header name input box, the request header name "xxxxx" is displayed in the request header name input box; in response to an input operation on the request header content input box, the request header content "xxxxx" is displayed in the request header content input box.
[0103] In some embodiments, in response to a triggering operation on a request body button, a request body name input box, a request body content input box, and a delete button are displayed in the request box; in response to an input operation on the request body name input box, the request body name is displayed in the request body name input box; in response to an input operation on the request body content input box, the request body content is displayed in the request body content input box; in response to a triggering operation on the delete button, the request body name input box and the request body content box are deleted from the request box.
[0104] In some embodiments, the request box includes an add button. In response to triggering the add button, an add input box is displayed. In response to input operation on the add input box, add information is displayed in the add input box. The add information includes at least one of user identity information, verification code and proxy information.
[0105] In some embodiments, the above step 504 includes that different request modes correspond to different request headers and request bodies.
[0106] In some embodiments, in response to a deletion operation on any interface of the at least one interface, the interface parameters of the interface are deleted from the interface list.
[0107] In some embodiments, in response to an edit operation on any of the at least one interface, an edit interface of the interface is displayed, the edit interface displaying the interface parameters of the interface; based on the edit operation in the edit interface, the updated interface parameters are displayed in the interface list. Optionally, in response to a trigger operation on an edit button corresponding to any interface, the target platform interface jumps to the edit interface of the interface, the interface parameters of the interface are displayed in the edit interface, in response to an edit operation on the edit interface, the updated interface parameters of the interface are displayed in the edit interface, and in response to a save operation on the edit interface, the interface and the updated interface parameters of the interface are displayed in the interface list.
[0108] In step 505, the server obtains the interface parameters of the target interface in response to the test request of the target interface sent by the terminal.
[0109] In step 506 , if the application to be tested to which the target interface belongs is stored in a local server, the local server accesses the target interface in a database stored in the local server based on the interface parameter of the target interface.
[0110] The server includes a local server and an extended server. For the extended server, a proxy server is configured for the local server, and the extended server is accessed based on the proxy server.
[0111] In some embodiments, the local server accesses the target interface in the database of the local server according to the interface name, access mode, interface address, and protocol request method of the target interface.
[0112] The above step 506 is one implementation method for the server to access the target interface. In addition, the server can also access the target interface based on another implementation method: if the application to which the target interface belongs is stored in the extension server, the proxy server configured on the local server accesses the target interface in the database of the extension server based on the interface parameters of the target interface.
[0113] In some embodiments, various interfaces of various applications to be tested deployed on a local server are obtained, and some of the interfaces of the applications to be tested are stored in the database of the local server, while other interfaces of the applications to be tested are stored in the database of an extension server, to avoid excessive space occupied by the interfaces of the applications to be tested, which would affect the use of the database. In the database of the local server and the database of the extension server, each interface corresponds to an interface address. The interface address stored in the database of the extension server is accessed through a proxy server, and the interface address stored in the database of the local server is accessed through the local server. The database of the local server and the database of the extension server are both associated with the target platform, so that the terminal can not only view the various interfaces of various applications by accessing the target platform, but also quickly select any interface of any application for testing.
[0114] In some embodiments, each application to be tested is deployed on a local server, and a proxy server (engine x, Nginx) is configured for the local server. Optionally, the proxy server is configured using the following code:
[0115] In step 507, the server sends feedback data to the terminal.
[0116] In some embodiments, the server sends different feedback data to the terminal based on different interface parameters.
[0117] In step 508, the terminal parses the feedback data from the server and displays the test result of the target interface on the test interface.
[0118] In some embodiments, the above steps include parsing the feedback data from the server to obtain annotations for each string segment in the feedback data; and displaying each string segment in the feedback data and the corresponding annotations on the test interface.
[0119] In some embodiments, after obtaining the response code, the terminal calls the first parsing function to parse the response code to obtain the value of the response code. After obtaining multiple character strings, the terminal calls the second parsing function to parse the multiple character strings to obtain the annotations corresponding to each character string. Optionally, the terminal obtains the response time (duration) and transfer size (transferSize) in JavaScript through the following code: const requests=window.performance.getEntries().filter (i=>i.name.includes(this.form.api)) const lastRequest=requests[requests.length-1] this.duration=Math.ceil(lastRequest.duration) this.transferSize=this.sizeTostr(lastRequest.transferSize)
[0120] As shown in Figure 6, the terminal determines that the target interface test is successful through the response code value 200, the response time value 156ms and the annotation of the multi-segment character string. If the response code value is not 200 and the annotation of the multi-segment character string includes "business processing failure", the target interface test is determined to have failed.
[0121] In the embodiment of the present application, the terminal directly tests each interface of each application deployed on the server by accessing the target platform, without having to look up the interface address of each interface of each application, thereby greatly improving the testing efficiency of the interface.
[0122] FIG7 is an interface testing device 700 provided according to an embodiment of the present application, the device comprising:
[0123] The first display module 701 is used to display an application menu on the target platform interface, where the application menu includes multiple applications to be tested;
[0124] A second display module 702 is configured to display an interface list of a target application in the application menu in response to an operation on the target application, wherein the interface list displays at least one interface and interface parameters of the target application;
[0125] A third display module 703 is configured to display a test interface of a target interface in response to a test operation on the target interface of the at least one interface, wherein the test interface displays interface parameters of the target interface;
[0126] A sending module 704 is configured to send a test request of the target interface to the server based on the target interface parameters set on the test interface, wherein the test request is configured to instruct the server to test the target interface based on the target interface parameters;
[0127] The parsing module 705 is used to parse the feedback data from the server and display the test result of the target interface on the test interface.
[0128] In a possible implementation, the sending module 704 includes:
[0129] An initiating unit is used to respond to a test initiation operation, and based on the target interface address set for the interface address and the target request method set for the request method in the test interface, send the test request of the target interface to the server. In one possible implementation method, different request methods correspond to different request headers and request bodies.
[0130] In a possible implementation, the device further includes:
[0131] An editing module, configured to display an editing interface of the interface in response to an editing operation on any one of the at least one interface, wherein the editing interface displays interface parameters of the interface;
[0132] The updating module is used to display updated interface parameters in the interface list based on the editing operation in the editing interface.
[0133] In a possible implementation, the device further includes:
[0134] The deleting module is configured to delete the interface parameters of any interface from the interface list in response to a deletion operation on the at least one interface.
[0135] In a possible implementation, the parsing module 705 includes:
[0136] A parsing unit, configured to parse the feedback data from the server to obtain annotations for each string in the feedback data;
[0137] The annotation unit is used to display each string segment in the feedback data and the corresponding annotation on the test interface.
[0138] In a possible implementation, the device further includes:
[0139] The return module is used to highlight the difference data between the multiple feedback data returned for the different request modes on the test interface if the test is performed on the target interface in different request modes.
[0140] It should be noted that the interface testing device provided in the above embodiment only uses the division of the above functional modules as an example when executing the corresponding steps. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the interface testing device provided in the above embodiment and the interface testing method embodiment are based on the same concept. The specific implementation process is detailed in the method embodiment and will not be repeated here.
[0141] In the embodiment of the present application, the terminal directly tests each interface of each application deployed on the server by accessing the target platform, without having to look up the interface address of each interface of each application, thereby greatly improving the testing efficiency of the interface.
[0142] An embodiment of the present application further provides a computer device, including a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein the processor implements the above method when executing the computer program.
[0143] Taking a computer device as an example, FIG8 is a schematic diagram of the structure of a terminal provided in an embodiment of the present application. Referring to FIG8 , terminal 800 may be a smartphone, a tablet computer, an MP3 player (Moving Picture Experts Group Audio Layer III), an MP4 player (Moving Picture Experts Group Audio Layer IV), a laptop computer, or a desktop computer. Terminal 800 may also be referred to as a user device, a portable terminal, a laptop terminal, a desktop terminal, or other similar names.
[0144] Typically, the terminal 800 includes a processor 801 and a memory 802 .
[0145] The processor 801 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 801 may be implemented in at least one hardware form of DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), or PLA (Programmable Logic Array). The processor 801 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the awake state, also known as a CPU (Central Processing Unit); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 801 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 801 may also include an AI (Artificial Intelligence) processor, which is used to process computing operations related to machine learning.
[0146] The memory 802 may include one or more computer-readable storage media, which may be non-transitory. The memory 802 may also include high-speed random access memory and non-volatile memory, such as one or more disk storage devices and flash memory storage devices. In some embodiments, the non-transitory computer-readable storage medium in the memory 802 is used to store at least one program code, which is used to be executed by the processor 801 to implement the process executed by the terminal in the background removal method provided in the method embodiment of the present disclosure.
[0147] In some embodiments, terminal 800 may optionally include a peripheral device interface 803 and at least one peripheral device. The processor 801, memory 802, and peripheral device interface 803 may be connected via a bus or signal lines. Each peripheral device may be connected to peripheral device interface 803 via a bus, signal lines, or circuit boards. Specifically, the peripheral device may include at least one of a radio frequency circuit 804, a display screen 805, a camera assembly 806, an audio circuit 807, and a power supply 808.
[0148] The peripheral device interface 803 can be used to connect at least one I / O (Input / Output)-related peripheral device to the processor 801 and the memory 802. In some embodiments, the processor 801, the memory 802, and the peripheral device interface 803 are integrated on the same chip or circuit board; in some other embodiments, any one or two of the processor 801, the memory 802, and the peripheral device interface 803 can be implemented on separate chips or circuit boards, which is not limited in the present disclosure.
[0149] The RF circuit 804 is used to receive and transmit RF (Radio Frequency) signals, also known as electromagnetic signals. The RF circuit 804 communicates with communication networks and other communication devices via electromagnetic signals. The RF circuit 804 converts electrical signals into electromagnetic signals for transmission, or converts received electromagnetic signals into electrical signals. In some embodiments, the RF circuit 804 includes an antenna system, an RF transceiver, one or more amplifiers, a tuner, an oscillator, a digital signal processor, a codec chipset, a user identity module card, and the like. The RF circuit 804 can communicate with other terminals via at least one wireless communication protocol. Such wireless communication protocols include, but are not limited to, metropolitan area networks, various generations of mobile communication networks (2G, 3G, 4G, and 5G), wireless local area networks, and / or WiFi (Wireless Fidelity) networks. In some embodiments, the RF circuit 804 may also include circuitry related to Near Field Communication (NFC), although this disclosure does not limit this.
[0150] Display screen 805 is used to display a user interface (UI). This UI may include graphics, text, icons, videos, or any combination thereof. When display screen 805 is a touchscreen display, it is also capable of collecting touch signals on or above the surface of display screen 805. These touch signals can be input as control signals to processor 801 for processing. Display screen 805 can also be used to provide virtual buttons and / or a virtual keyboard, also known as soft buttons and / or a soft keyboard. In some embodiments, there can be one display screen 805, located on the front panel of terminal 800. In other embodiments, there can be at least two display screens 805, located on different surfaces of terminal 800 or in a foldable design. In still other embodiments, display screen 805 can be a flexible display, located on a curved or foldable surface of terminal 800. Display screen 805 can also be configured as a non-rectangular, irregular shape, also known as a special-shaped screen. Display screen 805 can be made of materials such as LCD (Liquid Crystal Display) and OLED (Organic Light-Emitting Diode).
[0151] The camera assembly 806 is used to capture images or videos. In some embodiments, the camera assembly 806 includes a front camera and a rear camera. Typically, the front camera is arranged on the front panel of the terminal, and the rear camera is arranged on the back of the terminal. In some embodiments, there are at least two rear cameras, which are any one of a main camera, a depth of field camera, a wide-angle camera, and a telephoto camera, so as to realize the fusion of the main camera and the depth of field camera to realize the background blur function, the fusion of the main camera and the wide-angle camera to realize panoramic shooting and VR (Virtual Reality) shooting function or other fusion shooting functions. In some embodiments, the camera assembly 806 may also include a flash. The flash can be a single-color temperature flash or a dual-color temperature flash. A dual-color temperature flash refers to a combination of a warm light flash and a cold light flash, which can be used for light compensation at different color temperatures.
[0152] The audio circuit 807 may include a microphone and a speaker. The microphone is used to collect sound waves from the user and the environment, and convert the sound waves into electrical signals that are input into the processor 801 for processing, or input into the radio frequency circuit 804 to achieve voice communication. For the purpose of stereo sound collection or noise reduction, there may be multiple microphones, each located in different parts of the terminal 800. The microphone may also be an array microphone or an omnidirectional collection microphone. The speaker is used to convert electrical signals from the processor 801 or the radio frequency circuit 804 into sound waves. The speaker may be a traditional thin film speaker or a piezoelectric ceramic speaker. When the speaker is a piezoelectric ceramic speaker, it can not only convert electrical signals into sound waves audible to humans, but also convert electrical signals into sound waves inaudible to humans for purposes such as ranging. In some embodiments, the audio circuit 807 may also include a headphone jack.
[0153] Power supply 808 is used to power various components in terminal 800. Power supply 808 can be AC power, DC power, a disposable battery, or a rechargeable battery. When power supply 808 includes a rechargeable battery, the rechargeable battery can support wired charging or wireless charging. The rechargeable battery can also be used to support fast charging technology.
[0154] In some embodiments, the terminal 800 further includes one or more sensors 809 , including but not limited to: an acceleration sensor 810 , a gyroscope sensor 811 , a pressure sensor 812 , an optical sensor 813 , and a proximity sensor 814 .
[0155] The accelerometer 810 can detect the magnitude of acceleration along the three coordinate axes of the coordinate system established by the terminal 800. For example, the accelerometer 810 can be used to detect the components of gravity acceleration along the three coordinate axes. The processor 801 can control the display screen 805 to display the user interface in a landscape or portrait view based on the gravity acceleration signal collected by the accelerometer 810. The accelerometer 810 can also be used to collect game or user motion data.
[0156] The gyroscope sensor 811 can detect the orientation and rotation angle of the terminal 800. It can also work with the accelerometer 810 to collect the user's three-dimensional movements of the terminal 800. Based on the data collected by the gyroscope sensor 811, the processor 801 can implement the following functions: motion sensing (for example, changing the UI based on the user's tilt operation), image stabilization during shooting, game control, and inertial navigation.
[0157] The pressure sensor 812 can be provided on the side frame of the terminal 800 and / or below the display screen 805. When the pressure sensor 812 is provided on the side frame of the terminal 800, it can detect the user's gripping signal of the terminal 800. The processor 801 performs left and right hand recognition or shortcut operations based on the gripping signal collected by the pressure sensor 812. When the pressure sensor 812 is provided below the display screen 805, the processor 801 controls the operable controls on the UI interface based on the user's pressure operation on the display screen 805. Operable controls include at least one of a button control, a scroll bar control, an icon control, and a menu control.
[0158] The optical sensor 813 is used to detect ambient light intensity. In one embodiment, the processor 801 can control the display brightness of the display screen 805 based on the ambient light intensity detected by the optical sensor 813. Specifically, when the ambient light intensity is high, the display brightness of the display screen 805 is increased; when the ambient light intensity is low, the display brightness of the display screen 805 is decreased. In another embodiment, the processor 801 can also dynamically adjust the shooting parameters of the camera assembly 806 based on the ambient light intensity detected by the optical sensor 813.
[0159] Proximity sensor 814, also known as a distance sensor, is typically located on the front panel of terminal 800. Proximity sensor 814 is used to detect the distance between the user and the front of terminal 800. In one embodiment, when proximity sensor 814 detects that the distance between the user and the front of terminal 800 is gradually decreasing, processor 801 controls display screen 805 to switch from the screen-on state to the screen-off state. When proximity sensor 814 detects that the distance between the user and the front of terminal 800 is gradually increasing, processor 801 controls display screen 805 to switch from the screen-off state to the screen-on state.
[0160] Those skilled in the art will appreciate that the structure shown in FIG8 does not limit the terminal 800 and may include more or fewer components than shown, or combine certain components, or adopt a different component arrangement.
[0161] Taking the computer device as a server as an example, FIG9 is a schematic diagram of the structure of a server provided in an embodiment of the present application. The server 900 may have relatively large differences due to different configurations or performances, and may include one or more processors (Central Processing Units, CPU) 901 and one or more memories 902, wherein the one or more memories 902 store at least one computer program, and the at least one computer program is loaded and executed by the one or more processors 901 to implement the above-mentioned interface testing method. Of course, the server 900 may also have components such as a wired or wireless network interface, a keyboard, and an input and output interface for input and output. The server 900 may also include other components for implementing device functions, which will not be described in detail here.
[0162] An embodiment of the present application further provides a computer-readable storage medium, the computer-readable storage medium including a stored computer program, wherein when the computer program is executed, the device containing the computer-readable storage medium is controlled to execute the interface testing method described above. Optionally, the computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a compact disc (CD-ROM), a magnetic tape, a floppy disk, an optical data storage device, or the like.
[0163] An embodiment of the present application further provides a computer program product, which implements the interface testing method described above when executed by a processor.
[0164] Those skilled in the art will understand that all or part of the steps to implement the above embodiments may be accomplished by hardware, or by a program to instruct the relevant hardware, and the program may be stored in a computer-readable storage medium, which may be a read-only memory, a disk, or an optical disk, etc.
[0165] The above description is merely an optional embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present application shall be included in the scope of protection of the present application.
Claims
1. An interface testing method, characterized in that: include: On the target platform interface, displaying an application menu, wherein the application menu includes a plurality of applications to be tested; In response to an operation on a target application in the application menu, displaying an interface list of the target application, wherein the interface list displays at least one interface and interface parameters of the target application; In response to a test operation on a target interface among the at least one interface, displaying a test interface of the target interface, wherein the test interface displays interface parameters of the target interface; Based on the target interface parameters set on the test interface, sending a test request of the target interface to the server, the test request is used to instruct the server to test the target interface based on the target interface parameters; The feedback data from the server is parsed, and the test result of the target interface is displayed on the test interface.
2. The method according to claim 1, characterized in that The interface parameters of the target interface include an interface address and a request mode, and sending a test request of the target interface to the server based on the target interface parameters set on the test interface includes: In response to a test initiation operation, the test request for the target interface is sent to a server based on the target interface address set for the interface address and the target request mode set for the request mode in the test interface.
3. The method according to claim 2, characterized in that Different request methods correspond to different request headers and request bodies.
4. The method according to claim 1, characterized in that: After displaying the interface list of the target application in response to the operation on the target application in the application menu, the method further includes: In response to an editing operation on any one of the at least one interface, displaying an editing interface of the interface, wherein the editing interface displays interface parameters of the interface; Based on the editing operation in the editing interface, updated interface parameters are displayed in the interface list.
5. The method according to claim 1, characterized in that After displaying the interface list of the target application in response to the operation on the target application in the application menu, the method further includes: In response to a deletion operation on any one of the at least one interface, the interface parameters of the interface are deleted from the interface list.
6. The method according to claim 1, characterized in that The parsing of the feedback data from the server and displaying the test results on the test interface include: Parsing the feedback data from the server to obtain annotations for each string in the feedback data; Each string segment in the feedback data and the corresponding annotation are displayed on the test interface.
7. The method according to claim 1, characterized in that The method further comprises: If the target interface is tested in different request modes, based on the multiple feedback data returned in response to the different request modes, the difference data between the multiple feedback data are highlighted on the test interface.
8. An interface testing device, characterized in that: include: A first display module is used to display an application menu on a target platform interface, wherein the application menu includes a plurality of applications to be tested; A second display module, configured to display an interface list of the target application in response to an operation on the target application in the application menu, wherein the interface list displays at least one interface and interface parameters of the target application; A third display module, configured to display a test interface of the target interface in response to a test operation on the target interface among the at least one interface, wherein the test interface displays interface parameters of the target interface; A sending module is used to send a test request of the target interface to the server based on the target interface parameters set on the test interface, and the test request is used to instruct the server to perform a test based on the target interface parameters. Testing the target interface according to the interface parameters; The parsing module is used to parse the feedback data of the server and display the test result of the target interface on the test interface.
9. A computer device, characterized in that: The computer device includes a processor and a memory, wherein the memory is used to store at least one program, and the at least one program is loaded by the processor and executes the interface testing method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores at least one program, and the at least one program is loaded and executed by a processor to implement the interface testing method according to any one of claims 1 to 7.
11. A computer program product, characterized in that The computer program product comprises at least one program, and the at least one program is loaded and executed by a processor to implement the interface testing method according to any one of claims 1 to 7.