Interface test method, interface test system, computer device and storage medium
Patent Information
- Application Number
- CN202211114495.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-14
- Publication Date
- 2026-09-25
- Estimated Expiration
- 2042-09-14
AI Technical Summary
[0004]有鉴于此,本发明提供了一种接口测试方法、接口测试系统、计算机设备及存储介质,主要目的在于解决目前对于新功能的异常接口,需要测试人员消耗大量的精力与时间对异常接口进行问题的排查,新功能验收效率不高的问题
[0032]依据本申请第四方面,提供了一种可读存储介质,其上存储有计算机程序,所述计算机程序被处理器执行时实现上述第一方面中任一项所述的方法的步骤。
Smart Images

Figure CN115495344B_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of operation and maintenance technology, and more specifically, relates to an interface testing method, an interface testing system, a computer device, and a storage medium. Background Technology
[0002] As companies expand their businesses, the functionality of their applications also increases. After developers create new features, they submit test versions of the new feature interfaces for each version, which are then accepted by testers.
[0003] In practice, testers need to test new features before accepting them, and only proceed with business logic testing after confirming the interfaces are functioning correctly. However, the applicant recognizes that developers sometimes hand over new feature interfaces to testers without self-testing their accessibility. Testers often need to test multiple features simultaneously, and if an interface is faulty, they need to review various error messages from several interfaces to determine if it's inaccessible. This requires significant time and effort for troubleshooting, resulting in low efficiency for new feature acceptance. Therefore, the applicant seeks to develop an interface testing method that allows testers to quickly determine if multiple new feature interfaces are functioning correctly and to identify interface anomalies earlier. Summary of the Invention
[0004] In view of this, the present invention provides an interface testing method, an interface testing system, a computer device, and a storage medium. The main purpose is to solve the problem that currently, for abnormal interfaces of new functions, testers need to spend a lot of energy and time to troubleshoot abnormal interfaces, resulting in low efficiency of new function acceptance.
[0005] According to the first aspect of this application, an interface testing method is provided, the method comprising:
[0006] When multiple interface information to be tested is received from the client, multiple interface test requests are constructed using the multiple interface information to be tested, and the multiple interface test requests are transmitted to the application system. Each interface test request carries a preset test identifier and interface information to be tested.
[0007] Collect the interface requests received by each system interface in the application system, and obtain at least one interface test request carrying the preset test identifier.
[0008] At least one interface information to be tested is extracted from the at least one interface test request. The at least one interface information to be tested is marked with a test success identifier, and the marked at least one interface information to be tested is transmitted to the client so that the client can display the marked at least one interface information to be tested. Other interface information to be tested is marked with a test failure identifier, wherein the other interface information to be tested is the interface information to be tested other than the at least one interface information to be tested among the plurality of interface information to be tested.
[0009] Optionally, before constructing multiple interface test requests using the multiple interface test requests and transmitting the multiple interface test requests to the application system after receiving multiple interface test information transmitted by the client, the method further includes:
[0010] In response to a user's test trigger action, a test page is transmitted to the client so that the client can display the test page;
[0011] When the client detects that the user has confirmed the test page, the client obtains the Internet Protocol (IP) address and the multiple interface information to be tested entered by the user on the test page, marks the multiple interface information to be tested with the IP address, and transmits the marked multiple interface information to the test plugin. Each interface information to be tested includes an interface type and an interface address.
[0012] Optionally, the test page includes an IP address identifier and IP address input unit, an interface type identifier and multiple interface type input units, an interface address identifier and multiple interface address input units, a test result identifier and multiple test result display units, and a startup unit.
[0013] Optionally, the step of constructing multiple interface test requests using the multiple interface information to be tested, and transmitting the multiple interface test requests to the application system, includes:
[0014] For each interface to be tested, perform the following operations: obtain the interface type and interface address from the interface to be tested information, and construct an initial test request based on the interface type and the interface address;
[0015] Obtain multiple initial test requests, add the preset test identifier to each of the multiple initial test requests, and obtain the multiple interface test requests;
[0016] The server indicated by the IP address is determined, and the multiple interface test requests are transmitted to the server, which then distributes the multiple interface test requests to the application system.
[0017] Optionally, the step of collecting interface requests received by each system interface in the application system and obtaining at least one collected interface test request carrying the preset test identifier includes:
[0018] Collect the interface requests received by each system interface in the application system, and detect whether each interface request carries the preset test identifier;
[0019] If an interface request carries the preset test identifier, then the interface request is determined to be an interface test request;
[0020] The interface requests sent to the application system are continuously monitored to obtain at least one interface test request.
[0021] Optionally, the steps of extracting at least one interface information to be tested from the at least one interface test request, marking the at least one interface information to be tested with a test success identifier, transmitting the marked at least one interface information to be tested to the client so that the client displays the marked at least one interface information to be tested, and marking other interface information to be tested with a test failure identifier, include:
[0022] Obtain the test success identifier, extract the information of the at least one interface to be tested carried in the at least one interface test request, mark the at least one interface to be tested information with the test success identifier, and transmit the marked at least one interface to be tested information to the client;
[0023] The client determines the other interface information to be tested from the plurality of interface information to be tested based on the received at least one interface information to be tested, obtains the test failure identifier, and displays the at least one interface information to be tested after being marked on the test page, and marks the other interface information to be tested on the test page using the test failure identifier.
[0024] Optionally, after extracting at least one interface information to be tested from the at least one interface test request, marking the at least one interface information to be tested with a test success identifier, transmitting the marked at least one interface information to be tested to the client so that the client displays the marked at least one interface information to be tested, and marking other interface information to be tested with a test failure identifier, the method further includes:
[0025] Query the log files associated with the other interfaces to be tested, and generate redirect links to the log files;
[0026] The redirect link is sent to the client, so that the client can use the redirect link to annotate the other interface information to be tested on the test page;
[0027] When a log jump instruction is received from the client, the log file is transmitted to the client so that the client can display the log file. The log jump instruction is generated and sent by the client when it detects that the jump link has been triggered.
[0028] According to a second aspect of this application, an interface testing system is provided, the system comprising:
[0029] The client is used to transmit multiple interface information to be tested; receive at least one interface information to be tested after being marked, and display the marked at least one interface information to be tested, and mark other interface information to be tested with test failure flags, wherein the other interface information to be tested is the interface information to be tested other than the at least one interface information to be tested among the multiple interface information to be tested;
[0030] A testing plugin is used to construct multiple interface test requests using the multiple interface information to be tested transmitted by the client when receiving such information from the client. The plugin then transmits these multiple interface test requests to the application system, wherein each interface test request carries a preset test identifier and interface information to be tested. The plugin also collects interface requests received by each system interface in the application system, obtains at least one interface test request carrying the preset test identifier, extracts at least one interface information to be tested from the at least one interface test request, marks the at least one interface information to be tested with a test success identifier, and transmits the marked at least one interface information to the client.
[0031] According to a third aspect of this application, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps of the method described in any of the first aspects above.
[0032] According to a fourth aspect of this application, a readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the steps of the method described in any one of the first aspects above.
[0033] By employing the above technical solution, this application provides an interface testing method. A testing plugin can construct multiple interface test requests based on received information about multiple interfaces to be tested, and transmit these requests to the application system. The testing plugin collects interface requests received by each system interface in the application system, obtaining at least one interface test request carrying a preset test identifier. The testing plugin uses a test success identifier to mark at least one interface information to be tested extracted from at least one interface test request, and transmits the marked at least one interface information to the client. The client displays the received marked at least one interface information to be tested. Simultaneously, the client uses a test failure identifier to mark and display other interface information to be tested that failed. That is, if the system interface is normal, the testing plugin will detect that the interface test requests received by that system interface carry a preset test identifier. For interfaces to be tested that do not carry a preset test identifier, the testing plugin considers this interface to be an abnormal interface. The client displays the test results based on the interface test information fed back by the testing plugin. Therefore, this method allows testers to avoid expending a lot of effort and time troubleshooting abnormal interfaces when accepting new features, thereby improving the efficiency of new feature acceptance.
[0034] The above description is merely an overview of the technical solution of the present invention. In order to better understand the technical means of the present invention and to implement it in accordance with the contents of the specification, and in order to make the above and other objects, features and advantages of the present invention more apparent and understandable, specific embodiments of the present invention are described below. Attached Figure Description
[0035] Various other advantages and benefits will become apparent to those skilled in the art upon reading the following detailed description of preferred embodiments. The accompanying drawings are for illustrative purposes only and are not intended to limit the invention. Furthermore, the same reference numerals denote the same parts throughout the drawings. In the drawings:
[0036] Figure 1 A flowchart of an interface testing method provided in an embodiment of this application is shown.
[0037] Figure 2 A flowchart of another interface testing method provided in an embodiment of this application is shown.
[0038] Figure 3 This illustration shows a schematic diagram of the interaction between the client and the test plugin in another interface testing method provided in this application embodiment.
[0039] Figure 4 A structural diagram of an interface testing system provided in an embodiment of this application is shown.
[0040] Figure 5 A schematic diagram of the device structure of the computer equipment provided in the embodiments of this application is shown; Detailed Implementation
[0041] Various embodiments and features of this application are described herein with reference to the accompanying drawings.
[0042] It should be understood that various modifications can be made to the embodiments described herein. Therefore, the above description should not be considered as limiting, but merely as an example of embodiments. Other modifications within the scope and spirit of this application will be apparent to those skilled in the art.
[0043] The accompanying drawings, which are included in and form part of this specification, illustrate embodiments of the present application and, together with the general description of the present application given above and the detailed description of the embodiments given below, serve to explain the principles of the present application.
[0044] These and other features of this application will become apparent from the following description of preferred forms of embodiments given as non-limiting examples, with reference to the accompanying drawings.
[0045] It should also be understood that although this application has been described with reference to some specific examples, those skilled in the art can certainly implement many other equivalent forms of this application.
[0046] The above and other aspects, features and advantages of this application will become more apparent when taken in conjunction with the accompanying drawings and in view of the following detailed description.
[0047] Specific embodiments of this application are described thereafter with reference to the accompanying drawings; however, it should be understood that the claimed embodiments are merely examples of this application, which can be implemented in various ways. Well-known and / or repeated functions and structures are not described in detail to avoid unnecessary or redundant details that could obscure the application. Therefore, the specific structural and functional details claimed herein are not intended to be limiting, but merely serve as the basis and representative basis for the claims to teach those skilled in the art to use this application in a variety of substantially any suitable detailed structures.
[0048] This specification may use the phrases “in one embodiment,” “in another embodiment,” “in yet another embodiment,” or “in other embodiments,” all of which may refer to one or more of the same or different embodiments according to this application.
[0049] This application provides an interface testing method, such as... Figure 1 As shown, the method includes:
[0050] 101. When multiple interface information to be tested is received from the client, multiple interface test requests are constructed using the multiple interface information to be tested, and the multiple interface test requests are transmitted to the application system.
[0051] In this embodiment of the application, when the test plugin receives multiple interface information to be tested transmitted by the client, the test plugin obtains the interface information to be tested of multiple system interfaces in the application system, and constructs multiple interface test requests using the multiple interface information to be tested, and sends the multiple interface test requests to the corresponding application system. Each interface test request carries a preset test identifier and interface information to be tested.
[0052] There are three forms of client-side presentation: text-based clients, graphical interfaces, and web pages. Text-based clients are implemented via command lines, while graphical interfaces are operated by clicking on functional modules (e.g., QQ). Both text-based clients and graphical interfaces have high development costs. In contrast, web pages do not require installation or updates and can be used across platforms. Therefore, clients tend to prefer using web pages to interact with users. Based on this, the client in this embodiment uses a web page to interact with the user. The web page consists of three parts: HTML (Hypertext Markup Language), CSS (Cascading Style Sheets), and JavaScript. HTML defines the web page structure, CSS controls the styles of elements on the page, beautifying the page, and JavaScript defines the page behavior, responding to user actions. This can be understood as HTML constructing the skeletal framework of a human body, CSS adding flesh and blood to the framework (dressing it up), and JavaScript giving it life and making it move.
[0053] 102. Collect the interface requests received by each system interface in the application system, and obtain at least one interface test request carrying a preset test identifier.
[0054] The inventors recognized that when testers accept new features submitted by developers, developers sometimes fail to self-test whether the new feature interfaces are accessible before handing them over to testers for acceptance. Testers often test multiple features simultaneously, and if an interface is abnormal, testers need to go through various error messages from several interfaces to find out that the interface is inaccessible. Testers need to spend a lot of energy and time troubleshooting. Based on this, the testers developed a testing plugin that is mounted on the server of the application system. The server can be a standalone server or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDN), and big data and artificial intelligence platforms. This allows the testing plugin to properly collect interface requests received by each system interface in the application system, thus implementing the technical solution described in this application.
[0055] In this embodiment, after the test plugin transmits multiple interface test requests to the corresponding application system, the test plugin intercepts the interface requests sent to the application system and determines whether the interface request sent to each system interface in the application system carries a preset test identifier, thereby obtaining at least one interface test request carrying a preset test identifier.
[0056] 103. Extract at least one interface information to be tested from at least one interface test request, mark at least one interface information to be tested with a test success identifier, and transmit the marked at least one interface information to be tested to the client.
[0057] In this embodiment, the test plugin extracts at least one interface information to be tested from at least one interface test request. Then, the test plugin marks the at least one interface information to be tested with the acquired test success identifier, obtaining the marked at least one interface information to be tested. This marked at least one interface information to be tested is then transmitted to the client. It should be noted that for interface test requests that do not detect an interface carrying a preset test identifier, the test plugin does not provide any feedback to the client. The client receives the marked at least one interface information to be tested transmitted by the test plugin and displays it. For other interface information to be tested that failed the test, the client marks the other interface information to be tested with a test failure identifier. The other interface information to be tested refers to the interface information to be tested other than the at least one interface information to be tested among multiple interface information to be tested.
[0058] The method provided in this application embodiment can construct multiple interface test requests based on received multiple interface information to be tested, and transmit these multiple interface test requests to the application system. The test plugin collects the interface requests received by each system interface in the application system, and obtains at least one interface test request carrying a preset test identifier. The test plugin uses a test success identifier to mark at least one interface information to be tested extracted from at least one interface test request, and transmits the marked at least one interface information to be tested to the client. The client displays the received marked at least one interface information to be tested. At the same time, the client uses a test failure identifier to mark and display other interface information to be tested that failed the test. That is, if the system interface is normal, the test plugin will detect that the interface test request received by the system interface carries a preset test identifier. For the interface to be tested that does not carry a preset test identifier, the test plugin considers this interface to be an abnormal interface. The client displays the test results based on the interface test information fed back by the test plugin. Therefore, the above method allows testers to avoid spending a lot of effort and time troubleshooting abnormal interfaces when accepting new functions, thereby improving the efficiency of new function acceptance.
[0059] This application provides an interface testing method, such as... Figure 2 As shown, the method includes:
[0060] 201. In response to the user's test trigger action, the test plugin transmits the test page to the client.
[0061] In this embodiment, the test plugin responds to the user's test trigger operation by transmitting a test page to the client, and the client displays the received test page. When the client detects that the user has confirmed the test page, the client obtains the Internet Protocol (IP) address and multiple interface information to be tested entered by the user on the test page. The client annotates the multiple interface information to be tested using the IP address and transmits the annotated multiple interface information to the test plugin. Each interface information to be tested includes an interface type and an interface address.
[0062] In this embodiment, the client interacts with the user using a test page. After receiving the test page transmitted by the test plugin, the client displays the test page to the user so that the user can input relevant information. In an optional embodiment, the test page includes an IP address identifier and an IP address input unit, an interface type identifier and multiple interface type input units, an interface address identifier and multiple interface address input units, a test result identifier and multiple test result display units, and a startup unit. The user can input an IP address in the IP address input unit, an interface type in the interface type input unit, and an interface address in the interface address input unit. Specifically, the user inputs the IP address of the server running the application system into the IP address input unit, so that the client can find the IP machine providing the service through the IP address. Furthermore, the interface type that the user can input into the interface type input unit includes, but is not limited to, HTTP (Hypertext Transfer Protocol)... The HTTP type is used to verify the echo test of the URL address in the web application system, while the Dubbo type is used to verify the echo test of the Dubbo interface provided by the Dubbo framework. In actual operation, as long as the application system has a certain interface type, the interface type can be added to the interface type input unit through the extension function.
[0063] Dubbo is an open-source, high-performance service framework that enables applications to output and input services through high-performance Remote Procedure Calls (RPCs). Dubbo is also a high-performance, lightweight open-source Java RPC framework that provides three core capabilities: interface-oriented remote method invocation, intelligent fault tolerance and load balancing, and automatic service registration and discovery. Dubbo's type interfaces are dedicated to providing high-performance and transparent RPC remote service invocation solutions, as well as SOA service governance solutions. The Dubbo framework departs from the traditional web service model, instead using a service provider model that exposes services and a service consumer model that invokes remote services.
[0064] It should be noted that the number of interface type input units can be flexibly set according to user needs. The number of interface address input units and test result display units are equal to the number of interface type input units. For example, if the number of interface type input units is set to 4, then the corresponding number of interface address input units and test result display units will both be 4. Furthermore, in actual operation, the test result identifier can also be called the echo result identifier. The specific label can also be flexibly set according to industry labeling rules and personal habits. Similar to the above rules, the activation unit can also be called the echo verification trigger unit or something else.
[0065] For example, the process by which the client obtains the IP address and information about multiple interfaces to be tested is as follows:
[0066] First, the client receives and displays the test page transmitted from the test page. The test page includes an IP address identifier and an IP address input unit, an interface type identifier and four interface type input units, an interface address identifier and four interface address input units, an echo result identifier and four echo result display units, and an echo verification trigger unit. Then, the user enters the server's IP address (e.g., 1.2.3.4) in the IP address input unit. Next, the user enters the interface type and corresponding interface address in the four interface type input units and their respective interface address input units, triggering the echo verification trigger unit. Finally, the client detects the user's trigger operation and further confirms whether an interface test request has been detected. If an interface test request has been detected, the client obtains the IP address, the entered interface type, and the corresponding interface address for each interface type.
[0067] 202. When the test plugin receives multiple interface information to be tested from the client, it constructs multiple interface test requests using the multiple interface information to be tested, and transmits the multiple interface test requests.
[0068] In this embodiment, the test plugin performs the following operations for each set of interface types and corresponding interface addresses: The test plugin constructs an initial test request based on the interface type and interface address, thereby obtaining multiple initial test requests. Subsequently, the test plugin adds a preset test identifier to each of the multiple initial test requests, thus obtaining multiple interface test requests. Finally, the test plugin determines the server indicated by the IP address and transmits the multiple interface test requests to that server, which then distributes the multiple interface test requests to the application system. For example, the process of constructing and transmitting multiple interface test requests is as follows:
[0069] Based on the number of interface type input units in step 201, the test plugin can construct 4 initial test requests based on the interface type and interface address. The test plugin adds a preset test identifier to each initial test request to obtain 4 interface test requests. The preset test identifier includes, but is not limited to, echo=true. Then, the test plugin sends the 4 interface test requests to the server indicated by the IP address, and the server distributes the 4 interface test requests to the application system.
[0070] 203. The test plugin collects the interface requests received by each system interface in the application system and obtains at least one interface test request carrying a preset test identifier.
[0071] In this embodiment, firstly, the test plugin intercepts all interface requests sent to the application system. That is, the test plugin collects interface requests received by each system interface in the application system. These interface requests can be interface test requests sent by the client of this application or interface requests sent by other clients. Then, the test plugin checks whether each interface request carries the preset test identifier `echo=true` from step 202. If an interface request carries `echo=true`, it can be determined that the interface request is an interface test request. Since the test interfaces sent to the application system are continuously sent, the test plugin continuously detects the interface requests sent to the application system. The detection method is as described above, and the test plugin obtains at least one interface test request. Specifically, the test plugin in this embodiment can be the `rpc-echo.jar` plugin.
[0072] 204. The test plugin extracts at least one interface information to be tested from at least one interface test request, marks at least one interface information to be tested with a test success identifier, and transmits the marked at least one interface information to the client.
[0073] In this embodiment, the testing plugin extracts the interface information to be tested from each test request carrying `echo=true`, then marks the extracted interface information with a test success flag, obtaining at least one marked interface information, and transmits this marked information to the client. It should be noted that the test success flag can be "OK" or other industry-specific flags; testers can choose flexibly based on their work habits and industry rules. Furthermore, the testing plugin does not provide any feedback for interface requests that do not carry `echo=true`.
[0074] Furthermore, within a preset reception period, for system interfaces that do not receive feedback, the client will determine that the system interface has a problem and set a test failure flag for the abnormal interface. This test failure flag can be FAIL or something else. First, the client obtains the test failure flag FAIL. Then, based on at least one interface to be tested, the client determines other interface information from among multiple interface information to be tested. That is, other interface information to be tested refers to the interface information other than at least one interface information to be tested. For example, if the number of marked interface information to be tested in the test plugin feedback is 3, and based on the number of interface type input units in step 201, the problematic system interface is 1, the interface type and interface address corresponding to each of the 3 interface information to be tested are extracted, and the interface type and corresponding interface address of the remaining interface to be tested are determined. Next, on the client's test page, based on the obtained test failure flag FAIL, FAIL is marked in the echo result display unit corresponding to the remaining interface information to be tested, and based on the received 3 marked interface information to be tested, OK is directly displayed in the corresponding echo result display unit.
[0075] Furthermore, the client has a preset reception duration, such as 10 seconds, 15 seconds, etc. The client starts timing when sending multiple interface test requests. If no feedback is received for the interface to be tested within the preset reception duration, the client considers the system interface corresponding to the interface to be tested to be an abnormal interface.
[0076] It should be noted that, in the above content, the number of other interface information to be tested is assumed to be 1. However, in actual operation, the number of other interface information to be tested can be multiple. The specific number is related to the number of interface type input units and the number of interface information to be tested after feedback annotation. That is, the number of other interface information to be tested = the number of interface type input units - the number of interface information to be tested after feedback annotation.
[0077] 205. The test plugin generates a jump link to the log file and sends the jump link to the client. When the test plugin receives a log jump command from the client, it transfers the log file to the client.
[0078] To facilitate troubleshooting of abnormal system interfaces, a redirect link can be added to the test failure flag. The specific process is as follows:
[0079] First, the testing plugin queries the log files associated with other interfaces under test and generates redirect links to those log files. Then, the testing plugin sends these redirect links to the client. The client uses these links on the test page to annotate other interfaces under test. Next, when the client detects that a redirect link has been triggered, it generates a log redirect command and sends it to the testing plugin. Finally, when the testing plugin receives the log redirect command from the client, it transmits the log files to the client, which then displays them. Users can easily locate the problematic interface based on the log files and troubleshoot the issue.
[0080] It should be noted that in actual operation, redirect links can be marked on other interface information to be tested, or they can be left unmarked. When redirect links are no longer needed, the client can delete them.
[0081] Furthermore, log files are used to record database update operations performed by transactions. There are two main formats: record-based log files and data block-based log files. Record-based log files include: the start marker of each transaction, the end marker of each transaction, and all update operations of each transaction. Each transaction's start marker, end marker, and each update operation constitute a log record. Data block-based log files mainly include: a transaction identifier (indicating which transaction it is), the type of operation (insert, delete, or modify), the operation object (internal identifier of the record), the old value of the data before the update (this is null for insert operations), and the new value of the data after the update (this is null for delete operations). For data block-based log files, the log record includes the transaction identifier and the updated data block. Since both the entire block before and after the update are included in the log file, information such as the operation type and operation object does not need to be included in the log record. Preferably, the log file in this embodiment is a log file in the form of a record. Its main function is to record what information occurred in the application system at what time, which service, and what information was involved. This information also includes information such as troubleshooting instructions for system faults.
[0082] The overall process of the technical solution in this application is summarized below: Figure 3 As shown, the client displays a test page to the user, providing input boxes for IP address, interface type, and interface address. The user can enter the IP address and information about multiple interfaces to be tested in these boxes. For example, Figure 3The user entered the IP address [1.2.3.4] and provided four sets of interface information to be tested on the test page. The test page included an echo result input box for each interface, used to display a success or failure indicator after the test. Furthermore, the test page provided an "Echo Verification" button, which also serves as the activation unit. When this button is triggered, the client sends the four sets of interface information, each labeled with an IP address, to the test plugin. The system receives requests based on the integrated interfaces, and the test requests are also received through these interfaces. Figure 3 The "rpc-echo.jar" in the code is a testing plugin. This plugin is pre-installed on the client and system, and continuously collects requests received by the system's interfaces. It then uses the presence of preset test flags in the collected requests to provide feedback to the client on whether the four sets of tests have passed. Figure 3 As shown, groups one, three, and four passed the test and were marked with "OK" in the echo results, indicating a successful test. Group two, however, failed the test and were marked with "Fail" in the echo results.
[0083] The method provided in this application embodiment identifies abnormal system interfaces through interaction between a client and a testing plugin. First, in response to a user's test trigger operation, a test page is transmitted to the client. Then, upon receiving multiple interface information to be tested from the client, multiple interface test requests are constructed using this information, and these requests are transmitted. Next, the testing plugin collects the interface requests received by each system interface in the application system and obtains at least one interface test request carrying a preset test identifier. Finally, the testing plugin extracts at least one interface information to be tested from the at least one interface test request, marks the at least one interface information to be tested with a test success identifier, and transmits the marked at least one interface information to the client. The testing plugin also generates a redirect link to a log file and sends the redirect link to the client. When a log redirection instruction is received from the client, the testing plugin transmits the log file to the client. If the system interface is normal, the testing plugin will detect that the interface test requests received by the system interface carry a preset test identifier. For interfaces that do not carry a preset test identifier, the testing plugin considers the interface to be abnormal. The client displays the test results based on the interface test information fed back by the testing plugin. Therefore, by using the above method, testers do not need to spend a lot of effort and time troubleshooting abnormal interfaces when accepting new features, thereby improving the efficiency of new feature acceptance. At the same time, by triggering the jump links on other test information, the client can display the log files corresponding to the abnormal interface, which can quickly and efficiently troubleshoot abnormal interfaces.
[0084] Furthermore, as Figure 1 To specifically implement the method, this application provides an interface testing system, such as... Figure 4 As shown, the system includes: client 401 and test plugin 402.
[0085] The client 401 is used to transmit multiple interface information to be tested; receive at least one interface information to be tested after being marked, and display the at least one interface information to be tested after being marked, and mark other interface information to be tested with test failure flags, wherein the other interface information to be tested is the interface information to be tested other than at least one interface information to be tested among the multiple interface information to be tested;
[0086] The test plugin 402 is used to construct multiple interface test requests using the multiple interface information to be tested when it receives multiple interface information to be tested transmitted from the client, and transmit the multiple interface test requests to the application system. Each interface test request carries a preset test identifier and interface information to be tested. The plugin collects the interface requests received by each system interface in the application system, obtains at least one interface test request carrying a preset test identifier, extracts at least one interface information to be tested from at least one interface test request, marks at least one interface information to be tested with a test success identifier, and transmits the marked at least one interface information to be tested to the client.
[0087] In specific application scenarios, the test plugin 402 is also specifically used to respond to the user's test trigger operation and transmit the test page to the client; the client 401 is also specifically used to display the test page, and when it detects that the user has confirmed the test page, to obtain the network Internet Protocol IP address and multiple interface information to be tested entered by the user on the test page, to label the multiple interface information to be tested using the IP address, and to transmit the labeled multiple interface information to be tested to the test plugin, wherein each interface information to be tested includes the interface type and the interface address.
[0088] Specifically, the test page has an IP address identifier and IP address input unit, an interface type identifier and multiple interface type input units, an interface address identifier and multiple interface address input units, a test result identifier and multiple test result display units, and a start unit. Users can enter the IP address in the IP address input unit, the interface type in the interface type input unit, and the interface address in the interface address input unit.
[0089] In specific application scenarios, the test plugin 402 is also used to perform the following operations on each interface information to be tested: obtain the interface type and interface address from the interface information to be tested, and construct an initial test request based on the interface type and interface address; obtain multiple initial test requests, add a preset test identifier to each initial test request in the multiple initial test requests to obtain multiple interface test requests; determine the server indicated by the IP address, transmit the multiple interface test requests to the server, and the server distributes the multiple interface test requests to the application system.
[0090] In specific application scenarios, the test plugin 402 is also used to collect interface requests received by each system interface in the application system and detect whether each interface request carries a preset test identifier; if an interface request carries a preset test identifier, it is determined that the interface request is an interface test request; continuously detect the interface requests sent to the application system to obtain at least one interface test request.
[0091] In specific application scenarios, the test plugin 402 is also specifically used to obtain a test success identifier, extract at least one interface information to be tested carried in at least one interface test request, mark at least one interface information to be tested with the test success identifier, and transmit the marked at least one interface information to be tested to the client; the client 401 is also specifically used to determine other interface information to be tested from multiple interface information to be tested based on the received at least one interface information to be tested, obtain a test failure identifier, display the marked at least one interface information to be tested on the test page, and mark other interface information to be tested with the test failure identifier on the test page.
[0092] The apparatus provided in this application embodiment can construct multiple interface test requests based on received multiple interface information to be tested, and transmit these multiple interface test requests to the application system. The test plugin collects the interface requests received by each system interface in the application system, and obtains at least one interface test request carrying a preset test identifier. The test plugin uses a test success identifier to mark at least one interface information to be tested extracted from at least one interface test request, and transmits the marked at least one interface information to be tested to the client. The client displays the received marked at least one interface information to be tested. At the same time, the client uses a test failure identifier to mark and display other interface information to be tested that failed the test. That is, if the system interface is normal, the test plugin will detect that the interface test request received by the system interface carries a preset test identifier. For interface to be tested that does not carry a preset test identifier, the test plugin considers this interface to be an abnormal interface. The client displays the test results based on the interface test information fed back by the test plugin. Therefore, the above method allows testers to avoid spending a lot of effort and time troubleshooting abnormal interfaces when accepting new functions, thereby improving the efficiency of new function acceptance.
[0093] In an exemplary embodiment, see Figure 5 Furthermore, a computer device is provided, comprising a bus, a processor, a memory, and a communication interface. It may also include an input / output interface and a display device, wherein the various functional units can communicate with each other via the bus. The memory stores a computer program, and the processor executes the program stored in the memory to perform the interface testing method described in the above embodiments.
[0094] A computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of the interface testing method described above.
[0095] Through the above description of the embodiments, those skilled in the art can clearly understand that this application can be implemented in hardware or by using software plus necessary general-purpose hardware platforms. Based on this understanding, the technical solution of this application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, external hard drive, etc.) and includes several instructions to cause a computer device (such as a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0096] Those skilled in the art will understand that the accompanying drawings are merely schematic diagrams of a preferred embodiment, and the modules or processes shown in the drawings are not necessarily essential for implementing this application.
[0097] Those skilled in the art will understand that the modules in the apparatus of the implementation scenario can be distributed within the apparatus of the implementation scenario as described, or they can be located in one or more apparatuses different from this implementation scenario, with corresponding changes. The modules of the above-described implementation scenario can be combined into one module, or they can be further divided into multiple sub-modules.
[0098] The serial numbers in this application are for descriptive purposes only and do not represent the superiority or inferiority of the implementation scenario.
[0099] The above embodiments are merely exemplary embodiments of this application and are not intended to limit this application. The scope of protection of this application is defined by the claims. Those skilled in the art can make various modifications or equivalent substitutions to this application within its substance and scope of protection, and such modifications or equivalent substitutions should also be considered to fall within the scope of protection of this application.
Claims
1. An interface testing method, characterized in that, include: In response to a user's test trigger operation, a test page is transmitted to the client so that the client can display the test page. When the client detects that the user has confirmed the test page, the client obtains the Internet Protocol (IP) address and multiple interface information to be tested entered by the user on the test page, uses the IP address to label the multiple interface information to be tested, and transmits the labeled multiple interface information to the test plugin. Each interface information to be tested includes an interface type and an interface address. When multiple interface information to be tested is received from the client, multiple interface test requests are constructed using the multiple interface information to be tested, and the multiple interface test requests are transmitted to the application system. This includes: performing the following operations on each interface information to be tested through a test plugin: obtaining the interface type and interface address from the interface information to be tested; constructing an initial test request based on the interface type and the interface address; obtaining multiple initial test requests; adding a preset test identifier to each of the multiple initial test requests; obtaining the multiple interface test requests; determining the server indicated by the IP address; transmitting the multiple interface test requests to the server; and having the server distribute the multiple interface test requests to the application system. Each interface test request carries a preset test identifier and interface information to be tested. Collecting interface requests received by each system interface in the application system, and obtaining at least one interface test request carrying the preset test identifier, includes: intercepting all interface requests sent to the application system through a test plugin, extracting at least one interface test request carrying the preset test identifier, wherein the preset test identifier is echo=true, the test plugin is mounted on the server mounted on the application system, and the interface request includes interface test requests sent by the client; At least one interface information to be tested is extracted from the at least one interface test request. The at least one interface information to be tested is marked with a test success identifier, and the marked at least one interface information to be tested is transmitted to the client so that the client can display the marked at least one interface information to be tested. Other interface information to be tested is marked with a test failure identifier, wherein the other interface information to be tested is the interface information to be tested other than the at least one interface information to be tested among the plurality of interface information to be tested.
2. The interface testing method according to claim 1, characterized in that, The test page includes an IP address identifier and IP address input unit, an interface type identifier and multiple interface type input units, an interface address identifier and multiple interface address input units, a test result identifier and multiple test result display units, and a startup unit.
3. The interface testing method according to claim 1, characterized in that, The step of collecting interface requests received by each system interface in the application system and obtaining at least one interface test request carrying the preset test identifier includes: Collect the interface requests received by each system interface in the application system, and detect whether each interface request carries the preset test identifier; If an interface request carries the preset test identifier, then the interface request is determined to be an interface test request; The interface requests sent to the application system are continuously monitored to obtain at least one interface test request.
4. The interface testing method according to claim 1, characterized in that, The process of extracting at least one interface information to be tested from the at least one interface test request, marking the at least one interface information to be tested with a test success identifier, transmitting the marked at least one interface information to the client so that the client can display the marked at least one interface information to be tested, and marking other interface information to be tested with a test failure identifier includes: Obtain the test success identifier, extract the information of the at least one interface to be tested carried in the at least one interface test request, mark the at least one interface to be tested information with the test success identifier, and transmit the marked at least one interface to be tested information to the client; The client determines the other interface information to be tested from the plurality of interface information to be tested based on the received at least one interface information to be tested, obtains the test failure identifier, and displays the at least one interface information to be tested after being marked on the test page, and marks the other interface information to be tested on the test page using the test failure identifier.
5. The interface testing method according to claim 1, characterized in that, The method further includes: extracting at least one interface information to be tested from the at least one interface test request; marking the at least one interface information to be tested with a test success identifier; transmitting the marked at least one interface information to be tested to the client so that the client can display the marked at least one interface information to be tested; and marking other interface information to be tested with a test failure identifier. Query the log files associated with the other interfaces to be tested, and generate redirect links to the log files; The redirect link is sent to the client, so that the client can use the redirect link to annotate the other interface information to be tested on the test page; When a log jump instruction is received from the client, the log file is transmitted to the client so that the client can display the log file. The log jump instruction is generated and sent by the client when it detects that the jump link has been triggered.
6. An interface testing system, characterized in that, include: The client is used to transmit information about multiple interfaces to be tested; Receive at least one labeled interface information to be tested, display the labeled at least one interface information to be tested, and label other interface information to be tested with a test failure flag, wherein the other interface information to be tested is the interface information to be tested other than the at least one interface information to be tested among the plurality of interface information to be tested; A testing plugin, used to construct multiple interface test requests using the multiple interface information to be tested transmitted by the client upon receiving such information, and to transmit the multiple interface test requests to the application system, includes the following operations performed on each interface information to be tested: obtaining the interface type and interface address from the interface information to be tested; constructing an initial test request based on the interface type and interface address; obtaining multiple initial test requests; adding a preset test identifier to each of the multiple initial test requests; obtaining the multiple interface test requests; determining the server indicated by the IP address; transmitting the multiple interface test requests to the server; and having the server distribute the multiple interface test requests to the application system. Each interface... The interface test request carries a preset test identifier and information about the interface to be tested; it collects interface requests received by each system interface in the application system, and obtains at least one interface test request carrying the preset test identifier, including: intercepting all interface requests sent to the application system through a test plugin, extracting at least one interface test request carrying the preset test identifier, wherein the preset test identifier is echo=true, the test plugin is mounted on the server mounted on the application system, and the interface request includes interface test requests sent by the client; extracting at least one interface information to be tested from the at least one interface test request, marking the at least one interface information to be tested with a test success identifier, and transmitting the marked at least one interface information to be tested to the client; The test plugin is also used to transmit a test page to the client in response to a user's test trigger operation; The client is also used to display the test page, and when it detects that the user has confirmed the test page, to obtain the Internet Protocol (IP) address and the multiple interface information to be tested entered by the user on the test page, to label the multiple interface information to be tested using the IP address, and to transmit the labeled multiple interface information to be tested to the test plugin, wherein each interface information to be tested includes an interface type and an interface address.
7. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 5.
8. A readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 5.
Citation Information
Patent Citations
Interface testing method and device, electronic equipment and storage medium
CN113760697A