Interface document, test and simulation generation method and device, and computer storage medium

By obtaining and combining interface information, automatically generate interface documents, test pages and simulation pages, the problem of low efficiency of interface documents and testing in the existing technology is solved, the automatic testing and simulation functions of the interface are realized, and the development efficiency and the Tripartite communication efficiency.

CN113778883BActive Publication Date: 2024-11-22HUNAN HAPPLY SUNSHINE INTERACTIVE ENTERTAINMENT MEDIA CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111069572.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-09-13
Publication Date
2024-11-22
Estimated Expiration
2041-09-13

AI Technical Summary

Technical Problem

Existing system interface documents and tests mainly rely on manual writing and testing, which are inefficient, and mature tools such as Swagger can only generate fixed pages and cannot be deeply expanded and configured.

Method used

By obtaining the interface information and controller methods of the user's access link, it is combined into an interface document class, and using template technology to generate and automatically generate interface document pages, test pages and simulation pages, supporting one-click testing of all interfaces and adapting to the test framework.

Benefits of technology

It realizes automatic generation of interface documents, test pages and simulation pages, improves the efficiency and flexibility of interface testing, supports one-click testing, and reduces learning costs and development complexity.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113778883B_ABST
    Figure CN113778883B_ABST
Patent Text Reader

Abstract

The present invention provides an interface document, test and simulation generation method and device, and computer storage medium. The method comprises: obtaining a user access link; obtaining interface information of the user access link, all control methods corresponding to the associated controller, and input parameters and output parameters of the control method; combining all control methods corresponding to the controller, input parameters and output parameters of the control method, and interface information into an interface document class; generating an interface document page, an interface test page, and a simulation page from the interface document class based on template technology; thereby realizing automatic generation of interface document pages, test pages, and simulation pages, and being able to extend an adaptive test framework and support one-key testing of all interfaces.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of computer language technology, and more specifically, relates to an interface document, a test and simulation generation method and device, and a computer storage medium. Background Art

[0002] At present, most of our system interface documentation classes and interface tests are manually written and manually tested, which is very inefficient. Although there is a relatively mature interface documentation class generation tool on the market, Swagger, this Swagger can only generate fixed pages and test on the pages, and cannot be deeply expanded and configured. Summary of the invention

[0003] In view of this, the purpose of the present invention is to provide an interface document, test and simulation generation method and device, and computer storage medium for automatically generating interface document pages, test pages, and simulation pages, which can be expanded and adapted to the test framework and support one-click testing of all interfaces.

[0004] The first aspect of the present invention discloses an interface document, test and simulation generation method, comprising:

[0005] Get the user access link;

[0006] Obtaining interface information of the user access link, all control methods corresponding to the associated controller, and input parameters and output parameters of the control methods;

[0007] Combine all control methods corresponding to the controller, input parameters and output parameters of the control methods, and interface information into an interface document class;

[0008] The interface document class is used according to template technology to generate interface document pages, interface test pages and simulation pages.

[0009] Optionally, all control methods corresponding to the controller associated with the user access link are obtained, and the input parameters and output parameters of the control methods include:

[0010] Obtain the controller associated with the link, and scan all control methods of the controller;

[0011] Obtaining input parameters of the control method;

[0012] According to the input parameters of the control method, the output parameters of the control method are obtained.

[0013] Optionally, obtaining interface information of the user access link, all control methods corresponding to the associated controller, and input parameters and output parameters of the control methods include:

[0014] Obtaining the interface annotation in the user access link; wherein the interface annotation includes: interface information, interface information method, interface information input parameter, and interface information output parameter;

[0015] The interface information method includes: all methods of the controller; the interface information input parameters include: input parameters of the control method; the interface information parameters include: output parameters of the control method.

[0016] Optionally, after generating an interface document page, an interface test page and a simulation page from the interface document class according to the template technology, the method further includes:

[0017] Output the generated page to the display.

[0018] Optionally, after outputting the generated page to the display, it also includes:

[0019] When a simulated interface request is obtained from the user, the simulated interface when the user enters the simulated page is obtained;

[0020] Saves information of simulation interface and simulation data.

[0021] Optionally, after outputting the generated page to the display, it also includes:

[0022] When a user's test interface request is obtained, information about the interface tested when the user enters the interface test page is obtained;

[0023] Sign the parameters of the test interface and encapsulate the interface parameters and interface address;

[0024] Determine whether the test interface is simulated; if not, process the returned data normally; if so, return the simulated data.

[0025] Optionally, the interface document class is used to generate an interface document page, an interface test page and a simulation page according to template technology, including:

[0026] Generate an interface document page by combining the interface document class and the interface document template according to the template technology;

[0027] Generate an interface test page by combining the interface document class and the interface test template according to the template technology; and

[0028] The interface document class and the interface simulation template are combined according to the template technology to generate a simulation page.

[0029] Optionally, obtaining the interface information of the user access link and all control methods corresponding to the associated controller, and before the input parameters and output parameters of the control method, further includes:

[0030] The user access link is filtered using an interface document filter;

[0031] Determining whether the prefix of the filtered user access link is a preset prefix;

[0032] If yes, then get the link following the prefix;

[0033] Determine whether the controller associated with the link following the prefix has been configured with an interface annotation;

[0034] If so, the steps of obtaining the interface information of the user access link, all control methods corresponding to the associated controller, and the input parameters and output parameters of the control methods are executed.

[0035] The second aspect of the present invention discloses an interface document, test and simulation generation device, comprising:

[0036] The first acquisition module is used to acquire the user access link;

[0037] A second acquisition module is used to acquire interface information of the user access link, all control methods corresponding to the associated controller, and input parameters and output parameters of the control methods;

[0038] A combination module, used for combining all control methods corresponding to the controller, input parameters and output parameters of the control methods, and the interface information into an interface document class;

[0039] The generation module is used to generate interface document pages, interface test pages and simulation pages from the interface document class according to template technology.

[0040] A third aspect of the present invention discloses a computer storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the interface document, test and simulation generation method as described in any one of the first aspect of the present invention.

[0041] It can be seen from the above technical scheme that the present invention provides an interface document, test and simulation generation method, including: obtaining a user access link; obtaining the interface information of the user access link, all control methods corresponding to the associated controller, and the input parameters and output parameters of the control method; combining all control methods corresponding to the controller, the input parameters and output parameters of the control method, and the interface information into an interface document class; generating an interface document page, an interface test page and a simulation page from the interface document class based on template technology; thereby realizing automatic generation of interface document pages, test pages and simulation pages, and being able to extend the adaptation test framework and support one-click testing of all interfaces. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0043] Figure 1 It is a flow chart of an interface document, test and simulation generation method provided by an embodiment of the present invention;

[0044] Figure 2 is a flow chart of another interface document, test and simulation generation method provided by an embodiment of the present invention;

[0045] Figure 3 is a flow chart of another interface document, test and simulation generation method provided by an embodiment of the present invention;

[0046] Figure 4 It is a flow chart of a simulation page in an interface document, test and simulation generation method provided by an embodiment of the present invention;

[0047] Figure 5 The invention discloses a flowchart of a test page in an interface document, test and simulation generation method provided by an embodiment of the invention. DETAILED DESCRIPTION

[0048] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0049] In this application, the terms "comprises", "comprising" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprising a ..." does not exclude the presence of other identical elements in the process, method, article or device comprising the element.

[0050] It should be noted that Swagger is a web service for generating, describing and calling RESTful interfaces. In layman's terms, Swagger is a service that displays all the interfaces that you want to expose in the project on a page and can call and test the interfaces.

[0051] Spring: The Spring framework is an open source J2EE framework, a framework that is generally used by JAVA services.

[0052] Validation: A method for validating interface parameters in the Spring framework.

[0053] Simulation: The meaning of simulation is that during the testing process, for some objects that are not easy to construct or obtain, a virtual object is used to create a test method for testing.

[0054] Postman: An interface testing tool.

[0055] NodeJS: A front-end development framework.

[0056] The embodiment of the present invention provides an interface document, test and simulation generation method, which is used to solve the problem that only fixed pages can be generated and tests can be performed on the pages, but in-depth expansion and configuration cannot be performed in the prior art.

[0057] See also Figure 1 , the interface documentation, test and simulation generation methods, including:

[0058] S101: Obtain a user access link.

[0059] Specifically, when a user accesses the system of the interface document, test and simulation generation method provided in this application, a user access link is generated, which is the above-mentioned user access link and is used to provide an acquisition prerequisite for the execution of subsequent steps.

[0060] S102: Obtain interface information of the user access link, all control methods corresponding to the associated controller, and input parameters and output parameters of the control methods.

[0061] Specifically, the controller associated with the user access link may be first obtained, and then the control method, input parameters and output parameters of the control method, and interface information and other parameters may be obtained based on the controller.

[0062] Of course, other methods are also possible, as long as all control methods corresponding to the controller, input parameters and output parameters of the control methods, and interface information can be obtained. They will not be described one by one here, and they are all within the protection scope of this application.

[0063] S103: Combine all control methods corresponding to the controller, input parameters and output parameters of the control methods, and interface information into an interface document class.

[0064] It should be noted that a class is a template that describes the behavior and status of a type of object; that is, the document class describes the behavior and status of the document object.

[0065] Specifically, the control method, input parameters and output parameters of the control method, and interface information are all regarded as components of the interface document class. That is, the interface document class includes four parameters: control method, input parameters and output parameters of the control method, and interface information.

[0066] S104, generating an interface document page, an interface test page and a simulation page from the interface document class according to the template technology.

[0067] It should be noted that the above description has described the main information of the interface document class, and corresponding pages can be generated by using template technology for this information, such as interface document page, interface test page and simulation page.

[0068] It should be noted that the interface test page is mainly used to test the interface, and whether the interface parameters meet the user's needs, etc. The simulation page is used to simulate the interface. The interface document can display information such as interface data. Of course, the interface document page, interface test page and simulation page are not limited to the above description, and will not be repeated here one by one, and they are all within the scope of protection of this application.

[0069] The interface document, test and simulation generation method can be applicable to JAVA technology, Freemaker technology, HTML, JS technology, etc., which will not be described one by one here, and are all within the protection scope of this application.

[0070] In this embodiment, not only can the interface document page, test page, and simulation page be dynamically generated, but other test framework codes can also be expanded to generate, such as Postman, NodeJS, and support one-click testing of all interfaces.

[0071] In practical applications, see Figure 2 , the acquisition of all control methods corresponding to the controller associated with the user access link involved in step S102, and the input parameters and output parameters of the control methods include:

[0072] S201. Acquire the controller associated with the link, and scan all control methods of the controller.

[0073] Specifically, each controller carries a different control method, so the control method of the controller can be obtained by scanning. The number of control methods of the controller is not specifically limited here, and it can be determined according to the actual situation, and all are within the protection scope of this application.

[0074] S202: Obtain input parameters of the control method.

[0075] Different control methods have different types of input parameters, but the present invention is not limited thereto. Therefore, as long as the control method is obtained, its input parameters can be determined.

[0076] S203. Obtain output parameters of the control method according to input parameters of the control method.

[0077] Different control methods have different types of output parameters, but the method is not limited thereto. Therefore, as long as the control method is acquired, its output parameters can be determined.

[0078] After determining the output parameters, you can use the validation in the Spring framework to analyze the required attributes and length attributes of the parameters.

[0079] It should be noted that the Swagger used in the prior art cannot automatically analyze the data types of the input and output parameters of the interface, while the present embodiment can automatically analyze the data types of the input and output parameters, and analyze the required attributes and length attributes of the parameters according to the validation in the Spring framework.

[0080] In practical applications, the specific process of step S102 may be:

[0081] Obtain the interface annotation in the user access link; wherein the interface annotation includes: interface information, interface information method, interface information input parameter, and interface information output parameter.

[0082] The interface information method includes: all methods of the controller; the interface information input parameters include: input parameters of the control method; the interface information parameters include: output parameters of the control method.

[0083] Specifically, the annotations for each interface only require four annotations, such as @Api, @ApiMethod, @ApiParam, and @ApiResponse.

[0084] @Api is the interface information, which mainly describes the document title and document description; it can also describe the document version, document access address, document generation output format (html / MD), etc., which will not be repeated here one by one, and are all within the protection scope of this application.

[0085] @ApiMethod is the interface information method, which mainly describes all methods of the controller; such as the name of the method, whether the request method of the method is POST or GET, of course, the request methods of the method also include HEAD, PUT, DELETE, OPTIONS, CONNECT, etc., which will not be repeated here one by one, and all are within the protection scope of this application; the receiving method of the method parameter is "application / x-www-form-urlencoded" or "application / json"; of course, the receiving method of the method can also be Content-Type: text / html; charset=utf-8Content-Type: multipart / form-data; boundary=something, etc.; they will not be repeated here one by one, and all are within the protection scope of this application.

[0086] @ApiParam is the input parameter of the interface information; it mainly describes the input parameters of the method, such as the definition, description, type, required attributes, length, etc. of the input parameters; of course, it can also describe other parameters, which will not be repeated here one by one, and they are all within the scope of protection of this application.

[0087] @ApiResponse is the output parameter of the interface information, which mainly describes the data information returned by the interface, that is, the output parameter of the method; such as the definition, description, type, etc. of the output parameter; of course, it can also describe other parameters, which will not be repeated here one by one, and they are all within the scope of protection of this application.

[0088] The specific process of obtaining the interface annotation in the user access link may be: scanning all controllers with interface API annotations in the project, traversing all methods using JAVA launch technology, and obtaining the input parameter param and output parameter response of the method.

[0089] Next, the specific process of step S103 may be: according to the above four annotations @Api, @ApiMethod, @ApiParam, @ApiResponse, combine them into the desired interface document class ApiDocument.

[0090] The specific process of step S104 can be: according to the interface document class ApiDocument obtained in the above steps, use the template technology Freemaker to generate API document, API test page and MOCK page, that is, interface document page, interface test page and simulation page.

[0091] The process of API document generation can be as follows: first make the API.ftl template, and then use the template technology Freemaker to dynamically generate the interface document class ApiDocument generated above. The code is generally:

[0092] Template template=configuration.getTemplate("API.ftl");

[0093] template.process(ApiDocument, out);

[0094] Among them, Out outputs the page.

[0095] The generation process of the API test page is the same as that of the MOCK page. It can be dynamically generated using the two templates APITEST.ftl and APIMOCK.ftl.

[0096] When the API test page is put into use, that is, when the user conducts the test: obtain the address, call type, parameters, etc. of the interface test, use apidoc.js to sign the parameters, and finally use ajax to call the interface and display the returned data. Specifically, the user selects the interface to be tested on the test page, clicks the test button, JS will obtain the URL address, parameters, call method, etc. of the current test, use JQuery's Ajax to access the interface, and finally output the returned data of the interface and display it on the display.

[0097] The purpose of using the MOCK page is to help developers perform MOCK operations on a Method method in the Controller control layer before the interface is fully developed, so as to input the data to be returned in advance. The background saves the information of the current interface and Mock data and stores it in a table. When the user calls the interface, the background uses the MockInterceptor interceptor to intercept the method method of the controller that needs to be mocked, query the simulated data of the interface from the table, and return the simulated data.

[0098] That is to say, when this interface has not been developed yet, others, such as the front end, can access the interface and get the data we entered in advance.

[0099] It should be noted that Controller means the control layer in the SrpingMVC framework, which is generally used for interface calls, receiving parameters and outputting parameters.

[0100] Method: The method of the Controller control layer, usually a specific interface.

[0101] Param: Input parameters of the Method method.

[0102] Response: The output parameter of the Method method.

[0103] POST: http request method, https: / / www.runoob.com / tags / html-httpmethods.html.

[0104] GET: http request method, https: / / www.runoob.com / tags / html-httpmethods.html.

[0105] application / x-www-form-urlencoded: The content type of http generally refers to the Content-Type in the web page; it is used to define the type of network files and the encoding of the web page, and determines the form and encoding in which the browser will read the file https: / / www.runoob.com / http / http-content-type.html; application / json: the same as above.

[0106] ApiDocument: Interface document class, a class in this method, which contains all the content needed for page generation.

[0107] Freemaker: is a template engine, that is, a general tool based on templates and data to be changed, and used to generate output text (HTML web pages, e-mails, configuration files, source code, etc.).

[0108] MockInterceptor: Interface simulation interceptor. The interceptor of this method is implemented based on SrpingAOP technology and is used to intercept a method in the control layer.

[0109] All the data in the interface documents come from the annotations in the code. If you modify the annotations or a field in the code, the interface documents will be updated synchronously.

[0110] It should be noted that the Swagger used in the prior art has complicated annotations, many dependencies, and high learning costs, while this embodiment has only 4 annotations, which is simple to use and has a low learning cost. It automatically analyzes the input and output parameter information and verification information of the interface, and automatically generates API document pages, API test pages, and APIMOCK pages. The code is the document. When you modify any interface, the document pages are updated synchronously, which can effectively improve the efficiency of background development and the efficiency of communication and joint debugging with third-party callers.

[0111] In practical applications, before step S102, the following steps are also included:

[0112] (1) Use interface document filters to filter user access links.

[0113] That is to say, there may be some illegal or unreasonable user access links, and the interface document filter will filter out these unreasonable or illegal user access links. Of course, other types of user access links can also be filtered out, which will not be elaborated here one by one, and they are all within the protection scope of this application.

[0114] (2) Determine whether the prefix of the filtered user access link is a preset prefix.

[0115] It should be noted that judging whether the link accessed by the user is a specific link is determined by judging the prefix. Of course, other judgment methods are also possible, which will not be described here one by one, and are all within the protection scope of this application.

[0116] If yes, get the link after the prefix.

[0117] (3) Determine whether the controller associated with the link following the prefix has been configured with an interface annotation.

[0118] If yes, execute step S102.

[0119] In practical applications, the specific process of step S103 may be:

[0120] Based on the template technology, the interface document class and the interface document template are used to generate the interface document page; based on the template technology, the interface document class and the interface test template are used to generate the interface test page; and based on the template technology, the interface document class and the interface simulation template are used to generate the simulation page.

[0121] That is to say, different pages are generated according to different templates. It should be noted that each page has different functions, so it is necessary to set different templates.

[0122] In practical applications, see Figure 3 , after step S104, further comprising:

[0123] S105: Output the generated page to a display.

[0124] That is to say, the interface document page, interface test page and simulation page are all displayed to the user, and the user can check or send corresponding requests according to his or her needs, such as test requests, simulation requests, etc., which will not be described one by one here, and are all within the scope of protection of this application.

[0125] In practical applications, after step S105, Figure 4 As shown, it also includes:

[0126] When a simulated interface request is obtained from the user, that is, when the user needs a simulated interface, the simulated interface when the user enters the simulated page is obtained; and information and simulated data of the simulated interface are saved.

[0127] That is, when the user needs to simulate an interface, the corresponding simulated interface information and simulated data are saved, so that the simulated data of the interface can be directly obtained during subsequent calls.

[0128] In practical applications, after step S105, Figure 5 As shown, it also includes:

[0129] When the user's test interface request is obtained, that is, when the test interface is not needed, the information of the interface tested when the user enters the interface test page is obtained; the test interface is parameter signed; and the interface parameters and interface address are encapsulated; it is determined whether the test interface is simulated; if not, the return data is processed normally; if so, the simulated data is returned.

[0130] It should be noted that the interface can also be intercepted before determining whether the test interface is simulated. The two steps of parameter signing of the test interface and encapsulation of interface parameters and interface address are performed by the front end. The two steps of normal processing of returned data and returning simulated data are performed by the background.

[0131] Specifically, the following examples are used to illustrate the corresponding steps of this application:

[0132] (1) Use the global filter ApidocFilter to intercept links starting with / apidoc.

[0133] (2) Get the URL after / apidoc.

[0134] (3) Determine whether the Controller associated with the URL has been configured with the @Api annotation.

[0135] (4) If there is one, get the current Controller, use JAVA launch technology to scan all methods of the Controller, get the method name, request method, etc. and put them into the apiMethods of Apidocument.

[0136] (5) Get the param of the method, obtain the definition, description, type, required attributes, length, etc. of the param, and put it into the apiParams of ApiMethod.

[0137] (6) Get the response of the method, obtain the definition, description, type, etc. of the response, and put it into the apiResponses of ApiMethod.

[0138] (7) Finally, we get the Apidocument, which contains all the necessary information of the entire Controller. Using Freemaker template technology, we generate the Api document page, Api test page, and ApiMock page from ApiDoc.ftl, ApiTest.ftl, and ApiMock.ftl.

[0139] (8) Finally, the generated page is displayed on the monitor, and the user can view the API documentation, test and mock the interface.

[0140] (9) When the user needs to test a certain interface, he only needs to select the interface and input the parameters to start the test. The interface address, access type, and number of parameters have all been generated in advance.

[0141] (10) If the current interface has not been completely written, you can perform a mock operation. Select an interface and enter the content to be returned on the mock page. Click Save. When the user accesses this interface again, the mock data will be returned.

[0142] Among them, ApidocFilter is the interface document filter; / apidoc is the program link, such as http: / / ip:port / apidoc / a / b / c. If this link starts with / apidoc, it is the link we want to filter; url: the url here refers to the above / a / b / c; Controller; the controller in SpringMVC, the controller is generally bound to a RequestMapping, which is the access path. If the bound link is the same as the link we obtained above, it is the controller we are looking for; @Api: interface document annotation.

[0143] The embodiment of the present invention also provides an interface document, test and simulation generation device, including:

[0144] The first acquisition module is used to acquire the user access link.

[0145] The second acquisition module is used to acquire the interface information of the user access link, all control methods corresponding to the associated controller, and the input parameters and output parameters of the control methods.

[0146] The combination module is used to combine all control methods corresponding to the controller, input parameters and output parameters of the control methods, and interface information into an interface document class.

[0147] The generation module is used to generate interface document pages, interface test pages and simulation pages from interface document classes based on template technology.

[0148] The specific working process of the units disclosed in the above embodiments of the present application can be found in the corresponding method embodiments, which will not be repeated here and are all within the protection scope of the present application.

[0149] An embodiment of the present invention further provides a computer storage medium on which a computer program is stored, wherein when the computer program is executed by a processor, the interface document, test and simulation generation method provided in the above embodiment is implemented.

[0150] The process and principle of the interface document, test and simulation generation method can be found in the above embodiments for details, which will not be described here one by one, and are all within the scope of protection of this application.

[0151] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer 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 foregoing.

[0152] It should be noted that the computer-readable medium disclosed above may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-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 of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer 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. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, device or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. The computer readable signal medium may also be any computer readable medium other than a computer 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. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.

[0153] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.

[0154] Another embodiment of the present invention provides an electronic device, including:

[0155] One or more processors.

[0156] A storage device having one or more programs stored thereon.

[0157] When one or more programs are executed by one or more processors, the one or more processors implement the interface document, test and simulation generation method as any one of the above embodiments.

[0158] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart.

[0159] The features recorded in the various embodiments in this specification can be replaced or combined with each other, and the same and similar parts between the various embodiments can refer to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system or system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can refer to the partial description of the method embodiment. The system and system embodiments described above are only schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative work.

[0160] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.

[0161] The above description of the disclosed embodiments enables one skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to one skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. An interface document, test and simulation generation method, characterized in that: include: Get the user access link; Obtaining interface information of the user access link, all control methods corresponding to the associated controller, and input parameters and output parameters of the control methods; Combine all control methods corresponding to the controller, input parameters and output parameters of the control methods, and interface information into an interface document class; Dynamically generate interface document pages, interface test pages and simulation pages from the interface document class according to template technology; The obtaining of the interface information of the user access link, all control methods corresponding to the associated controller, and the input parameters and output parameters of the control method include: Obtaining the interface annotation in the user access link; wherein the interface annotation includes: the interface information, interface information method, interface information input parameter, and interface information output parameter; The interface information includes: document title and document description; the interface information method includes: all methods of the controller; the interface information input parameters include: input parameters of the control method; the interface information output parameters include: output parameters of the control method.

2. The interface document, test and simulation generation method according to claim 1, characterized in that: The obtaining of the interface information of the user access link, all control methods corresponding to the associated controller, and the input parameters and output parameters of the control method include: Obtain the controller associated with the user access link, and scan all control methods of the controller; Obtaining input parameters of the control method; According to the input parameters of the control method, the output parameters of the control method are obtained.

3. The interface document, test and simulation generation method according to claim 1, characterized in that: After the interface document class is used to generate an interface document page, an interface test page and a simulation page according to the template technology, the following is also included: Output the generated page to the display.

4. The interface document, test and simulation generation method according to claim 3, characterized in that: After outputting the generated page to the display, it also includes: When a simulated interface request is obtained from the user, the simulated interface when the user enters the simulated page is obtained; Saves information of simulation interface and simulation data.

5. The interface document, test and simulation generation method according to claim 4, characterized in that: After outputting the generated page to the display, it also includes: When a user's test interface request is obtained, information about the interface tested when the user enters the interface test page is obtained; Sign the parameters of the test interface and encapsulate the interface parameters and interface address; Determine whether the test interface is simulated; if not, process the returned data normally; if so, return the simulated data.

6. The interface document, test and simulation generation method according to claim 1, characterized in that: The interface document class is used according to the template technology to dynamically generate an interface document page, an interface test page and a simulation page, including: Generate an interface document page by combining the interface document class and the interface document template according to the template technology; Generate an interface test page by combining the interface document class and the interface test template according to the template technology; and The interface document class and the interface simulation template are combined according to the template technology to generate a simulation page.

7. The interface document, test and simulation generation method according to any one of claims 1 to 6, characterized in that: Acquiring the interface information of the user access link, all control methods corresponding to the associated controller, and the input parameters and output parameters of the control method, further comprising: The user access link is filtered using an interface document filter; Determining whether the prefix of the filtered user access link is a preset prefix; If yes, then get the link following the prefix; Determine whether the controller associated with the link following the prefix has been configured with an interface annotation; If so, the steps of obtaining the interface information of the user access link, all control methods corresponding to the associated controller, and the input parameters and output parameters of the control methods are executed.

8. An interface document, test and simulation generation device, characterized in that: include: The first acquisition module is used to acquire the user access link; A second acquisition module is used to acquire interface information of the user access link, all control methods corresponding to the associated controller, and input parameters and output parameters of the control methods; A combination module, used for combining all control methods corresponding to the controller, input parameters and output parameters of the control methods, and the interface information into an interface document class; A generation module, used to dynamically generate interface document pages, interface test pages and simulation pages from the interface document class according to template technology; The second acquisition module is specifically used to obtain the interface annotation in the user access link; wherein the interface annotation includes: the interface information, interface information method, interface information input parameters, interface information output parameters; the interface information includes: document title and document description; the interface information method includes: all methods of the controller; the interface information input parameters include: input parameters of the control method; the interface information output parameters include: output parameters of the control method.

9. A computer storage medium, characterized in that: A computer program is stored thereon, wherein when the computer program is executed by a processor, the interface document, test and simulation generation method as described in any one of claims 1 to 7 is implemented.