Interface debugging method and device, computer readable storage medium and electronic device

By constructing and injecting interface attribute information to generate interface debugging requests, the problem of interface debugging complexity in a multi-cluster environment is solved, and efficient interface debugging request processing is achieved.

CN114661600BActive Publication Date: 2025-01-21YIDU CLOUD (BEIJING) TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210285624.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-22
Publication Date
2025-01-21
Estimated Expiration
2042-03-22

AI Technical Summary

Technical Problem

Existing interface request tools are complex in multi-cluster environments and are difficult to encapsulate flexibly, resulting in low interface debugging efficiency.

Method used

By obtaining the interface attribute information of the interface to be debugged, the configuration space name is constructed, and the interface attribute information is injected into the target configuration space based on the preset plug-in, and the interface debugging request is generated, sent to the server and received debugging results.

Benefits of technology

It realizes the mutual isolation of the target configuration space of each interface to be debugged in a multi-cluster environment, allows parallel processing of the same interfaces of multiple different clusters on the same terminal device, and improves the processing efficiency of interface debugging requests.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114661600B_ABST
    Figure CN114661600B_ABST
Patent Text Reader

Abstract

The present disclosure is about an interface debugging method and device, a computer-readable storage medium and an electronic device, and relates to the technical field of interface debugging of application programs. The method comprises: obtaining interface attribute information of an interface to be debugged, and constructing a configuration space name according to an interface name included in the interface attribute information; injecting the interface attribute information into a current configuration space corresponding to the configuration space name based on a preset plug-in, obtaining a target configuration space corresponding to the interface to be debugged, and generating an interface debugging request corresponding to the interface to be debugged according to the target configuration space; sending the interface debugging request to a server, and receiving a debugging result sent by the server executing the interface debugging request. The present disclosure improves the debugging efficiency of the interface to be debugged.
Need to check novelty before this filing date? Find Prior Art

Description

Background Art

[0002] An interface request refers to the process of transmitting the client's request parameters to the server through the Hypertext Transfer Protocol, transmitting the hypertext to the local client after processing, and then displaying it by the local client.

[0003] Currently, the interface request tool commonly used in the command terminal is a file transfer tool that uses URL syntax to work in the command line. However, in actual use, the file transfer tool requires the debugger to input the parameters required by the interface request in real time, and cannot directly use the encapsulation to complete the parameter generation corresponding interface request, which makes the interface debugging efficiency low.

[0004] Therefore, it is necessary to provide a new interface debugging method and device.

[0005] It should be noted that the information disclosed in the above background technology section is only used to enhance the understanding of the background of the present disclosure, and therefore may include information that does not constitute the prior art known to ordinary technicians in the field. Summary of the invention

[0006] The purpose of the present disclosure is to provide an interface debugging method, an interface debugging device, a computer-readable storage medium and an electronic device, thereby overcoming the problem of low interface debugging efficiency caused by the limitations and defects of related technologies at least to a certain extent.

[0007] According to one aspect of the present disclosure, there is provided an interface debugging method, which is configured in a terminal device, and the interface debugging method includes:

[0008] Acquire interface attribute information of the interface to be debugged, and construct a configuration space name according to the interface name included in the interface attribute information;

[0009] Injecting the interface attribute information into a current configuration space corresponding to the configuration space name based on a preset plug-in, obtaining a target configuration space corresponding to the interface to be debugged, and generating an interface debugging request corresponding to the interface to be debugged according to the target configuration space;

[0010] The interface debugging request is sent to a server, and a debugging result sent by the server after executing the interface debugging request is received.

[0011] In an exemplary embodiment of the present disclosure, the interface attribute information further includes the interface environment and the interface site of the interface to be debugged;

[0012] Wherein, based on a preset plug-in, the interface attribute information is injected into the current configuration space corresponding to the configuration space name to obtain a target configuration space corresponding to the interface to be debugged, including:

[0013] Generate an information adding instruction corresponding to the interface environment and the interface site based on the preset plug-in, and inject the interface environment and the interface site into the current configuration space based on the information adding instruction;

[0014] In response to a storage command acting on the current configuration space injected into the interface environment and the interface site, the current configuration space injected into the interface environment and the interface site and the configuration space name are bound to obtain a target configuration space corresponding to the interface to be debugged.

[0015] In an exemplary embodiment of the present disclosure, injecting the interface environment and the interface site into the current configuration space based on the information adding command includes:

[0016] Replacing historical data that can be dynamically injected into the current configuration space based on a preset data format;

[0017] Based on the adding command, the preset data format in the current configuration space is replaced by utilizing the interface environment and the interface site.

[0018] In an exemplary embodiment of the present disclosure, the interface debugging method further includes:

[0019] The environment information of the cluster where the interface to be debugged is located is obtained, and based on the preset plug-in, the environment information of the cluster is injected into the current configuration space in the form of static information.

[0020] In an exemplary embodiment of the present disclosure, before generating an interface debugging request corresponding to the interface to be debugged according to the target configuration space, the interface debugging method further includes:

[0021] Determining, according to the interface attribute information, whether the server needs to perform identity authentication when executing the interface debugging request;

[0022] When it is determined that identity authentication is required, user identity information is obtained, and the user identity information is injected into the target configuration space based on the preset plug-in.

[0023] In an exemplary embodiment of the present disclosure, obtaining user identity information includes:

[0024] crawling the data stored on the local terminal of the terminal device in the browser included in the terminal device through the preset plug-in, and determining whether the data stored on the local terminal of the terminal device includes the user identity information;

[0025] If the user identity information is included, obtaining the user identity information from the data stored on the local terminal of the terminal device through the preset plug-in;

[0026] If the user identity information is not included, a user identity information acquisition instruction is generated through the preset plug-in, and the user identity information is acquired based on the user identity information acquisition instruction.

[0027] In an exemplary embodiment of the present disclosure, after receiving the debugging result sent by the server executing the interface debugging request, the interface debugging method further includes:

[0028] The data format of the debugging result is converted based on the preset plug-in, and the debugging result after the format conversion is displayed, so that the tester can adjust the interface to be debugged according to the debugging result.

[0029] In an exemplary embodiment of the present disclosure, the interface debugging method further includes:

[0030] An interface debugging case corresponding to the interface to be debugged is generated according to the interface debugging request and the debugging result after format conversion, and the interface debugging case is stored.

[0031] According to one aspect of the present disclosure, there is provided an interface debugging device, which is configured in a terminal device, and the interface debugging device includes:

[0032] A configuration space name building module, used to obtain interface attribute information of the interface to be debugged, and build a configuration space name according to the interface name included in the interface attribute information;

[0033] An interface debugging request generating module, used for injecting the interface attribute information into the current configuration space corresponding to the configuration space name based on a preset plug-in, obtaining a target configuration space corresponding to the interface to be debugged, and generating an interface debugging request corresponding to the interface to be debugged according to the target configuration space;

[0034] The debugging result receiving module is used to send the interface debugging request to the server and receive the debugging result sent by the server when executing the interface debugging request.

[0035] According to one aspect of the present disclosure, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the interface debugging method described in any one of the above is implemented.

[0036] According to one aspect of the present disclosure, there is provided an electronic device, including:

[0037] Processor; and

[0038] A memory, configured to store executable instructions of the processor;

[0039] The processor is configured to execute any one of the above-mentioned interface debugging methods by executing the executable instructions.

[0040] An interface debugging method provided by an embodiment of the present disclosure, on the one hand, can directly generate an interface debugging request according to a target configuration space corresponding to an interface to be debugged, without the need for a debugger to input parameters required by the interface request in real time, thereby avoiding the problem in the prior art that the corresponding interface request cannot be generated directly by encapsulation to complete the parameter generation, thereby improving the debugging efficiency of the interface to be debugged; on the other hand, can construct a configuration space name according to an interface name included in the interface attribute information; then inject the interface attribute information into a current configuration space corresponding to the configuration space name based on a preset plug-in, obtain a target configuration space corresponding to the interface to be debugged, and generate an interface debugging request corresponding to the interface to be debugged according to the target configuration space, so that in a specific application process, the target configuration space corresponding to the interface to be debugged can be obtained according to the name of the interface to be debugged and then the corresponding interface debugging request can be generated, so that the target configuration spaces of the interfaces to be debugged in a multi-cluster environment can also be isolated from each other, so that the interface debugging requests of the same interfaces of multiple different clusters can be processed in parallel on the same terminal device, thereby improving the processing efficiency of the interface debugging requests.

[0041] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] The accompanying drawings herein are incorporated into the specification and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the specification are used to explain the principles of the present disclosure. Obviously, the accompanying drawings described below are only some embodiments of the present disclosure, and for ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without creative work.

[0043] Figure 1 The following schematically shows a flow chart of an interface debugging method according to an exemplary embodiment of the present disclosure.

[0044] Figure 2 A block diagram of an interface debugging system according to an exemplary embodiment of the present disclosure is schematically shown.

[0045] Figure 3 An example diagram schematically shows a target configuration space in which a module is pangu and an interface is export_list according to an example embodiment of the present disclosure.

[0046] Figure 4 A flowchart of an interface debugging method in a case where identity authentication is required according to an exemplary embodiment of the present disclosure is schematically shown.

[0047] Figure 5 An example diagram of a target configuration space in which a module is pangu_base according to an example embodiment of the present disclosure is schematically shown.

[0048] Figure 6 An example diagram of a scenario for beautifying debugging results according to an example embodiment of the present disclosure is schematically shown.

[0049] Figure 7 An example diagram schematically illustrates a beautified debugging result according to an example embodiment of the present disclosure.

[0050] Figure 8 An example diagram schematically illustrates another interface debugging method according to an example embodiment of the present disclosure.

[0051] Fig. 9 A block diagram schematically shows an interface debugging device according to an example embodiment of the present disclosure.

[0052] Fig.10 An electronic device for implementing the above interface debugging method according to an exemplary embodiment of the present disclosure is schematically shown. DETAILED DESCRIPTION

[0053] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as being limited to the examples set forth herein; on the contrary, these embodiments are provided so that the present disclosure will be more comprehensive and complete, and the concepts of the example embodiments are fully conveyed to those skilled in the art. The described features, structures, or characteristics may be combined in one or more embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present disclosure. However, those skilled in the art will appreciate that the technical solutions of the present disclosure may be practiced while omitting one or more of the specific details, or other methods, components, devices, steps, etc. may be adopted. In other cases, known technical solutions are not shown or described in detail to avoid obscuring various aspects of the present disclosure.

[0054] In addition, the accompanying drawings are only schematic illustrations of the present disclosure and are not necessarily drawn to scale. The same reference numerals in the figures represent the same or similar parts, and their repeated description will be omitted. Some of the block diagrams shown in the accompanying drawings are functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software form, or implemented in one or more hardware modules or integrated circuits, or implemented in different networks and / or processor devices and / or microcontroller devices.

[0055] Currently, there are some browser-, client-, and terminal-based interface request tools on the market. By using these tools, the process of simulating an interface request can be simplified, and the convenience of interface debugging can be increased in development or actual applications (such as automated testing, web crawlers, etc.).

[0056] However, the above scheme has the following defects: on the one hand, in order to be compatible with the comprehensiveness of functions, the above interface request tool is more troublesome to use in specific scenarios; for example, in a multi-cluster environment of a private cloud, because there are too many parameters and environments to be configured, the complexity of single use is too high, and it is difficult to flexibly encapsulate, which is extremely inconvenient during development and debugging; on the other hand, after configuring the interface for a single request, because the data itself needs to be dynamically verified, and the authentication validity period of the interface identity will affect the interface request, it is necessary to frequently update the parameters during a period of development, making the debugging itself more cumbersome; on the other hand, a single request cannot be persisted by default, and at most the results are stored, but the parameters and other configurations requested at the time cannot be reproduced in high-intensity development and testing.

[0057] Based on this, this exemplary embodiment first provides an interface debugging method, which can be run on a terminal device, which can include a desktop computer or a PC; of course, those skilled in the art can also run the method disclosed in this disclosure on other platforms as required, and this exemplary embodiment does not specifically limit this. Figure 1 As shown, the interface debugging method may include the following steps:

[0058] Step S110. Obtain interface attribute information of the interface to be debugged, and construct a configuration space name according to the interface name included in the interface attribute information;

[0059] Step S120: injecting the interface attribute information into the current configuration space corresponding to the configuration space name based on the preset plug-in, obtaining the target configuration space corresponding to the interface to be debugged, and generating an interface debugging request corresponding to the interface to be debugged according to the target configuration space;

[0060] Step S130: Send the interface debugging request to the server, and receive the debugging result sent by the server after executing the interface debugging request.

[0061] In the above interface debugging method, on the one hand, since the interface debugging request can be directly generated according to the target configuration space corresponding to the interface to be debugged, there is no need for the debugging personnel to input the parameters required by the interface request in real time, thereby avoiding the problem in the prior art that the corresponding interface request cannot be generated directly by encapsulation to complete the parameters, thereby improving the debugging efficiency of the interface to be debugged; on the other hand, since the configuration space name can be constructed according to the interface name included in the interface attribute information; and then the interface attribute information is injected into the current configuration space corresponding to the configuration space name based on the preset plug-in, the target configuration space corresponding to the interface to be debugged is obtained, and the interface debugging request corresponding to the interface to be debugged is generated according to the target configuration space, so that in a specific application process, the target configuration space corresponding to the interface to be debugged can be obtained according to the name of the interface to be debugged and then the corresponding interface debugging request can be generated, so that the target configuration spaces of each interface to be debugged in a multi-cluster environment can also be isolated from each other, and then the interface debugging requests of the same interface of multiple different clusters can be processed in parallel on the same terminal device, thereby improving the processing efficiency of the interface debugging request.

[0062] Hereinafter, the interface debugging method according to the exemplary embodiment of the present disclosure will be explained and illustrated in detail with reference to the accompanying drawings.

[0063] First, the terms involved in the exemplary embodiments of the present disclosure are explained:

[0064] Multi-cluster, also known as multi-server cluster, refers to the collection of many servers to provide the same service together, which looks like there is only one server to the client. Multi-server cluster can use multiple computers for parallel computing to achieve high computing speed, and can also use multiple computers for backup, so that any machine is broken and the entire system can still run normally.

[0065] Private Clouds are cloud services built for a single customer and can provide the most effective control over data, security, and service quality. Private Clouds can be deployed within the firewall of an enterprise data center or in a secure hosting location. The core attribute of a private cloud is proprietary resources.

[0066] Secondly, the purpose of the invention and the application scenario of the example embodiment of the present disclosure are explained and illustrated. Specifically, the interface debugging method provided by the example embodiment of the present disclosure can be applied to debug the interfaces included in the multi-cluster environment under the private cloud. In the specific process of debugging the interface, by configuring mutually isolated target configuration spaces for the interfaces to be debugged, the environmental information of each cluster and the interface attribute information of the interface to be debugged are encapsulated in the target configuration space, and a tool for quickly modifying the content of the space is provided to achieve dynamic injection of the information included in the target configuration space. At the same time, for the private cloud scenario, by isolating a single interface request, and performing plug-in expansion and development before and after an interface request, the complex interface parameters in the private cloud scenario can be met, thereby making the processing of commonly used interface permission request operations and request results more flexible.

[0067] Further, the interface debugging system involved in the exemplary embodiment of the present disclosure is explained and illustrated. Figure 2 As shown, the interface debugging system may include a terminal device 210 and a server 220, and the terminal device may be connected to the server 220 via a wired network or a wireless network. The terminal device may include a client of one or more applications, and a corresponding browser is also provided on the terminal device. The client may be a client based on the browser display, or a client that is independent of the browser for separate display. This example does not impose any special restrictions on this. At the same time, on the server side, a cluster environment required to run each application is provided.

[0068] The following will be combined Figure 2 right Figure 1 The interface debugging method shown in is explained and illustrated.

[0069] In step S110, the interface attribute information of the interface to be debugged is obtained, and a configuration space name is constructed according to the interface name included in the interface attribute information.

[0070] In this example embodiment, first, the interface attribute information of the interface to be debugged included in each application can be obtained from the database corresponding to the application, where the interface attribute information can include the interface name, interface address, interface calling method, interface parameters, and the interface parameters can include the interface environment, interface site, etc.; of course, the interface parameters can also include other parameters, which can be added according to actual needs during actual application, and this example does not impose any special restrictions on this.

[0071] Secondly, after obtaining the interface attribute information of the interface to be debugged, the configuration space name can be constructed according to the interface name in the interface attribute information. Among them, in the process of constructing the configuration space name, it can be constructed directly based on the interface name of the interface to be debugged, or it can be constructed according to the interface name and the interface address. This example does not impose special restrictions on this. It should be supplemented here that in order to facilitate the generation of an interface debugging request corresponding to the interface to be debugged according to the target configuration space of each interface to be debugged, a target configuration space can be configured for each interface to be debugged; therefore, in order to avoid the problem that different interfaces to be debugged have the same interface name and thus cause the configuration space name to be repeated, the interface address can be added to the interface name when constructing the configuration space name, thereby achieving the purpose of one-to-one mapping between the interface to be debugged and the target configuration space, thereby further improving the generation efficiency of the interface debugging request, thereby improving the interface debugging efficiency.

[0072] In step S120, the interface attribute information is injected into the current configuration space corresponding to the configuration space name based on the preset plug-in to obtain a target configuration space corresponding to the interface to be debugged, and an interface debugging request corresponding to the interface to be debugged is generated according to the target configuration space.

[0073] In this example embodiment, first, based on a preset plug-in, the interface attribute information is injected into the current configuration space corresponding to the configuration space name, and a target configuration space corresponding to the interface to be debugged is obtained. Specifically, it may include: first, based on the preset plug-in, an information addition instruction corresponding to the interface environment and the interface site is generated, and based on the information addition instruction, the interface environment and the interface site are injected into the current configuration space; secondly, in response to a storage command acting on the current configuration space injected with the interface environment and the interface site, the current configuration space injected with the interface environment and the interface site and the configuration space name are bound to obtain a target configuration space corresponding to the interface to be debugged.

[0074] Among them, in the process of injecting the interface environment and the interface site into the current configuration space based on the information adding command, it can be achieved in the following ways: first, based on the preset data format, the historical data that can be dynamically injected in the current configuration space is replaced; secondly, based on the adding command, the interface environment and the interface site are used to replace the data with the preset data format in the current configuration space.

[0075] For example, in a specific application process, a software developer or an interface debugger can create the above-mentioned preset plug-in, which can be used to inject interface attribute information, crawl web page information, and perform secondary development on the debugging results corresponding to the interface debugging request, etc.; of course, in a specific application process, the preset plug-in can also be given other uses according to actual needs, and this example does not impose special restrictions on this. Further, in the specific process of injecting the interface environment and interface site of the debug interface, the dynamic injection method create_space_name (interface environment, interface site) can be overloaded, and the two parameters "interface environment" and "interface site" can be passed in when calling to dynamically inject the current configuration space name (that is, the configuration space name); then, the nv--add xxx=xxx--add yyy=yyy command is used to configure the dynamically injected variables and methods required by the interface, and the env--save command is used to save it locally and bind it to the configuration space name to form the target configuration space corresponding to the interface to be debugged.

[0076] It should be noted that, in the specific parameter injection process, the historical data that can be dynamically injected in the current configuration space can first be replaced based on the preset data format. For example, the replaced historical data is: ${}.${}, etc. After the replacement is completed, when performing dynamic injection, the interface site and interface environment parameters can be directly added at the location with the data format. This method can further improve the parameter injection efficiency and the accuracy of dynamic injection.

[0077] Furthermore, it is also necessary to obtain the environment information of the cluster where the interface to be debugged is located, and inject the environment information of the cluster into the current configuration space in the form of static information based on the preset plug-in. That is, in the target configuration space, the environment information of the cluster required to run the application program including the interface to be debugged is also included; wherein, the environment information can be injected in a static manner; that is, the environment information is fixed information and does not need to be changed in real time; of course, if the environment information of the cluster changes, the fixed information can also be updated through the preset plug-in. Through this method, the environment information is configured once and used multiple times, and only a short space name needs to be set once before the interface request; that is, when the target configuration space of a certain interface to be debugged needs to be configured, if the environment information of the cluster where the interface to be debugged is located is consistent with the environment information included in the current configuration space, there is no need to re-inject the environment information; of course, in order to avoid repeated injection of the environment information, when selecting the current configuration space corresponding to the interface to be debugged, the current configuration space with the same cluster environment information as the interface to be debugged can be selected, thereby achieving the purpose of improving the construction efficiency of the target configuration space.

[0078] in, Figure 3 The following schematically shows an example of a target configuration space in which a module is a pangu and an interface is an export_list. Figure 3 In the module, the parameters biz_id and desease_id are parameters that can be dynamically injected, while the configurations such as domain name and browser cookie information can be inherited from the parent module pangu_base. It should be noted here that the above-mentioned interface environment and interface address are different from the environment information of the cluster. The interface environment can be used to represent the interface environment of the interface to be debugged included in the application and the interface address of the interface to be debugged in the application in different applications. At the same time, since the interface environment and interface address will change with the change of the application, they need to be dynamically injected, thereby improving the generation efficiency of the target configuration space.

[0079] Figure 4 The following schematically illustrates an interface debugging method in a case where identity authentication is required according to an exemplary embodiment of the present disclosure. Figure 4 As shown, the interface debugging method may include the following steps:

[0080] Step S410, judging whether the server needs to perform identity authentication when executing the interface debugging request according to the interface attribute information;

[0081] Step S420, when it is determined that identity authentication is required, user identity information is obtained, and the user identity information is injected into the target configuration space based on the preset plug-in.

[0082] Among them, the user identity information can be obtained in the following manner: first, through the preset plug-in, crawl the data stored on the local terminal of the terminal device in the browser included in the terminal device, and determine whether the data stored on the local terminal of the terminal device includes the user identity information; secondly, if the user identity information is included, obtain the user identity information from the data stored on the local terminal of the terminal device through the preset plug-in; further, if the user identity information is not included, generate a user identity information acquisition instruction through the preset plug-in, and acquire the user identity information based on the user identity information acquisition instruction.

[0083] Steps S410 to S420 are explained and illustrated below. Specifically, whether the server needs to perform identity authentication (i.e., whether authentication is required) when executing the interface debugging request can be determined based on whether the interface attribute information includes user attribute information; if the user attribute information is included, it can be determined that authentication is required; if not, it can be determined that authentication is not required; if authentication is not required, the execution step of the interface debugging request can be directly executed; if authentication is required, the user identity information acquisition step and the user identity information injection step need to be executed.

[0084] Furthermore, in the process of obtaining user identity information, the above-mentioned preset plug-in can be used to crawl the data stored in the browser on the local terminal of the terminal device (that is, cookie), and then extract the user identity information (such as user name, user password, etc.) from the cookie; if the user identity information is extracted, it can be determined that the browser of the current terminal device has logged in to the administrator account, and then --with-browser-cookie can be used to complete the acquisition of the identity information; among them, the --with-browser-cookie parameter can analyze the cookie information of the domain name to which the current interface belongs from the storage file of the local browser software, thereby realizing the function of copying the user identity information in the browser to the client; then, through the run--name add_user gets all the information of the interface to be debugged from the configuration file through the name add_user, and finally gets the dynamic injection information of the target cluster with the --env environment = xxx --env site = yyy parameters. In the interface request, the dynamically injected information is directly replaced with the data in the ${} format in the current configuration interface to complete the injection of all information and obtain the target configuration space. Of course, if the browser of the current machine does not have an administrator account logged in, you can create a dynamic injection method get_auth(), implement the development of authentication acquisition according to the site authentication logic, configure it in the interface configuration using cookie:'get_auth()', and finally inject it. This method solves the problem in the prior art that after configuring the interface for a single request, because the data itself needs to be dynamically verified, and the authentication validity period of the interface identity will affect the interface request, the parameters need to be frequently updated during a period of development, making the debugging itself more cumbersome.

[0085] in, Figure 5 An example diagram of a target configuration space of a module pangu_base is shown, where domain is the interface domain name, which can be dynamically injected, and the injection source comes from the plug-in function make_domain(), and cookie_domains: is the authentication information of which domain names the browser needs to use.

[0086] It should be further explained here that the target configuration space recorded in the above example embodiment, in order to solve the complex problem of interface debugging in multi-cluster scenarios, reflects commonly used information such as environment variables in the target configuration space, so that the target configuration space of each interface to be debugged can be independent without relying on the variable parameters of other interfaces to be debugged, thereby achieving mutual isolation in multiple clusters and multiple environments, and further allowing concurrent requests for the same interface in multiple clusters on one machine, thereby achieving the purpose of improving interface debugging.

[0087] Furthermore, after obtaining the target configuration space, an interface debugging request corresponding to the interface to be debugged can be generated according to the target configuration space. Through this method, the problem that the interface request tool in the prior art is more troublesome to use in specific scenarios in order to be compatible with the comprehensiveness of functions can be solved; for example, in a multi-cluster environment of a private cloud, because there are too many parameters and environments to be configured, the complexity of a single use is too high, and it is difficult to flexibly encapsulate, which is extremely inconvenient during development and debugging.

[0088] In step S130, the interface debugging request is sent to a server, and a debugging result sent by the server after executing the interface debugging request is received.

[0089] Specifically, after receiving the interface debugging request, it can be sent to the server. When the server receives the interface debugging request, it can simulate a complete interface calling process according to the interface address, interface environment, interface calling method and corresponding cluster environment information included in the interface debugging request, and then obtain the corresponding debugging result; wherein, the debugging result exists in the form of a JSON file. It should be noted here that if the interface debugging request includes user identity information, the user's permissions can be matched according to the user identity information, and then the corresponding debugging result can be obtained; wherein, the debugging result will vary according to the permissions of the user.

[0090] Furthermore, after obtaining the debugging result, it is necessary to convert the data format of the debugging result based on the preset plug-in, and display the debugging result after format conversion, so that the tester can adjust the interface to be debugged according to the debugging result. That is, since the interface data (debugging result) returned by the server is usually in JSON format, it can be specifically as follows: [{"name":"xxx","version":"xxx","time":"xxx","nickname":"xxx"}]. Therefore, it is not easy to view when the amount of data is large. At this time, secondary development can be carried out in the plug-in by writing code to beautify the result. The specific beautification process can be referred to. Figure 6 As shown, the display results obtained after beautification can be referred to Figure 7 shown.

[0091] Furthermore, the interface debugging method also includes: generating an interface debugging case corresponding to the interface to be debugged according to the interface debugging request and the debugging result after format conversion, and storing the interface debugging case. That is, the target configuration space and the interface debugging case can be stored locally on the terminal device, so as to facilitate secondary development such as other interface calls; this method can solve the problem in the prior art that a single request cannot be persisted by default, and at most the result can be stored, but the configurations such as the parameters requested at that time cannot be reproduced in high-intensity development tests.

[0092] The following, combined Figure 8 The interface debugging method of the exemplary embodiment of the present disclosure is further explained and illustrated. Figure 8 As shown, the interface debugging method may include the following steps:

[0093] Step S801, the terminal device configures the interface attribute information of the interface to be debugged on the client, such as: interface name, interface address, interface calling method and interface parameters, etc.;

[0094] Step S802, the terminal device configures the configuration space name of the current configuration space according to the interface name, and injects the interface attribute information into the current configuration space based on the preset plug-in;

[0095] Step S803, the terminal device binds the current configuration space and the configuration space name to obtain the target configuration space;

[0096] Step S804, the terminal device determines whether the server needs to perform user identity information verification during the process of executing the interface debugging request of the interface to be debugged; if so, jump to step S805; if not, jump to step S806;

[0097] Step S805, the terminal device obtains the user identity information based on the preset plug-in and injects it into the target configuration space;

[0098] Step S806, the terminal device generates an interface debugging request according to the target configuration space, and sends the interface debugging request to the server;

[0099] Step S807, the server executes the interface debugging request to obtain the debugging result, and feeds back the debugging result to the terminal device;

[0100] Step S808: The terminal device performs secondary development on the debugging result and displays the result after development.

[0101] Based on this, it can be known that the interface debugging method provided by the exemplary embodiment of the present disclosure can, on the one hand, shorten the request process and debugging time during interface debugging, and save manpower; at the same time, since the target configuration space of the interface to be debugged can be persisted locally on the terminal device, and the commonly used static environment information can be saved, it can be configured once and used multiple times, and only a short space name needs to be set once before the interface request; and, the interface environment and interface site of the interface to be debugged can be dynamically injected by dynamic injection; of course, the dynamically injected information can be set according to the actual needs of the interface to be debugged; further, in addition to obtaining the debugging result, it can also be further developed and beautified and displayed, and all the information of this request is persisted after a single request is completed, and the functions of viewing and re-requesting are provided, which is convenient for test staff to reproduce the problem; further, the use of the target configuration space can encapsulate the cluster environment information, without the need for developers to remember it manually, and without copying and pasting it everywhere every time it is used; the use of dynamic variable injection can reduce the steps of configuring parameters when developing the debugging interface, thereby improving efficiency and saving manpower; the plug-in development of a single interface request can expand the present invention more, and the utilization rate can be improved in actual development in combination with actual scenarios.

[0102] The exemplary embodiment of the present disclosure also provides an interface debugging device, which is configured in a terminal device. Fig. 9 As shown, the interface debugging device may include a configuration space name building module 910, an interface debugging request generating module 920, and a debugging result receiving module 930. Among them:

[0103] The configuration space name building module 910 may be used to obtain interface attribute information of the interface to be debugged, and build a configuration space name according to the interface name included in the interface attribute information;

[0104] The interface debugging request generating module 920 may be used to inject the interface attribute information into the current configuration space corresponding to the configuration space name based on a preset plug-in, obtain a target configuration space corresponding to the interface to be debugged, and generate an interface debugging request corresponding to the interface to be debugged according to the target configuration space;

[0105] The debugging result receiving module 930 may be used to send the interface debugging request to the server, and receive the debugging result sent by the server when executing the interface debugging request.

[0106] In the above interface debugging device, on the one hand, since the interface debugging request can be directly generated according to the target configuration space corresponding to the interface to be debugged, there is no need for the debugging personnel to input the parameters required by the interface request in real time, thereby avoiding the problem in the prior art that the corresponding interface request cannot be generated directly by encapsulation to complete the parameters, thereby improving the debugging efficiency of the interface to be debugged; on the other hand, since the configuration space name can be constructed according to the interface name included in the interface attribute information; and then the interface attribute information is injected into the current configuration space corresponding to the configuration space name based on the preset plug-in, the target configuration space corresponding to the interface to be debugged is obtained, and the interface debugging request corresponding to the interface to be debugged is generated according to the target configuration space, so that in a specific application process, the target configuration space corresponding to the interface to be debugged can be obtained according to the name of the interface to be debugged and then the corresponding interface debugging request can be generated, so that the target configuration spaces of each interface to be debugged in a multi-cluster environment can also be isolated from each other, and then the interface debugging requests of the same interface of multiple different clusters can be processed in parallel on the same terminal device, thereby improving the processing efficiency of the interface debugging request.

[0107] In an exemplary embodiment of the present disclosure, the interface attribute information further includes the interface environment and the interface site of the interface to be debugged;

[0108] Wherein, based on a preset plug-in, the interface attribute information is injected into the current configuration space corresponding to the configuration space name to obtain a target configuration space corresponding to the interface to be debugged, including:

[0109] Generate an information adding instruction corresponding to the interface environment and the interface site based on the preset plug-in, and inject the interface environment and the interface site into the current configuration space based on the information adding instruction;

[0110] In response to a storage command acting on the current configuration space injected into the interface environment and the interface site, the current configuration space injected into the interface environment and the interface site and the configuration space name are bound to obtain a target configuration space corresponding to the interface to be debugged.

[0111] In an exemplary embodiment of the present disclosure, injecting the interface environment and the interface site into the current configuration space based on the information adding command includes:

[0112] Replacing historical data that can be dynamically injected into the current configuration space based on a preset data format;

[0113] Based on the adding command, the preset data format in the current configuration space is replaced by utilizing the interface environment and the interface site.

[0114] In an exemplary embodiment of the present disclosure, the interface debugging device may further include:

[0115] The environment information injection module can be used to obtain the environment information of the cluster where the interface to be debugged is located, and inject the environment information of the cluster into the current configuration space in the form of static information based on the preset plug-in.

[0116] In an exemplary embodiment of the present disclosure, the interface debugging device further includes:

[0117] A first judgment module may be used to judge whether the server needs to perform identity authentication when executing the interface debugging request according to the interface attribute information;

[0118] The identity information injection module can be used to obtain user identity information when it is determined that identity authentication is required, and inject the user identity information into the target configuration space based on the preset plug-in.

[0119] In an exemplary embodiment of the present disclosure, obtaining user identity information includes:

[0120] crawling the data stored on the local terminal of the terminal device in the browser included in the terminal device through the preset plug-in, and determining whether the data stored on the local terminal of the terminal device includes the user identity information;

[0121] If the user identity information is included, obtaining the user identity information from the data stored on the local terminal of the terminal device through the preset plug-in;

[0122] If the user identity information is not included, a user identity information acquisition instruction is generated through the preset plug-in, and the user identity information is acquired based on the user identity information acquisition instruction.

[0123] In an exemplary embodiment of the present disclosure, the interface debugging device further includes:

[0124] The debugging result conversion module can be used to convert the data format of the debugging result based on the preset plug-in, and display the debugging result after format conversion, so that the tester can adjust the interface to be debugged according to the debugging result.

[0125] In an exemplary embodiment of the present disclosure, the interface debugging device further includes:

[0126] The interface debugging case storage module can be used to generate an interface debugging case corresponding to the interface to be debugged according to the interface debugging request and the debugging result after format conversion, and store the interface debugging case.

[0127] The specific details of each module in the above-mentioned interface debugging device have been described in detail in the corresponding interface debugging method, so they will not be repeated here.

[0128] It should be noted that, although several modules or units of the device for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the embodiments of the present disclosure, the features and functions of two or more modules or units described above can be embodied in one module or unit. On the contrary, the features and functions of one module or unit described above can be further divided into multiple modules or units to be embodied.

[0129] In addition, although the steps of the method in the present disclosure are described in a specific order in the drawings, this does not require or imply that the steps must be performed in this specific order, or that all the steps shown must be performed to achieve the desired results. Additionally or alternatively, some steps may be omitted, multiple steps may be combined into one step, and / or one step may be decomposed into multiple steps, etc.

[0130] In an exemplary embodiment of the present disclosure, an electronic device capable of implementing the above method is also provided.

[0131] Those skilled in the art will appreciate that various aspects of the present disclosure may be implemented as systems, methods or program products. Therefore, various aspects of the present disclosure may be specifically implemented in the following forms, namely: complete hardware implementation, complete software implementation (including firmware, microcode, etc.), or a combination of hardware and software, which may be collectively referred to herein as "circuits", "modules" or "systems".

[0132] Refer to the following Fig.10 The electronic device 1000 according to this embodiment of the present disclosure is described. Fig.10 The electronic device 1000 shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.

[0133] like Fig.10 As shown, the electronic device 1000 is in the form of a general computing device. The components of the electronic device 1000 may include, but are not limited to: the at least one processing unit 1010, the at least one storage unit 1020, a bus 1030 connecting different system components (including the storage unit 1020 and the processing unit 1010), and a display unit 1040.

[0134] The storage unit stores program codes, which can be executed by the processing unit 1010, so that the processing unit 1010 performs the steps according to various exemplary embodiments of the present disclosure described in the above “Exemplary Method” section of this specification. For example, the processing unit 1010 can perform the following steps: Figure 1 Step S110 shown in: obtaining interface attribute information of the interface to be debugged, and constructing a configuration space name according to the interface name included in the interface attribute information; step S120: injecting the interface attribute information into the current configuration space corresponding to the configuration space name based on a preset plug-in, obtaining a target configuration space corresponding to the interface to be debugged, and generating an interface debugging request corresponding to the interface to be debugged according to the target configuration space; step S130: sending the interface debugging request to the server, and receiving the debugging result sent by the server when executing the interface debugging request.

[0135] The storage unit 1020 may include a readable medium in the form of a volatile storage unit, such as a random access storage unit (RAM) 10201 and / or a cache storage unit 10202 , and may further include a read-only storage unit (ROM) 10203 .

[0136] The storage unit 1020 may also include a program / utility 10204 having a set (at least one) of program modules 10205, such program modules 10205 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment.

[0137] Bus 1030 may represent one or more of several types of bus structures, including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.

[0138] The electronic device 1000 may also communicate with one or more external devices 1100 (e.g., keyboards, pointing devices, Bluetooth devices, etc.), may also communicate with one or more devices that enable a user to interact with the electronic device 1000, and / or may communicate with any device that enables the electronic device 1000 to communicate with one or more other computing devices (e.g., routers, modems, etc.). Such communication may be performed via an input / output (I / O) interface 1050. Furthermore, the electronic device 1000 may also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) via a network adapter 1060. As shown, the network adapter 1060 communicates with other modules of the electronic device 1000 via a bus 1030. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device 1000, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.

[0139] Through the description of the above implementation, it is easy for those skilled in the art to understand that the example implementation described here can be implemented by software, or by software combined with necessary hardware. Therefore, the technical solution according to the implementation of the present disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, including several instructions to enable a computing device (which can be a personal computer, a server, a terminal device, or a network device, etc.) to execute the method according to the implementation of the present disclosure.

[0140] In an exemplary embodiment of the present disclosure, a computer-readable storage medium is also provided, on which a program product capable of implementing the above method of the present specification is stored. In some possible implementations, various aspects of the present disclosure may also be implemented in the form of a program product, which includes a program code, and when the program product is run on a terminal device, the program code is used to enable the terminal device to execute the steps according to various exemplary implementations of the present disclosure described in the above "Exemplary Method" section of the present specification.

[0141] According to the program product for implementing the above method in the embodiment of the present disclosure, it can adopt a portable compact disk read-only memory (CD-ROM) and include program code, and can be run on a terminal device, such as a personal computer. However, the program product of the present disclosure is not limited thereto. In this document, a readable storage medium can be any tangible medium containing or storing a program, which can be used by or in combination with an instruction execution system, an apparatus or a device.

[0142] The program product may use any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.

[0143] Computer readable signal media may include data signals propagated in baseband or as part of a carrier wave, in which readable program code is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Readable signal media may also be any readable medium other than a readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.

[0144] The program code embodied on the readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination of the foregoing.

[0145] Program code for performing the operations of the present disclosure may be written in any combination of one or more programming languages, including object-oriented programming languages ​​such as Java, C++, etc., and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving a remote computing device, the remote computing device may be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., through the Internet using an Internet service provider).

[0146] In addition, the above-mentioned figures are only schematic illustrations of the processes included in the method according to the exemplary embodiments of the present disclosure, and are not intended to be limiting. It is easy to understand that the processes shown in the above-mentioned figures do not indicate or limit the time sequence of these processes. In addition, it is also easy to understand that these processes can be performed synchronously or asynchronously, for example, in multiple modules.

[0147] Other embodiments of the present disclosure will be readily apparent to those skilled in the art after considering the specification and practicing the inventions invented herein. This application is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not invented by the present disclosure. The specification and examples are to be considered merely exemplary, and the true scope and spirit of the present disclosure are indicated by the claims.

Claims

1. An interface debugging method, characterized in that: Configured in the terminal device, the interface debugging method includes: Acquire interface attribute information of the interface to be debugged, and construct a configuration space name according to the interface name included in the interface attribute information; Injecting the interface attribute information into a current configuration space corresponding to the configuration space name based on a preset plug-in, obtaining a target configuration space corresponding to the interface to be debugged, and generating an interface debugging request corresponding to the interface to be debugged according to the target configuration space; Sending the interface debugging request to a server, and receiving a debugging result sent by the server executing the interface debugging request; Among them, based on a preset plug-in, the interface attribute information is injected into the current configuration space corresponding to the configuration space name to obtain a target configuration space corresponding to the interface to be debugged, including: based on the preset plug-in, generating an information adding instruction corresponding to the interface environment and interface site of the interface to be debugged, and based on the information adding instruction, injecting the interface environment and interface site into the current configuration space; in response to a storage command acting on the current configuration space injected with the interface environment and interface site, binding the current configuration space injected with the interface environment and interface site and the configuration space name to obtain a target configuration space corresponding to the interface to be debugged.

2. The interface debugging method according to claim 1, characterized in that: Injecting the interface environment and the interface site into the current configuration space based on the information adding command includes: Replacing historical data that can be dynamically injected into the current configuration space based on a preset data format; Based on the adding command, the preset data format in the current configuration space is replaced by utilizing the interface environment and the interface site.

3. The interface debugging method according to claim 2, characterized in that: The interface debugging method also includes: The environment information of the cluster where the interface to be debugged is located is obtained, and based on the preset plug-in, the environment information of the cluster is injected into the current configuration space in the form of static information.

4. The interface debugging method according to claim 1, characterized in that: Before generating an interface debugging request corresponding to the interface to be debugged according to the target configuration space, the interface debugging method further includes: Determining, according to the interface attribute information, whether the server needs to perform identity authentication when executing the interface debugging request; When it is determined that identity authentication is required, user identity information is obtained, and the user identity information is injected into the target configuration space based on the preset plug-in.

5. The interface debugging method according to claim 4, characterized in that: Obtain user identity information, including: crawling the data stored on the local terminal of the terminal device in the browser included in the terminal device through the preset plug-in, and determining whether the data stored on the local terminal of the terminal device includes the user identity information; If the user identity information is included, obtaining the user identity information from the data stored on the local terminal of the terminal device through the preset plug-in; If the user identity information is not included, a user identity information acquisition instruction is generated through the preset plug-in, and the user identity information is acquired based on the user identity information acquisition instruction.

6. The interface debugging method according to claim 1, characterized in that: After receiving the debugging result sent by the server executing the interface debugging request, the interface debugging method further includes: The data format of the debugging result is converted based on the preset plug-in, and the debugging result after the format conversion is displayed, so that the tester can adjust the interface to be debugged according to the debugging result.

7. The interface debugging method according to claim 6, characterized in that: The interface debugging method also includes: An interface debugging case corresponding to the interface to be debugged is generated according to the interface debugging request and the debugging result after format conversion, and the interface debugging case is stored.

8. An interface debugging device, characterized in that: Configured in the terminal equipment, the interface debugging device includes: A configuration space name building module, used to obtain interface attribute information of the interface to be debugged, and build a configuration space name according to the interface name included in the interface attribute information; An interface debugging request generating module, used for injecting the interface attribute information into the current configuration space corresponding to the configuration space name based on a preset plug-in, obtaining a target configuration space corresponding to the interface to be debugged, and generating an interface debugging request corresponding to the interface to be debugged according to the target configuration space; A debugging result receiving module, used for sending the interface debugging request to the server, and receiving the debugging result sent by the server when executing the interface debugging request; Among them, based on a preset plug-in, the interface attribute information is injected into the current configuration space corresponding to the configuration space name to obtain a target configuration space corresponding to the interface to be debugged, including: based on the preset plug-in, generating an information adding instruction corresponding to the interface environment and interface site of the interface to be debugged, and based on the information adding instruction, injecting the interface environment and interface site into the current configuration space; in response to a storage command acting on the current configuration space injected with the interface environment and interface site, binding the current configuration space injected with the interface environment and interface site and the configuration space name to obtain a target configuration space corresponding to the interface to be debugged.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the interface debugging method according to any one of claims 1 to 7 is implemented.

10. An electronic device, characterized in that: include: processor; as well as A memory, configured to store executable instructions of the processor; Wherein, the processor is configured to execute the interface debugging method according to any one of claims 1 to 7 by executing the executable instructions.

Citation Information

Patent Citations

  • Interface testing method, interface testing device, electronic device and storage medium

    CN109446071A

  • Server cluster test method and device, medium and electronic equipment

    CN113010428A