CN115658537A - Interface data simulation method and device - Google Patents

Interface data simulation method and device Download PDF

Info

Publication number
CN115658537A
CN115658537A CN202211386995.0A CN202211386995A CN115658537A CN 115658537 A CN115658537 A CN 115658537A CN 202211386995 A CN202211386995 A CN 202211386995A CN 115658537 A CN115658537 A CN 115658537A
Authority
CN
China
Prior art keywords
simulation data
interface
interface simulation
api
api route
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211386995.0A
Other languages
Chinese (zh)
Inventor
徐�明
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Bank of China Ltd
Original Assignee
Bank of China Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Bank of China Ltd filed Critical Bank of China Ltd
Priority to CN202211386995.0A priority Critical patent/CN115658537A/en
Publication of CN115658537A publication Critical patent/CN115658537A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Stored Programmes (AREA)

Abstract

The invention discloses a method and a device for simulating interface data, which relate to the technical field of artificial intelligence, and the method comprises the following steps: acquiring a plurality of interface simulation data in a development environment server; confirming a file path related to each interface simulation data; generating an API route corresponding to each interface simulation data according to the file path related to each interface simulation data; establishing a mapping relation between each API route and interface simulation data corresponding to the API route; and the mapping relation is used for the development environment server to complete interface registration of the API route according to the mapping relation. The method and the device are used for reducing the code amount of manually registering the API route when the developer uses mock data, improving the working efficiency of the developer and optimizing the experience of the developer.

Description

Interface data simulation method and device
Technical Field
The invention relates to the technical field of artificial intelligence, in particular to a method and a device for simulating interface data.
Background
This section is intended to provide a background or context to the embodiments of the invention that are recited in the claims. The description herein is not admitted to be prior art by inclusion in this section.
In the development stage of web application, interface data simulation is a common method for debugging programs, and can solve the problem that data cannot be debugged between applications when an interface is not completed.
In the currently popular technical solution, data simulation generally requires manual registration of an "API" name, and then a process of data simulation can be completed, which is specifically described as follows:
in many current projects with separated front and back ends, the development of the front end and the back end is carried out independently, and before a server interface is not given, interface data required by the front end needs to be carried out in a mock (mock: simulating the interface data so as to be used in an application) mode. When the front end uses mock data, most of the prior schemes start a node service of a devServer in the development stage, and the devServer receives a request and returns analog data. Most of the middleware used by devServer at present is routed according to the manually registered API, and then return data is given. One problem is that adding or deleting a piece of mock data each time is performed manually, which reduces the work efficiency.
Disclosure of Invention
The embodiment of the invention provides an interface data simulation method, which is used for reducing the code amount of manually registering API (application program interface) routing when a developer uses mock data, improving the working efficiency of the developer and optimizing the experience of the developer, and comprises the following steps:
acquiring a plurality of interface simulation data in a development environment server;
confirming a file path related to each interface simulation data;
generating an API route corresponding to each interface simulation data according to the file path related to each interface simulation data;
establishing a mapping relation between each API route and interface simulation data corresponding to the API route; and the mapping relation is used for the development environment server to complete interface registration of the API route according to the mapping relation.
An embodiment of the present invention further provides an interface data simulation apparatus, configured to reduce a code amount of manually registering an API route when a developer uses mock data, improve working efficiency of the developer, and optimize experience of the developer, where the apparatus includes:
the interface simulation data acquisition module is used for acquiring a plurality of interface simulation data in the development environment server;
the file path confirming module is used for confirming a file path related to each interface simulation data;
the API route generating module is used for generating an API route corresponding to each interface simulation data according to the file path related to each interface simulation data;
the mapping relation establishing module is used for establishing the mapping relation between each API route and the interface simulation data corresponding to the API route; and the mapping relation is used for the development environment server to complete interface registration of the API route according to the mapping relation.
The embodiment of the invention also provides computer equipment, which comprises a memory, a processor and a computer program which is stored on the memory and can run on the processor, wherein the processor executes the computer program to realize the simulation method of the interface data.
An embodiment of the present invention further provides a computer-readable storage medium, where a computer program is stored, and when the computer program is executed by a processor, the computer program implements the interface data simulation method.
An embodiment of the present invention further provides a computer program product, where the computer program product includes a computer program, and when the computer program is executed by a processor, the computer program implements the interface data simulation method.
In the embodiment of the invention, a plurality of interface simulation data in a development environment server are obtained; confirming a file path related to each interface simulation data; generating an API route corresponding to each interface simulation data according to the file path related to each interface simulation data; establishing a mapping relation between each API route and interface simulation data corresponding to the API route; compared with the technical scheme that the devServer uses middleware to manually register the API route in the prior art, the method has the advantages that the API route corresponding to each interface simulation data is generated according to the file path related to each interface simulation data, so that the routing mode of the file path can be applied to the scene of front-end mock data, the registration function of the API route is automatically completed, the automatic conversion from the file path to the API route path is realized, the manually increased code amount of a developer when the developer uses the mock data can be reduced, the working efficiency of the developer is improved, and the experience of the developer is optimized.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts. In the drawings:
fig. 1 is a schematic flow chart illustrating a method for simulating interface data according to an embodiment of the present invention;
FIG. 2 is a diagram illustrating an exemplary method for simulating interface data according to an embodiment of the present invention;
FIG. 3 is a schematic structural diagram of an interface data simulation apparatus according to an embodiment of the present invention;
FIG. 4 is a diagram illustrating an exemplary embodiment of an interface data simulator;
FIG. 5 is a diagram illustrating an exemplary embodiment of an interface data simulator;
FIG. 6 is a diagram of a computer device for simulation of interface data in an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention more apparent, the embodiments of the present invention are further described in detail below with reference to the accompanying drawings. The exemplary embodiments and descriptions of the present invention are provided to explain the present invention, but not to limit the present invention.
The term "and/or" herein merely describes an associative relationship, meaning that three relationships may exist, e.g., a and/or B, may mean: a exists alone, A and B exist simultaneously, and B exists alone. In addition, the term "at least one" herein means any one of a plurality or any combination of at least two of a plurality, for example, including at least one of a, B, C, and may mean including any one or more elements selected from the group consisting of a, B, and C.
In the description of the present specification, the terms "comprising," "including," "having," "containing," and the like are used in an open-ended fashion, i.e., to mean including, but not limited to. Reference to the description of the terms "one embodiment," "a particular embodiment," "some embodiments," "for example," etc., means that a particular feature, structure, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the application. In this specification, the schematic representations of the terms used above do not necessarily refer to the same embodiment or example. Furthermore, the particular features, structures, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples. The sequence of steps involved in the embodiments is for illustrative purposes to illustrate the implementation of the present application, and the sequence of steps is not limited and can be adjusted as needed.
According to the technical scheme, the data acquisition, storage, use, processing and the like meet relevant regulations of national laws and regulations.
In the development stage of web application, interface data simulation is a common method for debugging programs, and can solve the problem that data cannot be debugged between applications when an interface is not completed.
In the currently popular technical solution, data simulation generally requires manual registration of an "API" name, and then a process of data simulation can be completed, which is specifically described as follows:
in many current projects with separated front and back ends, the development of the front end and the back end is carried out independently, and before a server interface is not given, interface data required by the front end needs to be carried out in a mock (mock: simulating the interface data so as to be used in an application) mode. When the front end uses mock data, most of the prior schemes start a node service of a devServer in the development stage, and the devServer receives a request and returns analog data. Most of the middleware used by devServer at present is routed according to the manually registered API, and then return data is given. One problem is that adding or deleting a piece of mock data each time is performed manually, which reduces the work efficiency.
In order to solve the above problem, an embodiment of the present invention provides a method for simulating interface data, so as to reduce a code amount of manually registering an API route when a developer uses mock data, improve working efficiency of the developer, and optimize experience of the developer, where, referring to fig. 1, the method may include:
step 101: acquiring a plurality of interface simulation data in a development environment server;
step 102: confirming a file path related to each interface simulation data;
step 103: generating an API route corresponding to each interface simulation data according to the file path related to each interface simulation data;
step 104: establishing a mapping relation between each API route and interface simulation data corresponding to the API route; and the mapping relation is used for the development environment server to complete interface registration of the API route according to the mapping relation.
In the embodiment of the invention, a plurality of interface simulation data in a development environment server are obtained; confirming a file path related to each interface simulation data; generating an API route corresponding to each interface simulation data according to the file path related to each interface simulation data; establishing a mapping relation between each API route and interface simulation data corresponding to the API route; compared with the technical scheme that the devServer uses middleware to manually register the API route in the prior art, the method has the advantages that the API route corresponding to each interface simulation data is generated according to the file path related to each interface simulation data, so that the routing mode of the file path can be applied to the scene of front-end mock data, the registration function of the API route is automatically completed, the automatic conversion from the file path to the API route path is realized, the manually increased code amount of a developer when the developer uses the mock data can be reduced, the working efficiency of the developer is improved, and the experience of the developer is optimized.
In one embodiment, the method may be applied to the simulation data middleware, and completes the route definition (i.e., the API route corresponding to each interface simulation data is generated in the subsequent step) and the data organization (i.e., the mapping relationship between each API route and the interface simulation data corresponding to the API route is established in the subsequent step) for the simulation data, and returns the data to the front-end request according to a certain specification and format.
In the above embodiment, the simulation data middleware may be loaded when the development environment server is started, and the mapping relationship between each API route and the interface simulation data corresponding to the API route is already established, so as to implement interface registration for the API route.
In specific implementation, a plurality of interface simulation data in the development environment server are obtained first.
In one embodiment, obtaining a plurality of interface simulation data in a development environment server comprises:
and responding to the ajax request of the browser, and acquiring a plurality of interface simulation data in the development environment server.
In the embodiment, in the development stage, the server middleware in the development environment can be modified through the javascript program, so that the ajax request of the browser end can use the server in the development environment to return data, and on the basis, the registration function of the API routing can be automatically completed through rewriting the configuration information in the subsequent step.
In specific implementation, after a plurality of interface simulation data in the development environment server are obtained, a file path related to each interface simulation data is confirmed.
In an embodiment, the development environment server may complete the return of the interface data.
In one embodiment, identifying the file path to which each interface emulation data relates comprises:
and confirming the file path related to each interface simulation data in a mode of automatically traversing the file path based on the code of the node js program.
In the embodiment, the automatic conversion from the file path to the routing path can be completed by using a program, so that the amount of codes manually increased when a developer uses mock data can be reduced, and the working efficiency is improved.
In specific implementation, after the file path related to each interface simulation data is confirmed, the API route corresponding to each interface simulation data is generated according to the file path related to each interface simulation data.
As an example, as shown in fig. 2, for example, a data file API1.Json, where the file directory under the project directory is/mock/API/path 1/API1.Json, the processing program will automatically fetch "/API/path1/API1" as an API route index under the specified "mock" directory, and so on to obtain all API routes under the "mock" folder.
In one embodiment, the conversion from the file path to the routing path may be automatically completed by a program, and the conversion is provided to the service middleware (i.e., the simulation data middleware) for use, so as to implement the establishment of the mapping relationship between each API route and the interface simulation data corresponding to the API route in the subsequent step.
In one embodiment, a program firstly uses a synchronous mode to circularly traverse the file state under a mock folder, if the current file state is in a directory format, the directory is continuously opened, and the program is recursively called; and if the current file state is in a file format, reading the directory of the file, and adding a file name to form a character string as a route of the API of the file, so that the paths of all data files in the mock folder can be traversed.
In the embodiment, compared with the existing front-end mock technology which completes the route increase of the API based on a manual registration mode, compared with an automatic route increasing mode, the method needs to be manually performed each time one mock data is increased or deleted, and the efficiency is lower. According to the embodiment of the invention, the API route corresponding to each interface simulation data is generated according to the file path related to each interface simulation data, so that the file path is converted into the API route path in a mode of automatically traversing the file path by using a program in the subsequent step, and then the automatic registration of the route information is completed.
In specific implementation, after an API route corresponding to each interface simulation data is generated according to a file path related to each interface simulation data, a mapping relation between each API route and the interface simulation data corresponding to the API route is established; and the mapping relation is used for the development environment server to complete interface registration of the API route according to the mapping relation.
In the embodiment, the API routing mode of the file path can be applied to the scene of front-end mock data, and a manual code registration mode is not used, so that the code amount manually increased when a developer uses the mock data can be reduced, and the working efficiency is improved.
In one embodiment, establishing a mapping relationship between each API route and interface emulation data corresponding to the API route includes:
and establishing a mapping relation between each API route and the interface simulation data corresponding to the API route according to preset specifications and formats.
In the embodiment, in the development stage, the server middleware in the development environment can be modified through the javascript program, so that the ajax request of the browser can use the server in the development environment to return data, and on the basis, the registration function of the API route is automatically completed by rewriting the configuration information.
In specific implementation, the method for simulating interface data provided in the embodiment of the present invention may further include:
and recording a file path related to each interface simulation data, the generated API route corresponding to each interface simulation data, and the established mapping relation between each API route and the interface simulation data corresponding to the API route to obtain a record file.
In the embodiment, by generating the record file, the management personnel can be assisted to fetch and read the process at any time, and the vulnerability and the defect in the process can be found by the management personnel; meanwhile, the staff can also trace the data in the process by calling and reading the record file, the accuracy of the authenticity of the data is verified, and the accuracy of the process is improved.
In specific implementation, the interface data simulation method provided in the embodiment of the present invention may further include: acquiring update interface simulation data in a development environment server;
confirming a file path related to each updating interface simulation data;
generating an API route corresponding to each updating interface simulation data according to the file path related to each updating interface simulation data;
and establishing the API route of each updating interface simulation data and the mapping relation between the updating interface simulation data corresponding to the API route.
In the embodiment, the operation that an API path is manually registered when newly added simulation data is added in the development process can be reduced, the efficiency of a developer is improved, and the experience of the developer is optimized. After the interface simulation data is added, modified and/or deleted, the API route corresponding to each updating interface simulation data can be generated directly according to the file path related to each updating interface simulation data, the registration function of the API route is automatically completed, and the automatic conversion from the updated file path to the API route path is realized.
A specific embodiment is given below to illustrate a specific application of the method of the present invention, and in this embodiment, a mechanism for simulating interface data based on file routing may be provided, and may include the following steps:
1. the workflow is a middleware for loading simulation data when the development environment server is started;
2. the pre-processing module automatically completes the conversion from the file path to the routing path in the process and provides configuration information to the simulation data middleware;
3. when an interface request comes, the development environment server transfers the request to a simulation data middleware which completes the simulation return of the data by utilizing the configuration provided by the front processing module.
Wherein, the development environment server can complete the return of interface data; the simulation data middleware can complete the route definition and data organization of the simulation data and return the data to the front-end request according to certain specifications and formats; the preposed processing module can automatically complete the conversion from the file path to the routing path through a program and provide the conversion for the service middleware to use.
Of course, it should be understood that other variations of the above detailed process may be adopted, and all the related variations should fall into the scope of the present invention.
In the embodiment of the invention, a plurality of interface simulation data in a development environment server are obtained; confirming a file path related to each interface simulation data; generating an API route corresponding to each interface simulation data according to the file path related to each interface simulation data; establishing a mapping relation between each API route and interface simulation data corresponding to the API route; compared with the technical scheme that a devServer uses middleware to manually register API routing in the prior art, the method has the advantages that the API routing corresponding to each interface simulation data is generated according to the file path related to each interface simulation data, so that the routing mode of the file path can be applied to the scene of front-end mock data, the registration function of the API routing is automatically completed, automatic conversion from the file path to the API routing path is realized, the amount of codes manually increased when a developer uses the mock data can be reduced, the working efficiency of the developer is improved, and the experience of the developer is optimized.
As described above, in the embodiments of the present invention, by optimizing the use of middleware, the manual registration process is automatically completed by a program, and the acquisition of each API route is formed by traversing and converting a file path using nodejs, so that when mock data is added or reduced later, only new creation or deletion of necessary data is needed, and registration of a route is not needed to be concerned, and the embodiments of the present invention can be applied to a mock data scene of a pure front-end project.
The embodiment of the invention also provides a simulation device of interface data, which is expressed by the following embodiment. Because the principle of the device for solving the problems is similar to the interface data simulation method, the implementation of the device can refer to the implementation of the interface data simulation method, and repeated parts are not described again.
An embodiment of the present invention further provides an interface data simulation apparatus, configured to reduce a code amount of manually registering an API route when a developer uses mock data, improve working efficiency of the developer, and optimize experience of the developer, where as shown in fig. 3, the apparatus includes:
an interface simulation data acquisition module 301, configured to acquire a plurality of interface simulation data in the development environment server;
a file path confirming module 302, configured to confirm a file path related to each interface simulation data;
the API route generating module 303 is configured to generate an API route corresponding to each interface simulation data according to a file path related to each interface simulation data;
a mapping relationship establishing module 304, configured to establish a mapping relationship between each API route and interface simulation data corresponding to the API route; and the mapping relation is used for the development environment server to complete interface registration of the API route according to the mapping relation.
In one embodiment, the interface simulation data acquisition module is specifically configured to:
and responding to the ajax request of the browser end, and acquiring a plurality of interface simulation data in the development environment server.
In one embodiment, the file path validation module is specifically configured to:
and confirming the file path related to each interface simulation data in a mode of automatically traversing the file path based on the node js program code.
In one embodiment, the mapping relationship establishing module is specifically configured to:
and establishing a mapping relation between each API route and the interface simulation data corresponding to the API route according to preset specifications and formats.
In one embodiment, as shown in fig. 4, the method further includes:
a recording module 401 configured to:
and recording a file path related to each interface simulation data, the generated API route corresponding to each interface simulation data, and the established mapping relation between each API route and the interface simulation data corresponding to the API route to obtain a record file.
In one embodiment, as shown in fig. 5, further includes:
API route update module 501, configured to:
acquiring the simulation data of an updating interface in a development environment server;
confirming a file path related to each updating interface simulation data;
generating an API route corresponding to each updating interface simulation data according to the file path related to each updating interface simulation data;
and establishing the mapping relation between the API route of each updating interface simulation data and the updating interface simulation data corresponding to the API route.
An embodiment of a computer device for implementing all or part of the contents in the interface data simulation method according to the present invention provides that the computer device specifically includes the following contents:
a processor (processor), a memory (memory), a communication Interface (Communications Interface), and a bus; the processor, the memory and the communication interface complete mutual communication through the bus; the communication interface is used for realizing information transmission between related devices; the computer device may be a desktop computer, a tablet computer, a mobile terminal, and the like, but the embodiment is not limited thereto. In this embodiment, the computer device may be implemented with reference to the embodiment of the method for implementing interface data simulation and the embodiment of the simulation apparatus for implementing interface data simulation in the embodiment, and the contents of the computer device are incorporated herein, and repeated details are not repeated.
Fig. 6 is a schematic block diagram of a system configuration of a computer apparatus 1000 according to an embodiment of the present application. As shown in fig. 6, the computer apparatus 1000 may include a cpu 1001 and a memory 1002; the memory 1002 is coupled to the cpu 1001. Notably, this FIG. 6 is exemplary; other types of structures may also be used in addition to or in place of the structures to implement telecommunications or other functions.
In one embodiment, the simulation function of the interface data may be integrated into the cpu 1001. The cpu 1001 may be configured to perform the following control:
acquiring a plurality of interface simulation data in a development environment server;
confirming a file path related to each interface simulation data;
generating an API route corresponding to each interface simulation data according to the file path related to each interface simulation data;
establishing a mapping relation between each API route and interface simulation data corresponding to the API route; the mapping relationship is used for the development environment server to complete interface registration of the API routing according to the mapping relationship in another embodiment, the interface data simulation device may be configured separately from the central processing unit 1001, for example, the interface data simulation device may be configured as a chip connected to the central processing unit 1001, and the interface data simulation function is realized by the control of the central processing unit.
As shown in fig. 6, the computer device 1000 may further include: a communication module 1003, an input unit 1004, an audio processor 1005, a display 1006, a power supply 1007. It is noted that the computer device 1000 does not necessarily include all of the components shown in FIG. 6; furthermore, the computer device 1000 may also comprise components not shown in fig. 6, as can be seen in the prior art.
As shown in fig. 6, the cpu 1001, which is sometimes referred to as a controller or operation control, may include a microprocessor or other processor device and/or logic device, and the cpu 1001 receives input and controls the operation of the components of the computer device 1000.
The memory 1002 may be, for example, one or more of a buffer, a flash memory, a hard drive, a removable media, a volatile memory, a non-volatile memory, or other suitable device. The information relating to the failure may be stored, and a program for executing the information may be stored. And the cpu 1001 can execute the program stored in the memory 1002 to realize information storage or processing, or the like.
The input unit 1004 provides input to the cpu 1001. The input unit 1004 is, for example, a key or a touch input device. The power supply 1007 is used to supply power to the computer apparatus 1000. The display 1006 displays display objects such as images and characters. The display may be, for example, but is not limited to, an LCD display.
The memory 1002 may be a solid state memory such as Read Only Memory (ROM), random Access Memory (RAM), a SIM card, or the like. There may also be a memory that holds information even when power is off, can be selectively erased, and is provided with more data, an example of which is sometimes called an EPROM or the like. The memory 1002 may also be some other type of device. Memory 1002 includes buffer memory 1021 (sometimes referred to as a buffer). The memory 1002 may include an application/function storage part 1022, the application/function storage part 1022 being used for storing application programs and function programs or a flow for executing the operation of the computer device 1000 by the central processing unit 1001.
The memory 1002 may also include a data store 1023, the data store 1023 being used to store data such as contacts, digital data, pictures, sounds and/or any other data used by the computer device. Driver storage 1024 of memory 1002 may include various drivers for the computer device for communication functions and/or for performing other functions of the computer device (e.g., messaging applications, address book applications, etc.).
The communication module 1003 is a transmitter/receiver 1003 that transmits and receives signals via an antenna 1008. A communication module (transmitter/receiver) 1003 is coupled to the central processor 1001 to provide an input signal and receive an output signal, which may be the same as the case of a conventional mobile communication terminal.
Based on different communication technologies, a plurality of communication modules 1003, such as a cellular network module, a bluetooth module, and/or a wireless local area network module, may be provided in the same computer device. The communication module (transmitter/receiver) 1003 is further coupled via an audio processor 1005 to a speaker 1009 and a microphone 1010 for providing audio output via the speaker 1009 and for receiving audio input from the microphone 1010 for carrying out the usual telecommunications functions. The audio processor 1005 may include any suitable buffers, decoders, amplifiers and so forth. In addition, the audio processor 1005 is also coupled to the central processor 1001, so that sound can be recorded locally through the microphone 1010, and so that locally stored sound can be played through the speaker 1009.
An embodiment of the present invention further provides a computer-readable storage medium, where a computer program is stored, and when the computer program is executed by a processor, the computer program implements the interface data simulation method.
An embodiment of the present invention further provides a computer program product, where the computer program product includes a computer program, and when the computer program is executed by a processor, the computer program implements the interface data simulation method.
In the embodiment of the invention, a plurality of interface simulation data in a development environment server are obtained; confirming a file path related to each interface simulation data; generating an API route corresponding to each interface simulation data according to the file path related to each interface simulation data; establishing a mapping relation between each API route and interface simulation data corresponding to the API route; compared with the technical scheme that a devServer uses middleware to manually register API routing in the prior art, the method has the advantages that the API routing corresponding to each interface simulation data is generated according to the file path related to each interface simulation data, so that the routing mode of the file path can be applied to the scene of front-end mock data, the registration function of the API routing is automatically completed, automatic conversion from the file path to the API routing path is realized, the amount of codes manually increased when a developer uses the mock data can be reduced, the working efficiency of the developer is improved, and the experience of the developer is optimized.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention has been described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
The above-mentioned embodiments are provided to further explain the objects, technical solutions and advantages of the present invention in detail, and it should be understood that the above-mentioned embodiments are only examples of the present invention and should not be used to limit the scope of the present invention, and any modifications, equivalents, improvements and the like made within the spirit and principle of the present invention should be included in the scope of the present invention.

Claims (15)

1. A method for simulating interface data, comprising:
acquiring a plurality of interface simulation data in a development environment server;
confirming a file path related to each interface simulation data;
generating an API route corresponding to each interface simulation data according to the file path related to each interface simulation data;
establishing a mapping relation between each API route and interface simulation data corresponding to the API route; and the mapping relation is used for the development environment server to complete interface registration of the API route according to the mapping relation.
2. The method of claim 1, wherein obtaining a plurality of interface simulation data in a development environment server comprises:
and responding to the ajax request of the browser end, and acquiring a plurality of interface simulation data in the development environment server.
3. The method of claim 1, wherein identifying a file path to which each interface emulation data relates comprises:
and confirming the file path related to each interface simulation data in a mode of automatically traversing the file path based on the node js program code.
4. The method of claim 1, wherein establishing a mapping between each API route and interface emulation data corresponding to the API route comprises:
and establishing a mapping relation between each API route and the interface simulation data corresponding to the API route according to preset specifications and formats.
5. The method of claim 1, further comprising:
and recording a file path related to each interface simulation data, the generated API route corresponding to each interface simulation data, and the established mapping relation between each API route and the interface simulation data corresponding to the API route to obtain a record file.
6. The method of claim 1, further comprising:
acquiring update interface simulation data in a development environment server;
confirming a file path related to each updating interface simulation data;
generating an API route corresponding to each updating interface simulation data according to the file path related to each updating interface simulation data;
and establishing the API route of each updating interface simulation data and the mapping relation between the updating interface simulation data corresponding to the API route.
7. An apparatus for simulating interface data, comprising:
the interface simulation data acquisition module is used for acquiring a plurality of interface simulation data in the development environment server;
the file path confirming module is used for confirming a file path related to each interface simulation data;
the API route generating module is used for generating an API route corresponding to each interface simulation data according to the file path related to each interface simulation data;
the mapping relation establishing module is used for establishing the mapping relation between each API route and the interface simulation data corresponding to the API route; and the mapping relation is used for the development environment server to complete interface registration of the API route according to the mapping relation.
8. The apparatus of claim 7, wherein the interface emulation data acquisition module is specifically configured to:
and responding to the ajax request of the browser end, and acquiring a plurality of interface simulation data in the development environment server.
9. The apparatus of claim 7, wherein the file path validation module is specifically configured to:
and confirming the file path related to each interface simulation data in a mode of automatically traversing the file path based on the node js program code.
10. The apparatus of claim 7, wherein the mapping relationship establishing module is specifically configured to:
and establishing a mapping relation between each API route and the interface simulation data corresponding to the API route according to preset specifications and formats.
11. The apparatus of claim 7, further comprising:
a recording module to:
and recording a file path related to each interface simulation data, the generated API route corresponding to each interface simulation data, and the established mapping relation between each API route and the interface simulation data corresponding to the API route to obtain a record file.
12. The apparatus of claim 7, further comprising:
an API route update module to:
acquiring the simulation data of an updating interface in a development environment server;
confirming a file path related to each updating interface simulation data;
generating an API route corresponding to each updating interface simulation data according to the file path related to each updating interface simulation data;
and establishing the API route of each updating interface simulation data and the mapping relation between the updating interface simulation data corresponding to the API route.
13. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the method of any one of claims 1 to 6 when executing the computer program.
14. A computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program which, when executed by a processor, implements the method of any one of claims 1 to 6.
15. A computer program product, characterized in that the computer program product comprises a computer program which, when being executed by a processor, carries out the method of any one of claims 1 to 6.
CN202211386995.0A 2022-11-07 2022-11-07 Interface data simulation method and device Pending CN115658537A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211386995.0A CN115658537A (en) 2022-11-07 2022-11-07 Interface data simulation method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211386995.0A CN115658537A (en) 2022-11-07 2022-11-07 Interface data simulation method and device

Publications (1)

Publication Number Publication Date
CN115658537A true CN115658537A (en) 2023-01-31

Family

ID=85016698

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211386995.0A Pending CN115658537A (en) 2022-11-07 2022-11-07 Interface data simulation method and device

Country Status (1)

Country Link
CN (1) CN115658537A (en)

Similar Documents

Publication Publication Date Title
CN110377462B (en) Interface testing method and device and terminal equipment
CN110941563B (en) Automatic script testing method and device
CN112463634A (en) Software testing method and device under micro-service architecture
CN111897738B (en) Automatic testing method and device based on atomic service
CN114153856A (en) Host data double-writing method and device
CN113342330A (en) Front-end engineering generation method and device
CN113746840A (en) JSON format message generation method and device
CN109492039A (en) A kind of recording method of daily record data, device, electronic equipment and readable medium
CN111930624A (en) Test link message data processing method and device
JP7375089B2 (en) Method, device, computer readable storage medium and computer program for determining voice response speed
CN115658537A (en) Interface data simulation method and device
CN111124541A (en) Configuration file generation method, device, equipment and medium
CN115495519A (en) Report data processing method and device
CN112905464B (en) Application running environment data processing method and device
CN114374614A (en) Network topology configuration method and device
CN113791984A (en) Automatic interface testing method and device
CN114840576A (en) Data standard matching method and device
CN112102058A (en) Management system parameter configuration method and device
CN113742212A (en) New and old system migration test method and device
CN113050985A (en) Front-end engineering dependence automatic registration method and device
CN113050936A (en) Front-end data processing method and device based on integrated development environment
CN113110829A (en) Multi-UI component library data processing method and device
CN111859041A (en) Data transmission method and device
CN112965952B (en) Data asset processing method and device
CN114244830B (en) File gateway application nonfunctional testing method and system

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination