Detailed Description
The principles and spirit of the present application will be described with reference to a number of exemplary embodiments. It should be understood that these embodiments are given solely for the purpose of enabling those skilled in the art to better understand and to practice the present application, and are not intended to limit the scope of the present application in any way. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
As will be appreciated by one of skill in the art, embodiments of the present application may be embodied as an apparatus, device, method, or computer program product. Thus, the present application may be embodied in the form of: entirely hardware, entirely software (including firmware, resident software, micro-code, etc.), or a combination of hardware and software.
According to an embodiment of the present application, a data processing method, a data processing apparatus, an electronic device, and a computer-readable storage medium are provided.
Any number of elements in the drawings are by way of example and not by way of limitation, and any nomenclature is used solely for differentiation and not by way of limitation.
The principles and spirit of the present application are explained in detail below with reference to several representative embodiments of the present application.
Summary of The Invention
At present, the scheme of the related art for data processing is generally as follows: real data stored in the database is fed back as test data, or test data which can only be used for a specific service scene is manufactured in a manual mode. Therefore, the data processing using the above method generally depends entirely on real data, or can be applied only in a specific service scenario, and has a high labor cost.
Based on the above problems, the applicant thought that it is possible to avoid that the test data fed back during data processing completely depends on the real data and that the test data can be applied only to a specific service scenario, and in one embodiment of the present disclosure, the feedback generates the first data based on the data simulation rule simulation configuration when the data simulation rule is matched, and the real data is fed back when the data simulation rule is not matched. Therefore, the first data are generated through the data simulation rule simulation structure matched with the data query request, the generation of the test data in the related technology is completely dependent on the real data, and the supply of the test data can be guaranteed through two ways of the simulation data and the real data no matter whether the data simulation rule is matched or not, so that the logic of data query is perfected, and the experience of developers for obtaining the test data is improved.
Application scene overview
It should be noted that the following application scenarios are merely illustrated for the convenience of understanding the spirit and principles of the present application, and the embodiments of the present application are not limited in this respect. Rather, embodiments of the present application may be applied to any scenario where applicable.
When the method is applied to a database scene, the generation of test data in the related technology is completely dependent on real data, and the supply of the test data can be guaranteed in two ways of simulation data and real data no matter whether the data simulation rule is matched or not, so that the logic of data query is perfected, and the experience of developers for obtaining the test data is improved.
Illustrative methodMethod of
In conjunction with the application scenarios described above, a data processing method according to an exemplary embodiment of the present application is described below with reference to fig. 1 and 12.
Referring to fig. 1, fig. 1 is a flow chart illustrating a data processing method according to an exemplary embodiment of the present application. As shown in fig. 1, the data processing method may include:
step S110: and acquiring a data query request, and determining a data simulation rule matched with the data query request.
Step S120: if the data simulation rule is matched, feeding back first data; wherein the first data is generated based on the matched data simulation rule simulation structure.
Step S130: if the data simulation rule is not matched, feeding back second data; and the second data is real data obtained by querying in the database based on the data query request.
On one hand, if the data simulation rule is matched, the first data are fed back, and if the data simulation rule is not matched, the second data are fed back, so that the generation of the test data does not depend on the real data completely, the supply of the test data can be guaranteed in two ways of the simulation data and the real data, the logic of data query is perfected, and the experience degree of developers for acquiring the test data is improved; on the other hand, a general method for simulating and constructing first data based on the simulation data rule is provided, different first data can be fed back according to different data simulation rules, the test function can be completed by using the first data in more service scenes, and the efficiency of simulating and constructing the first data is improved; in addition, when different first data need to be fed back, the data simulation rule can be changed, and the flexibility of constructing the first data is improved.
These steps are described in detail below.
In step S110, a data query request is obtained, and a data simulation rule matching the data query request is determined.
Specifically, the data query request is a request for querying test data, and the request may be issued by a tester needing the test data, or may be issued by any developer needing the test data, which is not particularly limited in this exemplary embodiment. And, the data simulation rule is a rule for constructing test data by subsequent simulation.
For example, a data query request A is obtained, and it is determined whether there is a data simulation rule matching the data query request A.
Referring to fig. 2, fig. 2 is a schematic flow chart of a process before a data query request is obtained. As shown in fig. 2, may include:
step S210: acquiring an authentication request, and transparently transmitting the authentication request to a database to acquire a target authentication result consistent with a preset authentication result; the preset authentication result is the result that the interface verification serial number of the application program data interface is consistent with the authentication verification serial number and the interface key of the application program data interface is consistent with the authentication interface key; the application program data interface is a data interface for sending an authentication request.
The database is used to store real data, where the real data is data matched with the test requirement of the developer, for example, if the developer needs to test whether the application a can load a large amount of purchase data during the promotion period to ensure that the user can purchase goods successfully, the real data may be historical purchase data of different users on the application a.
The authentication request is a request sent by a developer who needs to acquire test data, and the authentication request carries an interface verification serial number and an interface key of an application program data interface which sends the request. The interface verification serial number of the application program data interface refers to a unique identifier, the unique identifier corresponds to an application program tested by a developer, the interface key refers to a password used by the developer to log in the application program, the authentication verification serial number is data used for judging whether the interface verification serial number is legal, and the authentication interface key is data used for judging whether the interface key is legal.
When the authentication request is obtained, the authentication request is directly transmitted to a server corresponding to the database without any processing on the authentication request so as to obtain a target authentication result fed back by the server, the target authentication result fed back by the server can be divided into two types, and when the target authentication result is consistent with a preset authentication result, the server feeds back the target authentication result to an application program used by a developer. The preset authentication result refers to an authentication result that the interface key and the interface verification serial number are both legal, that is, the authentication result when the interface key exists in the authentication interface key and the interface verification serial number exists in the authentication verification serial number.
For example, an authentication request B is obtained, the request is transmitted to a server corresponding to the database, the interface verification serial number 123 and the interface key XX1 in the authentication data B obtained by the database are obtained, and the authentication verification serial number and the authentication interface key are obtained, if 123 exists in the authentication verification serial number and XX1 exists in the authentication interface key, it is determined that the authentication is successful at this time, and then a target authentication result which is consistent with the preset authentication result and indicates that the authentication is successful is fed back.
Step S220: and feeding back a target authentication result to obtain a data query request.
And feeding back the target authentication result to an application program, wherein the application program is the application program which sends out the authentication request. After the application program obtains the target authentication result, the data query request can be sent according to the requirements of developers needing to test the data.
For example, the target authentication result is fed back to the application program 1, where the application program 1 is an application program that sends an authentication request, and at this time, a data query request, that is, a data query request sent by a developer that needs to test data through the application program 1, may be obtained.
Therefore, by implementing the optional embodiment, the fed-back target authentication result needs to be obtained before the data query request is obtained, so that the risk that the first data or the second data fed back subsequently is leaked is avoided, and the safety of data processing is improved.
Referring to fig. 3, fig. 3 is a flow chart illustrating a process of determining a data simulation rule matching a data query request. As shown in fig. 3, the data query request includes a query request link, and determining the data simulation rule matching the data query request may include:
step S310: and determining a query request link corresponding to the data query request, and determining a simulation rule identifier matched with the query request link.
Specifically, the query request link refers to a link used for initiating a data query request, the simulation rule identifier refers to an identifier corresponding to a data simulation rule, and the identifier may be represented by a number, a letter, or a string, which is not limited in this exemplary embodiment. It is worth noting that one simulation rule identifier uniquely identifies one data simulation rule.
For example, it is determined that the query request link corresponding to the data query request a is xxxxxx.xxxx, and there is a simulation rule identification corresponding to xxxxxx.xxxx, which may be 123 in particular.
Step S320: and if the simulation rule identification is matched, determining the data simulation rule corresponding to the simulation rule identification as the data simulation rule matched with the data query request.
Specifically, if a simulation rule identifier corresponding to the query request link exists, a data simulation rule corresponding to the simulation rule identifier is obtained.
For example, if the simulation rule corresponding to the data request link xxxx.xxxx is identified as 123, then the data simulation rule C corresponding to 123 is obtained.
Step S330: and if the simulation rule identification is not matched, determining that no data simulation rule matched with the data query request exists.
Specifically, if the simulation rule identifier is not matched, it is determined that the simulation rule identifier corresponding to the data query request cannot be matched.
For example, if the data request is linked to xx.xx, and there is no simulation rule id matching xx.xx, it is determined that there is no data simulation rule matching the data query request.
Therefore, whether the simulation rule identification corresponding to the query request link exists or not is determined, the follow-up determination that the fed-back data is the first data or the second data is facilitated, namely whether the simulation rule identification corresponding to the query request link exists or not can guarantee the supply of the test data in two ways of the simulation data and the real data, the logic of data query is improved, and the experience of developers for obtaining the data is improved.
As an alternative embodiment, the data simulation rule includes: the method comprises the following steps of (1) obtaining a model name, a field name corresponding to the model name, the number of data, a processing mode of sensitive data in sample data and a feedback format of the sample data; the sample data is generated by simulating a structure based on a model name, a field name and a data number, the data number is used for limiting the number of the sample data, and the processing mode of sensitive data in the sample data comprises data desensitization and/or data confusion.
Specifically, the sample data refers to test data required by a developer who initiates a data query request, the model name refers to a name for distinguishing the sample data, for example, the sample data may be data for testing a shopping application, the model name may be shop _ mockbata, the sample data may also be data used in testing a medical diagnosis, and the model name may be hospital _ mockbata.
The field names are names corresponding to each data item in the sample data, for example, data items of shopping time, shopping products, and payment amount exist in the sample data for testing the shopping application, and there are three field names, which may be time, product, and type, respectively.
The number of data pieces refers to the number of required test data, for example, if a user who sends a query data request needs 3 sample data pieces, the number of data pieces is 3. Sensitive data refers to data which may bring harm to users and society using application programs after leakage, and data desensitization and data obfuscation are ways for desensitizing sensitive data in sample data, specifically, data desensitization refers to ways for deforming sensitive data through desensitization rules, and data obfuscation refers to ways for replacing sensitive data in sample data with data that looks like real production data that cannot be abused by anyone. The feedback format refers to a format of the sample data when the sample data is fed back to the application.
For example, the data simulation rule includes a model name shop _ mockdata, field names time, product, and type, a number of data pieces 3, a processing mode data desensitization of sensitive data in the data, and a feedback format Json (JS Object Notation) format of sample data.
Therefore, by implementing the optional embodiment, a universal data simulation rule is provided, different first data can be determined according to different data simulation rules subsequently, not only is the flexibility of the simulation construction of the first data increased, but also the different data simulation rules can be determined according to different business scene requirements, so that the business scene in which the subsequently determined first data can be applied is expanded, in addition, the first data are not generated based on an artificial form any more, and the efficiency of simulation construction of the first data is improved.
In step S120, if the data simulation rule is matched, feeding back the first data; wherein the first data is generated based on the matched data simulation rule simulation structure.
Specifically, the first data is data generated according to a data simulation rule configuration.
For example, fig. 4 shows a flow chart of data processing, as shown in fig. 4, wherein thedata interface 410 is a query data interface provided for all services to issue a data query request. Thefirst server 420 is a server which feeds back the first data based on the matched data simulation rule, and thesecond server 430 is a server corresponding to a database storing real data.
If the data simulation rule corresponding to the data query request is matched, the data query request is sent to thefirst server 420, the first data is constructed based on the data simulation rule corresponding to the data query request in a simulation manner, and the first data is fed back to thedata interface 410.
As an alternative embodiment, please refer to fig. 5, and fig. 5 shows a schematic flow chart of feeding back the first data. As shown in fig. 5, the data query request includes a filter condition, and the feeding back the first data may include:
step S510: and if the data simulation rule is matched, determining the model name, the field name, the number of data and the processing mode corresponding to the data simulation rule.
Specifically, the filtering condition refers to a condition corresponding to a test requirement of a developer, and is used for filtering the sample data, so as to obtain data meeting the filtering condition in the sample data, and further implement filtering of the sample data.
For example, the data simulation rule matched with the data query request a is a data simulation rule 1, the data simulation rule 1 includes a model name shop _ mockbata, field names time, product and type, a data number of 3 and a processing mode data desensitization of sensitive data, based on which the obtained model name corresponding to the data simulation rule 1 is shop _ mockbata, the field names time, product and type, the data number of 3 and the processing mode is data desensitization.
Step S520: and obtaining sample data based on the model name, the field name, the number of data pieces and the processing mode.
Specifically, sample data is obtained according to the model name, the field name, the number of data pieces, and the processing mode.
For example, the obtained model name is shop _ mockdata, the field names are time, product, and type, the number of data pieces is 3, and the processing mode is data desensitization.
Based on this, sample data D can be obtained, specifically, the sample data D includes 3 pieces of data, which are data 1, data 2, and data 3, and includes a field value corresponding to time, 2 months and 22 days, a short sleeve field value corresponding to Product, a field value clothing corresponding to type, a field value corresponding to time, X months and XX days, a field value corresponding to Product, gold, a financial Product corresponding to type, a field value corresponding to time, 3 months and 03 days, a field value corresponding to Product, a ball shoe, and a field value shoe corresponding to type in data 1.
Step S530: and determining a filtering condition corresponding to the data query request, and filtering the sample data according to the filtering condition to obtain the filtered sample data.
Specifically, the filtered sample data is the data determined after the sample data is filtered according to the filtering condition.
For example, sample data D is obtained, specifically, the sample data D includes 3 pieces of data, which are data 1, data 2, and data 3, and includes a field value corresponding to time in data 1, 2 months and 22 days, a field value corresponding to Product short-sleeve, a field value corresponding to type, a field value corresponding to time in data 2, X months and XX days, a field value corresponding to Product is gold, a field value corresponding to type, a financial Product, a field value corresponding to time in data 3, 3 months and 03 days, a field value corresponding to Product is a ball shoe, and a shoe field value corresponding to type.
The obtained filtering condition is that time is 2 months and 22 days, that is, only data with the field name time value of 2 months and 22 days is needed finally, based on the data, sample data D is filtered, data 2 and data 3 are filtered, and it is determined that the filtered sample data is data 1.
Step S540: and obtaining first data corresponding to the filtered sample data based on the feedback format, and feeding back the first data.
Specifically, the format of the sample data is converted according to the determined feedback format to obtain first data, and the first data is fed back.
For example, the sample data after filtering is data 1, the data 1 is converted into a Json format to obtain first data, and the first data is fed back.
Therefore, in the implementation of the optional embodiment, on one hand, the sample data is generated based on the data simulation rule, that is, the sample data is not generated in a manual mode any more, so that the efficiency of generating the sample data is improved, different sample data can be generated based on different data simulation rules, and the flexibility of generating the sample data is improved; on the other hand, the obtained first data is the data obtained after the sample data is filtered according to the filtering condition, the testing requirement of a developer sending a data query request is met, and besides, the format of the first data needs to be adjusted according to the feedback format, so that the use and unified management of the first data are facilitated, and the developer can understand the content of the first data more easily.
As an alternative embodiment, please refer to fig. 6, and fig. 6 shows a schematic flow chart of obtaining sample data. As shown in fig. 6, may include:
step S610: and simulating and constructing sample data based on the model name, the field name, the number of data pieces and the processing mode.
Specifically, there are two ways to obtain sample data based on the model name, the field name, the number of data pieces, and the processing manner, where the first way is constructed by real-time simulation according to the model name, the field name, the number of data pieces, and the processing manner.
For example, the obtained model name is shop _ mockdata, the field names are time, product, and type, the number of data pieces is 3, and the processing mode is data desensitization.
Based on this, the sample data D can be constructed in real-time simulation according to the above data, specifically, the sample data D includes 3 pieces of data, which are data 1, data 2 and data 3, and includes a field value corresponding to time, i.e., 2 months and 22 days, a short sleeve corresponding to Product, a field value garment corresponding to type, i.e., X months and XX days, a field value corresponding to time, i.e., gold, a field value corresponding to type, a financial Product corresponding to type, i.e., 3 months and 03 days, a field value corresponding to time, i.e., a ball shoe, and a shoe corresponding to type in the data 1.
Step S620: and acquiring preset simulation data constructed by pre-simulation, and taking data matched with the model name, the field name, the number of data pieces and the processing mode in the preset simulation data as sample data.
Specifically, a second way to obtain sample data based on the model name, the field name, the number of pieces of data, and the processing way is to match from preset simulation data of a pre-simulation configuration.
For example, fig. 7 shows a schematic flowchart of a process for obtaining preset simulation data, as shown in fig. 7, where theperson 710 is a developer, and theserver 720 is a server for generating a query request link, it should be noted that the query request link generated by theserver 720 is a link that can be matched to a data simulation rule, and sample data that can be obtained through the data simulation rule corresponding to the link, and the sample data is sample data obtained from preset simulation data constructed by simulation in advance.
Step S730 is a process of creating a model name in advance for the developer, and after the developer creates the created model name, the created model name needs to be sent to thedata management system 740 for the maintenance of the model name by thedata management system 740, step S750 is a process of acquiring sample data from real data, step S760 is a process of performing data desensitization on sensitive data in the sample data, step S770 is a process of transforming the data format according to the feedback format, and performing data simulation rule creation according to the model name in S730, the sample data in S750, the data desensitization manner in S760, and the feedback format in S770, and step S780 is a process of generating a query link corresponding to the data simulation rule in S770.
Based on this, when the query request link matches the query request link in S780, the preset simulation data in S750 is obtained, and then data matching the model name, the field name, the number of pieces of data, and the processing manner in the preset simulation data is taken as sample data.
For example, there are 10 pieces of preset simulation data constructed by simulation in advance, the model name of the 1 st piece of preset simulation data is user _ mockbata, the model names of the 2 nd to 7 th pieces of preset simulation data are shop _ mockbata, the model names of the 8 th to 10 th pieces of preset simulation data are app _ mockbata, 3 field names exist in the 2 nd to 6 th pieces of preset simulation data, which are respectively time, product and type, 2 field names exist in the 7 th piece of preset simulation data, which are respectively color and amount, the processing formats of the 2 nd to 6 th pieces of data are data desensitization, and the processing formats of the rest data are data obfuscation.
The acquired model name is shop _ mockdata, the field names are time, product and type, the number of data is 3, the processing mode data desensitization of sensitive data in the data is realized, and based on the data desensitization, sample data acquired in preset simulation data are any three pieces of data from 2 nd to 6 th.
It can be seen that, in implementing this alternative embodiment, there are two ways to generate sample data, one way is to simulate and construct the sample data in real time according to the model name, the field name, the number of data pieces, and the processing method, and the other way is to match the sample data with preset simulation data generated in advance. By using the first mode, different sample data can be simulated and constructed based on different model names, field names, data numbers and processing modes, the flexibility of simulation construction sample data is increased, in the second mode, the sample data is directly obtained by matching from preset simulation data generated in advance, and the generation speed of the sample data is improved because the preset sample simulation data is generated in advance.
Referring to fig. 8, fig. 8 is a schematic flow chart illustrating editing sample data. As shown in fig. 8, may include:
step S810: acquiring import data, and merging the sample data and the import data to update the sample data; the import data is data corresponding to import operation, the import operation is operation acting on a graphical user interface, and the graphical user interface is used for editing the sample data.
The developer needing test data can edit the sample data, and the editing process can be realized on a graphical user interface. The import data refers to data which needs to be imported into the sample data by a developer, and correspondingly, the import operation is an operation performed on a graphical user interface by the developer and is used for determining the import data.
For example, fig. 9 shows a graphical user interface for editing sample data, where theinterface 910 is a graphical user interface, the model name of the sample data is displayed in theinput box 920, the field name of the sample data is displayed in theinput box 930, the sample data is displayed in the data entry table 950 is displayed in theinput box 940, the field value corresponding to the field name is displayed in each cell in the table 950, the operation performed by the user on thecontrol 960 is an import operation, and the operation performed by the user on thecontrol 970 is an export operation.
When a user needing test data touches thecontrol 960 on thegui 910, the imported data is obtained, and after the imported data is obtained, the imported data and the sample data in the table 950 are merged to obtain updated sample data.
Step S820: acquiring export data, and deleting the export data from the sample data to update the sample data; the export data is data corresponding to export operation, and the export operation is operation acting on the graphical user interface.
The export data is data corresponding to export operation, the export operation is an operation which can be acted on a graphical user interface by a developer, and the operation is used for determining which data in the sample data need to be deleted.
For example, fig. 9 shows a graphical user interface for editing sample data, and the user's operation oncontrol 970 is an export operation.
When a developer needing test data touchescontrol 970 ongraphical user interface 910, export data is obtained, and after the export data is obtained, the export data is deleted from table 950 to obtain updated sample data.
Step S830: acquiring sample data to be replaced and replacement data, and replacing the sample data to be replaced with the replacement data; the sample data to be replaced is data corresponding to the replacement operation, the replacement data is data corresponding to the input operation, and the replacement operation and the input operation are operations acting on the graphical user interface.
The sample data to be replaced refers to data needing to be replaced, and the replacement data is used for replacing the replaced data. The alternative operation is an operation which can act on the graphical user interface, specifically a selection operation, and the input operation is another operation which acts on the graphical user interface, specifically an input operation.
For example, fig. 9 shows a graphical user interface for editing sample data, when a developer selects a field value corresponding to a field name in the sample data of the table 950, the field value is data to be replaced, and after selecting the data to be replaced, the developer may input replacement data in a cell corresponding to the field value, so as to implement a process of replacing the data to be replaced with the replacement data.
Therefore, by implementing the optional embodiment, the sample data can be edited by acting on the operation on the graphical user interface, the requirements of developers needing to test the data are better met, the experience of the developers is improved, and the flexibility of editing the sample data is also improved.
Referring to fig. 10, fig. 10 is a schematic flow chart illustrating a process of obtaining filtered sample data. As shown in fig. 10, the filtering condition includes a filtering field name and a data filtering condition that the filtering field name needs to satisfy, and may include:
step S1010: and acquiring the name of the filtering field from the filtering condition, and determining a data value corresponding to the name of the filtering field in the sample data.
The filtering field names are one or more of the field names, and some data in the sample data can be filtered through the data values corresponding to the filtering field names.
For example, the filter field name is time, and the data value corresponding to time in the sample data is 2 months and 22 days.
Step S1020: and acquiring data filtering conditions from the filtering conditions, determining target data values meeting the data filtering conditions from the data values, and determining sample data corresponding to the target data values as filtered sample data.
The data filtering condition refers to a condition that a data value corresponding to the filtering field name should satisfy, and based on this, the target data value refers to a data value satisfying the data filtering condition.
For example, the data filtering condition is that time is 2 months and 22 days, and there are 3 pieces of sample data, the time value of the first piece of sample data is 2 months and 21 days, the time value of the 2 nd piece of sample data is 3 months and 1, the time value of the 3 rd piece of sample data is 2 months and 22 days, based on this, the target data value is 2 months and 22 days, and the filtered sample data is the third piece of sample data.
Therefore, by implementing the optional embodiment, the sample data can be filtered according to the filtering conditions, and the filtering conditions correspond to the testing requirements of developers, so that the fitting degree of the filtered sample data and the requirements of the developers is improved, the experience of the developers is improved, different filtered sample data can be obtained through different filtering conditions, and the flexibility of determining the sample data is increased.
Fig. 11 is a schematic flowchart illustrating a process of feeding back first data according to the foregoing embodiment, as shown in fig. 11, where thedata interface 1110 is an interface for uniformly querying data, theserver 1120 is a server for determining the first data, and theserver 1130 is a server corresponding to a database storing real data. First, step S1140 is a process in which a developer sends an authentication request from the unifiedquery data interface 1110, step S1150 is a process in which theserver 1120 acquires the authentication request, step S1160 is a process in which the authentication request is transmitted to theserver 1130 when the authentication request is received, step S1170 is a process in which a corresponding determination is made to obtain an authentication result, step S1180 is a process in which theserver 1130 feeds back the target authentication result to theserver 1120 if the authentication result is a target authentication result that is consistent with a preset authentication result, theserver 1120 sends the target authentication result to the unifiedquery data interface 1110, and at this time, theserver 1120 may receive the data query request.
Step S1190 is a process of receiving the data query request, step S1191 is a process of determining a data simulation rule matching the data query request, step S1192 is a process of simulating and constructing sample data based on the data simulation rule if the data simulation rule is matched, step S1193 is a process of obtaining first data based on a feedback format, and step S1194 is a process of feeding back the first data to the unifiedquery data interface 1110.
Step S1195 is a process of transmitting the data query request to theserver 1130 if the data simulation rule is not matched, and step S1196 is a process of obtaining real data and returning the real data to theserver 1110, where the real data is data obtained from a database in theserver 1130. Embodiments of steps S1195 and S1196 are described in detail below.
In step S130, if the data simulation rule is not matched, feeding back second data; and the second data is real data obtained by querying in the database based on the data query request.
Specifically, the second data refers to real data stored in the database, which is generated during use by a user using the application program.
For example, fig. 4 shows a flow chart of data processing, and as shown in fig. 4, if the data simulation rule is not matched, the data query request is sent to thesecond server 430, and the second data is acquired in thesecond server 430, so as to feed back the second data to thedata interface 410.
As an alternative embodiment, please refer to fig. 12, and fig. 12 shows a schematic flow chart of feeding back the second data. As shown in fig. 12, the data query request includes a query request link, which may include:
step 1210: and if the data simulation rule is not matched, determining a query request link corresponding to the data query request.
If the data simulation rule is not matched, it is proved that no rule capable of simulating and manufacturing the first data exists at the moment, and based on the rule, an inquiry request link corresponding to the inquiry request needs to be acquired.
For example, if no data simulation rule corresponding to the data query request is matched, the query request link corresponding to the data query request is determined to be xx.
Step S1220: and determining second data in the database based on the query request link, and feeding back the second data.
And determining real data, namely second data, in the database according to the query request link, and feeding back the second data.
For example, the real data corresponding to the query request linked with xx.xx is determined to be data E in the database, and the data E is fed back.
Therefore, by implementing the optional embodiment, real data is fed back when the data simulation rule is not matched, so that the data which can be fed back also exists even under the condition that the data simulation rule cannot be matched, the logic of the query request is perfected, the supply of test data can be guaranteed by two ways of simulating data and real data, the experience degree of developers is improved, and the normal operation of subsequent test services is facilitated.
By implementing the embodiment of the application, on one hand, if the data simulation rule is matched, the first data is fed back, and if the data simulation rule is not matched, the second data is fed back, so that the generation of the test data does not depend on the real data completely, the supply of the test data can be guaranteed by two ways of the simulation data and the real data, the logic of data query is perfected, and the experience of developers for obtaining the test data is improved; on the other hand, a general method for simulating and constructing first data based on the simulation data rule is provided, different first data can be fed back according to different data simulation rules, the test function can be completed by using the first data in more service scenes, and the efficiency of simulating and constructing the first data is improved; in addition, when different first data need to be fed back, the data simulation rule can be changed, and the flexibility of constructing the first data is improved.
Exemplary Medium
Having described the method of the exemplary embodiments of the present application, the media of the exemplary embodiments of the present application will be described next.
In some possible embodiments, aspects of the present application may also be implemented as a medium having program code stored thereon, which when executed by a processor of a device, is used to implement the steps in the information display method according to various exemplary embodiments of the present application described in the above section "exemplary method" of the present specification.
Specifically, the processor of the device, when executing the program code, is configured to implement the following steps: acquiring a data query request, and determining a data simulation rule matched with the data query request; if the data simulation rule is matched, feeding back first data; wherein the first data is generated based on the matched data simulation rule simulation structure; if the data simulation rule is not matched, feeding back second data; and the second data is real data obtained by querying in the database based on the data query request.
In some embodiments of the present application, the program code is further configured to, when executed by the processor of the device, perform the following steps: determining a query request link corresponding to the data query request, and determining a simulation rule identifier matched with the query request link; if the simulation rule identification is matched, determining the data simulation rule corresponding to the simulation rule identification as the data simulation rule matched with the data query request; and if the simulation rule identification is not matched, determining that no data simulation rule matched with the data query request exists.
In some embodiments of the present application, the program code is further configured to, when executed by the processor of the device, perform the following steps: if the data simulation rule is matched, determining a model name, a field name, the number of data and a processing mode corresponding to the data simulation rule; obtaining sample data based on the model name, the field name, the number of data pieces and the processing mode; determining a filtering condition corresponding to the data query request, and filtering the sample data according to the filtering condition to obtain filtered sample data; and obtaining first data corresponding to the filtered sample data based on the feedback format, and feeding back the first data.
In some embodiments of the present application, the program code is further configured to, when executed by the processor of the device, perform the following steps: sample data is constructed in a simulation mode based on the model name, the field name, the number of data pieces and the processing mode; or acquiring preset simulation data constructed by pre-simulation, and taking data matched with the model name, the field name, the number of data pieces and the processing mode in the preset simulation data as sample data.
In some embodiments of the present application, the program code is further configured to, when executed by the processor of the device, perform the following steps: acquiring import data, and merging the sample data and the import data to update the sample data; the method comprises the steps that imported data are data corresponding to import operation, the import operation is operation acting on a graphical user interface, and the graphical user interface is used for editing sample data; acquiring export data, and deleting the export data from the sample data to update the sample data; the export data is data corresponding to export operation, and the export operation is operation acting on a graphical user interface; acquiring sample data to be replaced and replacement data, and replacing the sample data to be replaced with the replacement data; the sample data to be replaced is data corresponding to the replacement operation, the replacement data is data corresponding to the input operation, and the replacement operation and the input operation are operations acting on the graphical user interface.
In some embodiments of the present application, the program code is further configured to, when executed by the processor of the device, perform the following steps: acquiring a filtering field name from the filtering condition, and determining a data value corresponding to the filtering field name in the sample data; and acquiring data filtering conditions from the filtering conditions, determining target data values meeting the data filtering conditions from the data values, and determining sample data corresponding to the target data values as filtered sample data.
In some embodiments of the present application, the program code is further configured to, when executed by the processor of the device, perform the following steps: if the data simulation rule is not matched, determining a query request link corresponding to the data query request; and determining second data in the database based on the query request link, and feeding back the second data.
In some embodiments of the present application, the program code is further configured to, when executed by the processor of the device, perform the following steps: acquiring an authentication request, and transparently transmitting the authentication request to a database to acquire a target authentication result consistent with a preset authentication result; the preset authentication result is the result that the interface verification serial number of the application program data interface is consistent with the authentication verification serial number and the interface key of the application program data interface is consistent with the authentication interface key; the application program data interface is a data interface for sending an authentication request; and feeding back a target authentication result to obtain a data query request.
It should be noted that: the above-mentioned medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example but not limited to: an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples (a non-exhaustive list) of the readable storage medium include: an electrical connection having one or more wires, a portable disk, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
A readable signal medium may include a propagated data signal with readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take a variety of forms, including, but not limited to: an electromagnetic signal, an optical signal, or any suitable combination of the foregoing. A readable signal medium may also be any readable medium that is not a readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wired, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
Program code for carrying out operations of the present application may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, C + + or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user computing device, partly on a remote computing device, or entirely on the remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device over any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computing device (e.g., over the internet using an internet service provider).
Exemplary devices
Having described the medium of the exemplary embodiment of the present application, next, a data processing apparatus of the exemplary embodiment of the present application will be described with reference to fig. 13.
Referring to fig. 13, fig. 13 is a block diagram illustrating a data processing apparatus according to an exemplary embodiment of the present application. As shown in fig. 13, adata processing apparatus 1300 according to an exemplary embodiment of the present application includes: adetermination module 1310, afirst feedback module 1320, and asecond feedback module 1330, wherein:
a determiningmodule 1310 configured to obtain the data query request and determine a data simulation rule matching the data query request;
afirst feedback module 1320 configured to feed back the first data if the data simulation rule is matched; wherein the first data is generated based on the matched data simulation rule simulation structure;
asecond feedback module 1330 configured to feed back second data if the data simulation rule is not matched; and the second data is real data obtained by querying in the database based on the data query request.
It can be seen that, by implementing the apparatus shown in fig. 13, the first data is constructed based on the simulation of the data simulation rule, so that the test data in the related art is prevented from being generated completely depending on the real data, the supply of the test data can be ensured by two ways of the simulation data and the real data, the logic of data query is improved, and the experience of developers in obtaining the test data is improved.
In one embodiment, based on the foregoing solution, before the determiningmodule 1310 obtains the data query request, the method includes:
acquiring an authentication request, and transparently transmitting the authentication request to a database to acquire a target authentication result consistent with a preset authentication result; the preset authentication result is the result that the interface verification serial number of the application program data interface is consistent with the authentication verification serial number and the interface key of the application program data interface is consistent with the authentication interface key; the application program data interface is a data interface for sending an authentication request;
and feeding back a target authentication result to obtain a data query request.
Therefore, by implementing the optional embodiment, the target authentication result fed back by the database needs to be obtained before the data query request is obtained, so that the risk that the first data and the second data fed back subsequently are leaked is avoided, and the safety of data processing is improved.
In one embodiment, based on the foregoing scheme, the determiningmodule 1310 determines the data simulation rule matching the data query request, including:
determining a query request link corresponding to the data query request, and determining a simulation rule identifier matched with the query request link;
if the simulation rule identification is matched, determining the data simulation rule corresponding to the simulation rule identification as the data simulation rule matched with the data query request;
and if the simulation rule identification is not matched, determining that no data simulation rule matched with the data query request exists.
Therefore, whether the simulation rule identification corresponding to the query request link exists or not is determined, the follow-up determination that the fed-back data is the first data or the second data is facilitated, namely whether the simulation rule identification corresponding to the query request link exists or not can guarantee the supply of the test data in two ways of the simulation data and the real data, the logic of data query is improved, and the experience of developers for obtaining the data is improved.
In one embodiment, based on the foregoing scheme, the determiningmodule 1310 data modeling rules comprises: the method comprises the following steps of (1) obtaining a model name, a field name corresponding to the model name, the number of data, a processing mode of sensitive data in sample data and a feedback format of the sample data; the sample data is generated by simulating a structure based on a model name, a field name and a data number, the data number is used for limiting the number of the sample data, and the processing mode of sensitive data in the sample data comprises data desensitization and/or data confusion.
Therefore, by implementing the optional embodiment, a universal data simulation rule is provided, different first data can be determined according to different data simulation rules subsequently, not only is the flexibility of the simulation construction of the first data increased, but also the different data simulation rules can be determined according to different business scene requirements, so that the business scene in which the subsequently determined first data can be applied is expanded, in addition, the first data are not generated based on an artificial form any more, and the efficiency of simulation construction of the first data is improved.
In one embodiment, based on the foregoing scheme, if thefirst feedback module 1320 matches the data simulation rule, the feedback of the first data includes:
if the data simulation rule is matched, determining a model name, a field name, the number of data and a processing mode corresponding to the data simulation rule;
obtaining sample data based on the model name, the field name, the number of data pieces and the processing mode;
determining a filtering condition corresponding to the data query request, and filtering the sample data according to the filtering condition to obtain filtered sample data;
and obtaining first data corresponding to the filtered sample data based on the feedback format, and feeding back the first data.
Therefore, in the implementation of the optional embodiment, on one hand, the sample data is generated based on the data simulation rule, that is, the sample data is not generated in a manual mode any more, so that the efficiency of generating the sample data is improved, different sample data can be generated based on different data simulation rules, and the flexibility of generating the sample data is improved; on the other hand, the obtained first data is the data obtained after the sample data is filtered according to the filtering condition, the testing requirement of a developer sending a data query request is met, and besides, the format of the first data needs to be adjusted according to the feedback format, so that the use and unified management of the first data are facilitated, and the developer can understand the content of the first data more easily.
In an embodiment, based on the foregoing scheme, the obtaining, by thefirst feedback module 1320, sample data based on the model name, the field name, the number of data pieces, and the processing manner includes:
sample data is constructed in a simulation mode based on the model name, the field name, the number of data pieces and the processing mode;
and acquiring preset simulation data constructed by pre-simulation, and taking data matched with the model name, the field name, the number of data pieces and the processing mode in the preset simulation data as sample data.
It can be seen that, in implementing this alternative embodiment, the sample data is generated in two ways, one way is generated by simulating the structure in real time according to the model name, the field name, the number of data pieces and the processing way, and the other way is obtained by matching the preset simulation data generated in advance. By using the first mode, different sample data can be simulated and constructed based on different model names, field names, data numbers and processing modes, the flexibility of simulation construction sample data is increased, in the second mode, the sample data is directly obtained by matching from preset simulation data generated in advance, and the speed of generating the sample data is improved because the preset sample simulation data is generated in advance.
In one embodiment, based on the foregoing solution, thefirst feedback module 1320 further includes:
acquiring import data, and merging the sample data and the import data to update the sample data; the imported data is data corresponding to the import operation, the import operation is operation acting on a graphical user interface, and the graphical user interface is used for editing the sample data;
acquiring export data, and deleting the export data from the sample data to update the sample data; the export data is data corresponding to export operation, and the export operation is operation acting on a graphical user interface;
acquiring sample data to be replaced and replacement data, and replacing the sample data to be replaced with the replacement data; the sample data to be replaced is data corresponding to the replacement operation, the replacement data is data corresponding to the input operation, and the replacement operation and the input operation are operations acting on the graphical user interface.
Therefore, by implementing the optional embodiment, the sample data can be edited by acting on the operation on the graphical user interface, the requirements of the user needing to test the data are better met, the experience degree of the user is improved, and the flexibility of editing the sample data is also improved.
In an embodiment, based on the foregoing solution, the filtering processing performed by thefirst feedback module 1320 on the sample data according to the filtering condition to obtain the filtered sample data includes:
acquiring a filtering field name from the filtering condition, and determining a data value corresponding to the filtering field name in the sample data;
and acquiring data filtering conditions from the filtering conditions, determining target data values meeting the data filtering conditions from the data values, and determining sample data corresponding to the target data values as filtered sample data.
Therefore, by implementing the optional embodiment, the sample data can be filtered according to the filtering conditions, and the filtering conditions correspond to the testing requirements of developers, so that the fitting degree of the filtered sample data and the requirements of the developers is improved, the experience of the developers is improved, different filtered sample data can be obtained through different filtering conditions, and the flexibility of determining the sample data is increased.
In one embodiment, based on the foregoing scheme, if thesecond feedback module 1330 does not match the data simulation rule, the second feedback module feeds back the second data, including:
if the data simulation rule is not matched, determining a query request link corresponding to the data query request;
and determining second data in the database based on the query request link, and feeding back the second data.
Therefore, by implementing the optional embodiment, real data is fed back when the data simulation rule is not matched, so that the data which can be fed back also exists even under the condition that the data simulation rule cannot be matched, the logic of the query request is perfected, the supply of test data can be guaranteed by two ways of simulating data and real data, the experience degree of developers is improved, and the normal operation of subsequent test services is facilitated.
It should be noted that although in the above detailed description several modules or units of the data processing device are mentioned, this division is not mandatory. Indeed, the features and functionality of two or more modules or units described above may be embodied in one module or unit, according to embodiments of the application. Conversely, the features and functions of one module or unit described above may be further divided into embodiments by a plurality of modules or units.
Exemplary electronic device
Having described the method, medium, and apparatus of the exemplary embodiments of the present application, an electronic device according to another exemplary embodiment of the present application is next described.
As will be appreciated by one skilled in the art, aspects of the present application may be embodied as a system, method or program product. Accordingly, various aspects of the present application may be embodied in the form of: an entirely hardware embodiment, an entirely software embodiment (including firmware, microcode, etc.) or an embodiment combining hardware and software aspects that may all generally be referred to herein as a "circuit," module "or" system.
Anelectronic device 1400 according to such an embodiment of the present disclosure is described below with reference to fig. 14. Theelectronic device 1400 shown in fig. 14 is only an example and should not bring any limitations to the functionality and scope of use of the embodiments of the present disclosure.
As shown in fig. 14, theelectronic device 1400 is embodied in the form of a general purpose computing device. The components of theelectronic device 1400 may include, but are not limited to: the at least oneprocessing unit 1410, the at least onememory unit 1420, thebus 1430 that connects the various system components (including thememory unit 1420 and the processing unit 1410), and thedisplay unit 1440.
Wherein the storage unit stores program code that is executable by theprocessing unit 1410, such that theprocessing unit 1410 performs steps according to various exemplary embodiments of the present disclosure described in the "exemplary methods" section above in this specification.
Thestorage unit 1420 may include readable media in the form of volatile memory units, such as a random access memory unit (RAM)1421 and/or acache memory unit 1422, and may further include a read only memory unit (ROM) 1423.
Thestorage unit 1420 may also include a program/usage tool 1424 having a set (at least one) ofprogram modules 1425,such program modules 1425 include, but are not limited to: an operating system, one or more application programs, other program modules, and program data, each of which, and in some combination, may comprise a representation of a network environment.
Thebus 1430 may include a data bus, an address bus, and a control bus.
Theelectronic device 1400 may also communicate with one or more external devices 1470 (e.g., keyboard, pointing device, bluetooth device, etc.), which may be through an input/output (I/O)interface 1450. Also, theelectronic device 1400 may communicate with one or more networks (e.g., a Local Area Network (LAN), a Wide Area Network (WAN), and/or a public network, such as the internet) via thenetwork adapter 1460. As shown, thenetwork adapter 1460 communicates with the other modules of theelectronic device 1400 via the bus 1230. It should be appreciated that although not shown in the figures, other hardware and/or software modules may be used in conjunction with theelectronic device 1400, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, among others.
Through the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein may be implemented by software, or by software in combination with necessary hardware. Therefore, the technical solution according to the embodiments of the present disclosure may be embodied in the form of a software product, which may be stored in a non-volatile storage medium (which may be a CD-ROM, a usb disk, a removable hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which may be a personal computer, a server, a terminal device, or a network device, etc.) to execute the method according to the embodiments of the present disclosure.
In an exemplary embodiment of the present disclosure, there is also provided a computer-readable storage medium having stored thereon a program product capable of implementing the above-described method of the present specification. In some possible embodiments, aspects of the present disclosure may also be implemented in the form of a program product comprising program code for causing a terminal device to perform the steps according to various exemplary embodiments of the present disclosure described in the "exemplary methods" section above of this specification, when the program product is run on the terminal device.
While the spirit and principles of the application have been described with reference to several particular embodiments, it is to be understood that the application is not limited to the disclosed embodiments, nor is the division of aspects, which is for convenience only as the features in such aspects may not be combined to benefit from the description. The application is intended to cover various modifications and equivalent arrangements included within the spirit and scope of the appended claims.