CN115495372A - Analog data processing method, device, equipment and medium - Google Patents
Analog data processing method, device, equipment and medium Download PDFInfo
- Publication number
- CN115495372A CN115495372A CN202211213267.XA CN202211213267A CN115495372A CN 115495372 A CN115495372 A CN 115495372A CN 202211213267 A CN202211213267 A CN 202211213267A CN 115495372 A CN115495372 A CN 115495372A
- Authority
- CN
- China
- Prior art keywords
- data
- interface
- test
- request
- response
- 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
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3668—Software testing
- G06F11/3696—Methods or tools to render software testable
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3668—Software testing
- G06F11/3672—Test management
- G06F11/3688—Test management for test execution, e.g. scheduling of test suites
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 application relates to a method, a device, equipment and a medium for processing analog data, which relate to the technical field of computers, and the method comprises the following steps: the method comprises the steps of determining target interface information according to a test data request of a target application program, carrying out data fusion processing according to the target interface information, test response data corresponding to the target interface information and test data in the test data request to obtain single-case global object data corresponding to the test data request, displaying an interface operation interface according to the single-case global object data, carrying out simulation data processing according to interface selection operation submitted by a user on the interface operation interface to obtain a simulation data result corresponding to the test data request, and therefore the problem that operation is complicated due to the fact that existing test troubleshooting data must be connected with a PC is solved, and test development efficiency is improved.
Description
Technical Field
The present application relates to the field of computer technologies, and in particular, to a method, an apparatus, a device, and a medium for processing analog data.
Background
At present, in the software development and test process, developers are often required to check whether the request and the interface return data are correct. In the prior art, analog (mock) data is generally adopted for data testing, and specifically, development and testing personnel generally need to use Charles or Fiddler and the like for data package capture analysis and mock data testing. However, these operations all depend on a Personal Computer (PC), and the tester must connect with the PC and configure a proxy certificate when performing data checking, which results in a very complicated data testing procedure and makes it impossible to perform data testing anytime and anywhere.
Disclosure of Invention
The application provides a method, a device, equipment and a medium for processing simulation data, so that dependence on a PC and dependence on a proxy certificate are eliminated, the problem of complex operation caused by the fact that the existing test troubleshooting data must be connected with the PC is solved, and test development efficiency is improved.
In a first aspect, the present application provides an analog data processing method, including:
determining target interface information according to a test data request of a target application program;
performing data fusion processing according to the target interface information, the test response data corresponding to the target interface information and the test data in the test data request to obtain single-case global object data corresponding to the test data request;
displaying an interface operation interface according to the single-case global object data;
and carrying out simulation data processing according to interface selection operation submitted by a user on the interface operation interface to obtain a simulation data result corresponding to the test data request.
Optionally, the mobile terminal is installed with an application interceptor, and the determining target interface information according to the test data request of the target application program includes:
intercepting a data request of the target application program through the application interceptor to obtain the test data request;
extracting uniform resource locator parameters from the test data request;
target interface information is determined based on the uniform resource locator parameter.
Optionally, the performing data fusion processing according to the target interface information, the test response data corresponding to the target interface information, and the test data in the test data request to obtain single-case global object data corresponding to the test data request includes:
determining test response data corresponding to the target interface information;
extracting the test data from the test data request, and determining test request time corresponding to the test data;
and according to a preset singleton mode, packaging the target interface information, the test response data, the request time and the test data to obtain singleton global object data.
Optionally, the determining test response data corresponding to the target interface information includes:
when the uniform resource locator parameter is matched with an interface parameter in a cache simulation data set, determining the cache simulation data corresponding to the interface parameter as original response data, and determining the test response data based on the original response data, wherein the cache simulation data set is a set generated by the mobile terminal according to the obtained cache data when the application interceptor is started;
and when the uniform resource locator parameter is not matched with the interface parameter in the cache simulation data set, creating the test response data based on the target interface information.
Optionally, the determining the test response data based on the raw response data includes: taking the original response data as the test response data; or, performing copy processing based on the original response data to obtain copy data, and determining the copy data as the test response data.
Optionally, the processing of the simulation data according to the interface selection operation submitted by the user on the interface operation interface to obtain the simulation data result corresponding to the test data request includes:
when the interface selection operation is a modification selection operation, determining a target editing interface based on the modification selection operation;
displaying response data corresponding to the target editing interface;
modifying the response data according to a response editing operation submitted by a user to obtain response modified data;
carrying out format verification according to the response modification data to obtain a format verification result;
and if the format verification result is a format verification passing result, generating the simulation data result based on the response modification data.
Optionally, before determining the target interface information according to the test data request of the target application, the method further includes: when the application interceptor is started, obtaining cache data, wherein the cache data comprises cache simulation data and interface parameters corresponding to the cache simulation data; generating a cache simulation data set according to the cache simulation data and interface parameters corresponding to the cache simulation data;
after generating the simulation data result based on the response modification data, the method further comprises:
updating the cached simulation data set based on the simulation data result.
Optionally, the displaying an interface operation interface according to the single instance of the global object data includes:
extracting test request time from the singleton global object data;
performing interface sorting processing based on the test request time to obtain a target interface list;
and displaying an interface operation interface based on the target interface list.
Optionally, the processing of the simulation data according to the interface selection operation submitted by the user on the interface operation interface to obtain the simulation data result corresponding to the test data request includes:
when the interface selection operation is a preset selection operation, determining a target interface selected by the preset selection operation;
extracting a request response parameter corresponding to the target interface from the target interface list;
generating the simulated data results based on the request response parameters.
In a second aspect, the present application provides an analog data processing apparatus comprising:
the target interface information determining module is used for determining target interface information according to a test data request of a target application program;
the single-case global object data determining module is used for performing data fusion processing according to the target interface information, the test response data corresponding to the target interface information and the test data in the test data request to obtain single-case global object data corresponding to the test data request;
the display module is used for displaying an interface operation interface according to the single-case global object data;
and the simulation data processing module is used for carrying out simulation data processing according to interface selection operation submitted by a user on the interface operation interface to obtain a simulation data result corresponding to the test data request.
In a third aspect, the present application provides an electronic device, including a processor, a communication interface, a memory, and a communication bus, where the processor, the communication interface, and the memory complete mutual communication through the communication bus;
a memory for storing a computer program;
a processor for implementing the steps of the method for processing analog data according to any of the embodiments of the first aspect when executing the program stored in the memory.
In a fourth aspect, the present application provides a computer-readable storage medium having stored thereon a computer program which, when being executed by a processor, carries out the steps of the simulation data processing method according to any one of the embodiments of the first aspect.
In summary, in the embodiment of the application, the target interface information is determined according to the test data request of the target application program, data fusion processing is performed according to the target interface information, the test response data corresponding to the target interface information and the test data in the test data request, single-case global object data corresponding to the test data request is obtained, an interface operation interface is displayed according to the single-case global object data, simulation data processing is performed according to interface selection operation submitted by a user on the interface operation interface, and a simulation data result corresponding to the test data request is obtained, so that the problem of complicated operation caused by the fact that existing test troubleshooting data must be connected with a PC is solved, and the test development efficiency is improved.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and together with the description, serve to explain the principles of the application.
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious for those skilled in the art to obtain other drawings without inventive labor.
Fig. 1 is a schematic flowchart of an analog data processing method according to an embodiment of the present disclosure;
FIG. 2 is a schematic flow chart diagram illustrating steps of a method for processing simulation data according to an alternative embodiment of the present application;
FIG. 3 is a flow chart of analog data processing provided by an alternative embodiment of the present application;
fig. 4 is a block diagram of an analog data processing apparatus according to an embodiment of the present disclosure;
fig. 5 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some embodiments of the present application, but not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
For the purpose of facilitating understanding of the embodiments of the present application, the following description will be further explained with reference to the accompanying drawings and specific embodiments, which are not intended to limit the embodiments of the present application.
Fig. 1 is a schematic flow chart of a method for processing analog data according to an embodiment of the present disclosure. As shown in fig. 1, the analog data processing method provided in the embodiment of the present application may specifically include the following steps:
Specifically, the target Application may be an Application (App) installed on the mobile terminal, which is not limited in this embodiment of the Application; the test data request may include a data request of a target application program, and the target application program may determine the data request when mock data needs to be acquired, which is not limited in the embodiment of the present application; the target interface information may be an interface for acquiring the response data, for example, the target interface information may include a Uniform Resource Locator (URL), which is not limited in this embodiment of the present application. Specifically, the embodiment of the application can obtain the test data request of the target application program, and can determine the target interface information according to the test data request of the target application program.
In a specific implementation, the analog data processing method provided in the embodiment of the present application may be applied to a mobile terminal, and for example, the mobile terminal may include an android terminal and an IOS terminal, which is not limited in the embodiment of the present application. For example, when the mobile terminal is an android terminal, the target application program may be an App installed in the android terminal, the development of the backend interface is not completed, and under the condition that developers or testers need to check data for the App, the data request of the target application program may be intercepted to serve as a test data request, and then a URL may be extracted from the test data request to serve as target interface information.
And 120, performing data fusion processing according to the target interface information, the test response data corresponding to the target interface information and the test data in the test data request to obtain single-case global object data corresponding to the test data request.
Specifically, the test response data may be divided into mock data and data predefined by the user, which is not limited in the embodiment of the present application; the test data may contain a request parameter, and the request parameter may be used to determine a request form object (FormBody), where the request form object may be used to implement identity authentication, and the like, which is not limited in this embodiment of the present application. Specifically, after the target interface information is determined, test response data may be obtained for the target interface information, test data may be extracted from the test data request, and then data fusion processing may be performed according to the target interface information, the test response data, and the test data, for example, the target interface information may be used as a key (key) in a key value pair, and the test response data and the test data may be used as a value (value) in the key value pair to perform data fusion, so as to obtain single-case global object data.
In a specific implementation, the embodiment of the application can intercept two stages of data request and data response of a target application program. Specifically, after the data request phase of the target application program is intercepted and the test data request is determined, the mock data corresponding to the URL may be tried to be acquired based on the URL corresponding to the test data request. And then, whether mock data corresponding to the URL is acquired or not can be determined, if the mock data corresponding to the URL is determined to be acquired, original response data can be determined based on the mock data, if the mock data corresponding to the URL is determined not to be acquired, data predefined by a user can be used as the original response data, data fusion processing is further performed according to target interface information, test response data corresponding to the target interface information and test data in the test data request, single-instance global object data corresponding to the test data request is obtained, the request phase and the response phase of the target application program are intercepted, data in the request phase and data in the response phase are obtained, the request response log is acquired, specific information of the interface request and the response data can be quickly browsed and viewed on the mobile terminal, and functions of analyzing the intercepted request response log and replacing the mock data are further realized.
And step 130, displaying an interface operation interface according to the single-case global object data.
Specifically, after determining the single-case global object data, the embodiment of the present application may design a User Interface (UI) according to the single-case global object data, for example, an Interface list may be generated by using target Interface information in the single-case global object data, and then the Interface list may be used as an Interface operation Interface, and the Interface operation Interface is displayed by the mobile terminal, so that a subsequent User may perform analog data replacement on test response data corresponding to the target Interface information, that is, step 140 is executed.
And 140, performing simulation data processing according to interface selection operation submitted by a user on the interface operation interface to obtain a simulation data result corresponding to the test data request.
Specifically, a user can select target interface information needing analog data processing through interface selection operation on an interface operation interface, and then the user can perform analog data processing on the target interface information, if test response data corresponding to the target interface information can be modified, the test response data is replaced by mock data set by the user, a simulated data result corresponding to a test data request is obtained, mock operation is achieved, normal development of a front end can be ensured through the mock data in advance when a rear end is not issued, the back end is not required to be waited for issuing, when data mock and request response data are analyzed, a PC (personal computer) is not required to be connected or agents such as a hanging agent and the like are not required, time and space limitations are eliminated, time cost is greatly saved, the problem that the existing test troubleshooting data must be connected with the PC is solved, and test development efficiency is improved.
In a specific implementation, a user may replace test response data corresponding to target interface information, and may also replace test data corresponding to the target interface information, and perform simulated data processing on request parameters in the test data, for example, increase, modify, delete, and the like on the basis of the original request parameters, and perform simulated data processing on the request parameters to control response to different content data.
Therefore, according to the embodiment of the application, the target interface information is determined according to the test data request of the target application program, data fusion processing is performed according to the target interface information, the test response data corresponding to the target interface information and the test data in the test data request, single-case global object data corresponding to the test data request is obtained, an interface operation interface is displayed according to the single-case global object data, simulation data processing is performed according to interface selection operation submitted by a user on the interface operation interface, and a simulation data result corresponding to the test data request is obtained, so that the problem of complicated operation caused by the fact that existing test troubleshooting data must be connected with a PC is solved, and the test development efficiency is improved.
Referring to fig. 2, a schematic flow chart illustrating steps of a method for processing analog data according to an alternative embodiment of the present application is shown. The analog data processing method specifically comprises the following steps:
In specific implementation, the embodiment of the application can intercept the request phase and the response phase of the App through an Interceptor (Interceptor) included in a network request framework (OkHttp). Specifically, the OkHttp can support multiple interceptors, which can be specifically divided into two major categories, one of which is an Application Interceptor (Application Interceptor), and the Application Interceptor can be the first Interceptor to start execution in an interception chain (chain); the other type is a Network Interceptor (Network Interceptor), which may be the sixth position in the interception chain, and is typically used to observe the transmission of data across the Network.
As an example, the request response log analysis interceptor and the mock data interceptor may be implemented by an application interceptor, so as to intercept the data request and respond in two phases by the request response log analysis interceptor, and take mock data corresponding to the data request as response data by the mock data interceptor. Since the application interceptor is usually called only once, there is no need to worry about responses of intermediate processes, such as redirection and retry, and it can decide whether to perform other interception by calling the chain. Of course, the request response log analysis interceptor and the mock data interceptor may also be implemented by a network interceptor, and this example does not limit the implementation manner of the interceptors.
In an optional embodiment, in the embodiment of the present application, when the application interceptor is installed in the mobile terminal, the determining the target interface information according to the test data request of the target application program may specifically include: intercepting a data request of the target application program through the application interceptor to obtain the test data request; extracting uniform resource locator parameters from the test data request; target interface information is determined based on the uniform resource locator parameter.
As an example, referring to fig. 3, the interception of the data request may be implemented by applying a request interceptor, so as to obtain a test data request, and then, chain.
In actual processing, the OkHttp may have a network connection pool built therein, may support GNU-free software file compressor (GNU-zip, gzip) compression, and the like, and the interceptor of the OkHttp may specifically include a retry and redirection interceptor (retry and follow window interceptor), a bridge interceptor
(bridge interceptor), cache interceptor (CacheInterceptor), link interceptor (ConnectInterceptor), and request service interceptor (CallServerInterceptor), etc., each of which may be configured to handle intercepted requests. Specifically, okHttp can refer to each object and the next object corresponding to the object through a chain of responsibility mode to form a chain, interceptors can be applied to different nodes of the chain, each interceptor has respective responsibility to process a request, each chain can determine whether to process the intercepted request, and OkHttp can add a custom interceptor to a user to realize logic thereof, so that functions of intercepting request log analysis and mock data replacement response data can be realized according to characteristics.
In an optional embodiment, before determining the target interface information according to the test data request of the target application program, the method may further include: when the application interceptor is started, obtaining cache data, wherein the cache data comprises cache simulation data and interface parameters corresponding to the cache simulation data; and generating a cache simulation data set according to the cache simulation data and the interface parameters corresponding to the cache simulation data. The interface parameter is an interface URL, and the cache simulation data may include mock data, which is not limited in this embodiment.
Specifically, the mock data interceptor may be implemented by the application interceptor, so that when the application interceptor is started, the mock data interceptor is started, and then the cached data may be pulled to obtain the cached data. And generating a cache simulation data set based on the cache simulation data and the interface parameters contained in the cache data, wherein the cache simulation data set can be stored in a key-value pair form, for example, the interface parameter (interface URL) can be used as a key, the cache simulation data corresponding to the interface parameter can be used as a value, and the cache simulation data set is generated so that test response data corresponding to the target interface information can be determined in the following.
Specifically, the embodiment of the application can determine test response data corresponding to the target interface information. For example, when the mock data interceptor is started, the mock data interceptor may obtain a URL corresponding to the target interface information, and may determine whether the URL matches a mock interface list of the local cache, for example, whether the URL belongs to the mock interface list, if it is determined that the URL belongs to the mock interface list, it may be determined that the URL matches the mock interface list of the local cache, and then may extract the mock data corresponding to the URL from the mock data of the local cache, take the mock data as original response data, and determine test response data based on the original response data; if the URL is determined not to belong to the mock interface list, the URL is determined not to be matched with the mock interface list cached locally, then data defined in advance by the user can be obtained, the data can be in a data exchange format (JSON) format, JSON data preset by the user is used as original response data, and test response data are further determined. Under the condition that the mock data interceptor is not started, JSON data preset by a user can be used as original response data, and then test response data are determined.
In an optional embodiment, the determining test response data corresponding to the target interface information in the embodiment of the present application may specifically include: when the uniform resource locator parameter is matched with an interface parameter in a cache simulation data set, determining the cache simulation data corresponding to the interface parameter as original response data, and determining the test response data based on the original response data. The cache simulation data set is a set generated by the mobile terminal according to the obtained cache data when the application interceptor is started; and when the uniform resource locator parameter is not matched with the interface parameter in the cache simulation data set, creating the test response data based on the target interface information.
In a specific implementation, to avoid the occurrence of a state exception, for example, in the OkHttp request callback, response information is normally called back by using a response.body (). String () method, a situation that a call data stream is closed may occur after the response information is called by the response.body (). String () method, and at this time, the exception is thrown when the response information is obtained by calling the response.body (). String (), so that after the original response data is obtained in the embodiment of the present application, the original response data may be copied to obtain copied data, and then the copied data may be used as test response data to avoid the situation of the state exception and the like.
In an optional embodiment, the determining the test response data based on the original response data in the embodiment of the present application may specifically include: taking the original response data as the test response data; or, performing copy processing based on the original response data to obtain copy data, and determining the copy data as the test response data.
As an example, referring to fig. 3, original response information (i.e., original response data) may be obtained through a chain response () method, and then the original response data may be copied to obtain new ResponseBody (i.e., test response data).
Specifically, the embodiment of the present application may extract the test data from the test data request, and then may determine the test request time corresponding to the test data, where the test request time may include a request time corresponding to the test data request, which is not limited in this application.
As an example, referring to fig. 3, the test data (RequestBody) may be obtained by a request. And then, based on the obtained RequestBody, formBody is determined, and then key-value pair information can be constructed, for example, the URL can be used as a key, the FormBody is used as a value, the key-value pair information is constructed and stored in a memory and a disk to be persisted locally, and the data can be used according to the condition after the App is restarted.
Specifically, according to the embodiment of the application, the obtained target interface information, the current test response data request time, and the test data may be encapsulated according to a single-instance mode, for example, the target interface information, the current test response data request time, and the test data may be encapsulated into one object to obtain single-instance global object data, the single-instance global object data represents all information included in the current target interface information, and subsequently, all corresponding information of the current target interface information, such as the test response data, the request time, the test data, and the like, may be obtained according to the target interface information.
As one example, referring to fig. 3, the URL, the response content (ResponseBody), and the request key-value pair (key-value pair information) may be stored separately to be persisted locally. And then, data fusion processing can be carried out on the key value pair information, the response content and the like through a single instance to obtain single instance global object data, and the request response log can be obtained.
And 250, displaying an interface operation interface according to the single-case global object data.
Optionally, the above operation interface for displaying the single instance of the global object data may specifically include the following sub-steps:
sub-step 2501, extracting the test request time from the singleton global object data.
Specifically, the test request time may be extracted from a single instance of global object data, so that the test request time may be sequenced in the following process.
And a substep 2502 of performing interface sorting processing based on the test request time to obtain a target interface list.
Specifically, the interface ordering processing may be performed based on the test request time in the embodiment of the present application, for example, the target interface information may be ordered according to the sequence of the test request time, so as to obtain the target interface list.
Substep 2503, displaying an interface operation interface based on the target interface list.
Specifically, the target interface list may be rendered through the UI design, resulting in an interface operation interface, which may then be displayed.
As an example, referring to fig. 3, after obtaining the singleton global object data, the singleton global object data may be stored in the singleton global storage to be persisted locally. And then, extracting each single-case global object data from the single-case global storage, sequencing the target interface information according to the test request time corresponding to the single-case global object data to obtain an interface list (namely a target interface list), and displaying the interface list on an interface operation interface through a UI.
And step 260, when the interface selection operation is a modification selection operation, determining a target editing interface based on the modification selection operation.
Specifically, when the interface selection operation is a modification selection operation, the embodiment of the application may determine, based on the modification selection operation, target interface information selected by a user to serve as a target editing interface.
As an example, the modification selection operation may be set as a single-click operation, which is not limited in this example, that when the user performs a single click on the selected target interface information, it may be determined that the interface selection operation is the modification selection operation, and then the target interface information selected by the user may be used as the target editing interface. For example, referring to fig. 3, after clicking a URL interface in an interface list by a user, the URL may be determined as a target editing interface, then single-instance global object data corresponding to the target editing interface may be obtained, and test response data in the single-instance global object data may be subjected to display formatting, for example, JSON formatting may be performed on the test response data, so that the structure of the test response data is clearer and clear, the user may browse the test response data conveniently, the modification on the test response data is more accurate and faster, and the user experience is improved.
Further, referring to fig. 3, the user may perform a long-press operation on the URL in the interface list in addition to performing a single-click operation on the URL in the interface list, and by the long-press operation, the selected URL is used as a target editing interface, and then the current interface request parameter, that is, the test data in the single-instance global object data corresponding to the target editing interface may be obtained, so as to perform JSON formatted display on the test data, so that the user may perform modification and replacement on the interface request parameter, such as adding a parameter (adding a parameter in a key value pair form), modifying a parameter, or deleting a parameter, and the like, to implement control and response to different content data.
In an optional embodiment, when the interface selection operation is a preset selection operation, the performing simulation data processing according to the interface selection operation submitted by the user on the interface operation interface to obtain a simulation data result corresponding to the test data request may specifically include: when the interface selection operation is a preset selection operation, determining a target interface selected by the preset selection operation; extracting a request response parameter corresponding to the target interface from the target interface list; generating the simulated data results based on the request response parameters. The request response parameter may be test data, which is not limited in this embodiment of the present application.
And 270, displaying the response data corresponding to the target editing interface.
Specifically, the interface operation interface may display, to the user, response data corresponding to the target editing interface according to the target editing interface selected by the user, where the response data may include test response data, and the embodiment of the present application does not limit this.
Step 280, modifying the response data according to the response editing operation submitted by the user to obtain response modified data.
Specifically, the response modification data may include mock data set by the user, which is not limited in this embodiment of the application. Specifically, the user may modify the response data, for example, may replace the response data, modify the response data into mock data to obtain the response modified data, and subsequently perform format verification on the response modified data to obtain a format verification result.
And 290, performing format verification according to the response modification data to obtain a format verification result.
Specifically, the format check result includes a format check passing result and a format check failing result, which is not limited in the embodiment of the present application. Specifically, the embodiment of the application can perform format verification according to the response modification data, so that when the format verification passes, the result of the format verification passing is determined as the result of the format verification; and when the format check is failed, determining the result of the format check failure as a format check result.
In a specific implementation, a target format may be preset, after determining response modification data, format verification may be performed on the response modification data, for example, whether a format corresponding to the response modification data is a target format may be judged, so that when the format corresponding to the response modification data is the target format, it is determined that format verification passes, and then a format verification passing result may be obtained; and when the format corresponding to the response modification data is the non-target format, determining that the format verification fails, and then obtaining a format verification failure result.
For example, referring to fig. 3, the user may edit the response content (i.e., response data) of the interface, modify the data source (mock data), and obtain response modification data. And then, carrying out format check on the response modified data, determining whether the response modified data is in a JSON format, if the response modified data is determined to be in the JSON format, determining that the check is successful (namely the check is passed), and the mock data is successfully modified, and then, lasting to localization by taking the URL as key and the mock data as value. And if the verification fails (namely the verification fails), determining that the mock data is unsuccessfully modified, reminding a user that the mock data is not in the JSON format, and recommending to modify the mock data again according to the JSON format.
And 300, if the format verification result is a format verification passing result, generating the simulation data result based on the response modification data.
Specifically, according to the embodiment of the application, when the format verification result is the format verification passing result, the simulation data result is generated based on the response modification data, so that a user can quickly browse and view the interface request and the response data on the App, the mock is realized through the App, and the method does not need to rely on a PC (personal computer)
In an optional embodiment, after generating the simulation data result based on the response modification data, the embodiment of the present application may further include: updating the cached simulation data set based on the simulation data result. Specifically, the embodiment of the application can update the cached simulation data set based on the URL and mock data included in the simulation data result. And then, the URL and mock data modified by the user can be persisted to local storage, for example, the cache simulation data can be stored in a memory and a hard disk in a gathering manner, so that the mock flow can still be normally carried out after the App is restarted, and the stability of the mock is ensured.
As an example, referring to fig. 3, after determining that format check of mock data is successful, the URL may be used as a key, and the mock data may be used as a value, and the URL and the mock data may be persisted to a local storage, for example, a Map set (i.e., a cache simulation data set) of the mock may be updated based on the URL and the mock data. After a test data request is subsequently received, under the condition that a mock data interceptor is started, judging whether a URL corresponding to the test data request is matched with a URL of a cached mock, if the match is determined, taking the URL as a key, extracting a value corresponding to the key from a cached simulation data set, namely extracting mock data corresponding to the URL from the cached simulation data set, and taking the mock data as a new ResponseBody to complete the mock; if the URL corresponding to the test data request is determined not to be matched with the URL of the cached mock, the method can be ended.
In actual processing, under the condition that development of a backend part interface is completed, a user can modify a cache simulation data set, for example, the cache simulation data set can be displayed in the form of an interface list, after a URL selected through the list (a backend interface corresponding to the URL can be developed), the user can select to delete the URL and mock data corresponding to the URL, and the interceptor can be set not to intercept the URL, so that the App can normally use the backend interface data without affecting the mock flow.
Further, under the condition that all interfaces at the back end are developed, a user can delete all data contained in the cache simulation data set through a preset one-key clearing button, and batch unified management is achieved.
In summary, in the embodiments of the present application, target interface information is determined according to a test data request of a target application, test response data corresponding to the target interface information is determined, test data is extracted from the test data request, test request time corresponding to the test data is determined, then the target interface information, the test response data, the request time, and the test data are encapsulated according to a preset singleton mode to obtain singleton global object data, an interface operation interface is displayed according to the singleton global object data, when an interface selection operation is a modification selection operation, a target editing interface is determined based on the modification selection operation, response data corresponding to the target editing interface is displayed, response editing operation response data submitted by a user is modified according to the response editing operation, response modification data is obtained, format verification is performed according to the response modification data, a format verification result is obtained, when the format verification result is a format verification pass result, a simulation data result is generated based on the response modification data, so that when a back end is not published, mock data is provided for a front end, normal development of the front end is ensured without waiting for publishing, interface request and quick viewing interface request and response data on an App end, test data, and the problem that the existing test operation cost is reduced, and the problem of complicated test operation cost is solved.
It should be noted that, for simplicity of description, the method embodiments are described as a series of acts or combination of acts, but those skilled in the art will recognize that the embodiments are not limited by the order of acts described, as some steps may occur in other orders or concurrently depending on the embodiments.
As shown in fig. 4, an embodiment of the present application further provides an analog data processing apparatus 400, including:
a target interface information determining module 410, configured to determine target interface information according to a test data request of a target application;
a singleton global object data determining module 420, configured to perform data fusion processing according to the target interface information, the test response data corresponding to the target interface information, and the test data in the test data request, to obtain singleton global object data corresponding to the test data request;
a display module 430, configured to display an interface operation interface according to the single instance global object data;
the simulation data processing module 440 is configured to perform simulation data processing according to an interface selection operation submitted by a user on the interface operation interface, so as to obtain a simulation data result corresponding to the test data request.
Optionally, the target interface information determining module includes:
the interception submodule is used for intercepting the data request of the target application program through the application interceptor to obtain the test data request;
an extraction submodule for extracting uniform resource locator parameters from the test data request;
and the target interface information determining submodule is used for determining the target interface information based on the uniform resource locator parameter.
Optionally, the singleton global object data determining module includes:
the test response data determining submodule is used for determining test response data corresponding to the target interface information;
the test request time determining submodule is used for extracting the test data from the test data request and determining the test request time corresponding to the test data;
and the packaging submodule is used for packaging the target interface information, the test response data, the request time and the test data according to a preset singleton mode to obtain singleton global object data.
Optionally, the test response data determining sub-module includes:
a test response data determining unit, configured to determine, when the uniform resource locator parameter matches an interface parameter in a cache simulation data set, the cache simulation data corresponding to the interface parameter as original response data, and determine the test response data based on the original response data, where the cache simulation data set is a set generated by the mobile terminal according to the obtained cache data when the application interceptor is started; and when the uniform resource locator parameter is not matched with the interface parameter in the cache simulation data set, creating the test response data based on the target interface information.
Optionally, the test response data determining unit is specifically configured to use the original response data as the test response data; or, performing copy processing based on the original response data to obtain copy data, and determining the copy data as the test response data.
Optionally, the analog data processing module includes:
the target editing interface determining submodule is used for determining a target editing interface based on the modification selection operation when the interface selection operation is the modification selection operation;
the display sub-module is used for displaying the response data corresponding to the target editing interface;
the modification sub-module is used for modifying the response data according to a response editing operation submitted by a user to obtain response modification data;
the format checking submodule is used for carrying out format checking according to the response modification data to obtain a format checking result;
and the simulation data result generation submodule is used for generating the simulation data result based on the response modification data when the format verification result is a format verification passing result.
Optionally, the analog data processing apparatus further includes:
the buffer simulation data set generation submodule is used for acquiring buffer data when the application interceptor is started, and the buffer data comprises buffer simulation data and interface parameters corresponding to the buffer simulation data; generating a cache simulation data set according to the cache simulation data and interface parameters corresponding to the cache simulation data;
and the updating module is used for updating the cache simulation data set based on the simulation data result.
Optionally, the display module includes:
the test request time extraction submodule is used for extracting test request time from the single-case global object data;
the sequencing processing submodule is used for carrying out interface sequencing processing based on the test request time to obtain a target interface list;
and the display submodule is used for displaying an interface operation interface based on the target interface list.
Optionally, the analog data processing module is specifically configured to determine a target interface selected by the preset selection operation when the interface selection operation is a preset selection operation; extracting a request response parameter corresponding to the target interface from the target interface list; generating the simulated data results based on the request response parameters.
The analog data processing device provided by the embodiment of the present application can execute the analog data processing method provided by any embodiment of the present application, and has the corresponding functions and advantages of executing the analog data processing method.
In a specific implementation, the analog data processing apparatus may be integrated in a device, so that the device may perform analog data processing according to a test data request to obtain an analog data processing result, and the analog data processing result is used as an electronic device to implement analog data processing at a mobile terminal. The electronic device may be composed of two or more physical entities, or may be composed of one physical entity, for example, the electronic device may be a Personal Computer (PC), a Computer, a server, or the like, which is not limited in this application.
As shown in fig. 5, an electronic device provided in the embodiments of the present application includes a processor 111, a communication interface 112, a memory 113, and a communication bus 114, where the processor 111, the communication interface 112, and the memory 113 complete communication with each other through the communication bus 114; a memory 113 for storing a computer program; the processor 111 is configured to implement the steps of the analog data processing method provided in any one of the foregoing method embodiments when executing the program stored in the memory 113. Illustratively, the steps of the analog data processing method may include the steps of: determining target interface information according to a test data request of a target application program; performing data fusion processing according to the target interface information, the test response data corresponding to the target interface information and the test data in the test data request to obtain single-case global object data corresponding to the test data request; displaying an interface operation interface according to the single-case global object data; and carrying out simulation data processing according to interface selection operation submitted by a user on the interface operation interface to obtain a simulation data result corresponding to the test data request.
Embodiments of the present application further provide a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the steps of the simulation data processing method provided in any one of the foregoing method embodiments.
It is noted that, in this document, relational terms such as "first" and "second," and the like, may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising a … …" does not exclude the presence of another identical element in a process, method, article, or apparatus that comprises the element.
The above description is merely exemplary of the present application and is presented to enable those skilled in the art to understand and practice the present application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the application. Thus, the present application is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims (12)
1. An analog data processing method is applied to a mobile terminal, and comprises the following steps:
determining target interface information according to a test data request of a target application program;
performing data fusion processing according to the target interface information, the test response data corresponding to the target interface information and the test data in the test data request to obtain single-case global object data corresponding to the test data request;
displaying an interface operation interface according to the single-case global object data;
and carrying out simulation data processing according to interface selection operation submitted by a user on the interface operation interface to obtain a simulation data result corresponding to the test data request.
2. The method according to claim 1, wherein the mobile terminal is installed with an application interceptor, and the determining the target interface information according to the test data request of the target application program comprises:
intercepting a data request of the target application program through the application interceptor to obtain the test data request;
extracting uniform resource locator parameters from the test data request;
target interface information is determined based on the uniform resource locator parameter.
3. The method according to claim 2, wherein performing data fusion processing according to the target interface information, the test response data corresponding to the target interface information, and the test data in the test data request to obtain singleton global object data corresponding to the test data request comprises:
determining test response data corresponding to the target interface information;
extracting the test data from the test data request, and determining test request time corresponding to the test data;
and according to a preset singleton mode, packaging the target interface information, the test response data, the request time and the test data to obtain singleton global object data.
4. The method of claim 3, wherein the determining test response data corresponding to the target interface information comprises:
when the uniform resource locator parameter is matched with an interface parameter in a cache simulation data set, determining the cache simulation data corresponding to the interface parameter as original response data, and determining the test response data based on the original response data, wherein the cache simulation data set is a set generated by the mobile terminal according to the obtained cache data when the application interceptor is started;
and when the uniform resource locator parameter is not matched with the interface parameter in the cache simulation data set, creating the test response data based on the target interface information.
5. The method of claim 4,
said determining said test response data based on said raw response data comprises: taking the original response data as the test response data; or, performing copy processing based on the original response data to obtain copy data, and determining the copy data as the test response data.
6. The method of claim 1, wherein the performing simulation data processing according to an interface selection operation submitted by a user on the interface operation interface to obtain a simulation data result corresponding to the test data request comprises:
when the interface selection operation is a modification selection operation, determining a target editing interface based on the modification selection operation;
displaying response data corresponding to the target editing interface;
modifying the response data according to a response editing operation submitted by a user to obtain response modified data;
carrying out format verification according to the response modification data to obtain a format verification result;
and if the format verification result is a format verification passing result, generating the simulation data result based on the response modification data.
7. The method of claim 6,
before determining the target interface information according to the test data request of the target application program, the method further includes: when the application interceptor is started, obtaining cache data, wherein the cache data comprises cache simulation data and interface parameters corresponding to the cache simulation data; generating a cache simulation data set according to the cache simulation data and interface parameters corresponding to the cache simulation data;
after generating the simulation data result based on the response modification data, the method further comprises:
updating the cached simulation data set based on the simulation data result.
8. The method according to claim 1, wherein the displaying an interface operation interface according to the singleton global object data comprises:
extracting test request time from the singleton global object data;
performing interface sorting processing based on the test request time to obtain a target interface list;
and displaying an interface operation interface based on the target interface list.
9. The method of claim 8, wherein the performing simulation data processing according to the interface selection operation submitted by the user on the interface operation interface to obtain the simulation data result corresponding to the test data request comprises:
when the interface selection operation is a preset selection operation, determining a target interface selected by the preset selection operation;
extracting a request response parameter corresponding to the target interface from the target interface list;
generating the simulated data results based on the request response parameters.
10. An analog data processing apparatus, comprising:
the target interface information determining module is used for determining target interface information according to a test data request of a target application program;
the single-case global object data determining module is used for performing data fusion processing according to the target interface information, the test response data corresponding to the target interface information and the test data in the test data request to obtain single-case global object data corresponding to the test data request;
the display module is used for displaying an interface operation interface according to the single-case global object data;
and the simulation data processing module is used for carrying out simulation data processing according to interface selection operation submitted by a user on the interface operation interface to obtain a simulation data result corresponding to the test data request.
11. An electronic device is characterized by comprising a processor, a communication interface, a memory and a communication bus, wherein the processor and the communication interface are used for realizing mutual communication by the memory through the communication bus;
a memory for storing a computer program;
a processor for implementing the steps of the method of processing analog data according to any one of claims 1 to 9 when executing a program stored in a memory.
12. 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 simulation data processing method of any one of claims 1 to 9.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211213267.XA CN115495372A (en) | 2022-09-29 | 2022-09-29 | Analog data processing method, device, equipment and medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211213267.XA CN115495372A (en) | 2022-09-29 | 2022-09-29 | Analog data processing method, device, equipment and medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN115495372A true CN115495372A (en) | 2022-12-20 |
Family
ID=84472020
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202211213267.XA Pending CN115495372A (en) | 2022-09-29 | 2022-09-29 | Analog data processing method, device, equipment and medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN115495372A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117251385A (en) * | 2023-11-20 | 2023-12-19 | 深圳大道云科技有限公司 | method and device for acquiring mock data, terminal equipment and readable storage medium |
-
2022
- 2022-09-29 CN CN202211213267.XA patent/CN115495372A/en active Pending
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117251385A (en) * | 2023-11-20 | 2023-12-19 | 深圳大道云科技有限公司 | method and device for acquiring mock data, terminal equipment and readable storage medium |
CN117251385B (en) * | 2023-11-20 | 2024-04-02 | 深圳大道云科技有限公司 | method and device for acquiring mock data, terminal equipment and readable storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US8813039B2 (en) | Method and system for software defect reporting | |
CN105940654B (en) | Franchise static web application in trust | |
JP5425699B2 (en) | Information processing apparatus, test case generation method, program, and recording medium | |
US9170921B2 (en) | Application testing automation | |
US10817267B2 (en) | State machine representation of a development environment deployment process | |
CN107896244B (en) | Version file distribution method, client and server | |
US9727354B2 (en) | System and methods for loading an application and its modules in a client device | |
US20100115348A1 (en) | Alternate procedures assisting computer users in solving problems related to error and informational messages | |
CN111538659B (en) | Interface testing method, system, electronic equipment and storage medium of business scene | |
CN110727575B (en) | Information processing method, system, device and storage medium | |
WO2021129335A1 (en) | Operation monitoring method and apparatus, operation analysis method and apparatus | |
CN112765102B (en) | File system management method and device | |
CN108121650B (en) | Method and device for testing page user interface | |
CN111352612A (en) | Scheduling method and device for code deployment, electronic equipment and storage medium | |
CN112860645A (en) | Processing method and device for offline compressed file, computer equipment and medium | |
US10846665B2 (en) | Management of remotely stored data | |
US10120707B2 (en) | Deployment of development environments | |
CN113014445A (en) | Operation and maintenance method, device and platform for server and electronic equipment | |
CN112650689A (en) | Test method, test device, electronic equipment and storage medium | |
CN115495372A (en) | Analog data processing method, device, equipment and medium | |
US20220043774A1 (en) | Systems, methods, and storage media for transferring data files | |
US11836510B2 (en) | Snapshot capture of computing device user interfaces | |
US10394534B2 (en) | Framework for flexible logging of development environment deployment | |
CN115062254A (en) | Mock data implementation method based on Google browser, storage medium and equipment | |
US20220244975A1 (en) | Method and system for generating natural language content from recordings of actions performed to execute workflows in an application |
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 |