Simulation data management method, system, terminal and storage medium for front end

By providing simulated data management methods for the front-end, the problem of difficult adaptation of front-end simulated data after the back-end interface is changed is solved, and the flexible management and adaptability of data is realized, ensuring the normal development and display of the project.

CN119045872BActive Publication Date: 2025-03-04INSPUR YUNZHOU (SHANDONG) IND INTERNET CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411514439.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-10-29
Publication Date
2025-03-04
Estimated Expiration
2044-10-29

AI Technical Summary

Technical Problem

In the prior art, front-end simulation data is difficult to adapt after the back-end interface is changed, resulting in the data being no longer applicable, increasing project time cost and labor burden. In addition, front-end projects cannot display their functions normally when the back-end service is offline or intranet isolation.

Method used

Provides a simulation data management method for the front-end, filtering interfaces and parameters through global configuration, creating local folders for each interface, and saving simulated data or back-end response data based on global and dedicated parameters. When the backend service is abnormal, filter out the response data matching the request from the local folder and return to the frontend.

Benefits of technology

This method improves the flexibility and adaptability of simulated data, reduces data abandonment problems caused by interface changes, and can still provide response data to the front-end when the back-end service is unavailable, ensuring the normal development and display of the project.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119045872B_ABST
    Figure CN119045872B_ABST
Patent Text Reader

Abstract

The present invention relates to the technical field of software development, and specifically provides a simulation data management method, system, terminal and storage medium for a front end, including: globally configuring a filtering interface and global parameters, configuring dedicated parameters for each interface, and setting the priority of the dedicated parameters higher than the global parameters; creating a local folder for each interface; saving simulation data or back-end response data related to the interface to a corresponding local folder based on global parameters and dedicated parameters; confirming that the back-end service is abnormal, filtering out response data matching the request from the data saved in the corresponding local folder, and returning the filtered response data to the front end. The present invention can flexibly select the source of simulation data of the front end, so that the front-end data call is not affected by the back-end service status.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of software development, and in particular relates to a simulation data management method, system, terminal and storage medium for a front end. Background Art

[0002] The current common practice in the industry is that in the early stages of a project, when the backend interface has not yet been built, the front-end team will pre-generate mock data to support the initial construction and logic testing of the interface. However, as the project advances to the back-end joint debugging stage and the requirements are dynamically adjusted, the mock data originally created based on the front-end local often becomes no longer applicable due to changes in the interface URL, fields, and data format, and eventually becomes abandoned code in the warehouse.

[0003] In addition, during the development process, faced with emergencies such as changes in the office environment, VPN connection problems, or network instability, if the back-end service cannot be successfully connected at this time, the limitations of the front-end Mock data will undoubtedly become apparent. Especially when certain functions are highly dependent on the correct return of the front-end interface data, the front-end developer may become stagnant and have to spend time and energy to restore the development environment by backtracking or manually adjusting the Mock data. This process undoubtedly increases the time cost and manpower burden of the project.

[0004] What is even more difficult is that after the project is completed, if a specific function needs to be preserved or demonstrated for a long time, and the corresponding back-end service has been offline or is isolated in the intranet, even if the front-end project is successfully launched, it will not be able to intuitively display the expected results due to the lack of necessary back-end support and real-time interface data. This undoubtedly poses a challenge to function review, product display and subsequent maintenance. Summary of the invention

[0005] In view of the above-mentioned deficiencies in the prior art, the present invention provides a simulation data management method, system, terminal and storage medium for a front end to solve the above-mentioned technical problems.

[0006] In a first aspect, the present invention provides a simulation data management method for a front end, comprising:

[0007] Configure filtering interfaces and global parameters globally, configure dedicated parameters for each interface, and set the priority of dedicated parameters higher than global parameters;

[0008] Create local folders for each interface;

[0009] Save the simulation data or backend response data related to the interface to the corresponding local folder based on global parameters and dedicated parameters;

[0010] Confirm that the backend service is abnormal, filter out the response data that matches the request from the data saved in the corresponding local folder, and return the filtered response data to the front end.

[0011] In an optional implementation, globally configuring the filtering interface and global parameters, configuring dedicated parameters for each interface, and setting the priority of the dedicated parameters higher than the global parameters, includes:

[0012] Configure the filtering interface globally, and configure the simulation data generation method, global sensitive words, and global data storage method of the initial stage of the filtering interface;

[0013] Special parameters are configured at the interface call layer, and the special parameters include a simulation data generation method of the interface in the initial stage, interface sensitive words, and an interface data storage method.

[0014] In an optional implementation, a local folder is created for each interface, including:

[0015] Parse the interface address that needs to be generated;

[0016] Create a local folder for the interface in the corresponding directory based on the global parameters or dedicated parameters of the interface.

[0017] In an optional implementation, the simulation data or backend response data related to the interface is saved to a corresponding local folder based on the global parameters and the dedicated parameters, including:

[0018] Parse global parameters and interface-specific parameters to obtain simulation data generation methods, sensitive words, and data storage methods;

[0019] If the simulation data is generated by a tool, the simulation data management tool is used to generate the simulation data based on the simulation data field library; if the simulation data is generated by direct acquisition, the front-end request is intercepted to obtain the back-end response data to the request;

[0020] Perform sensitive word processing on the generated simulation data or the obtained response data;

[0021] The data after sensitive word processing is saved in the local folder of the interface according to the data saving method.

[0022] In an optional implementation, performing sensitive word processing on the generated simulation data or the acquired response data includes:

[0023] Use functions to convert generated simulation data or obtained response data into strings;

[0024] Use the replacement rule to replace the characters corresponding to the sensitive words in the string with other characters to obtain a new string;

[0025] Use the function to convert the new string into data.

[0026] In an optional implementation, the data after sensitive word processing is saved in a local folder of the interface according to the data saving method, including:

[0027] Analyze the data saving mode, where the data saving mode is one of overwrite saving, append saving or insert saving;

[0028] According to the parsed data storage method, the data after sensitive word processing is saved in the local folder of the interface.

[0029] In a second aspect, the present invention provides a simulation data management system for a front end, comprising:

[0030] Parameter configuration module, used to globally configure filtering interfaces and global parameters, configure dedicated parameters for each interface, and set the priority of dedicated parameters higher than global parameters;

[0031] Basic building blocks for creating local folders for each interface;

[0032] A data saving module, used to save the simulation data or backend response data related to the interface to a corresponding local folder based on global parameters and dedicated parameters;

[0033] The data return module is used to confirm the backend service exception, filter out the response data that matches the request from the data saved in the corresponding local folder, and return the filtered response data to the front end.

[0034] In an optional implementation, the parameter configuration module includes:

[0035] The global configuration unit is used to globally configure the filtering interface and configure the simulation data generation method, global sensitive words, and global data storage method of the initial stage of the filtering interface;

[0036] The dedicated configuration unit is used to configure dedicated parameters at the interface call layer, wherein the dedicated parameters include the simulation data generation method of the interface in the initial stage, the interface sensitive words, and the interface data storage method.

[0037] In a third aspect, a terminal is provided, including:

[0038] processor, memory, wherein:

[0039] The memory is used to store computer programs.

[0040] The processor is used to call and run the computer program from the memory, so that the terminal executes the above-mentioned terminal method.

[0041] According to a fourth aspect, a computer storage medium is provided, wherein the computer-readable storage medium stores instructions, and when the instructions are executed on a computer, the computer executes the methods described in the above aspects.

[0042] The beneficial effects of the present invention are that the simulation data management method, system, terminal and storage medium for the front end provided by the present invention can start the project by setting a specific startup command, intercept the real request, and then store the real interface url and interface data in the mock data folder in sequence, and start the local mock data generation service at the same time, and some configuration options can be added, and the data of the interface can be completely obtained, or the data of the interface can be modified and saved, or the mock data can be generated according to the field of the interface. The method is highly flexible, and the online data can be simply saved locally, and sensitive words can be removed according to simple configuration. And it can provide response data for the front-end project without relying on the back-end service after the project is completed, so that the front end can successfully start a specific effect diagram.

[0043] In addition, the invention has a reliable design principle, a simple structure and a very broad application prospect. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0045] Figure 1 is a schematic flow chart of a method according to an embodiment of the present invention.

[0046] Figure 2 is another schematic flow chart of a method according to an embodiment of the present invention.

[0047] Figure 3 is a schematic block diagram of a system according to an embodiment of the present invention.

[0048] Figure 4 A schematic diagram of the structure of a terminal provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0049] In order to enable those skilled in the art to better understand the technical solutions in the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.

[0050] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art of the present invention. The terms used in the specification of the present invention herein are only for the purpose of describing specific embodiments and are not intended to limit the present invention.

[0051] The key terms appearing in the present invention are explained below.

[0052] Mock data refers to a type of simulated data used in the software development process to simulate the data of a real data source with similar data structure and fields. Mock data is usually used when real data is unavailable or cannot be obtained, so as to provide available virtual data during development, testing, and demonstration.

[0053] URL is the link address to be visited, which is the abbreviation of Uniform Resource Locator.

[0054] The simulation data management method for the front end provided by the embodiment of the present invention is executed by a computer device, and accordingly, the simulation data management system for the front end runs in the computer device.

[0055] Figure 1 is a schematic flow chart of a method according to an embodiment of the present invention. Figure 1 The execution subject can be a simulation data management system for the front end. According to different requirements, the order of the steps in the flow chart can be changed, and some can be omitted.

[0056] like Figure 1 As shown, the method includes:

[0057] Step 110, globally configure the filtering interface and global parameters, configure dedicated parameters for each interface, and set the priority of the dedicated parameters higher than the global parameters;

[0058] Step 120, creating a local folder for each interface;

[0059] Step 130, saving the simulation data or backend response data related to the interface to a corresponding local folder based on the global parameters and the dedicated parameters;

[0060] Step 140, confirming that the backend service is abnormal, filtering out response data matching the request from the data stored in the corresponding local folder, and returning the filtered response data to the front end.

[0061] To facilitate understanding of the present invention, the doctor-patient interaction management method provided by the present invention is further described below based on the principle of the simulation data management method for the front end of the present invention and the process of managing the simulation data for the front end in the embodiment.

[0062] For details, please refer to Figure 2 , the simulation data management methods used for the front end include:

[0063] S1. Globally configure the filtering interface and global parameters, configure dedicated parameters for each interface, and set the priority of the dedicated parameters higher than the global parameters.

[0064] S101. Globally configure the filtering interface, and configure the simulation data generation method, global sensitive words, and global data storage method of the initial stage of the filtering interface.

[0065] Methods for configuring filtering interfaces globally include:

[0066] 1. Define regular expression matching rules

[0067] First, you need to define one or more regular expressions to match the interface prefix you are interested in. For example, if you want to match all interfaces starting with / api / v1 / user, you can define the following regular expression:

[0068] String patternString = "^ / api / v1 / user / .*";

[0069] Pattern pattern = Pattern.compile(patternString).

[0070] 2. Create a global filter

[0071] In Spring Boot, you can create a global filter by implementing the Filter interface or by marking a class with the @Component annotation (and inheriting OncePerRequestFilter). This filter will check each incoming request and use the regular expression defined above to match the requested URL.

[0072] 3. Configure and use filters

[0073] After implementing the PrefixMatchingFilter and using Spring Boot's automatic configuration, Spring will automatically discover and register this filter due to the presence of the @Component annotation.

[0074] If more complex configuration is required (such as specifying the order of filters), it can be achieved by implementing the WebMvcConfigurer interface and overriding the addFilters method.

[0075] Defining global parameters includes:

[0076] The data generation method in the initial stage of the project is to intercept requests and generate mock data;

[0077] Whether to delete all the data under a file or an interface when the mock is generated for the nth time (n>1). This configuration is to filter the data of a certain interface in the future so that it can keep the data unchanged after the last time or manual modification. In this way, if the interface URL changes, some interfaces may become abandoned codes and waste memory space;

[0078] Sensitive words can be replaced or hidden, and regular expressions can be passed in.

[0079] Globally configure the filtering interface, you can use regular matching to identify the interface with a certain prefix.

[0080] S102. Configure dedicated parameters at the interface call layer, where the dedicated parameters include a simulation data generation method of the interface in the initial stage, interface sensitive words, and an interface data storage method.

[0081] Add configuration items for each interface where the axios request interface is called. When the configuration items of each interface are repeated with the global ones, their priority is higher than the global configuration. Specific configuration data includes: whether the interface is filtered, folder generation directory, method of obtaining interface data, sensitive words, and interface data storage method.

[0082] S2. Create a local folder for each interface.

[0083] Parse the interface URL to be generated from the interface's dedicated parameters, and generate the corresponding folders and files. For example, if the interface URL is / a / b / c, the file directory is determined based on the configuration items apiPrefix and apiPath. If neither is configured, then a directory a / b / c.js is generated in the mockDatas folder; each file contains at least one interface's data.

[0084] S3. Data generation method.

[0085] S301. In the initial stage, the local simulation data generation service of the front end is started.

[0086] Mock.js is a JavaScript library for generating random data and intercepting Ajax requests. It is mainly used in the front-end development process. When the back-end interface has not been developed yet, Mock.js is used to simulate the back-end data so that the front-end can continue to develop and test. The following are the basic steps on how to use Mock.js to generate mock data:

[0087] First, import Mock.js into your project. You can import it through CDN, npm or yarn.

[0088] Mock.js uses data templates to define data structures. Each attribute in the data template is defined by "attribute name: attribute value", where the attribute value can be a string or a function or template that generates random data.

[0089] In this implementation, the data template is parsed from the dedicated parameters of the interface. Specifically, the interface data is obtained according to the configuration items. If ownMock is true, the interface data is directly stored; if it is false, data is generated according to other fields such as ownMockFields (library), secretWords (secret words), statusAttr, etc. First, it is determined whether there is a field in ownMockFields. If so, the value of this field is called by the mock.js package to generate random data. The generation rule is based on the configuration after |. This configuration is completely consistent with the benchmark in mock.js. The data generated by this field replaces the data in the interface.

[0090] Next, check statusAttr (return type attribute) to filter the data, and give priority to the data with required values. For example, one piece of data with status 1, 2, and 3 is required (one case is that the display effect of the page is different when the status value is different). At this time, it is necessary to filter the data, and according to the set sizeAttr and size, the default is 5, intercept the number of data.

[0091] S302: After the backend is able to provide some services, the response data is directly intercepted.

[0092] Intercept Axios requests:

[0093] axios.interceptors.response.use(res=>{ / / 1. Do some unified processing after requesting data return res}).

[0094] At code position 1, the res parameter contains the requested configuration config, interface url, and interface return data status information http status code, etc. The requested url, config, and parameters returned by the interface are passed to the local folder for packaging and then generate mock data.

[0095] S303. Data desensitization and storage.

[0096] The sensitive words of the global parameters and the sensitive words of the dedicated parameters are merged to obtain a full set of sensitive words, wherein the full set of sensitive words includes sensitive words and corresponding replacement words.

[0097] Because the interface data may be multi-layered, in order to speed up the replacement, first convert all the interface data into strings through JSON.stringify(), use the String replace method to replace according to the replacement rules, and then convert the data back to the previous format through JSON.parse().

[0098] Parse the data saving method, which is based on the dedicated parameters. If the dedicated parameters are not defined, the data saving method defined by the global parameters is used. Specifically, the data saving parameters, such as a file or a data under a certain interface, when the mock is generated for the nth time (n>1), whether to delete all the data first. This configuration is to filter out a certain interface data in the future so that the data after the last time or manual modification can be kept without change. In this way, if the interface URL changes, some interfaces may become abandoned codes and waste memory space.

[0099] When generating data for the nth time (n>1), the insertType parameter is used to determine how to write the data into the file, whether to directly overwrite the previous data, push it in, or insert it into the nth splice (n,1). This completely follows the way of inserting data.

[0100] S4. Confirm that the backend service is abnormal, filter out the response data that matches the request from the data saved in the corresponding local folder, and return the filtered response data to the front end.

[0101] When the network is unavailable or there is a problem with the backend service, the generated mock data calls another simulated backend service written in node.js, encapsulates the data saved in the corresponding local folder as response data and returns it to the frontend.

[0102] In a specific embodiment of the present invention, the simulation data management method for the front end includes the following process:

[0103] First, a method to intercept axios request responses is implemented to intercept the configuration items of the interface and the return data of the real interface and bring them to the mock data generation tool;

[0104] Implemented through node.js, it can generate corresponding directory folders and js files according to the interface URL; the js file needs to be processed according to the data and configuration items returned by the interface and then stored in a certain format in the js file, so that when the front-end mock service is started, the correct data can be obtained by requesting this interface;

[0105] The interception method takes effect only according to a specific startup command. Configure "dev:smock": "vite --mode smock" in the script of package.json. When npm run dev:smock is executed, it means that the mock data mode is generated at this time. Add .env.smock in the project root directory, and you can also configure some global parameters;

[0106] Configuration items include global configuration and local configuration of each interface. The configuration includes whether to complete the use of the data returned by the interface, the sensitive words that need to be replaced, whether to use mock.js to generate data, interface prefix filter words, interface generation directory rules, field names for an item of interface data that is an array, and its number configuration, data items that must be output for status values, whether a field is automatically generated or generates a fixed value using mockjs, and whether to filter this interface from being generated and stored locally;

[0107] Replace the sensitive words configured in the configuration item. Because the interface data may be multi-layered data, in order to speed up the replacement, first convert the interface data into a string through JSON.stringify(), replace it with the String replace method according to the replacement rule, and then convert the data back to the previous format through JSON.parse(); the replacement rule can be a regular expression or a simple string, or it can be omitted, then the sensitive words will be changed to *** by default and stored locally to better protect the security of the project;

[0108] The rule for generating directories for interface url is, assuming the interface is / api / user / list, and the configured interface filter field is / api, then the user directory is generated under the mockDatas directory, and there is a list.js file under it, which contains the interface data. Assuming there are two interfaces, / api / user / aaaa / bb / cc and / api / user / aaaa / bb / dd, and the interface path is relatively long, then check the configuration item apiPath as ['a', 'b', 'c'], / / previously user, aaa is used as the directory, bb is the final file name bb.js, and now there are two interface data cc and dd in bb.js, cc: {}, dd: {};

[0109] The mock data generation tool obtains interface data according to the configuration item generation method. If ownMock is true, the interface data is directly stored; if it is false, data is generated according to other fields such as ownMockFields (a field is automatically generated or generates a fixed value using mockjs), secretWords (sensitive words), and statusAttr (data status filter fields and values). First, determine whether there is a field in ownMockFields. If so, call the mock.js package to generate random data for the value of this field. The configuration based on the rules for generating random numbers is completely the same as that in mock.js. The data generated by this field replaces the corresponding data in the interface data. Then check statusAttr to filter the data, and give priority to the data that needs the value. For example, one piece of data with status 1, 2, and 3 is required (one case is that the display effect of the page is different when the status value is different). At this time, filter the data, and intercept the number of data according to the set sizeAttr and size, which defaults to 5. Finally, replace the sensitive words in the interface data according to the sensitive words set globally and for each interface.

[0110] When the mock generation tool generates data for the nth (n>1) time, it determines how to write the data into the file based on the insertType parameter, whether to directly overwrite the previous data, push it in, or insert it into the splice (n,1). This completely follows the way of inserting data.

[0111] When the network is down or there is a problem with the backend service, the generated mock data calls another simulated backend service written in node.js to provide the data in the local folder to the front end through the interface for front-end development and debugging as well as viewing of page effects.

[0112] In some embodiments, the simulation data management system for the front end may include multiple functional modules composed of computer program segments. The computer program of each program segment in the simulation data management system for the front end may be stored in the memory of the computer device and executed by at least one processor to perform (see Figure 1 Description) Functions for simulation data management on the front end.

[0113] In this embodiment, the simulation data management system for the front end can be divided into multiple functional modules according to the functions it performs, such as Figure 3 As shown. The functional modules of the system 300 may include: a parameter configuration module 310, a basic construction module 320, a data storage module 330 and a data return module 340. The module referred to in the present invention refers to a series of computer program segments that can be executed by at least one processor and can complete fixed functions, which are stored in a memory. In this embodiment, the functions of each module will be described in detail in subsequent embodiments.

[0114] Parameter configuration module, used to globally configure filtering interfaces and global parameters, configure dedicated parameters for each interface, and set the priority of dedicated parameters higher than global parameters;

[0115] Basic building blocks for creating local folders for each interface;

[0116] A data saving module, used to save the simulation data or backend response data related to the interface to a corresponding local folder based on global parameters and dedicated parameters;

[0117] The data return module is used to confirm the backend service exception, filter out the response data that matches the request from the data saved in the corresponding local folder, and return the filtered response data to the front end.

[0118] Optionally, as an embodiment of the present invention, the parameter configuration module includes:

[0119] The global configuration unit is used to globally configure the filtering interface and configure the simulation data generation method, global sensitive words, and global data storage method of the initial stage of the filtering interface;

[0120] The dedicated configuration unit is used to configure dedicated parameters at the interface call layer, wherein the dedicated parameters include the simulation data generation method of the interface in the initial stage, the interface sensitive words, and the interface data storage method.

[0121] Figure 4 A schematic diagram of the structure of a terminal 400 provided in an embodiment of the present invention. The terminal 400 can be used to execute the simulation data management method for the front end provided in an embodiment of the present invention.

[0122] The terminal 400 may include: a processor 410, a memory 420 and a communication unit 430. These components communicate via one or more buses. Those skilled in the art will appreciate that the server structure shown in the figure does not limit the present invention, and it may be a bus structure or a star structure, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.

[0123] The memory 420 can be used to store the execution instructions of the processor 410, and the memory 420 can be implemented by any type of volatile or non-volatile storage terminal or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk. When the execution instructions in the memory 420 are executed by the processor 410, the terminal 400 can perform some or all of the steps in the following method embodiments.

[0124] The processor 410 is the control center of the storage terminal, and uses various interfaces and lines to connect various parts of the entire electronic terminal. It runs or executes software programs and / or modules stored in the memory 420, and calls data stored in the memory to perform various functions of the electronic terminal and / or process data. The processor can be composed of an integrated circuit (IC), for example, it can be composed of a single packaged IC, or it can be composed of multiple packaged ICs with the same or different functions. For example, the processor 410 can include only a central processing unit (CPU). In the embodiment of the present invention, the CPU can be a single computing core or multiple computing cores.

[0125] The communication unit 430 is used to establish a communication channel so that the storage terminal can communicate with other terminals, receive user data sent by other terminals or send user data to other terminals.

[0126] The present invention also provides a computer storage medium, wherein the computer storage medium may store a program, and when the program is executed, the program may include some or all of the steps in each embodiment provided by the present invention. The storage medium may be a magnetic disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM).

[0127] Those skilled in the art can clearly understand that the technology in the embodiments of the present invention can be implemented by means of software plus a necessary general hardware platform. Based on this understanding, the technical solution in the embodiments of the present invention, in essence or in other words, the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk, and other media that can store program codes, including several instructions for enabling a computer terminal (which can be a personal computer, a server, or a second terminal, a network terminal, etc.) to execute all or part of the steps of the methods described in each embodiment of the present invention.

[0128] In this specification, the same or similar parts between the various embodiments can be referred to each other. In particular, for the terminal embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the description in the method embodiment.

[0129] In the several embodiments provided by the present invention, it should be understood that the disclosed systems and methods can be implemented in other ways. For example, the system embodiments described above are only schematic. For example, the division of the modules is only a logical function division. There may be other division methods in actual implementation, such as multiple modules or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of systems or modules, which can be electrical, mechanical or other forms.

[0130] The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical modules, that is, they may be located in one place or distributed on multiple network modules. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0131] In addition, each functional module in each embodiment of the present invention may be integrated into one processing module, or each module may exist physically separately, or two or more modules may be integrated into one module.

[0132] Although the present invention has been described in detail with reference to the accompanying drawings and in combination with the preferred embodiments, the present invention is not limited thereto. Without departing from the spirit and essence of the present invention, a person of ordinary skill in the art may make various equivalent modifications or substitutions to the embodiments of the present invention, and these modifications or substitutions shall be within the scope of the present invention. Any person of ordinary skill in the art may easily think of changes or substitutions within the technical scope disclosed by the present invention, and these shall be within the scope of protection of the present invention.

Claims

1. A simulation data management method for a front end, characterized in that: include: Configure filtering interfaces and global parameters globally, configure dedicated parameters for each interface, and set the priority of dedicated parameters higher than global parameters; Create local folders for each interface; Save the simulation data or backend response data related to the interface to the corresponding local folder based on global parameters and dedicated parameters; Confirm that the backend service is abnormal, filter out the response data that matches the request from the data saved in the corresponding local folder, and return the filtered response data to the front end; Save the simulation data or backend response data related to the interface to the corresponding local folder based on global parameters and dedicated parameters, including: Parse global parameters and interface-specific parameters to obtain simulation data generation methods, sensitive words, and data storage methods; If the simulation data is generated by a tool, the simulation data management tool is used to generate the simulation data based on the simulation data field library; if the simulation data is generated by direct acquisition, the front-end request is intercepted to obtain the back-end response data to the request; Perform sensitive word processing on the generated simulation data or the obtained response data; The data after sensitive word processing is saved in the local folder of the interface according to the data saving method.

2. The method according to claim 1, characterized in that Configure filtering interfaces and global parameters globally, configure dedicated parameters for each interface, and set the priority of dedicated parameters higher than global parameters, including: Configure the filtering interface globally, and configure the simulation data generation method, global sensitive words, and global data storage method of the initial stage of the filtering interface; Special parameters are configured at the interface call layer, and the special parameters include a simulation data generation method of the interface in the initial stage, interface sensitive words, and an interface data storage method.

3. The method according to claim 1, characterized in that Create local folders for each interface, including: Parse the interface address that needs to be generated; Create a local folder for the interface in the corresponding directory based on the global parameters or dedicated parameters of the interface.

4. The method according to claim 1, characterized in that: Perform sensitive word processing on the generated simulation data or the obtained response data, including: Use functions to convert generated simulation data or obtained response data into strings; Use the replacement rule to replace the characters corresponding to the sensitive words in the string with other characters to obtain a new string; Use the function to convert the new string into data.

5. The method according to claim 4, characterized in that The data after sensitive word processing is saved to the local folder of the interface according to the data saving method, including: Analyze the data saving mode, where the data saving mode is one of overwrite saving, append saving or insert saving; According to the parsed data storage method, the data after sensitive word processing is saved in the local folder of the interface.

6. A simulation data management system for a front end, characterized in that: include: Parameter configuration module, used to globally configure filtering interfaces and global parameters, configure dedicated parameters for each interface, and set the priority of dedicated parameters higher than global parameters; Basic building blocks for creating local folders for each interface; A data saving module, used to save the simulation data or backend response data related to the interface to a corresponding local folder based on global parameters and dedicated parameters; The data return module is used to confirm the backend service anomaly, filter out the response data that matches the request from the data saved in the corresponding local folder, and return the filtered response data to the front end; Save the simulation data or backend response data related to the interface to the corresponding local folder based on global parameters and dedicated parameters, including: Parse global parameters and interface-specific parameters to obtain simulation data generation methods, sensitive words, and data storage methods; If the simulation data is generated by a tool, the simulation data management tool is used to generate the simulation data based on the simulation data field library; if the simulation data is generated by direct acquisition, the front-end request is intercepted to obtain the back-end response data to the request; Perform sensitive word processing on the generated simulation data or the obtained response data; The data after sensitive word processing is saved in the local folder of the interface according to the data saving method.

7. The system according to claim 6, characterized in that The parameter configuration module includes: The global configuration unit is used to globally configure the filtering interface and configure the simulation data generation method, global sensitive words, and global data storage method of the initial stage of the filtering interface; The dedicated configuration unit is used to configure dedicated parameters at the interface call layer, wherein the dedicated parameters include the simulation data generation method of the interface in the initial stage, the interface sensitive words, and the interface data storage method.

8. A terminal, characterized in that: include: A memory for storing a simulation data management program for the front end; A processor is used to implement the steps of the simulation data management method for the front end as described in any one of claims 1-5 when executing the simulation data management program for the front end.

9. A computer-readable storage medium storing a computer program, characterized in that: The readable storage medium stores a simulation data management program for the front end, and when the simulation data management program for the front end is executed by the processor, the steps of the simulation data management method for the front end as described in any one of claims 1-5 are implemented.

Citation Information

Patent Citations

  • Interface simulation method and device, computer equipment and storage medium

    CN110109656A

  • Mock test method and device, electronic equipment and medium

    CN113190464A