CN110704218B - Data processing method, data processing device, computer equipment and storage medium - Google Patents

Data processing method, data processing device, computer equipment and storage medium Download PDF

Info

Publication number
CN110704218B
CN110704218B CN201910817959.7A CN201910817959A CN110704218B CN 110704218 B CN110704218 B CN 110704218B CN 201910817959 A CN201910817959 A CN 201910817959A CN 110704218 B CN110704218 B CN 110704218B
Authority
CN
China
Prior art keywords
data
response
api
abnormal
caller
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.)
Active
Application number
CN201910817959.7A
Other languages
Chinese (zh)
Other versions
CN110704218A (en
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.)
OneConnect Financial Technology Co Ltd Shanghai
Original Assignee
OneConnect Financial Technology Co Ltd Shanghai
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 OneConnect Financial Technology Co Ltd Shanghai filed Critical OneConnect Financial Technology Co Ltd Shanghai
Priority to CN201910817959.7A priority Critical patent/CN110704218B/en
Publication of CN110704218A publication Critical patent/CN110704218A/en
Application granted granted Critical
Publication of CN110704218B publication Critical patent/CN110704218B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/0703Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation
    • G06F11/079Root cause analysis, i.e. error or fault diagnosis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/0703Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation
    • G06F11/0751Error or fault detection not based on redundancy
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/0703Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation
    • G06F11/0766Error or fault reporting or storing

Abstract

The application relates to a data processing method, a data processing device, computer equipment and a storage medium. The method comprises the following steps: when detecting that a data caller calls data in a data provider through an API (application programming interface), detecting whether the API is abnormal, when the API is abnormal, acquiring reference response data, wherein the reference response data corresponds to the API and corresponds to the data caller, simulating the data provider to respond to the data caller according to the reference response data, acquiring abnormal response data of the data provider to respond to the data caller through the API, and generating a data response log according to the reference response data and the abnormal response data. When the API is abnormal, the response of the data provider is simulated by acquiring the reference response data, so that the condition that the data provider does not respond to the data caller when the API is abnormal can be avoided, and the data transmission efficiency is further improved.

Description

Data processing method, data processing device, computer equipment and storage medium
Technical Field
The present application relates to the field of computer technologies, and in particular, to a data processing method and apparatus, a computer device, and a storage medium.
Background
With the development of computer technology, a computer device can implement data transmission through an API interface, wherein an application program system calling data through the API interface may be referred to as a data caller, and an application program system called data through the API interface may be referred to as a data provider, and the API interface plays a critical role in data transmission between the application program systems.
However, when the communication mode or protocol of the API interface changes, the data transmission mode between the application program systems needs to be reestablished, which causes a problem of low data transmission efficiency.
Disclosure of Invention
In view of the foregoing, it is desirable to provide a data processing method, an apparatus, a computer device and a storage medium, which can improve the efficiency of data transmission.
A method of data processing, the method comprising:
when detecting that a data caller calls data in a data provider through an API (application programming interface), detecting whether the API is abnormal or not;
when the API interface is abnormal, acquiring reference response data; wherein the reference response data corresponds to the API interface and the reference response data corresponds to the data caller;
simulating the data provider to respond to the data caller according to the reference response data, and acquiring abnormal response data of the data provider responding to the data caller through the API;
and generating a data response log according to the reference response data and the abnormal response data.
In one embodiment, the method further comprises:
acquiring a call request generated when the data caller calls the data in the data provider through the API;
the simulating the data provider to respond to the data caller according to the reference response data comprises:
acquiring a configuration file corresponding to the calling request, wherein the configuration file comprises the reference response data;
and when the calling request contains a response instruction, extracting the reference response data in the configuration file, and simulating the data provider to send the reference response data to the data caller.
In one embodiment, the detecting whether there is an exception in the API interface includes:
acquiring preset test data;
requesting the API interface according to the test data and acquiring a response result of the API interface;
when the response result is an abnormal response result, the API interface has an abnormality;
and when the response result is a normal response result, the API has no exception.
In one embodiment, the obtaining reference response data when the API interface is abnormal includes:
when the API has the abnormality, acquiring a data calling party calling data in the data provider through the abnormal API;
and searching reference response data according to the data calling party.
In one embodiment, the method further comprises:
when the API does not have abnormality, acquiring reference calling data generated when the data caller calls data in the data provider through a normal API, and acquiring reference response data generated when the data provider sends data to the data caller through the normal API;
establishing a corresponding relation between the reference calling data and the reference response data;
the searching for the reference response data according to the data caller comprises:
acquiring the reference calling data corresponding to the data calling party;
and searching reference response data corresponding to the reference calling data according to the corresponding relation.
In one embodiment, the method further comprises:
searching an API (application programming interface) corresponding to the abnormal response data according to the data response log;
and repairing the API corresponding to the abnormal response data according to the abnormal response data to obtain a repaired normal API.
A data processing apparatus, the apparatus comprising:
the interface detection module is used for detecting whether the API interface is abnormal or not when a data caller calls data in a data provider through the API interface is detected;
the reference response data acquisition module is used for acquiring reference response data when the API has abnormity; wherein the reference response data corresponds to the API interface and the reference response data corresponds to the data caller;
the simulation response module is used for simulating the data provider to respond to the data caller according to the reference response data and acquiring abnormal response data of the data provider responding to the data caller through the API;
and the log generation module is used for generating a data response log according to the reference response data and the abnormal response data.
A computer device comprising a memory and a processor, the memory storing a computer program, the processor implementing the following steps when executing the computer program:
when detecting that a data caller calls data in a data provider through an API (application programming interface), detecting whether the API is abnormal or not;
when the API interface is abnormal, acquiring reference response data; wherein the reference response data corresponds to the API interface and the reference response data corresponds to the data caller;
simulating the data provider to respond to the data caller according to the reference response data, and acquiring abnormal response data of the data provider responding to the data caller through the API;
and generating a data response log according to the reference response data and the abnormal response data.
A computer-readable storage medium, on which a computer program is stored which, when executed by a processor, carries out the steps of:
when detecting that a data caller calls data in a data provider through an API (application programming interface), detecting whether the API is abnormal or not;
when the API has the abnormality, acquiring reference response data; wherein the reference response data corresponds to the API interface and the reference response data corresponds to the data caller;
simulating the data provider to respond to the data caller according to the reference response data, and acquiring abnormal response data of the data provider responding to the data caller through the API;
and generating a data response log according to the reference response data and the abnormal response data.
According to the data processing method, the data processing device, the computer equipment and the storage medium, when the data in the data provider is called by the data caller through the API interface is detected, whether the API interface is abnormal or not is detected, when the API interface is abnormal, reference response data is obtained, wherein the reference response data corresponds to the API interface and corresponds to the data caller, the data provider is simulated to respond to the data caller according to the reference response data, the abnormal response data of the data caller is responded by the data provider through the API interface is obtained, and a data response log is generated according to the reference response data and the abnormal response data. When the API is abnormal, the response of the data provider is simulated by acquiring the reference response data, so that the condition that the data provider does not respond to the data caller when the API is abnormal can be avoided, and the data transmission efficiency is further improved.
Drawings
FIG. 1 is a diagram of an exemplary implementation of a data processing method;
FIG. 2 is a flow diagram that illustrates a data processing method in one embodiment;
FIG. 3 is a flow diagram that illustrates a flow of a method for simulating a data provider in response to a data caller, in accordance with an embodiment;
FIG. 4 is a block diagram showing the structure of a data processing apparatus according to an embodiment;
FIG. 5 is a diagram illustrating an internal structure of a computer device according to an embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more clearly understood, the present application is further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
The data processing method provided by the application can be applied to the application environment shown in fig. 1. The application environment includes a computer device 110. When detecting that a data caller calls data in a data provider through the API interface, the computer device 110 may detect whether there is an anomaly in the API interface. When there is an anomaly in the API interface, the computer device 110 may obtain reference response data, where the reference response data corresponds to the API interface and the reference response data corresponds to the data caller. The computer device 110 may simulate the data provider responding to the data caller according to the reference response data and acquire the abnormal response data of the data provider responding to the data caller through the API interface. The computer device 110 may generate a data response log based on the reference response data and the abnormal response data. The computer device 110 may be, but is not limited to, various personal computers, notebook computers, smart phones, tablet computers, and other devices.
In one embodiment, as shown in fig. 2, there is provided a data processing method including the steps of:
step 202, when detecting that a data caller calls data in a data provider through an API, detecting whether the API is abnormal.
An API (Application Programming Interface) Interface may be used for data transmission. The data caller may be used to indicate an application, computer running program, etc. that needs to call data. The data provider may be used to represent a server, database, etc. that stores the data. The data caller can call the data in the data provider through the API interface. When different data callers call data through the API interface, different communication modes and communication protocols may be agreed between the data invoker and the API interface, and when the communication mode or the communication protocol used by the API interface is different from that agreed with the data invoker before, there is a case where the data invoker calls data through the API interface and fails.
The computer device can detect data transmission among the data caller, the data provider and the API interface, and when the data caller is detected to call data in the data provider through the API interface, the computer device can detect whether the API interface is abnormal. Specifically, the computer device may obtain a communication mode and a communication protocol that are agreed in advance by the data caller and the API interface, and the computer device may obtain the communication mode and the communication protocol that are used when the data caller calls data through the API interface. The computer device can detect whether the API interface is abnormal according to the communication mode and the communication protocol adopted when the data caller calls the data through the API interface and the communication mode and the communication protocol agreed in advance.
Step 204, when the API has abnormity, acquiring reference response data; the reference response data corresponds to the API interface, and the reference response data corresponds to the data caller.
The response data can be data generated when the data provider responds to the data caller after the data caller calls the data in the data provider through the API. The reference response data may be preset, and when the data caller calls the data in the data provider through the API interface according to a predetermined communication method and communication protocol, the data provider provides response data generated when the data caller responds. The reference response data may be recorded in the computer device in a json format, which is a lightweight data exchange format.
The reference response data corresponds to the API interface, and the reference response data corresponds to the data caller. Specifically, the computer device may store reference response data of a plurality of data provider response data callers, and different reference response data may be correspondingly provided when different data callers and different API interfaces are used for data transmission. For example, a data caller in the computer device has an application a and an application B, a data provider has a database a and a database B, and an API interface has an API interface 1, wherein the stored reference response data has response data generated when the application a calls data in the database a through the API interface 1; the application program A calls the response data generated when the database B is called through the API 1; b, response data generated when the application program calls the data in the database A through the API (application program interface) 1; the B application calls the response data generated when the database B is called through the API interface 1.
The computer device may store reference response data generated when each data caller calls data in each data provider through the API interface, and may also store a corresponding relationship between the data caller and the API interface and between the data callers. When the API interface is abnormal, the computer device may search for the reference response data corresponding to the API interface and the data caller according to the stored correspondence between the data caller and the API interface and the data caller.
And step 206, simulating a data provider response data caller according to the reference response data, and acquiring abnormal response data of the data provider responding to the data caller through the API.
Whenever the data caller calls the data in the data provider through the API interface, the data provider responds to the data caller and generates response data. When the API has abnormality, the response data responded by the data providing direction data calling party is the abnormal response data; when the API does not have the abnormity, the response data responded by the data providing party to the data calling party is the normal response data.
The reference response data is used to indicate response data to which the data provider responds to the data caller when there is no abnormality in the API interface. When the API interface is abnormal, the computer device may simulate, after obtaining the reference response data, the data provider response data caller according to the reference response data, that is, simulate a state of the data provider response data caller when the API interface is not abnormal. Meanwhile, the data caller calls the data in the data provider through the abnormal API interface, the data provider can generate abnormal response data for the data caller through the abnormal API interface, and the computer equipment can intercept the abnormal corresponding data of the data provider which responds to the data caller through the abnormal API interface.
And step 208, generating a data response log according to the reference response data and the abnormal response data.
The log may be used to record the date, time, user, and action of the program during operation. The data response log may be recorded with differences between the reference response data and the abnormal response data. After the computer device obtains the reference response data and the abnormal response data, the computer device may compare differences between the reference response data and the abnormal response data and generate a data response log according to the differences.
In this embodiment, when it is detected that a data caller calls data in a data provider through an API interface, detecting whether the API interface is abnormal, when the API interface is abnormal, acquiring reference response data, wherein the reference response data corresponds to the API interface and corresponds to the data provider, simulating the data provider to respond to the data caller according to the reference response data, acquiring abnormal response data in which the data provider responds to the data caller through the API interface, and generating a data response log according to the reference response data and the abnormal response data. When the API is abnormal, the response of the data provider is simulated by acquiring the reference response data, so that the condition that the data provider does not respond to the data caller when the API is abnormal can be avoided, and the data transmission efficiency is further improved.
As shown in fig. 3, in an embodiment, the provided data processing method may further include a process of simulating a data provider responding to a data caller, and the specific steps include:
step 302, obtaining a call request generated when a data caller calls data in a data provider through an API interface.
The computer device may obtain a data call instruction, which may be used to call data. The computer device can call the data in the data provider through the API by using the data caller according to the data calling instruction. Specifically, the data caller may generate a call request and call the data in the data provider through the API interface according to the generated call request. The computer device may obtain a call request generated by a data caller.
Step 304, obtaining a configuration file corresponding to the call request, wherein the configuration file comprises reference response data.
The configuration file may be used to record a collection of settings and files of the environment required to load the data, and the configuration file may contain reference response data. After obtaining the call request, the computer device may further obtain a configuration file corresponding to the call request. Specifically, the computer device may analyze the obtained call request to obtain location information of the configuration file, and the computer device may find the configuration file according to the location information to obtain the configuration file corresponding to the call request.
And step 306, when the calling request contains a response instruction, extracting the reference response data in the configuration file, and simulating the data provider to send the reference response data to the data caller.
The response instructions may be for instructing the data provider to respond to the data caller. After the computer equipment analyzes the call request, whether the call request contains a response instruction or not can be detected, and a detection result is obtained. When the detection result obtained by the computer device is that the calling request does not contain the response instruction, the computer device does not need to simulate the data provider to respond to the data caller according to the reference response data; when the detection result obtained by the computer device is that the call request contains a response instruction, the computer device may search for reference response data in the configuration file. When the computer device does not find the reference response data in the configuration file, the computer device does not need to simulate a data provider response data caller according to the reference response data; when the computer device finds the reference response data in the configuration file, the computer device may extract the reference response data and simulate the data provider to send the reference response data to the data caller.
In this embodiment, the computer device obtains a configuration file corresponding to a call request by obtaining the call request generated when the data caller calls data in the data provider through the API interface, where the configuration file includes reference response data, extracts the reference response data in the configuration file when the call request includes a response instruction, and simulates the data provider to send the reference response data to the data caller. The computer equipment judges whether the data caller needs to be responded according to the calling request generated when the data is called, and further extracts the response of the reference response data simulation data provider, so that the condition that the data provider does not respond to the data caller when the API is abnormal is avoided, and the data transmission efficiency is improved.
In an embodiment, the provided data processing method may further include a process of detecting whether an API interface is abnormal, specifically including: acquiring preset test data; requesting an API (application programming interface) according to the test data and acquiring a response result of the API; when the response result is an abnormal response result, the API interface has an abnormality; and when the response result is a normal response result, the API has no exception.
The test data may be preset data for testing whether the API interface has an exception. The computer device may store test data corresponding to each API interface, and when the computer device receives an instruction to detect whether the API interface is abnormal, the computer device may search for the test data corresponding to the API interface, that is, obtain preset test data.
The exception response result may be a response error or a no response result. The computer device may have stored therein a reference normal response result corresponding to the test data. The computer device may request the API interface from the test data, i.e. transmit data through the API interface. The computer device can obtain a response result returned through the API, and the computer device can also obtain a reference normal response result corresponding to the stored test data, and compare the obtained response result with the reference normal response result to obtain a comparison result. When the comparison result obtained by the computer equipment is that the response result is different from the reference response result, the obtained response result is an abnormal response result, namely the API interface is abnormal; when the comparison result obtained by the computer equipment is that the response result is the same as the reference response result, the obtained response result is a normal response result, namely that no abnormality exists in the API.
In this embodiment, the computer device requests the API interface according to the test data by obtaining the preset test data, and obtains a response result of the API interface, where when the response result is an abnormal response result, the API interface is abnormal, and when the response result is a normal response result, the API interface is not abnormal. The computer equipment requests the API interface by using the test data, so that whether the API interface is abnormal or not is judged according to the response result of the API interface, the state of the API interface can be accurately judged, and the judgment accuracy of the API interface is improved.
In one embodiment, the computer device may simulate a response to the call of the branch flow in the called service by referring to the response data. Specifically, when the computer device detects that there is a service called, the computer device may obtain each branch flow of the called service, and obtain an API interface corresponding to each branch flow. The computer device may obtain branch data corresponding to each API interface from an xml (Extensible Markup Language) document. Wherein, the xml document may record the corresponding relationship between each API interface and the branch data. When the API is abnormal, the computer equipment can search branch data corresponding to the abnormal API in the service mirror image, replace the abnormal API data with the searched branch data and operate the searched branch data, so that the called response of the branch flow is simulated. The computer equipment enables the branch flow to be normally called when the API in the branch flow is abnormal by simulating the calling response of the branch flow in the called service, so that the condition that service calling errors occur due to the fact that the API in the branch flow is abnormal when the service is called can be reduced.
In an embodiment, the provided data processing method may further include a process of acquiring reference response data, specifically including: when the API interface is abnormal, acquiring a data calling party calling data in the data provider through the abnormal API interface; and searching reference response data according to the data calling party.
The computer device may store a corresponding relationship between the data caller and the reference response data, that is, when the data caller calls the data in the data provider through the API interface, the data caller may have the reference response data that needs to be returned by the data provider.
When the API interface is abnormal, the computer device may obtain a data caller who calls data through the abnormal API interface, and search for the reference response data according to a correspondence between the stored data caller and the reference response data.
In this embodiment, when there is an abnormality in the API interface, the computer device searches for the reference response data according to the data caller by obtaining the data caller who calls data in the data provider through the abnormal API interface. Because the data calling party and the reference response data are corresponding, when the API has abnormality, the computer equipment searches the reference response data through the acquired data calling party, and the efficiency of searching the reference response data is improved.
In another embodiment, the provided data processing method may further include a process of acquiring reference response data, specifically including: when the API does not have the abnormality, acquiring reference calling data generated when a data caller calls data in a data provider through a normal API, and acquiring reference response data generated when the data provider sends the data to the data caller through the normal API; establishing a corresponding relation between reference calling data and reference response data; acquiring reference calling data corresponding to a data calling party; and searching reference response data corresponding to the reference calling data according to the corresponding relation.
When the data caller calls the data in the data provider through the API interface, the data caller generates call data, and the call data can include information such as data caller identification, API interface identification, data provider identification, and called data. The data caller identification can be used for distinguishing different data callers; the API interface identifier may be used to distinguish between different API interfaces; the data provider identification may be used to distinguish between different data providers.
The call data generated when the API interface is abnormal is different from the call data generated when the API interface is not abnormal. The calling data generated when the API has the abnormality can be abnormal calling data; the call data generated when there is no exception for the API interface may be reference call data. When the API has the abnormality, response data generated by sending data to the data calling party through the abnormal API is provided by the data and can be abnormal response data; when the API interface is not abnormal, the response data generated by the data providing module sending the data to the data caller through the abnormal API interface may be the reference response data.
When the API interface is not abnormal, the computer device may obtain reference call data generated when the data caller calls data in the data provider through the normal API interface, and at the same time, the computer device may obtain reference response data generated when the data provider sends data to the data caller through the normal API interface. Because the reference calling data and the reference response data acquired by the computer device are transmitted through the same API when no abnormality exists, the computer device can establish a corresponding relationship between the reference calling data and the reference response data.
When the computer equipment searches the reference response data, the computer equipment can search a data calling party for data calling, and further search the reference calling data corresponding to the data calling party. The computer device may find the reference response data corresponding to the reference call data according to the correspondence between the reference call data and the reference response data.
In this embodiment, when the API interface is not abnormal, the computer device obtains reference call data generated when the data caller calls data in the data provider through the normal API interface, and obtains reference response data generated when the data provider sends data to the data caller through the normal API interface, establishes a correspondence between the reference call data and the reference response data, obtains reference call data corresponding to the data caller, and searches for reference response data corresponding to the reference call data according to the correspondence. The computer equipment can directly search the reference response data according to the corresponding relation after acquiring the reference calling data corresponding to the data calling party by pre-establishing the corresponding relation between the reference calling data and the reference response data, so that the searching efficiency of searching the reference response data is improved.
In an embodiment, the provided data processing method may further include a process of repairing an API interface in which an exception exists, specifically including: searching an API interface corresponding to the abnormal response data according to the data response log; and repairing the API corresponding to the abnormal response data according to the abnormal response data to obtain a repaired normal API.
The computer device may obtain a repair instruction for the API interface, where the repair instruction may include a data response log number. The computer device can find the corresponding data response log according to the data response log number in the repair instruction. The computer device can analyze the obtained data response log and search the API interface according to the abnormal response data in the data response log.
The computer device may repair the found API interface, and specifically, the computer device may repair the API interface according to the abnormal response data. The computer equipment can find the data with the abnormal API interface according to the abnormal response data and repair the data with the abnormal API interface into normal data, so that the repaired normal API interface is obtained.
In this embodiment, the computer device searches the API interface corresponding to the abnormal response data according to the data response log, and repairs the API interface corresponding to the abnormal response data according to the abnormal response data to obtain a repaired normal API interface. And the computer equipment repairs the API interface with the abnormality according to the abnormal response data, and the API interface needing to be repaired can be accurately found because the abnormal response data is obtained according to the data response log.
It should be understood that, although the steps in the above-described flowcharts are shown in sequence as indicated by the arrows, the steps are not necessarily performed in sequence as indicated by the arrows. The steps are not performed in the exact order shown and described, and may be performed in other orders, unless explicitly stated otherwise. Moreover, at least a portion of the steps in each of the flowcharts described above may include multiple sub-steps or multiple stages, which are not necessarily performed at the same time, but may be performed at different times, and the order of performing the sub-steps or the stages is not necessarily sequential, but may be performed alternately or alternatingly with other steps or at least a portion of the sub-steps or stages of other steps.
In one embodiment, as shown in fig. 4, there is provided a data processing apparatus including: an interface detection module 410, a reference response data acquisition module 420, a simulation response module 430, and a log generation module 440, wherein:
the interface detection module 410 is configured to detect whether an API interface is abnormal when detecting that a data caller calls data in a data provider through the API interface.
A reference response data obtaining module 420, configured to obtain reference response data when the API interface is abnormal; the reference response data corresponds to the API interface, and the reference response data corresponds to the data caller.
And the simulation response module 430 is configured to simulate the data provider response data caller according to the reference response data, and acquire abnormal response data of the data provider responding to the data caller through the API interface.
The log generating module 440 is configured to generate a data response log according to the reference response data and the abnormal response data.
In one embodiment, the data processing apparatus further includes a call request obtaining module, configured to obtain a call request generated when a data caller calls data in a data provider through an API interface. The simulation response module 430 is further configured to obtain a configuration file corresponding to the call request, where the configuration file includes reference response data; and when the calling request contains a response instruction, extracting the reference response data in the configuration file, and simulating the data provider to send the reference response data to the data caller.
In one embodiment, the interface detection module 410 is further configured to obtain preset test data; requesting an API (application programming interface) according to the test data and acquiring a response result of the API; when the response result is an abnormal response result, the API interface has an abnormality; when the response result is a normal response result, the API has no exception.
In one embodiment, the reference response data obtaining module 420 is further configured to, when the API interface is abnormal, obtain a data caller that calls data in the data provider through the abnormal API interface; and searching reference response data according to the data calling party.
In one embodiment, the reference response data obtaining module 420 is further configured to, when the API interface is not abnormal, obtain reference call data generated when the data caller calls data in the data provider through the normal API interface, and obtain reference response data generated when the data provider sends data to the data caller through the normal API interface; establishing a corresponding relation between reference calling data and reference response data; acquiring reference calling data corresponding to a data calling party; and searching reference response data corresponding to the reference calling data according to the corresponding relation.
In one embodiment, the provided data processing apparatus further includes an API interface modification module, configured to search, according to the data response log, an API interface corresponding to the abnormal response data; and repairing the API corresponding to the abnormal response data according to the abnormal response data to obtain a repaired normal API.
For specific definition of the data processing device, reference may be made to the definition of the data processing method above, and details are not repeated here. The various modules in the data processing apparatus described above may be implemented in whole or in part by software, hardware, and combinations thereof. The modules can be embedded in a hardware form or independent from a processor in the computer device, and can also be stored in a memory in the computer device in a software form, so that the processor can call and execute operations corresponding to the modules.
In one embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as shown in fig. 5. The computer device includes a processor, a memory, a network interface, a display screen, and an input device connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement a data processing method. The display screen of the computer equipment can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer equipment can be a touch layer covered on the display screen, a key, a track ball or a touch pad arranged on the shell of the computer equipment, an external keyboard, a touch pad or a mouse and the like.
Those skilled in the art will appreciate that the architecture shown in fig. 5 is merely a block diagram of some of the structures associated with the disclosed aspects and is not intended to limit the computing devices to which the disclosed aspects apply, as particular computing devices may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
In one embodiment, there is provided a computer device comprising a memory storing a computer program and a processor implementing the following steps when the processor executes the computer program:
when detecting that a data caller calls data in a data provider through an API (application programming interface), detecting whether the API is abnormal;
when the API has abnormality, acquiring reference response data; the reference response data corresponds to the API interface, and the reference response data corresponds to the data caller;
simulating a data provider response data caller according to the reference response data, and acquiring abnormal response data of the data provider responding to the data caller through an API (application programming interface);
and generating a data response log according to the reference response data and the abnormal response data.
In one embodiment, the processor when executing the computer program further performs the steps of: acquiring a call request generated when a data caller calls data in a data provider through an API (application programming interface); acquiring a configuration file corresponding to the call request, wherein the configuration file comprises reference response data; and when the calling request contains a response instruction, extracting the reference response data in the configuration file, and simulating the data provider to send the reference response data to the data caller.
In one embodiment, the processor when executing the computer program further performs the steps of: acquiring preset test data; requesting an API (application programming interface) according to the test data and acquiring a response result of the API; when the response result is an abnormal response result, the API interface has an abnormality; when the response result is a normal response result, the API has no exception.
In one embodiment, the processor, when executing the computer program, further performs the steps of: when the API has the abnormality, acquiring a data calling party for calling data in the data provider through the abnormal API; and searching reference response data according to the data calling party.
In one embodiment, the processor, when executing the computer program, further performs the steps of: when the API does not have the abnormality, acquiring reference calling data generated when a data caller calls data in a data provider through a normal API, and acquiring reference response data generated when the data provider sends the data to the data caller through the normal API; establishing a corresponding relation between reference calling data and reference response data; acquiring reference calling data corresponding to a data calling party; and searching reference response data corresponding to the reference calling data according to the corresponding relation.
In one embodiment, the processor when executing the computer program further performs the steps of: searching an API interface corresponding to the abnormal response data according to the data response log; and repairing the API corresponding to the abnormal response data according to the abnormal response data to obtain a repaired normal API.
In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored which, when executed by a processor, performs the steps of:
when detecting that a data caller calls data in a data provider through an API (application programming interface), detecting whether the API is abnormal;
when the API has abnormality, acquiring reference response data; the reference response data corresponds to the API interface, and the reference response data corresponds to the data caller;
simulating a data provider response data caller according to the reference response data, and acquiring abnormal response data of the data provider responding to the data caller through an API (application programming interface);
and generating a data response log according to the reference response data and the abnormal response data.
In one embodiment, the computer program when executed by the processor further performs the steps of: acquiring a call request generated when a data caller calls data in a data provider through an API (application programming interface); acquiring a configuration file corresponding to the calling request, wherein the configuration file comprises reference response data; and when the calling request contains a response instruction, extracting the reference response data in the configuration file, and simulating the data provider to send the reference response data to the data caller.
In one embodiment, the computer program when executed by the processor further performs the steps of: acquiring preset test data; requesting an API (application programming interface) according to the test data and acquiring a response result of the API; when the response result is an abnormal response result, the API interface has an abnormality; when the response result is a normal response result, the API has no exception.
In one embodiment, the computer program when executed by the processor further performs the steps of: when the API interface is abnormal, acquiring a data calling party calling data in the data provider through the abnormal API interface; and searching reference response data according to the data calling party.
In one embodiment, the computer program when executed by the processor further performs the steps of: when the API does not have the abnormality, acquiring reference calling data generated when a data caller calls data in a data provider through a normal API, and acquiring reference response data generated when the data provider sends the data to the data caller through the normal API; establishing a corresponding relation between reference calling data and reference response data; acquiring reference calling data corresponding to a data calling party; and searching reference response data corresponding to the reference calling data according to the corresponding relation.
In one embodiment, the computer program when executed by the processor further performs the steps of: searching an API interface corresponding to the abnormal response data according to the data response log; and repairing the API corresponding to the abnormal response data according to the abnormal response data to obtain a repaired normal API.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium used in the embodiments provided herein may include non-volatile and/or volatile memory, among others. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically Programmable ROM (EPROM), electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double Data Rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous Link DRAM (SLDRAM), rambus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
All possible combinations of the technical features in the above embodiments may not be described for the sake of brevity, but should be considered as being within the scope of the present disclosure as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present patent shall be subject to the appended claims.

Claims (6)

1. A method of data processing, the method comprising:
when detecting that a data caller calls data in a data provider through an API (application programming interface), acquiring preset test data;
requesting the API interface according to the test data and acquiring a response result of the API interface;
when the response result is an abnormal response result, the API interface has an abnormality;
when the response result is a normal response result, the API has no exception; when the API does not have abnormality, acquiring reference calling data generated when the data caller calls data in the data provider through a normal API, and acquiring reference response data generated when the data provider sends data to the data caller through the normal API; establishing a corresponding relation between the reference calling data and the reference response data;
when the API interface is abnormal, acquiring a data caller calling data in the data provider through the abnormal API interface;
acquiring the reference calling data corresponding to the data calling party; searching reference response data corresponding to the reference calling data according to the corresponding relation; wherein the reference response data corresponds to the API interface and the reference response data corresponds to the data caller;
simulating the data provider to respond to the data caller according to the reference response data, and acquiring abnormal response data of the data provider responding to the data caller through the API;
generating a data response log according to the reference response data and the abnormal response data;
searching an API (application programming interface) corresponding to the abnormal response data according to the data response log;
and repairing the API corresponding to the abnormal response data according to the abnormal response data to obtain a repaired normal API.
2. The method of claim 1, further comprising:
acquiring a call request generated when the data caller calls the data in the data provider through the API;
the simulating the data provider to respond to the data caller according to the reference response data comprises:
acquiring a configuration file corresponding to the calling request, wherein the configuration file comprises the reference response data;
and when the calling request contains a response instruction, extracting the reference response data in the configuration file, and simulating the data provider to send the reference response data to the data caller.
3. A data processing apparatus, characterized in that the apparatus comprises:
the interface detection module is used for acquiring preset test data when detecting that a data caller calls data in a data provider through an API (application program interface); requesting the API interface according to the test data and acquiring a response result of the API interface; when the response result is an abnormal response result, the API interface has an abnormality; when the response result is a normal response result, the API has no exception;
a reference response data obtaining module, configured to, when the API interface is not abnormal, obtain reference call data generated when the data caller calls data in the data provider through a normal API interface, and obtain reference response data generated when the data provider sends data to the data caller through the normal API interface; establishing a corresponding relation between the reference calling data and the reference response data; when the API interface is abnormal, acquiring a data caller calling data in the data provider through the abnormal API interface; acquiring the reference calling data corresponding to the data calling party; searching reference response data corresponding to the reference calling data according to the corresponding relation; wherein the reference response data corresponds to the API interface and the reference response data corresponds to the data caller;
the simulation response module is used for simulating the data provider to respond to the data caller according to the reference response data and acquiring abnormal response data of the data provider responding to the data caller through the API;
the log generation module is used for generating a data response log according to the reference response data and the abnormal response data;
the API interface modification module is used for searching an API interface corresponding to the abnormal response data according to the data response log; and repairing the API corresponding to the abnormal response data according to the abnormal response data to obtain a repaired normal API.
4. The apparatus of claim 3, further comprising:
a calling request acquisition module for acquiring a calling request generated when the data caller calls the data in the data provider through the API;
the simulation response module is further configured to obtain a configuration file corresponding to the call request, where the configuration file includes the reference response data; and when the calling request contains a response instruction, extracting the reference response data in the configuration file, and simulating the data provider to send the reference response data to the data caller.
5. A computer device comprising a memory and a processor, the memory storing a computer program, wherein the processor implements the steps of the method of claim 1 or 2 when executing the computer program.
6. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method of claim 1 or 2.
CN201910817959.7A 2019-08-30 2019-08-30 Data processing method, data processing device, computer equipment and storage medium Active CN110704218B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910817959.7A CN110704218B (en) 2019-08-30 2019-08-30 Data processing method, data processing device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910817959.7A CN110704218B (en) 2019-08-30 2019-08-30 Data processing method, data processing device, computer equipment and storage medium

Publications (2)

Publication Number Publication Date
CN110704218A CN110704218A (en) 2020-01-17
CN110704218B true CN110704218B (en) 2023-03-10

Family

ID=69193930

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910817959.7A Active CN110704218B (en) 2019-08-30 2019-08-30 Data processing method, data processing device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN110704218B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109298997A (en) * 2018-08-08 2019-02-01 平安科技(深圳)有限公司 Interface test method, system, computer equipment and storage medium
CN109656806A (en) * 2018-10-29 2019-04-19 口碑(上海)信息技术有限公司 A kind of the playback test method and device of interface data
CN109976924A (en) * 2019-03-22 2019-07-05 北京奇艺世纪科技有限公司 Interface call method and device
CN110083526A (en) * 2019-03-15 2019-08-02 深圳壹账通智能科技有限公司 Applied program testing method, device, computer installation and storage medium
CN110109818A (en) * 2019-03-15 2019-08-09 平安城市建设科技(深圳)有限公司 Monitoring method, device, terminal and the readable storage medium storing program for executing of back end interface data

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109298997A (en) * 2018-08-08 2019-02-01 平安科技(深圳)有限公司 Interface test method, system, computer equipment and storage medium
CN109656806A (en) * 2018-10-29 2019-04-19 口碑(上海)信息技术有限公司 A kind of the playback test method and device of interface data
CN110083526A (en) * 2019-03-15 2019-08-02 深圳壹账通智能科技有限公司 Applied program testing method, device, computer installation and storage medium
CN110109818A (en) * 2019-03-15 2019-08-09 平安城市建设科技(深圳)有限公司 Monitoring method, device, terminal and the readable storage medium storing program for executing of back end interface data
CN109976924A (en) * 2019-03-22 2019-07-05 北京奇艺世纪科技有限公司 Interface call method and device

Also Published As

Publication number Publication date
CN110704218A (en) 2020-01-17

Similar Documents

Publication Publication Date Title
CN110008118B (en) Page data testing method and device, computer equipment and storage medium
CN109474578B (en) Message checking method, device, computer equipment and storage medium
CN109446068B (en) Interface test method, device, computer equipment and storage medium
CN110209652B (en) Data table migration method, device, computer equipment and storage medium
CN110290212B (en) Service call recording method, device, computer equipment and storage medium
CN108427613B (en) Abnormal interface positioning method and device, computer equipment and storage medium
CN112363941A (en) Interface testing method and device, computer equipment and storage medium
CN108848000B (en) Network request testing method and device, computer equipment and storage medium
CN108400978B (en) Vulnerability detection method and device, computer equipment and storage medium
CN108256322B (en) Security testing method and device, computer equipment and storage medium
CN110704312B (en) Method, device, computer equipment and storage medium for pressure test
CN112269744A (en) System abnormity testing method and device, computer equipment and storage medium
CN110941555A (en) Test case recommendation method and device, computer equipment and storage medium
CN111797026A (en) Test case generation method and device, computer equipment and storage medium
CN111414309B (en) Automatic test method of application program, computer equipment and storage medium
CN112637008B (en) Link simulation test method, device, system, computer equipment and storage medium
CN112612706A (en) Automated testing method, computer device and storage medium
CN111159025B (en) Application program interface testing method and device, computer equipment and storage medium
CN110704218B (en) Data processing method, data processing device, computer equipment and storage medium
CN114039760B (en) Security testing method and device, computer equipment and storage medium
CN112817816B (en) Embedded point processing method and device, computer equipment and storage medium
CN111398701B (en) Equipment test method, device, computer equipment and storage medium
CN110460585B (en) Equipment identity identification method and device, computer equipment and storage medium
CN116107781A (en) Log tracking method, device, electronic equipment and computer program product
CN108108369B (en) Method and device for processing calling error of common interface library

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
GR01 Patent grant
GR01 Patent grant