Interface management method, device, equipment and storage medium
Collect information through the interface definition interactive interface to generate interface documents and dynamically generate test data, which solves the problem of low front-end and back-end collaboration efficiency, realizes the test data requirements of front-end technicians and avoids repeated revisions by back-end technicians.
Patent Information
- Application Number
- CN202010522353.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-06-10
- Publication Date
- 2024-10-25
- Estimated Expiration
- 2040-06-10
AI Technical Summary
Lack of communication between front-end and back-end technical staff leads to low collaboration efficiency, and existing interface management tools cannot dynamically generate test data, resulting in extended product development time and increased workload.
An interface management method and device are provided, which collects interface definition information through the interface definition interactive interface, generates interface documents, and dynamically generates test data based on the request information.
It improves the efficiency of front-end and back-end collaboration, allowing front-end technicians to carry out development work at the same time to meet test data requirements and avoid back-end technicians from repeatedly revising the interface code.
Smart Images

Figure CN111694561B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present invention relate to the field of application development technology, and in particular to an interface management method, device, equipment and storage medium. Background Art
[0002] In the process of developing application products, back-end technicians are responsible for logic and provide data to front-end technicians, while front-end technicians are responsible for receiving back-end data for display and interaction. The development model with front-end and back-end separation allows technicians to focus on improving development efficiency in their respective fields. However, this collaborative approach also has some problems. For example, due to the lack of technical communication between front-end and back-end technicians, front-end technicians can only determine whether the interface meets the front-end requirements based on the generated test data when they perform joint debugging based on the interface documents provided by the back-end technicians. If the requirements are not met, the back-end technicians are required to rework. This serial working mode will prolong the time of product development, reduce the efficiency of product development, and increase the workload of front-end and back-end technicians.
[0003] The existing technology mainly generates interface documents by parsing the code data written by back-end technicians, but this technical means also needs to wait for the back-end technicians to finish writing the code before it can be implemented. And due to the lack of participation of front-end technicians, there will also be the problem of repeatedly modifying the interface. In addition, existing interface management tools, such as Swagger, do not have the function of dynamically generating test data, and thus cannot meet the test data requirements of the front-end development process. Summary of the invention
[0004] The embodiments of the present invention provide an interface management method, device, equipment and storage medium to improve the efficiency of front-end and back-end collaboration and dynamically generate test data required by front-end technicians.
[0005] In a first aspect, an embodiment of the present invention provides an interface management method, the method comprising:
[0006] When receiving the interface definition instruction input by the user, displaying the interface definition interactive interface;
[0007] Collecting interface definition information based on the interface definition interaction interface, and generating an interface document based on the interface definition information;
[0008] Receive externally input request information, and generate test data corresponding to the request information according to the request information and the interface document.
[0009] In a second aspect, an embodiment of the present invention further provides an interface management device, the device comprising:
[0010] The interface definition module is used to display an interface definition interaction interface when receiving an interface definition instruction input by a user, collect interface definition information input by the user based on the interface definition interaction interface, and generate an interface document based on the interface definition information;
[0011] An information transmission module, used for receiving request information input by a user;
[0012] The response simulation module is used to generate test data corresponding to the request information according to the request information and the interface document.
[0013] In a third aspect, an embodiment of the present invention further provides a device, the device comprising:
[0014] one or more processors;
[0015] A memory for storing one or more programs;
[0016] When the one or more programs are executed by the one or more processors, the one or more processors implement any of the interface management methods mentioned above.
[0017] In a fourth aspect, an embodiment of the present invention further provides a storage medium comprising computer executable instructions, wherein the computer executable instructions are used to execute any of the above-mentioned interface management methods when executed by a computer processor.
[0018] The embodiment of the present invention solves the problem of low efficiency of front-end and back-end collaboration by setting an interface definition interactive interface to collect interface definition information and generate interface documents, so that front-end technicians and back-end technicians can carry out development work at the same time, which not only meets the front-end technicians' needs for test data, but also avoids the back-end technicians from repeatedly revising the interface code at a later stage. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] Figure 1 This is a flow chart of an interface management method provided in Embodiment 1 of the present invention.
[0020] Figure 2A It is a schematic diagram of a Headers parameter collection module in an interface definition interaction interface provided in the first embodiment of the present invention.
[0021] Figure 2B It is a schematic diagram of a Query parameter collection module in an interface definition interaction interface provided in the first embodiment of the present invention.
[0022] Figure 2C It is a schematic diagram of a Body parameter acquisition module in an interface definition interaction interface provided in Example 1 of the present invention.
[0023] Figure 3A It is a schematic diagram of an interface definition interaction interface provided in the first embodiment of the present invention.
[0024] Figure 3B It is a schematic diagram of interface definition information provided by Embodiment 1 of the present invention.
[0025] Figure 4 This is a flow chart of an interface management method provided in Embodiment 2 of the present invention.
[0026] Figure 5 This is a flow chart of a test data response method provided in Embodiment 2 of the present invention.
[0027] Figure 6 This is a flowchart of an interface document import and export provided by Embodiment 2 of the present invention.
[0028] Figure 7 It is a schematic diagram of an interface management device provided in Embodiment 3 of the present invention.
[0029] Figure 8 It is a structural schematic diagram of a device provided in Embodiment 4 of the present invention. DETAILED DESCRIPTION
[0030] The present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are only used to explain the present invention, rather than to limit the present invention. It should also be noted that, for ease of description, only parts related to the present invention, rather than all structures, are shown in the accompanying drawings.
[0031] Embodiment 1
[0032] Figure 1 This is a flowchart of an interface management method provided in the first embodiment of the present invention. This embodiment is applicable to the development of products based on the front-end and back-end models. The method can be executed by an interface management device, which can be implemented in software and / or hardware, and can be configured in a terminal device. Specifically, it includes the following steps:
[0033] S110 . When an interface definition instruction input by a user is received, an interface definition interaction interface is displayed.
[0034] In one embodiment, optionally, the user inputs the interface definition instruction in at least one of a shortcut key, a page option, and a code. Exemplarily, when the user inputs the interface definition instruction through the shortcut key, a correspondence between the interface definition instruction and the shortcut key is established. Exemplarily, the shortcut key may be "shift+T". The specific definition of the shortcut key is not limited here, and the user may customize it. Exemplarily, when the user inputs the interface definition instruction through the page option, specifically, the user may input the interface definition instruction by clicking the page option corresponding to the interface definition function on the display interface of the terminal device. Specifically, the page option may also be an icon. Exemplarily, when the user inputs the interface definition instruction through the code, a correspondence between the interface definition instruction and the code is established, and the user may input the interface definition instruction by writing the code. Specifically, the user may enter the code corresponding to the interface definition instruction in the "Run" program of the terminal device.
[0035] The interface definition instruction is used to trigger the display of the interface definition interactive interface, wherein the interface definition interactive interface can collect the interface definition information input by the user.
[0036] S120: Collect interface definition information based on the interface definition interaction interface, and generate an interface document based on the interface definition information.
[0037] Exemplarily, the user inputs interface definition information in the interface definition interaction interface based on the content and related operation methods displayed on the interface definition interaction interface.
[0038] In one embodiment, optionally, the interface definition information includes basic information, request parameter information and response data information.
[0039] In one embodiment, optionally, the basic information includes interface name, interface method and interface path information. Among them, exemplarily, the interface name is used to distinguish interfaces with different functions, and the user can customize the settings. In actual applications, the front-end technicians and the back-end technicians negotiate to determine the required interface functions and the naming methods of each functional interface. Among them, exemplarily, the interface method includes the method supported by HTTP request (HyperText Transport Protocol). Exemplarily, the interface method includes but is not limited to GET, POST, PUT, DELETE, HEAD, OPTIONS, PATCH and TRACE. Among them, GET is used to obtain the specified resource and return the request body; POST is used to submit data to the specified resource for request processing, such as uploading a file; PUT is used to upload the latest content to the specified resource; DELETE is used to delete the specified resource; HEAD is used to obtain the specified resource but does not return the request body; OPTIONS is used to return the HTTP request method provided by the server to the specified resource; PATCH is used to update part of the content of the specified resource, such as updating a certain field; TRACE echoes the request received by the server, which is mainly used for testing or diagnosis. Wherein, exemplarily, the interface path includes an interface URI (Uniform Resource Identifier), and exemplarily, the interface path supports the Restful style, such as / api / users / :id.
[0040] In one embodiment, optionally, the request parameter information includes Headers parameter information, Query parameter information and Body parameter information. Among them, the HTTP request message includes a request line, a request body, a blank line and request data. Among them, the request header consists of a keyword / value pair, and the keyword and value are separated by ":". The request header is used to notify the server side about the client's request information. The Headers parameter includes the request header in the HTTP request message. Specifically, the Headers parameter information includes information such as parameter name, parameter value, example and remarks, among which an example of the Headers parameter information can be Content-Type: application / json. Figure 2A FIG. 1 is a schematic diagram of a Headers parameter collection module in an interface definition interaction interface provided in the first embodiment of the present invention. Figure 2A As shown, the Headers parameter collection interface includes an "Add Header" option, and the user can generate a new Headers parameter collection unit by clicking this option. Figure 2A3 Headers parameter collection units are shown in FIG. 1 , each of which includes a parameter name text box, a parameter value text box, and a remark information text box. The user can also click the trash can icon behind the Headers parameter collection unit to delete the corresponding Headers parameter collection unit.
[0041] The query parameter information is the parameter in the URL (Uniform Resource Locator) in the HTTP request message, which is located after the "?". The query parameter consists of a keyword / value pair, and multiple query parameters are connected by "&". Specifically, the query parameter information includes information such as the parameter name, whether it is required, examples, and remarks. An example of the query parameter information can be http: / / example.com / ? a=xxx&b=yyy, where a and b represent query parameters, and xxx and yyy are the values of a and b respectively. Figure 2B FIG. 1 is a schematic diagram of a query parameter collection module in an interface definition interactive interface provided by the first embodiment of the present invention. Figure 2B As shown, the Query parameter collection interface includes an "Add Query Parameter" option, and the user can generate a new Query parameter collection unit by clicking this option. Figure 2B 3 Query parameter collection units are shown in the figure, each of which includes a parameter name text box, a parameter value text box, and a remark information text box. The "box" in each Query parameter collection unit indicates whether it is required. After the user clicks the box, a "√" is generated in the box. The user can also click the "trash can" icon behind the Query parameter collection unit to delete the corresponding Query parameter collection unit.
[0042] The Body parameter includes the request body in the HTTP request message and supports the JSON format. In one embodiment, optionally, a JSON property editor is used to collect the Body parameter information. Specifically, the Body parameter information includes information such as the property name, whether it is required, the property type, the simulation rule, and the remarks. Figure 2C FIG. 1 is a schematic diagram of a Body parameter acquisition module in an interface definition interaction interface provided in the first embodiment of the present invention. Figure 2C As shown in the figure, "root" indicates the attribute name, "box" indicates "required", "object" indicates "attribute type", and "mock" indicates "simulation rule". Users can click the "+" icon behind the Body parameter collection unit to add a new sub-Body parameter corresponding to the Body parameter under the Body parameter, such as Figure 2CAs shown in the figure, "field_1", "field_2" and "field_3" are the sub-Body parameters of "root", and "field_4" is the sub-Body parameter of "field_1". You can delete the corresponding Body parameter collection unit by clicking the "×" icon behind the Body parameter collection unit.
[0043] In one embodiment, the response data information may include data in JSON format. In one embodiment, the response data information may be used to define constraints and rules for generating test data. Figure 4 Similarly, the description will not be repeated here.
[0044] Figure 3A It is a schematic diagram of an interface definition interaction interface provided in Example 1 of the present invention. The interface definition interaction interface shown in Figure 3 includes a basic information collection module, a request parameter collection module and a response data collection module. Among them, the two text boxes after "interface path" are the interface method text box and the interface path text box. After the user completes editing the definition information of the current interface, click the "Save" button in the interface to save the interface definition information. The interface definition interaction interface also includes an interface list for displaying all collected interfaces. Specifically, the interfaces can be classified and the corresponding interfaces can be displayed in different classification lists. Exemplarily, the classification list includes a test interface.
[0045] In one embodiment, optionally, the interface definition information also includes the interface status, the interface creator, and the interface update time. The interface status is used to indicate the definition status of the current interface. Exemplarily, the interface status may be unfinished, completed, and updating, etc. The interface creator includes the user who created the current interface. Specifically, before displaying the interface definition interactive interface, an account input prompt box is displayed. When the input account is the same as the saved account, the interface definition interactive interface is displayed, allowing the user to use the account to enter the interface definition information. The interface update time is used to record the time when the current interface is edited. Specifically, the interface update time is recorded when a save instruction is received.
[0046] Figure 3B It is a schematic diagram of interface definition information provided by Embodiment 1 of the present invention. Figure 3BThe interface definition information of the interface shown includes basic information, request parameter information, response data information, notes and modification records. Among them, the basic information includes name, creator, status, update time, method and path. The request parameter information includes Headers parameter information, Query parameter information and Body parameter information. Each Headers parameter collection unit in the Header list includes parameter name, parameter value, example and notes, each Query parameter collection unit in the Query list includes parameter name, whether it is required, example and notes, and each Body parameter collection unit in the Body list includes attribute name, whether it is required, attribute type, simulation rule and notes, wherein the attribute type includes text type and file type. The text type means that the parameter contains keyword / value pairs, and the file type means that the parameter contains files. The data type of the response data information is mainly in JSON format, and each collection unit in the parameter list includes attribute name, whether it is required, attribute type, simulation rule and notes, wherein the attribute type includes string, number, array, object, boolean and integer, and the above attribute types represent string data type, numerical data type, array data type, reference type, Boolean type and integer data type respectively.
[0047] S130, receiving external input request information, and generating test data corresponding to the request information according to the request information and the interface document.
[0048] Exemplarily, the type of request information includes HTTP request information. Specifically, according to the request parameter data in the request information and the response data information defined in the interface document, the test data corresponding to the request information is generated.
[0049] The technical solution of this embodiment solves the problem of low efficiency of front-end and back-end collaboration by setting up an interface definition interactive interface to collect interface definition information and generate interface documents, so that front-end technicians and back-end technicians can carry out development work at the same time, which not only meets the front-end technicians' needs for test data, but also avoids the back-end technicians from repeatedly revising the interface code at a later stage.
[0050] Embodiment 2
[0051] Figure 4It is a flowchart of an interface management method provided in the second embodiment of the present invention. The technical solution of this embodiment is a further refinement based on the above embodiment. Optionally, the test data corresponding to the request information is generated according to the request information and the interface document, including: matching the request information with the request parameter information in the interface document to obtain the target request parameter information and the response data information corresponding to the target request parameter information; generating the test data corresponding to the request information according to the target request parameter information and the response data information.
[0052] The specific implementation steps of this embodiment include:
[0053] S210: When an interface definition instruction input by a user is received, an interface definition interaction interface is displayed.
[0054] S220: Collect interface definition information based on the interface definition interaction interface, and generate an interface document based on the interface definition information.
[0055] S230, receiving externally input request information, matching the request information with the request parameter information in the interface document, and obtaining target request parameter information and response data information corresponding to the target request parameter information.
[0056] Wherein, exemplarily, the type of request information includes HTTP request information. Wherein, specifically, based on the basic information in the request information and the basic information in the interface document, matching is performed, where exemplarily, the basic information includes information such as interface name, interface method and interface path, and after a successful match, the definition interface corresponding to the request information, the target request parameter information corresponding to the definition interface and the response data information corresponding to the target request parameter can be obtained.
[0057] S240: Generate test data corresponding to the request information according to the target request parameter information and the response data information.
[0058] In one embodiment, optionally, the request information is verified according to the target request parameter information; if the verification is successful, the test data corresponding to the request information is generated according to the response data information. Wherein, exemplarily, the parameter type in the request information is verified according to the parameter type in the target request parameter information, if the parameter type in the request information is different from the parameter type in the target request parameter information, the verification fails, if they are the same, the verification succeeds. Wherein, generating the test data corresponding to the request information according to the response data information includes: generating the test data according to the simulation rules in the response data information and the request parameter data in the request information. Wherein, the simulation rules are used to identify the generation rules of the test data. In one embodiment, the simulation rules include defining the data type of the test data, such as @integer represents integer data, and @string represents string data. In one embodiment, the simulation rules include defining the data type and data length of the test data, such as @integer(1-10) represents integer data with a value of 1-10, and @string(1-10) represents string data with a value of 1-10. In one embodiment, the simulation rules include regular expression rules, such as @regex:^[a-zA-Z0-9]+$, where "^" represents matching the beginning of an input word line, "[a-zA-Z0-9]" represents 26 uppercase letters, 26 lowercase letters and 0 to 9 numbers, and "$" represents matching the end of an input line.
[0059] In one embodiment, optionally, the verification result and the generated test data are returned to the user; wherein the verification result includes a verification failure flag and remark information corresponding to the verification failure flag. wherein the verification failure flag is used to characterize different verification failure reasons, and the remark information is used to explain the reason for the verification failure. wherein, exemplarily, if the parameter type in the request information of the request parameter is different from the parameter type in the target request parameter information, the verification failure flag is A, and the remark information is that the parameter type does not meet the requirements. if the request information of the request parameter lacks a required parameter, the verification failure flag is B, and the remark information is that a required parameter is missing. the verification failure flag and the remark information are not specifically limited here, and the user can customize the settings.
[0060] Figure 5 This is a flow chart of a test data response method provided in Embodiment 2 of the present invention. Figure 5 The middle dotted line represents the server side. The request information is input to the server side through the client side, and the server side returns the generated response to the client side. Figure 5The receiving entrance and response entrance of the request information shown use the same gateway, which receives the request information input by the client and also receives the response data input by the server. When the gateway receives the request information, it matches the basic information of the request information with the basic information of the interface in the interface document, determines the matching definition interface, the target request parameter information of the definition interface, and the response data information corresponding to the target request parameter information. The request information is verified based on the target request parameter information, and the verification response data is sent to the response entrance gateway. If the verification is successful, test data is generated based on the response data information and the parameter data in the request information and sent to the response entrance gateway. The response entrance gateway returns the received verification response data and test data to the client.
[0061] On the basis of the above embodiment, optionally, an interface document to be migrated input by a user is received, and the interface definition information in the interface document to be migrated is parsed to obtain interface definition information that meets the preset format requirements. Among them, the interface document to be migrated includes interface documents generated by other interface management platforms. Exemplarily, the other interface management platform may be a swagger platform, and the data format of the interface document to be migrated may be in JSON format. The interface definition information in the interface documents generated by different interface management platforms is defined differently. Exemplarily, in this embodiment, "name" is used to represent the parameter name, and other interface management platforms use "" to represent the parameter name. Specifically, the interface definition information in the interface document to be migrated is parsed, including: according to the preset format requirements, the interface definition information in the interface document to be migrated is converted into the target interface definition information. Exemplarily, "definition" in the interface definition information in the migration interface document is replaced with "name".
[0062] The advantage of this setting is that the swagger platform can generate interface documents, but it does not have the function of dynamically generating test data. On the one hand, this embodiment simplifies the steps for technicians to re-enter interface definition information, and on the other hand, improves the compatibility of interface management to better meet user needs.
[0063] On the basis of the above embodiment, optionally, the target export template and export interface definition information are obtained, and the export interface definition information is filled into the target export template to generate an export interface document. The target export template includes the interface to be exported and the logical relationship between the interfaces. Specifically, the user can edit the default export template to generate a target export template, and based on the export interface in the target export template, obtain the export interface definition information corresponding to the export interface.
[0064] The advantage of such a setting is that different user requirements correspond to different interface documents. If only the default interface document can be exported, different user requirements cannot be met. This embodiment avoids the step of repeatedly modifying the exported interface document by setting the export template, reduces the workload of exporting the interface document, and thus improves work efficiency.
[0065] Figure 6 This is a flowchart of an interface document import and export provided by the second embodiment of the present invention. The interface document to be migrated is received in JSON format or provided by the swagger interface, and the interface document to be migrated is parsed by the import module to obtain interface definition information that meets the preset format requirements. The interface definition information corresponding to the export template is filled into the export template through the export template defined in the export module, and the interface document is generated and exported.
[0066] The technical solution of this embodiment solves the problem of low test efficiency by matching and verifying request information based on target request parameter information. The technicians can promptly correct the input request information according to the output verification results, thereby improving the efficiency of the test work.
[0067] Embodiment 3
[0068] Figure 7 Schematic diagram of an interface management device provided in Embodiment 3 of the present invention. This embodiment is applicable to product development based on the front-end and back-end models. The device can be implemented in software and / or hardware, and can be configured in a terminal device. The interface management device includes: an interface definition module 310, an information transmission module 320, and a response simulation module 330.
[0069] The interface definition module 310 is used to display an interface definition interactive interface when receiving an interface definition instruction input by a user, collect interface definition information input by the user based on the interface definition interactive interface, and generate an interface document based on the interface definition information;
[0070] The information transmission module 320 is used to receive the request information input by the user;
[0071] The response simulation module 330 is used to generate test data corresponding to the request information according to the request information and the interface document.
[0072] The technical solution of this embodiment solves the problem of low efficiency of front-end and back-end collaboration by setting up an interface definition interactive interface to collect interface definition information and generate interface documents, so that front-end technicians and back-end technicians can carry out development work at the same time, which not only meets the front-end technicians' needs for test data, but also avoids the back-end technicians from repeatedly revising the interface code at a later stage.
[0073] On the basis of the above technical solution, optionally, the interface definition information includes basic information, request parameter information and response data information, wherein the request parameter information includes Headers parameter information, Query parameter information and Body parameter information.
[0074] On the basis of the above technical solution, optionally, the response simulation module 330 includes:
[0075] A target request parameter information determination unit, used to match the request information with the request parameter information in the interface document to obtain the target request parameter information and the response data information corresponding to the target request parameter information;
[0076] The test data generating unit is used to generate test data corresponding to the request information according to the target request parameter information and the response data information.
[0077] On the basis of the above technical solution, optionally, the test data generating unit is specifically used to:
[0078] Verify the request information according to the target request parameter information;
[0079] If the verification is successful, test data corresponding to the request information is generated based on the response data information.
[0080] On the basis of the above technical solution, optionally, the device further includes:
[0081] The test data return module is used to return the verification result and the generated test data to the user; wherein the verification result includes a verification failure mark and remark information corresponding to the verification failure mark.
[0082] On the basis of the above technical solution, optionally, the device further includes:
[0083] The import module is used to receive the interface document to be migrated input by the user, parse the interface definition information in the interface document to be migrated, and obtain the interface definition information that meets the preset format requirements.
[0084] On the basis of the above technical solution, optionally, the device further includes:
[0085] The export module is used to obtain the target export template and export interface definition information, and fill the export interface definition information into the target export template to generate an export interface document.
[0086] The interface management device provided in the embodiment of the present invention can be used to execute the interface management method provided in the embodiment of the present invention, and has the corresponding functions and beneficial effects of the execution method.
[0087] It is worth noting that in the embodiment of the above-mentioned interface management device, the various units and modules included are only divided according to functional logic, but are not limited to the above-mentioned division, as long as the corresponding functions can be achieved; in addition, the specific names of the functional units are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of the present invention.
[0088] Embodiment 4
[0089] Figure 8 It is a structural diagram of a device provided by Embodiment 4 of the present invention. The embodiment of the present invention provides services for the implementation of the interface management method of the above embodiment of the present invention, and the interface management device in the above embodiment can be configured. Figure 8 A block diagram of an exemplary device 12 suitable for use in implementing embodiments of the present invention is shown. Figure 8 The device 12 shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0090] like Figure 8 As shown, device 12 is in the form of a general purpose computing device. Components of device 12 may include, but are not limited to, one or more processors or processing units 16, system memory 28, and bus 18 that connects various system components (including system memory 28 and processing unit 16).
[0091] Bus 18 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processor or a local bus using any of a variety of bus architectures. By way of example, these architectures include, but are not limited to, an Industry Standard Architecture (ISA) bus, a Micro Channel Architecture (MAC) bus, an Enhanced ISA bus, a Video Electronics Standards Association (VESA) local bus, and a Peripheral Component Interconnect (PCI) bus.
[0092] Device 12 typically includes a variety of computer system readable media. These media can be any available media that can be accessed by device 12, including volatile and non-volatile media, removable and non-removable media.
[0093] System memory 28 may include computer system readable media in the form of volatile memory, such as random access memory (RAM) 30 and / or cache memory 32. Device 12 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, storage system 34 may be used to read and write non-removable, non-volatile magnetic media ( Figure 8 not shown, usually called a "hard drive"). Although Figure 8Not shown in the figure, a disk drive for reading and writing to a removable non-volatile disk (e.g., a "floppy disk"), and an optical disk drive for reading and writing to a removable non-volatile optical disk (e.g., a CD-ROM, a DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to the bus 18 via one or more data medium interfaces. The memory 28 may include at least one program product having a set (e.g., at least one) of program modules that are configured to perform the functions of the various embodiments of the present invention.
[0094] A program / utility 40 having a set (at least one) of program modules 42 may be stored, for example, in the memory 28, such program modules 42 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. The program modules 42 generally perform the functions and / or methods of the embodiments described herein.
[0095] The device 12 may also communicate with one or more external devices 14 (e.g., a keyboard, a pointing device, a display 24, etc.), one or more devices that enable a user to interact with the device 12, and / or any device that enables the device 12 to communicate with one or more other computing devices (e.g., a network card, a modem, etc.). Such communication may be performed through an input / output (I / O) interface 22. Furthermore, the device 12 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) through a network adapter 20. Figure 8 As shown, the network adapter 20 communicates with other modules of the device 12 via the bus 18. It should be understood that, although not shown in the figure, other hardware and / or software modules can be used in conjunction with the device 12, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0096] The processing unit 16 executes various functional applications and data processing by running programs stored in the system memory 28, such as implementing the interface management method provided in the embodiment of the present invention.
[0097] Through the above-mentioned equipment, the problem of low efficiency of front-end and back-end collaboration has been solved, allowing front-end technicians and back-end technicians to carry out development work at the same time, which not only meets the front-end technicians' needs for test data, but also avoids the back-end technicians from repeatedly revising the interface code in the later stage.
[0098] Embodiment 5
[0099] Embodiment 5 of the present invention further provides a storage medium including computer executable instructions, and when the computer executable instructions are executed by a computer processor, they are used to execute an interface management method, the method comprising:
[0100] When receiving the interface definition instruction input by the user, displaying the interface definition interactive interface;
[0101] Collect interface definition information based on the interface definition interaction interface, and generate interface documents based on the interface definition information;
[0102] Receive external input request information, and generate test data corresponding to the request information based on the request information and interface documents.
[0103] The computer storage medium of the embodiment of the present invention can adopt any combination of one or more computer-readable media. The computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. The computer-readable storage medium can be, for example, but not limited to, a system, device or device of electricity, magnetism, light, electromagnetic, infrared, or semiconductor, or any combination of the above. More specific examples (non-exhaustive list) of computer-readable storage media include: 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 this document, a computer-readable storage medium can be any tangible medium containing or storing a program, which can be used by an instruction execution system, a device or a device or used in combination with it.
[0104] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, which carry computer-readable program code. 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. Computer-readable signal media 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.
[0105] The program code embodied on the computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
[0106] Computer program code for performing the operation of the present invention may be written in one or more programming languages or combinations thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer through any type of network including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0107] Of course, the computer executable instructions of a storage medium including computer executable instructions provided in an embodiment of the present invention are not limited to the above method operations, and can also execute related operations in the interface management method provided in any embodiment of the present invention.
[0108] Note that the above are only preferred embodiments of the present invention and the technical principles used. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and that various obvious changes, readjustments and substitutions can be made by those skilled in the art without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in more detail through the above embodiments, the present invention is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of the present invention, and the scope of the present invention is determined by the scope of the appended claims.
Claims
1. An interface management method, characterized in that: Applied to product development based on front-end and back-end models, including: When receiving an interface definition instruction input by a user, an interface definition interactive interface is displayed; wherein the user inputs the interface definition instruction in a manner including at least one of a shortcut key, a page option, and a code input method; the interface definition interactive interface includes a basic information collection module, a request parameter collection module, a response data collection module, and an interface list; Based on the interface definition interaction interface, interface definition information is collected, and an interface document is generated based on the interface definition information; wherein the interface definition information includes basic information, request parameter information, response data information, interface status, interface creator, and interface update time; the request parameter information includes Headers parameter information, Query parameter information, and Body parameter information; the response data information includes data in JSON format; Receive external input request information; Matching the basic information in the request information with the basic information of the request parameter information in the interface document to obtain target request parameter information and response data information corresponding to the target request parameter information; wherein the basic information includes an interface name, an interface method, and an interface path; and the response data information is used to define constraints and rules for generating test data; Verifying the request information according to the target request parameter information; If the verification is successful, then generating test data corresponding to the request information according to the simulation rules in the response data information and the request parameter data in the request information; wherein the simulation rules include: defining the data type, data length and regular expression rules of the test data; Returning the verification result and the generated test data to the user; wherein the verification result includes a verification failure mark and remark information corresponding to the verification failure mark; the verification failure mark is used to represent different verification failure reasons, and the remark information is used to explain the reason for the verification failure; Receiving the interface document to be migrated input by the user, and converting the interface definition information in the interface document to be migrated into the target interface definition information according to the preset format requirement; wherein the interface document to be migrated includes the interface document generated by other interface management platforms; the interface definition information in the interface documents generated by different interface management platforms is defined in different ways; Obtain a target export template and export interface definition information, and fill the export interface definition information into the target export template to generate an export interface document; wherein the target export template is generated by editing a default export template, and the target export template includes interfaces to be exported and logical relationships between interfaces; the export interface definition information is obtained based on the export interface in the target export template.
2. An interface management device, characterized in that: Applied to product development based on front-end and back-end models, including: The interface definition module is used to display the interface definition interaction interface when receiving the interface definition instruction input by the user; wherein the user inputs the interface definition instruction in a manner including at least one of shortcut keys, page options and codes; the interface definition interaction interface includes a basic information collection module, a request parameter collection module, a response data collection module and an interface list; based on the interface definition interaction interface, interface definition information is collected, and an interface document is generated based on the interface definition information; wherein the interface definition information includes basic information, request parameter information, response data information, interface status, interface creator and interface update time; the request parameter information includes Headers parameter information, Query parameter information and Body parameter information; the response data information includes data in JSON format; An information transmission module, used for receiving request information input by a user; A response simulation module, including a target request parameter information determination unit and a test data generation unit; The target request parameter information determination unit is used to match the basic information in the request information with the basic information of the request parameter information in the interface document to obtain the target request parameter information and the response data information corresponding to the target request parameter information; wherein the basic information includes the interface name, interface method and interface path; the response data information is used to define the constraints and rules for generating test data; The test data generating unit is used to verify the request information according to the target request parameter information; if the verification is successful, the test data corresponding to the request information is generated according to the simulation rules in the response data information and the request parameter data in the request information; wherein the simulation rules include: defining the data type, data length and regular expression rules of the test data; A test data return module, used to return the verification result and the generated test data to the user; wherein the verification result includes a verification failure mark and remark information corresponding to the verification failure mark; the verification failure mark is used to represent different verification failure reasons, and the remark information is used to explain the reason for the verification failure; An import module is used to receive the interface document to be migrated input by the user, and convert the interface definition information in the interface document to be migrated into the target interface definition information according to the preset format requirements; wherein the interface document to be migrated includes the interface document generated by other interface management platforms; the interface definition information in the interface documents generated by different interface management platforms is defined in different ways; An export module is used to obtain a target export template and export interface definition information, and fill the export interface definition information into the target export template to generate an export interface document; wherein the target export template is generated by editing a default export template, and the target export template includes interfaces to be exported and logical relationships between interfaces; the export interface definition information is obtained based on the export interface in the target export template.
3. An electronic device, characterized in that: include: one or more processors; A memory for storing one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the interface management method as claimed in claim 1.
4. A storage medium containing computer executable instructions, characterized in that: The computer executable instructions are used to perform the interface management method according to claim 1 when executed by a computer processor.
