CN116680187A - Data processing method and device - Google Patents

Data processing method and device Download PDF

Info

Publication number
CN116680187A
CN116680187A CN202310717496.3A CN202310717496A CN116680187A CN 116680187 A CN116680187 A CN 116680187A CN 202310717496 A CN202310717496 A CN 202310717496A CN 116680187 A CN116680187 A CN 116680187A
Authority
CN
China
Prior art keywords
end interface
interface
data
simulation
field
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
CN202310717496.3A
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.)
CCB Finetech Co Ltd
Original Assignee
CCB Finetech Co 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 CCB Finetech Co Ltd filed Critical CCB Finetech Co Ltd
Priority to CN202310717496.3A priority Critical patent/CN116680187A/en
Publication of CN116680187A publication Critical patent/CN116680187A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3696Methods or tools to render software testable
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The invention discloses a data processing method and device, and relates to the technical field of data processing. One embodiment of the method comprises the following steps: receiving a call request to a back-end interface, intercepting the call request, and acquiring the current development state of the back-end interface according to the identification of the back-end interface; in response to the fact that the back-end interface is not developed currently, replacing the domain name field and the path field of the call request with the domain name field and the path field of the simulation service, and sending the call request after replacing the field to the simulation service to receive a simulation processing result returned by the simulation service; and responding to the fact that the back-end interface is currently developed, sending a calling request to the back-end interface to receive a processing result returned by the back-end interface. According to the embodiment, different testing modes are adopted to respectively test the development states of the current rear-end interfaces, the interfaces are developed and completed to normally process requests, and the undeveloped interfaces use mock services to process the requests, so that service control is realized.

Description

Data processing method and device
Technical Field
The present invention relates to the field of data processing technologies, and in particular, to a data processing method and apparatus.
Background
In the front-end and back-end interface interaction link of the research and development scene, the back-end interface is generally developed after the back-end interface is completed, and the front-end cannot acquire the back-end interface data at the moment and can only wait all the time. In view of this problem, various solutions are proposed at present, but these solutions cannot select whether to process a back-end interface or to process a mock service according to the development status of the back-end interface, and only the mock data or the non-mock data can be returned. In addition, the mock data is usually provided by the back end, and when the mock data is abnormal, the front end cannot process and can only wait for the back end to process, so that the development efficiency is low.
Disclosure of Invention
In view of this, the embodiments of the present invention provide a data processing method and apparatus, which at least can solve the problem that in the prior art, a corresponding service cannot be selected according to a development progress state of a back-end interface, and the development efficiency is low due to strong dependence on back-end management data.
To achieve the above object, according to an aspect of an embodiment of the present invention, there is provided a data processing method including:
receiving a call request to a back-end interface, intercepting the call request, and acquiring the current development state of the back-end interface according to the identification of the back-end interface;
In response to the fact that the back-end interface is not developed currently, replacing the domain name field and the path field of the call request with the domain name field and the path field of the simulation service, and sending the call request after replacing the field to the simulation service to receive a simulation processing result returned by the simulation service;
and responding to the fact that the back-end interface is currently developed, sending the call request to the back-end interface to receive a processing result returned by the back-end interface.
Optionally, the obtaining, according to the identifier of the back-end interface, the current development state of the back-end interface includes:
the identification of the back-end interface is sent to the back-end to receive the current development state of the back-end interface returned by the back-end; or (b)
Inquiring the current development state of the back-end interface from a local back-end interface development schedule according to the identification of the back-end interface; the back end monitors the development progress of each back end interface in real time, and sends the development progress to the front end, or updates the back end interface development progress table to feed back to the front end, so that the front end updates the local back end interface development progress table.
Optionally, the call request includes a domain name field, a path field, an address field, and a request parameter;
The replacing the domain name field and the path field of the call request with the domain name field and the path field of the simulation service, and sending the call request after replacing the fields to the simulation service includes:
determining a target simulation service corresponding to the identifier of the back-end interface from a simulation service set, and replacing the domain name field of the call request with the domain name field of the target simulation service;
determining a target path field corresponding to a path field of the call request from a set of path fields corresponding to the target simulation service to replace the path field with the target path field;
and sending the call request after replacing the field to the target simulation service, so that the target simulation service queries a corresponding simulation data pool according to the target path field and the address field, and performs corresponding operation on data in the simulation data pool by using the request parameter according to the interface type of the back-end interface.
Optionally, the path field is a combination of a service function field and a service field, one back-end interface corresponds to one or more service function fields, and the call request is a call request for a target service function of the back-end interface.
Optionally, the interface type is one of query, addition, editing and deletion, and the performing, according to the interface type of the back-end interface, a corresponding operation on the data in the analog data pool by using the request parameter includes:
in the case that the interface type is query, the request parameters comprise simulation data identifiers, and from the simulation data pool, the simulation data corresponding to the simulation data identifiers are queried and returned;
under the condition that the interface type is deleted, the request parameters comprise simulation data identifiers, and from the simulation data pool, the simulation data corresponding to the simulation data identifiers are inquired and deleted, and an execution result is returned;
when the interface type is newly added, the request parameters comprise data to be added, the data to be added is added into the analog data pool, an identifier is set for the data to be added, and an execution result and the identifier of the data to be added are returned;
and under the condition that the interface type is editing, the request parameters comprise an analog data identifier and an editing parameter, inquiring analog data corresponding to the analog data identifier from the analog data pool, performing editing processing on the analog data by using the editing parameter, and returning an editing result.
To achieve the above object, according to another aspect of an embodiment of the present invention, there is provided a data processing apparatus including:
the acquisition module is used for receiving a call request to a rear-end interface, intercepting the call request and acquiring the current development state of the rear-end interface according to the identification of the rear-end interface;
the first processing module is used for replacing the domain name field and the path field of the call request with the domain name field and the path field of the simulation service in response to the fact that the back end interface is not developed currently, and sending the call request after the replacement of the domain name field to the simulation service so as to receive a simulation processing result returned by the simulation service;
and the second processing module is used for responding to the current development completion of the back-end interface, sending the calling request to the back-end interface and receiving the processing result returned by the back-end interface.
Optionally, the acquiring module is configured to:
the identification of the back-end interface is sent to the back-end to receive the current development state of the back-end interface returned by the back-end; or (b)
Inquiring the current development state of the back-end interface from a local back-end interface development schedule according to the identification of the back-end interface; the back end monitors the development progress of each back end interface in real time, and sends the development progress to the front end, or updates the back end interface development progress table to feed back to the front end, so that the front end updates the local back end interface development progress table.
Optionally, the call request includes a domain name field, a path field, an address field, and a request parameter;
the first processing module is configured to:
determining a target simulation service corresponding to the identifier of the back-end interface from a simulation service set, and replacing the domain name field of the call request with the domain name field of the target simulation service;
determining a target path field corresponding to a path field of the call request from a set of path fields corresponding to the target simulation service to replace the path field with the target path field;
and sending the call request after replacing the field to the target simulation service, so that the target simulation service queries a corresponding simulation data pool according to the target path field and the address field, and performs corresponding operation on data in the simulation data pool by using the request parameter according to the interface type of the back-end interface.
Optionally, the path field is a combination of a service function field and a service field, one back-end interface corresponds to one or more service function fields, and the call request is a call request for a target service function of the back-end interface.
Optionally, the interface type is one of query, addition, editing, and deletion, and the first processing module is configured to:
in the case that the interface type is query, the request parameters comprise simulation data identifiers, and from the simulation data pool, the simulation data corresponding to the simulation data identifiers are queried and returned;
under the condition that the interface type is deleted, the request parameters comprise simulation data identifiers, and from the simulation data pool, the simulation data corresponding to the simulation data identifiers are inquired and deleted, and an execution result is returned;
when the interface type is newly added, the request parameters comprise data to be added, the data to be added is added into the analog data pool, an identifier is set for the data to be added, and an execution result and the identifier of the data to be added are returned;
and under the condition that the interface type is editing, the request parameters comprise an analog data identifier and an editing parameter, inquiring analog data corresponding to the analog data identifier from the analog data pool, performing editing processing on the analog data by using the editing parameter, and returning an editing result.
To achieve the above object, according to still another aspect of an embodiment of the present invention, there is provided a data processing electronic device.
The electronic equipment of the embodiment of the invention comprises: one or more processors; and a storage device for storing one or more programs which, when executed by the one or more processors, cause the one or more processors to implement any of the data processing methods described above.
To achieve the above object, according to still another aspect of the embodiments of the present invention, there is provided a computer-readable medium having stored thereon a computer program which, when executed by a processor, implements any of the above-described data processing methods.
To achieve the above object, according to still another aspect of an embodiment of the present invention, there is provided a computer program product. A computer program product according to an embodiment of the present invention includes a computer program that, when executed by a processor, implements a data processing method according to an embodiment of the present invention.
According to the solution provided by the present invention, one embodiment of the above invention has the following advantages or beneficial effects: providing a general test scheme, combining the development state of the current back-end interface, adopting different test modes to perform respective tests, developing and completing the normal processing request of the interface, and using mock service to process the request by the undeveloped interface so as to realize service control; when the mock data needs to be changed, the front end can finish the adding, deleting and modifying operation of the mock data without depending on the back end, so that dynamic updating of the mock data is realized, and the problem of the existing strong-dependence back end interface is solved. The whole operation is simple, the professional requirement on the developer is low, so that the labor cost is reduced, and the research and development efficiency is improved.
Further effects of the above-described non-conventional alternatives are described below in connection with the embodiments.
Drawings
The drawings are included to provide a better understanding of the invention and are not to be construed as unduly limiting the invention. Wherein:
FIG. 1 is a schematic flow diagram of a data processing method according to an embodiment of the present invention;
FIG. 2 is a flow chart of an alternative data processing method according to an embodiment of the invention;
FIG. 3 is a flow chart of another alternative data processing method according to an embodiment of the invention;
FIG. 4 is a schematic diagram of the main modules of a data processing apparatus according to an embodiment of the present invention;
FIG. 5 is an exemplary system architecture diagram in which embodiments of the present invention may be applied;
fig. 6 is a schematic diagram of a computer system suitable for use in implementing an embodiment of the present invention.
Detailed Description
Exemplary embodiments of the present invention will now be described with reference to the accompanying drawings, in which various details of the embodiments of the present invention are included to facilitate understanding, and are to be considered merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the invention. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
It is noted that embodiments of the invention and features of the embodiments may be combined with each other without conflict. In the technical scheme of the invention, the related aspects of acquisition, analysis, use, transmission, storage and the like of the personal information of the user accord with the regulations of related laws and regulations, are used for legal and reasonable purposes, are not shared, leaked or sold outside the legal use aspects and the like, and are subjected to supervision and management of a supervision department. Necessary measures should be taken for the personal information of the user to prevent illegal access to such personal information data, ensure that personnel having access to the personal information data comply with the regulations of the relevant laws and regulations, and ensure the personal information of the user. Once these user personal information data are no longer needed, the risk should be minimized by limiting or even prohibiting the data collection and/or deletion.
User privacy is protected, when applicable, by de-identifying the data, including in some related applications, such as by removing a particular identifier (e.g., date of birth, etc.), controlling the amount or specificity of stored data (e.g., collecting location data at a city level rather than at a specific address level), controlling how the data is stored, and/or other methods.
Referring to fig. 1, a main flowchart of a data processing method provided by an embodiment of the present invention is shown, including the following steps:
s101: receiving a call request to a back-end interface, intercepting the call request, and acquiring the current development state of the back-end interface according to the identification of the back-end interface;
s102: in response to the fact that the back-end interface is not developed currently, replacing the domain name field and the path field of the call request with the domain name field and the path field of the simulation service, and sending the call request after replacing the field to the simulation service to receive a simulation processing result returned by the simulation service;
s103: and responding to the fact that the back-end interface is currently developed, sending the call request to the back-end interface to receive a processing result returned by the back-end interface.
In the above embodiment, for step S101, the present solution may be applied to front-back interface development scenarios, such as interface development scenarios of systems including application monitoring, intelligent log analysis platform, and the like. A proxy server (proxy is an indirect access mode for accessing another network service through a special network service) is configured at the front end, for example, an nmginx proxy, so that when a call request to the back end interface clicked by a user is received, the request is intercepted, the development state of the back end interface is queried, and corresponding operation is performed.
Some interfaces of the back end are developed, but some interfaces are not developed, and for the back end interfaces which are not developed, mock service processing needs to be called, and the mock service is not a real back end interface and can be regarded as that the front end opens a service.
The method comprises the steps that the back end monitors the current development progress of each interface in real time, the method mainly comprises the steps that the two types of progress are not completed, the back end can send the current development progress of each interface to the front end, a back end interface development progress table can be generated, and the back end interface development progress table is updated in real time according to monitored progress information, so that the updated back end interface development progress table is sent to the front end, preferably, the updated back end interface development progress table is sent to the front end only when the development progress of the interfaces is monitored to change, otherwise, the development progress table is not sent, occupation of a network is reduced, and resource waste is reduced.
In order to improve the interface state query efficiency, the front end may set a local back end interface development schedule to update the local back end interface development schedule after the current development schedule of the interface or the updated back end interface development schedule sent by the back end. For example, when the current development progress of the interface A is changed from incomplete to complete, the development state of the interface A in the table is updated, and when a call request for the interface A is received in the later period, the current development state of the interface A is directly queried through the table to be complete.
In addition to the above mode, the development state of the interface can be obtained through the front-end and back-end interaction mode. In this case, the back-end interface still needs to monitor the current development progress of each interface in real time, and after receiving a call request to a certain interface of the back-end, the front-end sends the identifier of the interface to the back-end to receive the current development status of the interface returned by the back-end.
For step S102, for the back-end interface that is not developed, mock data needs to be preset, and the front-end can complete the test operation without waiting for the development of the back-end interface during the test. Specifically, the domain name and the path of the network request are replaced by the domain name and the path of the mock service, then the front end sends the replaced call request to the mock service, and receives a mock processing result returned by the mock service, wherein the mock processing result is analog data provided by the mock service and corresponding to the call request.
Further, the domain name and the path of the mock service may be preconfigured, so that when the domain name and the path in the call request of the undeveloped back-end interface are replaced by the domain name and the path of the mock service. Alternatively, domain names and paths of a plurality of mock services may be configured, and correspondence between the backend interfaces and the mock services, such as interface 1, 2-mock service 1, and interface 3, 4-mock service 2, may be configured, so that different call requests are sent to different mock services for processing.
For step S103, the mock data is simulated data, not real data, and is only suitable for the case that the development of the back-end interface is not completed, and after the development of the back-end interface is completed, the data obtained by calling the back-end interface is generally different from the mock data. Therefore, under the condition that the development of the back-end interface is completed, the mock service is not used any more, and the request is directly sent to the back-end interface for processing, so that a real calling result is obtained.
According to the method provided by the embodiment, different testing modes are adopted to conduct testing respectively in combination with the development state of the current back-end interface, the developed interface processes the request normally, and the undeveloped interface processes the request by using the mock service, so that service control is achieved.
Referring to fig. 2, an alternative flow chart of a data processing method according to an embodiment of the invention is shown, comprising the following steps:
s201: receiving a call request to a back-end interface, intercepting the call request, and acquiring the current development state of the back-end interface according to the identification of the back-end interface; wherein the call request comprises a domain name field, a path field, an address field and a request parameter;
s202: and responding to the fact that the back-end interface is currently developed, sending the call request to the back-end interface to receive a processing result returned by the back-end interface.
S203: determining a target simulation service corresponding to the identification of the back-end interface from a simulation service set in response to the back-end interface not being currently developed, and replacing the domain name field of the call request with the domain name field of the target simulation service;
s204: determining a target path field corresponding to a path field of the call request from a set of path fields corresponding to the target simulation service to replace the path field with the target path field;
s205: and sending the call request after replacing the field to the target simulation service, so that the target simulation service queries a corresponding simulation data pool according to the target path field and the address field, and correspondingly operates data in the simulation data pool by using the request parameter according to the interface type of the back-end interface to obtain a simulation processing result.
In the above embodiment, for steps S201 and S202, reference may be made to the description shown in fig. 1, and details are not repeated here.
In the above embodiment, for steps S203 to S204, the call request may have various forms, and the URL (Uniform Resource Locator ) does not include the request parameters, such as http:// xxxx:8008/cpmServer/cpm/v1/alarmsenderList, so the call request at this time needs to include both the URL address and the request parameters. Another is the inclusion of request parameters in the URL, such as http:// xxxx:8008/cpmServer/cpm/v1/alarmsenderList/? xxxx, the call request may be only a URL address.
With the above http:// xxxx:8008/cpmServer/cpm/v1/alarmsenderList/? xxxx is taken as an example, xxxx in xx:8008 is a domain name field, corresponds to a called back end interface, 8008 is a port number, the port number is used to identify different programs running on a computer, and each network program corresponds to one or more specific port numbers. cpmServer is a path field, which is composed of specific service function field and service field, one interface can have multiple service functions, and the fields of different service functions are different, such as cpm and cmm. cpm/v1/alarmsenderList is the address field, and xxxx after question mark is the request parameter.
In the scheme, a plurality of mock services can be preset, and the corresponding relation between interfaces and the mock services, for example, interface 1, 2-mock service 1, interface 3 and 4-mock service 2, are set, so that the corresponding mock services need to be determined according to the identification of the back-end interface, and the target mock service is determined to be the mock service 1 if the back-end interface is the interface 1, and therefore xxxx:8008 is replaced by the domain name field of the mock service 1.
In the scheme, a plurality of path fields are also set for each mock service, the path fields of different requests correspond to the different path fields of the mock service, for example, the cpm and the cmm of the service function are set under the interface 1, the corresponding relation between the cpmServer-mock Server1 and the cmmServer-mock Server2 is set, and the mock Server1 and the mock Server2 form a path field set of the mock service 1, so that the cpmServer-mock Server1 in the URL address is replaced by the mock Server1.
The concept of mock implementation is mainly to review the above description by replacing linked domain names and paths, and http:// xxxx:8008/cpmServer/cpm/v1/alarmsenderList/? After xxxx is processed, the obtained new call request is the domain name field of http:// mock service 1/mockServer 1/cpm/v1/alarmsenderList/? xxxx.
For step S205, after receiving the request, the mock service does not need to make any further judgment, but only needs to directly perform processing. Similarly, different mock data pools are preset for different address fields and path fields in the mock service, and data in the mock data pools are agreed in advance by front-end developers and back-end developers. The operation type of the interface is set to be one of inquiry, new addition, editing and deletion, so that the mock service needs to process the analog data according to the interface type using the request parameters to obtain a processing result.
For example, mock a user list data including display name, user name, character, whether valid, cell phone number, mailbox, head portrait, personal homepage, lucky color, birthday. User names, display names, etc. of users can generate random Chinese names, i.e. texts
1. Display name= > generating a random chinese name (text)
2. User name= > generating a random english name (text)
3. Whether or not to be valid= > generate a random boolean value (boolean value, one of True or False)
4. A random mobile phone number is generated by the mobile phone number= > as 15576809210
5. User's birthday= > generating a random date
6. User mailbox= > generating a random mailbox
7. User's personal homepage= > generating a random link address
8. User head image= > generating random picture with background color
9. User lucky color= > generating a random 16-ary color value, e.g. white, green, pink
According to the method provided by the embodiment, for the undeveloped rear-end interface, the mode of replacing the domain name port and the path field is adopted, so that the request is forwarded to the mock service for processing, the request is not required to be sent to the rear-end interface, and the normal operation of the test is maintained.
Referring to FIG. 3, another alternative flow chart of a data processing method according to an embodiment of the invention is shown, comprising the steps of:
s301: receiving a call request to a back-end interface, intercepting the call request, and acquiring the current development state of the back-end interface according to the identification of the back-end interface; the calling request comprises a domain name field, a path field, an address field and a request parameter, and the interface type of the back-end interface is one of inquiry, addition, editing and deletion;
S302: and responding to the fact that the back-end interface is currently developed, sending the call request to the back-end interface to receive a processing result returned by the back-end interface.
S303: determining a target simulation service corresponding to the identification of the back-end interface from a simulation service set in response to the back-end interface not being currently developed, and replacing the domain name field of the call request with the domain name field of the target simulation service;
s304: determining a target path field corresponding to a path field of the call request from a set of path fields corresponding to the target simulation service to replace the path field with the target path field;
s305: sending a call request after replacing a field to the target simulation service, so that the target simulation service queries a corresponding simulation data pool according to the target path field and the address field;
s306: in the case that the interface type is query, the request parameters comprise simulation data identifiers, and from the simulation data pool, the simulation data corresponding to the simulation data identifiers are queried and returned;
s307: under the condition that the interface type is deleted, the request parameters comprise simulation data identifiers, and from the simulation data pool, the simulation data corresponding to the simulation data identifiers are inquired and deleted, and an execution result is returned;
S308: when the interface type is newly added, the request parameters comprise data to be added, the data to be added is added into the analog data pool, an identifier is set for the data to be added, and an execution result and the identifier of the data to be added are returned;
s309: and under the condition that the interface type is editing, the request parameters comprise an analog data identifier and an editing parameter, inquiring analog data corresponding to the analog data identifier from the analog data pool, performing editing processing on the analog data by using the editing parameter, and returning an editing result.
In the above embodiment, for the steps S301 and S302, reference is made to the description shown in fig. 1, and the steps S303 to S305 are referred to the description shown in fig. 2, which is not repeated here.
For steps S306 to S309, the problem of the front-back interface interaction link is solved by a request interception method represented by mock. For this case, the scheme also sets interface types, which are classified into query, add, edit, and delete, and each interface type is set at development time, and one interface preferably corresponds to only one type.
In the case that the interface type is query, the request parameter preferably only comprises a mock data identifier, and the mock data corresponding to the mock data identifier is queried from a mock data pool and returned;
in the case that the interface type is delete, the request parameter preferably only includes a mock data identifier, and from the mock data pool, the mock data corresponding to the mock data identifier is queried and deleted, and an execution result such as Success is returned;
under the condition that the interface type is newly added, the request parameters comprise data to be added, the data to be added is added into a mock data pool, an identifier is set for the data, for example, the current maximum identifier is 100, the identifier is set as 101 for the data, an execution result and the identifier of the data to be added are returned, for example, success is returned, the identifier is 101, and the subsequent user can conveniently execute inquiry, deletion and editing operations according to the data identifier;
in the case that the interface type is editing, the request parameters include a mock data identifier and an editing parameter, the mock data corresponding to the mock data identifier is queried from a mock data pool, editing processing is performed on the mock data by using the editing parameter, for example, unnecessary data is deleted, data replacement is performed, unit conversion, case conversion is performed, and the like, and an editing result such as Success is returned.
According to the method provided by the embodiment, the mock service can edit, delete, add and inquire by using the request parameters according to the interface type of the back end interface, even if the mock data is abnormal, the front end does not need to wait for the back end processing, and directly adds, deletes and revises the mock data, so that the mock data can be dynamically changed, the reliability of the mock data is improved, and the research and development efficiency is also improved because the back end processing is not needed.
In addition, aiming at the problem of the front-back interface interaction link, the prior art adopts the following scheme: 1. constructing an interface management tool represented by rap 2; wherein, rap2 is an online mock data generator; 2. by a request interception mode represented by mock.js; wherein, the monos is a js library for generating virtual data based on one of nodejs.
These several schemes all have some problems with mock data. Taking a common application monitoring system as an example, the following aspects are mainly focused on: 1. the construction cost of independently constructing the interface management tool is huge, the configuration of the interface management tool is complex, and the situation that the back-end interface is developed and completed when the configuration is completed is likely to occur compared with the back-end. 2. The mock data are controlled by the background, and if abnormal conditions occur, the front end cannot be changed and can only be changed by a back end developer, so that the principle of separating the front end from the back end is not overcome. 3. Directly using mock.js, the data are dynamically generated dummy data, and the situation that true mock is not added, deleted and checked can not be realized.
Compared with the prior art, the method provided by the embodiment of the invention has at least the following beneficial effects:
1. combining the development state of the current back-end interface, adopting different test modes to perform respective tests, and enabling the developed interface to normally process the request and the undeveloped interface to process the request by using a mock service so as to realize service control;
2. the method has the advantages that interface management tool service with high cost is not required to be built, existing codes are not required to be modified, and a call request can be intercepted by only configuring an agent at the front end, so that non-invasive development is realized;
3. mock data is rich in types, and random texts, numbers, boolean values, dates, mailboxes, links, pictures, colors and the like are supported to be generated;
4. when the mock data needs to be changed, the front end can finish the adding, deleting and modifying operation of the mock data without depending on the rear end, so that the dynamic updating of the mock data is realized, the testing reliability is improved, the front end and the rear end are separated, and the research and development time is shortened;
5. the whole operation is simple, the professional requirement on the developer is low, so that the labor cost is reduced, and the research and development efficiency is improved.
Referring to fig. 4, a schematic diagram of main modules of a data processing apparatus 400 according to an embodiment of the present invention is shown, including:
An obtaining module 401, configured to receive a call request to a back-end interface, intercept the call request, and obtain a current development state of the back-end interface according to an identifier of the back-end interface;
the first processing module 402 is configured to replace a domain name field and a path field of the call request with a domain name field and a path field of the simulation service in response to the back end interface not being currently developed, and send the call request after the replacement of the domain name field to the simulation service to receive a simulation processing result returned by the simulation service;
and the second processing module 403 is configured to send the call request to the back-end interface in response to the back-end interface having been currently developed, so as to receive a processing result returned by the back-end interface.
In the embodiment of the present invention, the obtaining module 401 is configured to:
the identification of the back-end interface is sent to the back-end to receive the current development state of the back-end interface returned by the back-end; or (b)
Inquiring the current development state of the back-end interface from a local back-end interface development schedule according to the identification of the back-end interface; the back end monitors the development progress of each back end interface in real time, and sends the development progress to the front end, or updates the back end interface development progress table to feed back to the front end, so that the front end updates the local back end interface development progress table.
The invention discloses an implementation device, wherein the call request comprises a domain name field, a path field, an address field and a request parameter;
the first processing module 402 is configured to:
determining a target simulation service corresponding to the identifier of the back-end interface from a simulation service set, and replacing the domain name field of the call request with the domain name field of the target simulation service;
determining a target path field corresponding to a path field of the call request from a set of path fields corresponding to the target simulation service to replace the path field with the target path field;
and sending the call request after replacing the field to the target simulation service, so that the target simulation service queries a corresponding simulation data pool according to the target path field and the address field, and performs corresponding operation on data in the simulation data pool by using the request parameter according to the interface type of the back-end interface.
The invention implements the device, the said path field is the combination of the business function field and service field, a back-end interface corresponds to one or more business function fields, the said call request is the call request to the goal business function of the said back-end interface.
In the embodiment of the present invention, the interface type is one of query, addition, editing, and deletion, and the first processing module 402 is configured to:
in the case that the interface type is query, the request parameters comprise simulation data identifiers, and from the simulation data pool, the simulation data corresponding to the simulation data identifiers are queried and returned;
under the condition that the interface type is deleted, the request parameters comprise simulation data identifiers, and from the simulation data pool, the simulation data corresponding to the simulation data identifiers are inquired and deleted, and an execution result is returned;
when the interface type is newly added, the request parameters comprise data to be added, the data to be added is added into the analog data pool, an identifier is set for the data to be added, and an execution result and the identifier of the data to be added are returned;
and under the condition that the interface type is editing, the request parameters comprise an analog data identifier and an editing parameter, inquiring analog data corresponding to the analog data identifier from the analog data pool, performing editing processing on the analog data by using the editing parameter, and returning an editing result.
In addition, the implementation of the apparatus in the embodiments of the present invention has been described in detail in the above method, so that the description is not repeated here.
Fig. 5 shows an exemplary system architecture 500, including terminal devices 501, 502, 503, a network 504, and a server 505 (by way of example only), to which embodiments of the invention may be applied.
The terminal devices 501, 502, 503 may be various electronic devices having a display screen and supporting web browsing, are installed with various communication client applications, and a user may interact with the server 505 through the network 504 using the terminal devices 501, 502, 503 to receive or transmit messages, etc.
The network 504 is used as a medium to provide communication links between the terminal devices 501, 502, 503 and the server 505. The network 504 may include various connection types, such as wired, wireless communication links, or fiber optic cables, among others.
The server 505 may be a server providing various services, and it should be noted that the method provided by the embodiment of the present invention is generally performed by the server 505, and accordingly, the apparatus is generally disposed in the server 505.
It should be understood that the number of terminal devices, networks and servers in fig. 5 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
Referring now to FIG. 6, there is illustrated a schematic diagram of a computer system 600 suitable for use in implementing an embodiment of the present invention. The terminal device shown in fig. 6 is only an example, and should not impose any limitation on the functions and the scope of use of the embodiment of the present invention.
As shown in fig. 6, the computer system 600 includes a Central Processing Unit (CPU) 601, which can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) 602 or a program loaded from a storage section 608 into a Random Access Memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the system 600 are also stored. The CPU 601, ROM 602, and RAM 603 are connected to each other through a bus 604. An input/output (I/O) interface 605 is also connected to bus 604.
The following components are connected to the I/O interface 605: an input portion 606 including a keyboard, mouse, etc.; an output portion 607 including a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, a speaker, and the like; a storage section 608 including a hard disk and the like; and a communication section 609 including a network interface card such as a LAN card, a modem, or the like. The communication section 609 performs communication processing via a network such as the internet. The drive 610 is also connected to the I/O interface 605 as needed. Removable media 611 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is installed as needed on drive 610 so that a computer program read therefrom is installed as needed into storage section 608.
In particular, according to embodiments of the present disclosure, the processes described above with reference to flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method shown in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication portion 609, and/or installed from the removable medium 611. The above-described functions defined in the system of the present invention are performed when the computer program is executed by a Central Processing Unit (CPU) 601.
The computer readable medium shown in the present invention may be a computer readable signal medium or a computer readable storage medium, or any combination of the two. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples of the computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present invention, however, the computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, with the computer-readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The modules involved in the embodiments of the present invention may be implemented in software or in hardware. The described modules may also be provided in a processor, for example, as: a processor comprises an acquisition module, a first processing module and a second processing module. The names of these modules do not in any way constitute a limitation of the module itself, for example the second processing module may also be described as a "real processing module".
As another aspect, the present invention also provides a computer-readable medium that may be contained in the apparatus described in the above embodiments; or may be present alone without being fitted into the device. The computer readable medium carries one or more programs which, when executed by a device, cause the device to perform any of the data processing methods described above.
The computer program product of the invention comprises a computer program which, when being executed by a processor, implements the data processing method in the embodiments of the invention.
The above embodiments do not limit the scope of the present invention. It will be apparent to those skilled in the art that various modifications, combinations, sub-combinations and alternatives can occur depending upon design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the scope of the present invention.

Claims (13)

1. A method of data processing, comprising:
receiving a call request to a back-end interface, intercepting the call request, and acquiring the current development state of the back-end interface according to the identification of the back-end interface;
In response to the fact that the back-end interface is not developed currently, replacing the domain name field and the path field of the call request with the domain name field and the path field of the simulation service, and sending the call request after replacing the field to the simulation service to receive a simulation processing result returned by the simulation service;
and responding to the fact that the back-end interface is currently developed, sending the call request to the back-end interface to receive a processing result returned by the back-end interface.
2. The method of claim 1, wherein the obtaining the current development state of the backend interface according to the identifier of the backend interface comprises:
the identification of the back-end interface is sent to the back-end to receive the current development state of the back-end interface returned by the back-end; or (b)
Inquiring the current development state of the back-end interface from a local back-end interface development schedule according to the identification of the back-end interface; the back end monitors the development progress of each back end interface in real time, and sends the development progress to the front end, or updates the back end interface development progress table to feed back to the front end, so that the front end updates the local back end interface development progress table.
3. The method of claim 1, wherein the call request includes a domain name field, a path field, an address field, and a request parameter;
the replacing the domain name field and the path field of the call request with the domain name field and the path field of the simulation service, and sending the call request after replacing the fields to the simulation service includes:
determining a target simulation service corresponding to the identifier of the back-end interface from a simulation service set, and replacing the domain name field of the call request with the domain name field of the target simulation service;
determining a target path field corresponding to a path field of the call request from a set of path fields corresponding to the target simulation service to replace the path field with the target path field;
and sending the call request after replacing the field to the target simulation service, so that the target simulation service queries a corresponding simulation data pool according to the target path field and the address field, and performs corresponding operation on data in the simulation data pool by using the request parameter according to the interface type of the back-end interface.
4. A method according to claim 3, wherein the path field is a combination of a service function field and a service field, one back-end interface corresponds to one or more service function fields, and the call request is a call request for a target service function of the back-end interface.
5. The method according to claim 3 or 4, wherein the interface type is one of inquiry, addition, editing and deletion, and the performing, according to the interface type of the backend interface, a corresponding operation on data in an analog data pool using the request parameters includes:
in the case that the interface type is query, the request parameters comprise simulation data identifiers, and from the simulation data pool, the simulation data corresponding to the simulation data identifiers are queried and returned;
under the condition that the interface type is deleted, the request parameters comprise simulation data identifiers, and from the simulation data pool, the simulation data corresponding to the simulation data identifiers are inquired and deleted, and an execution result is returned;
when the interface type is newly added, the request parameters comprise data to be added, the data to be added is added into the analog data pool, an identifier is set for the data to be added, and an execution result and the identifier of the data to be added are returned;
and under the condition that the interface type is editing, the request parameters comprise an analog data identifier and an editing parameter, inquiring analog data corresponding to the analog data identifier from the analog data pool, performing editing processing on the analog data by using the editing parameter, and returning an editing result.
6. A data processing apparatus, comprising:
the acquisition module is used for receiving a call request to a rear-end interface, intercepting the call request and acquiring the current development state of the rear-end interface according to the identification of the rear-end interface;
the first processing module is used for replacing the domain name field and the path field of the call request with the domain name field and the path field of the simulation service in response to the fact that the back end interface is not developed currently, and sending the call request after the replacement of the domain name field to the simulation service so as to receive a simulation processing result returned by the simulation service;
and the second processing module is used for responding to the current development completion of the back-end interface, sending the calling request to the back-end interface and receiving the processing result returned by the back-end interface.
7. The apparatus of claim 6, wherein the means for obtaining is configured to:
the identification of the back-end interface is sent to the back-end to receive the current development state of the back-end interface returned by the back-end; or (b)
Inquiring the current development state of the back-end interface from a local back-end interface development schedule according to the identification of the back-end interface; the back end monitors the development progress of each back end interface in real time, and sends the development progress to the front end, or updates the back end interface development progress table to feed back to the front end, so that the front end updates the local back end interface development progress table.
8. The apparatus of claim 6, wherein the call request comprises a domain name field, a path field, an address field, and a request parameter;
the first processing module is configured to:
determining a target simulation service corresponding to the identifier of the back-end interface from a simulation service set, and replacing the domain name field of the call request with the domain name field of the target simulation service;
determining a target path field corresponding to a path field of the call request from a set of path fields corresponding to the target simulation service to replace the path field with the target path field;
and sending the call request after replacing the field to the target simulation service, so that the target simulation service queries a corresponding simulation data pool according to the target path field and the address field, and performs corresponding operation on data in the simulation data pool by using the request parameter according to the interface type of the back-end interface.
9. The apparatus of claim 8, wherein the path field is a combination of a traffic function field and a service field, one back-end interface corresponds to one or more traffic function fields, and the call request is a call request for a target traffic function of the back-end interface.
10. The apparatus according to claim 8 or 9, wherein the interface type is one of query, add, edit, delete, and the first processing module is configured to:
in the case that the interface type is query, the request parameters comprise simulation data identifiers, and from the simulation data pool, the simulation data corresponding to the simulation data identifiers are queried and returned;
under the condition that the interface type is deleted, the request parameters comprise simulation data identifiers, and from the simulation data pool, the simulation data corresponding to the simulation data identifiers are inquired and deleted, and an execution result is returned;
when the interface type is newly added, the request parameters comprise data to be added, the data to be added is added into the analog data pool, an identifier is set for the data to be added, and an execution result and the identifier of the data to be added are returned;
and under the condition that the interface type is editing, the request parameters comprise an analog data identifier and an editing parameter, inquiring analog data corresponding to the analog data identifier from the analog data pool, performing editing processing on the analog data by using the editing parameter, and returning an editing result.
11. An electronic device, comprising:
one or more processors;
storage means for storing one or more programs,
when executed by the one or more processors, causes the one or more processors to implement the method of any of claims 1-5.
12. A computer readable medium, on which a computer program is stored, characterized in that the program, when being executed by a processor, implements the method according to any of claims 1-5.
13. A computer program product comprising a computer program which, when executed by a processor, implements the method according to any one of claims 1-5.
CN202310717496.3A 2023-06-16 2023-06-16 Data processing method and device Pending CN116680187A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310717496.3A CN116680187A (en) 2023-06-16 2023-06-16 Data processing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310717496.3A CN116680187A (en) 2023-06-16 2023-06-16 Data processing method and device

Publications (1)

Publication Number Publication Date
CN116680187A true CN116680187A (en) 2023-09-01

Family

ID=87781967

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310717496.3A Pending CN116680187A (en) 2023-06-16 2023-06-16 Data processing method and device

Country Status (1)

Country Link
CN (1) CN116680187A (en)

Similar Documents

Publication Publication Date Title
CN110896412B (en) Network request processing method and device and electronic equipment
CN109981322B (en) Method and device for cloud resource management based on label
CN109618176B (en) Processing method, equipment and storage medium for live broadcast service
CN109656799B (en) Test method and device
CN104536890A (en) Testing system, method and device
CN111414191A (en) Gray scale publishing method and device for small program
CN114285659A (en) Reverse proxy method, device, equipment and storage medium
CN113779422A (en) Method and device for realizing relation chain label, electronic equipment and storage medium
CN109587197A (en) It is associated with the methods, devices and systems of reported data
CN116737598A (en) Page debugging method, device, electronic equipment and computer readable medium
CN116680187A (en) Data processing method and device
CN110555201B (en) Knowledge document generation method, device, electronic equipment and storage medium
CN111786801B (en) Method and device for charging based on data flow
CN112860398A (en) Data processing method, device, equipment and medium based on rule engine
CN113742617A (en) Cache updating method and device
CN109271310B (en) Development testing method and device for network function of mobile application program
CN113434384A (en) Pressure testing method and device
CN111343172A (en) Network access authority dynamic processing method and device
CN115037572B (en) Application request identification method and device
CN115309612B (en) Method and device for monitoring data
CN112306791A (en) Method and device for monitoring performance
CN114968491B (en) Virtual resource testing method and device, electronic equipment and storage medium
CN110166626B (en) Application program distribution method, device and system in intelligent terminal
CN116627794A (en) Test case generation method and device
CN117111995A (en) Data processing method, device, electronic equipment and computer readable medium

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