Data preparation method and device, equipment, storage medium and product
By backing up and overwriting the target data in rule-class tests, the damage caused by coupling between data is solved, the efficiency of regression testing is improved, and the integrity and consistency of data is ensured.
Patent Information
- Application Number
- CN202411151983.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-21
- Publication Date
- 2024-12-10
AI Technical Summary
In rule-based testing, due to the coupling between data, other data in the database are easily destroyed when manually constructing data, resulting in repeated construction of data during regression testing, which increases the time and labor investment for data preparation and reduces efficiency.
By responding to the updated target data backup instruction in the source database, the target data is backed up as backup data, and when receiving the data playback instruction, the target data is overwritten based on the backup data to generate test data, avoiding data destruction and improving The efficiency of regression testing.
It realizes that the damaged target data is not required to be constructed manually repeatedly, and directly uses uncorrupted backup data for regression testing, which improves data preparation efficiency and ensures the integrity and consistency of the test data.
Smart Images

Figure CN119105962A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of rule-based testing technology, and in particular to methods, devices, equipment, storage media and products for data preparation. Background Art
[0002] In current rule-based testing technology, data needs to be accurately constructed based on specific rules and stored in the database. However, the rule logic is complex, and there are many data tables involved in data construction, and the relationship between tables is complex. Therefore, current rule-based testing technology mainly relies on manual construction of data and storage in the database.
[0003] In the process of manually constructing data, due to the coupling between the data constructed based on rules, when the data is constructed and saved in the database, another constructed data in the database may be destroyed.
[0004] Therefore, during regression testing, it is usually necessary to repeatedly construct the damaged data, which increases the time and manpower investment in data preparation during the regression testing phase, resulting in low efficiency in data preparation for regression testing. Summary of the invention
[0005] The main purpose of the present application is to provide a method, device, equipment, storage medium and product for data preparation, aiming to solve the technical problem of low efficiency of data preparation for regression testing.
[0006] To achieve the above objectives, the present application proposes a method for data preparation, which includes:
[0007] In response to a backup instruction for target data updated in a source database, backing up the target data to obtain backup data, wherein the target data includes data constructed based on a rule;
[0008] In response to the data playback instruction, the target data is overwritten based on the backup data to obtain test data.
[0009] Optionally, the step of backing up the target data in the source database to obtain the backup data includes:
[0010] Based on a first association relationship between the preset scene information and the target data, backing up the target data to obtain backup data;
[0011] The step of overwriting the target data based on the backup data to obtain the test data comprises:
[0012] Based on the first association relationship between the preset scene information and the target data, the target data is overwritten to obtain test data.
[0013] Optionally, the step of backing up the target data based on the first association relationship between the preset scene information and the target data includes:
[0014] The target data is backed up based on a first association relationship between the preset scene information and the target data, and a preset backup location.
[0015] Optionally, in response to a backup instruction for target data updated in the source database, the step of backing up the target data to obtain the backup data includes:
[0016] In response to a backup instruction for target data updated in a source database, obtaining a unique identifier of the target data;
[0017] Locating the target data based on the unique identifier to obtain a target backup location of the target data;
[0018] The target data is backed up based on the target backup location to obtain backup data.
[0019] Optionally, the step of responding to the data playback instruction and overwriting the target data based on the backup data to obtain the test data includes:
[0020] In response to the data playback instruction, the latest data within a preset time period in the backup data is obtained, where the preset time period is a time range between a current time point and a preset time point;
[0021] Based on the latest data within the preset time period, the target data is overwritten to obtain test data.
[0022] Optionally, in response to a backup instruction for target data updated in the source database, the step of backing up the target data to obtain the backup data includes:
[0023] In response to a backup instruction for target data updated in a source database, associated data of the target data is backed up to obtain backup data, wherein a second association relationship between the target data and the associated data is a logical relationship between a first rule and a second rule, the first rule is a rule based on which the target data is constructed, and the second rule is a rule based on which the associated data is constructed.
[0024] In addition, to achieve the above purpose, the present application also proposes a data preparation device, the data preparation device comprising:
[0025] A data backup module, configured to respond to a backup instruction for target data updated in a source database, back up the target data to obtain backup data, wherein the target data includes data constructed based on rules;
[0026] The data playback module, in response to the data playback instruction, overwrites the target data based on the backup data to obtain test data.
[0027] In addition, to achieve the above-mentioned purpose, the present application also proposes a data preparation device, which includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, and the computer program is configured to implement the steps of the data preparation method described above.
[0028] In addition, to achieve the above-mentioned purpose, the present application also proposes a computer-readable storage medium, which is a computer-readable storage medium. A computer program is stored on the storage medium, and when the computer program is executed by a processor, the steps of the data preparation method described above are implemented.
[0029] In addition, to achieve the above-mentioned purpose, the present application also provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, the steps of the data preparation method described above are implemented.
[0030] One or more technical solutions proposed in this application have at least the following technical effects:
[0031] The present application responds to a backup instruction for target data updated in a source database, backs up the target data, and obtains backup data, wherein the target data includes data constructed based on rules; responds to a data playback instruction, overwrites the target data based on the backup data, and obtains test data. Since the source data stored in the source database is data constructed based on rules, these data are coupled. When new data is constructed and stored in the source database, the target data may be damaged due to the coupling between the data. In order to avoid damaging the target data, in response to a backup instruction for target data updated in the source database, backs up the target data, and obtains backup data; subsequently, in response to the data playback instruction, the target data in the source database may be overwritten based on the backup data, and obtains test data. The backup data is not damaged, and the obtained test data can be directly used for regression testing without manually repeating the construction of the damaged target data. Therefore, the problem of time-consuming and labor-intensive data preparation in the regression testing stage is solved, and the efficiency of regression testing is improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] 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 present application.
[0033] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0034] Figure 1 A flowchart of the first embodiment of the method for preparing data for this application;
[0035] Figure 2 A schematic diagram of a scenario provided for the second embodiment of the method for data preparation of this application;
[0036] Figure 3 A flowchart of the third embodiment of the method for data preparation of this application is provided;
[0037] Figure 4 A schematic diagram of the module structure of the device for preparing data in the embodiment of the present application;
[0038] Figure 5 A schematic diagram of the device structure of the hardware operating environment involved in the method for data preparation in an embodiment of the present application.
[0039] The purpose, features and advantages of this application will be further described in conjunction with the embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0040] It should be understood that the specific embodiments described herein are only used to explain the technical solutions of the present application and are not used to limit the present application.
[0041] In order to better understand the technical solution of the present application, a detailed description will be given below in conjunction with the accompanying drawings and specific implementation methods.
[0042] It should be noted that the execution subject of this embodiment may be a computing service device with data processing, network communication and program running functions, such as a tablet computer, a personal computer, a mobile phone, etc., or an electronic device capable of realizing the above functions, a data preparation device, etc. The following takes the data preparation device as an example to illustrate this embodiment and the following embodiments.
[0043] Based on this, the present application embodiment provides a method for data preparation, referring to Figure 1 , Figure 1 A flowchart of the first embodiment of the method for data preparation of the present application.
[0044] In this embodiment, the data preparation method includes steps S10 to S20:
[0045] Step S10, in response to a backup instruction for target data updated in a source database, backing up the target data to obtain backup data, wherein the target data includes data constructed based on a rule;
[0046] It should be noted that the source database stores business data, which are constructed by different rules. Business data are the data required for rule-based testing. Business data can be customer information, account information, transaction records, etc. stored in the database of bank business rules; target data is the updated data stored in the source database, and target data includes data constructed based on rules.
[0047] The data preparation device responds to the backup instruction for the target data updated in the source database and backs up the target data to obtain the backup data.
[0048] In order to improve the convenience of users in using the data preparation method and to facilitate the triggering of backup and playback instructions, the data preparation device may be integrated with a backup playback component or may be communicatively connected to the backup playback component.
[0049] Among them, the backup instruction is sent by the backup part of the backup playback component after the data preparation device detects that the user clicks on the backup part in the backup playback component; the target data is backed up to obtain backup data, and the backup data is stored. The backup data can be stored in a MongoDB (distributed document storage database) data table or in a MySQL (relational database) data table.
[0050] In addition, it should be noted that the rules are a series of criteria such as defined data structure, format, logical relationship and constraint conditions.
[0051] For example, banks need to manage multiple risks, including credit risk, market risk, liquidity risk, operational risk, etc. In order to reduce risks, banks have established complex assessment and monitoring procedures; when banks provide a variety of products and services, products and services can be savings accounts, loans, credit cards, investment products, etc., each product has its own unique rules and terms, and different loan products may have different interest rate calculation methods, repayment methods and conditions; as a result of the combined effect of many factors, in order to ensure the safe, legal and efficient operation of banking business, while also providing customers with high-quality services, the rules are ultimately complicated, but they are essential to maintaining the stability of the financial system and protecting consumer rights.
[0052] When manually constructing rule-based data in a database, one rule may depend on the correct execution of another rule. If the data construction of a rule does not take this dependency into account, it may affect the correctness of other related rules. If the data construction of a rule does not follow the principle of data consistency, it may lead to inconsistent data in other tables. Therefore, due to the coupling between data, the data construction of one rule is likely to destroy the data of another constructed rule.
[0053] The updated target data in the source database is backed up to a backup data table for storage. The backup data storage format may be JSON (JavaScript Object Notation), XML (Extensible Markup Language), etc., to obtain backup data.
[0054] It is understandable that, because the rules are complex and the data between the rules are coupled, the data preparation device responds to the backup instructions for the target data updated in the source database and backs up the target data to obtain the backup data step, which can save the intact data required for rule-based testing, thereby ensuring the integrity of the data used in rule-based testing.
[0055] Step S20, in response to the data playback instruction, overwriting the target data based on the backup data to obtain test data.
[0056] It should be noted that the data playback instruction is an instruction sent by the playback part in the backup playback component after the data preparation device detects that the user clicks on the playback part in the backup playback component.
[0057] In order to prevent data leakage and improve data security, backup and playback can be encapsulated as components. Specifically, the encapsulation process can be to establish an API (Application Programming Interface): clarify the target users of the API, which can be developers, internal teams, etc., and determine the core functions and data access permissions that the API needs to provide; determine the resources available in the API, which can be users, products, etc., and define endpoints for each resource, that is, URL (Uniform Resource Locator) paths; define request methods, which can be GET (get fields), DELETE (delete fields), etc., request headers, request bodies, etc., define response status codes, response headers, response bodies, which can be in JSON or XML formats; create detailed API documentation, including endpoint lists, request / response examples, error handling, etc., to obtain the API address of the backup playback component. The API address is a URL (Uniform Resource Locator), and the URL can specify the location of the backup playback component to be accessed.
[0058] When the user needs to perform backup or playback, first enter the URL to specify the location of the backup playback component to be accessed; then enter the request parameters, which can be used to customize the behavior of the request, and the request parameters can be address, port, user name and user password, etc.; enable the automated script of the backup playback component to obtain return information, which can indicate the type of returned content, the length of the returned content, the generated timestamp, etc.
[0059] By establishing an API, the risk of data leakage can be reduced and the trust of users and businesses can be improved.
[0060] Specifically, when a data playback instruction is detected, based on the backup data stored in the backup data table from the source database, the target data in the backup data is obtained, the target data is played back, that is, the target position in the source database is overwritten, and the test data is confirmed to be ready to obtain the test data.
[0061] It can be understood that when the test data is subjected to rule-based testing, by responding to the data playback instruction and overwriting the target data based on the backup data to obtain the test data step, it can be ensured that the test data is not damaged, thereby eliminating the need for manual re-construction of the damaged source data, reducing the time for manual data construction, and thus solving the problem of time-consuming and labor-intensive data preparation during the rule-based testing phase, improving the efficiency of rule-based testing, and providing a consistent, complete, secure and efficient rule-based testing environment.
[0062] In a specific implementation, the step of responding to the data playback instruction and overwriting the target data based on the backup data to obtain the test data includes:
[0063] In response to a data playback instruction, the latest data within a preset time period in the backup data is obtained, and the preset time period is the time range between the current time point and the preset time point; based on the latest data within the preset time period, the target data is overwritten to obtain test data.
[0064] It should be noted that the current time point can be the current date called when preparing for rule-based testing; the preset time point is the latest update time of the data item or field; the latest data within the preset time period is the data updated or generated within the preset time period, and the preset time period can be the last 5 minutes, 1 hour, 1 day, etc.
[0065] Specifically, when there is a time difference between the execution of backup and playback, for example, the updated target data was backed up from the source database ten days ago and stored in the backup data table, and the backup data was obtained; in response to the data playback instruction, the acquired backup data should be the latest data within ten days, so the data ten days ago in the backup data is outdated data; when the backup data is played back into the source database, the latest data in the backup data should be selected for playback to ensure that the test data is the latest data.
[0066] For example, a reasonable preset time point n is set according to the test requirements, and the preset time point n depends on the business requirements for data freshness; when the freshness of the data needs to be checked, the current time point t is obtained, and then compared with the preset time point n to determine whether the data is fresh or expired; based on the current time point t and the preset time point n, the current time point t is calculated minus the preset time point n to obtain the preset time period; based on the latest data within the preset time period, the target data is overwritten to obtain the test data.
[0067] It can be understood that by adopting the above method, the freshness of data can be automatically monitored, the latest data within a preset time period can be accurately extracted and played back to the source database, ensuring that the test data is the latest data, avoiding the problem of invalid test data due to outdated data, and effectively improving the system's performance, security and user experience.
[0068] Based on the first embodiment of the present application, in the second embodiment of the present application, the same or similar contents as those in the above-mentioned embodiment 1 can be referred to the above introduction and will not be repeated later.
[0069] On this basis, the step of backing up the target data to obtain backup data includes:
[0070] Based on a first association relationship between the preset scene information and the target data, backing up the target data to obtain backup data;
[0071] It should be noted that the first association relationship is determined in advance based on the type of target data, and there is a corresponding relationship between the type of target data and the scene information.
[0072] It should be noted that the scenario information refers to information such as data, processes, rules and behaviors of participants involved in a specific scenario. This information helps to understand and define the specific operation methods of a specific business, such as the basic information of individuals or enterprises in customer information management involved in banking operations, the limit amount of deposits and withdrawals in deposit and withdrawal business, the loan amount and loan term in loan business, etc.
[0073] Exemplarily, the above-mentioned scenarios may be involved in the testing process. In order to facilitate testing, a configuration data table is established to store scenario information; the configuration data table stores scenario information, ignored fields, etc.; the test scenario description can be a detailed description of the test data, test process, test rules, and tester behavior involved in a specific test scenario; for example, in a banking business scenario, the test scenario description can be customer information, and the customer information can be customer ID (Identity document, identity identification number), name, account information, deposit information, and deposit information. The deposit information can be the deposit amount, deposit date, business process, and the business process can be logging into the bank system, entering the deposit amount, etc.; the ignored fields are invalid fields that need to be ignored during the backup process, and the invalid fields can be outdated fields, blank fields, etc.
[0074] There is a corresponding relationship between the type of target data and the scene information. The data preparation device obtains the scene information corresponding to the target data by acquiring the scene information corresponding to the target data stored in the configuration data table, and determines the scene corresponding to the target data based on the first association relationship between the scene information and the target data. Different backup data tables are provided for different scenes. Therefore, during the backup process, the target data can be backed up in the corresponding backup data table to obtain the backup data; refer to Figure 2 If the target data involves scene 1 and scene 2, it is necessary to back up the part of the target data corresponding to scene 1 to backup data table 1, and back up the part of the target data corresponding to scene 2 to backup data table 2.
[0075] Based on the ignored fields stored in the configuration data table, the target data updated in the source database is backed up, and invalid fields in the target data, such as expired fields, blank fields, etc., are ignored to obtain valid target data, and the valid target data is backed up to obtain backup data.
[0076] It can be understood that the data preparation device backs up data based on a first association relationship between preset scenario information and the target data to obtain the backup data step, establishes a configuration data table, and backs up the target data based on the scenario information corresponding to the target data stored in the configuration data table during the backup process, and backs up based on the ignored fields stored in the configuration data table to obtain the backup data. The scenario corresponding to the backup data is a test scenario, which increases the accuracy of the data backup process, reduces unnecessary data redundancy in the backup process, saves storage space of the backup data table, and ensures the integrity of the data during the backup process.
[0077] The step of overwriting the target data based on the backup data to obtain the test data comprises:
[0078] Based on the first association relationship between the preset scene information and the target data, the target data is overwritten to obtain test data.
[0079] Specifically, when a backup instruction is detected, the previously backed up and stored target data is obtained from the backup data table, the target data in the source database that needs to be overwritten is determined according to the scenario information, and the backup data is used to overwrite the target data in the source database.
[0080] For example, the source database of a banking system includes an account table and a transaction table. The account table contains account information, such as account ID, account balance, etc. The transaction table contains transaction information, such as transaction ID, transaction type (deposit, withdrawal, transfer, etc.), transaction amount, account ID, etc.; determine the target data that needs to be backed up, such as the account balance in the account table, and determine the associated data, such as the transaction records in the transaction table; obtain the scenario information in the configuration data table, such as timestamp, test scenario (such as transfer, deposit, etc.), operation type, etc.
[0081] When it is necessary to test the transfer rules in banking services, because the transfer operation (scenario information) will be associated with the account information of the two accounts (target data), it is necessary to back up the account information of the party performing the transfer operation and the account information of the other party related to the transfer operation; based on the association relationship between the transfer operation and the account information of the two accounts, the account information of the two accounts is backed up to obtain backup data; in response to the data playback instruction, based on the association relationship between the transfer operation and the account information of the two accounts, the scenario corresponding to the account information, that is, the scenario of the transfer operation, is determined, and the account information under the transfer operation scenario is covered to obtain test data.
[0082] It can be understood that the data preparation device covers the target data based on the first association relationship between the preset scenario information and the target data to obtain the step of test data. By establishing a scenario data table, the target data is covered based on the scenario information corresponding to the target data, ensuring that the scenario corresponding to the covered target data is the scenario required for the test, and ensuring that the test data is consistent with the target data updated in the source database, thereby improving the accuracy and efficiency of rule-based testing and reducing the risks in the rule-based testing process.
[0083] The step of backing up the target data in the source database based on the first association relationship between the preset scene information and the target data includes:
[0084] The target data is backed up based on a first association relationship between the preset scene information and the target data, and a preset backup location.
[0085] Specifically, in order to ensure that the backup location can be found quickly during data playback, the data preparation device selects a suitable backup location according to the test requirements to obtain a preset backup location.
[0086] For example, in a banking business testing scenario, the test usually requires data consistency, security and other requirements. When backing up the target data, you need to select a suitable backup location based on the test requirements. When the test requirement is that the data must be secure, you can choose an encrypted or access-controlled backup location to obtain a preset backup location.
[0087] It should be noted that the preset backup location refers to a data storage location determined in advance when performing data backup. The preset backup location can be a storage path stored in a data table, local disk, network share, cloud storage service or any other form of data storage medium.
[0088] It can be understood that the data preparation device backs up the target data based on the first association relationship between the preset scenario information and the target data, and the preset backup location. The preset backup location is a storage path stored in the backup data table. Based on the storage path, the target data is backed up and stored in the corresponding storage path. This can ensure that data can be quickly played back from the preset backup location in the backup data table, reducing the impact of data loss on the business and ensuring business continuity.
[0089] Based on the first and second embodiments of the present application, in the third embodiment of the present application, the same or similar contents as those of the above-mentioned first and second embodiments can be referred to the above introduction and will not be repeated later.
[0090] On this basis, refer to Figure 3, the step of backing up the target data in response to the backup instruction for the target data updated in the source database to obtain the backup data comprises:
[0091] Step A100, in response to a backup instruction for target data updated in a source database, obtaining a unique identifier of the target data;
[0092] Step A200, locating the target data based on the unique identifier to obtain a target backup location of the target data;
[0093] Step A300: backing up the target data based on the target backup location to obtain backup data.
[0094] It should be noted that the unique identifier is a code or number used to uniquely identify a specific object or record, and is used to distinguish different entities in the system. Different entities can be user accounts, files, database records, etc., to ensure that each item is unique throughout the system; the unique identifier can be a business primary key, which can be a customer ID, a unified social credit code, etc. The business primary key is used to identify the target data that has been updated in the source database. During backup, the target data is located based on the unique identifier to obtain the target backup location of the target data, thereby ensuring that the target data can be accurately located.
[0095] Exemplarily, in banking business, typical scenarios for locating target data through unique identifiers include but are not limited to: when it is necessary to back up or update the account information of a specific customer, the customer ID, account ID, unified social credit code, etc. can be used to locate the account data; for the backup or audit of a specific transaction, the transaction ID can be used to locate the relevant transaction records; when processing a loan application, the application ID can be used to locate all data related to the application; for risk assessment of a specific customer, the customer ID can be used to obtain all relevant financial data and credit scores; query the source database through the customer ID or account ID to find the target backup location of the target data, the target backup location refers to the scenario corresponding to the target data, and the target data is backed up to the scenario to which it belongs to obtain accurate and reasonable backup data for the scenario.
[0096] It can be understood that the data preparation device obtains the unique identifier of the target data by responding to the backup instruction for the target data updated in the source database; locates the target data based on the unique identifier to obtain the target backup position of the target data; and backs up the target data based on the target backup position to obtain the backup data, by analyzing the unique identifier of the target data, locating the target data based on the analysis result, and after successful positioning, obtaining the target backup position of the target data; backing up the target data based on the target backup position to obtain the backup data; ensuring that the correct data is processed, thereby reducing errors and omissions; when backing up or playing back data, the unique identifier can ensure that all related data are processed correctly, thereby maintaining the integrity of the data; through precise positioning, unnecessary data duplication can be reduced and storage space can be saved.
[0097] Based on the first, second and third embodiments of the present application, in the fourth embodiment of the present application, the same or similar contents as those of the above-mentioned first, second and third embodiments can be referred to the above introduction and will not be repeated later.
[0098] On this basis, the step of backing up the target data in response to the backup instruction for the target data updated in the source database to obtain the backup data includes:
[0099] In response to a backup instruction for target data updated in a source database, associated data of the target data is backed up to obtain backup data, wherein a second association relationship between the target data and the associated data is a logical relationship between a first rule and a second rule, wherein the first rule is a rule based on which the target data is constructed, and the second rule is a rule based on which the associated data is constructed.
[0100] It should be noted that the second association relationship is determined based on the logic between the first rule and the second rule, and there is an association relationship between the target data and the associated data.
[0101] In addition, it should be noted that the associated data is other data that is relied upon when constructing the target data. For example, in banking business, when constructing data related to a customer's transaction record, it relies on data related to the customer's basic information, such as name, address, etc.
[0102] For example, when using an online store application, its database may include an order table, a product table, and a customer table, etc.; the target data is the data in the order table, and the associated data is the product information in the product table and the customer information in the customer table. The product information can be product ID, name, price, etc., and the customer information can be customer ID, name, address, etc.
[0103] In response to a backup instruction for target data updated in a source database, associated data of the target data is backed up to obtain backup data.
[0104] The order table stores the product ID and customer ID corresponding to each order item, which are target data and are constructed based on the first rule; the product table stores the product ID and customer ID of each product, which are associated data and are constructed based on the second rule; there is an association relationship between the data in the order table and the data in the product table, which is a logical relationship between the first rule and the second rule; when a new order is created or an existing order is modified, a backup instruction will be triggered, and the backup system will automatically collect the order data, as well as the related product information and customer information, and back up these data.
[0105] It can be understood that by responding to the backup instruction for the target data updated in the source database, the associated data of the target data is backed up to obtain the step of backup data. When the target data is constructed and stored in the source database, the target data has associated data in the source database. Since there is a logical relationship between the first rule and the second rule, the first rule is the rule based on which the target data is constructed, and the second rule is the rule based on which the associated data is constructed, the target data may destroy the associated data based on the logical relationship between the first rule and the second rule, and the associated data that may be destroyed has been backed up, ensuring the consistency of all related data during data recovery, avoiding the problem of data inconsistency that may result from backing up only the target data, and ensuring that data will not be lost due to missing key data, reducing the risk of data loss.
[0106] This application also provides a data preparation device, please refer to Figure 4 , the data preparation device comprises:
[0107] A data backup module 10, configured to respond to a backup instruction for target data updated in a source database, back up the target data to obtain backup data, wherein the target data includes data constructed based on rules;
[0108] The data playback module 20 is used to respond to the data playback instruction and overwrite the target data based on the backup data to obtain test data.
[0109] The data preparation device provided by the present application adopts the data preparation method in the above embodiment to solve the technical problem of artificial repeated number generation. Compared with the prior art, the beneficial effects of the data preparation device provided by the present application are the same as the beneficial effects of the data preparation method provided by the above embodiment, and other technical features in the data preparation device are the same as the features disclosed in the above embodiment method, which will not be repeated here.
[0110] The present application provides a data preparation device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the data preparation method in the above-mentioned embodiment one.
[0111] Reference below Figure 5 , which shows a schematic diagram of the structure of a device suitable for implementing data preparation in an embodiment of the present application. The device for data preparation in an embodiment of the present application may include, but is not limited to, mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Descriptions), PMPs (Portable Media Players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 5 The data preparation device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0112] like Figure 5As shown, the data preparation device may include a processing device 1001 (e.g., a central processing unit, a graphics processor, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM: Read Only Memory) 1002 or a program loaded from a storage device 1003 to a random access memory (RAM: Random Access Memory) 1004. In RAM1004, various programs and data required for the operation of the data preparation device are also stored. The processing device 1001, ROM1002, and RAM1004 are connected to each other through a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Generally, the following systems can be connected to the I / O interface 1006: an input device 1007 including, for example, a touch screen, a touch pad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; an output device 1008 including, for example, a liquid crystal display (LCD: Liquid Crystal Display), a speaker, a vibrator, etc.; a storage device 1003 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 1009. The communication device 1009 can allow the data preparation device to communicate with other devices wirelessly or by wire to exchange data. Although the figure shows a data preparation device with various systems, it should be understood that it is not required to implement or have all the systems shown. More or fewer systems can be implemented or have alternatively.
[0113] In particular, according to the embodiments disclosed in the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device, or installed from a storage device 1003, or installed from a ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment disclosed in the present application are executed.
[0114] The data preparation device provided by the present application adopts the data preparation method in the above embodiment, and the data preparation efficiency of the regression test is low. Compared with the prior art, the beneficial effects of the data preparation device provided by the present application are the same as the beneficial effects of the data preparation method provided by the above embodiment, and other technical features in the data preparation device are the same as the features disclosed in the method of the previous embodiment, which will not be repeated here.
[0115] It should be understood that the various parts disclosed in this application can be implemented by hardware, software, firmware or a combination thereof. In the description of the above embodiments, specific features, structures, materials or characteristics can be combined in any one or more embodiments or examples in a suitable manner.
[0116] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
[0117] The present application provides a computer-readable storage medium having computer-readable program instructions (ie, computer programs) stored thereon, wherein the computer-readable program instructions are used to execute the data preparation method in the above-mentioned embodiment.
[0118] The computer-readable storage medium provided in the present application may be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, systems or devices, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer 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 disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, system or device. The program code contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination of the above.
[0119] The computer-readable storage medium may be included in the data preparation device; or may exist independently without being assembled into the data preparation device.
[0120] The above-mentioned computer-readable storage medium carries one or more programs. When the above-mentioned one or more programs are executed by the data preparation device, the data preparation device: responds to the backup instruction for the target data updated in the source database, backs up the target data to obtain backup data, wherein the target data includes data constructed based on rules; responds to the data playback instruction, overwrites the target data based on the backup data to obtain test data.
[0121] Computer program code for performing the operations of the present application may be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0122] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0123] The modules involved in the embodiments described in this application may be implemented by software or hardware, wherein the name of the module does not constitute a limitation on the unit itself in some cases.
[0124] The readable storage medium provided by the present application is a computer-readable storage medium, which stores computer-readable program instructions (i.e., computer programs) for executing the above-mentioned data preparation method, and the data preparation efficiency of the regression test is low. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided by the present application are the same as the beneficial effects of the data preparation method provided by the above-mentioned embodiment, and will not be repeated here.
[0125] The present application also provides a computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the steps of the data preparation method as described above are implemented.
[0126] The computer program product provided by the present application can prepare data for regression testing with low efficiency. Compared with the prior art, the beneficial effects of the computer program product provided by the present application are the same as those of the data preparation method provided by the above embodiment, which will not be described in detail here.
[0127] The above descriptions are only some embodiments of the present application, and are not intended to limit the patent scope of the present application. All equivalent structural changes made using the contents of the present application specification and drawings under the technical concept of the present application, or direct / indirect applications in other related technical fields are included in the patent protection scope of the present application.
Claims
1. A method for preparing rule-based test data, characterized in that: The method includes: In response to a backup instruction for target data updated in a source database, backing up the target data to obtain backup data, wherein the target data includes data constructed based on a rule; In response to the data playback instruction, the target data is overwritten based on the backup data to obtain test data.
2. The method according to claim 1, characterized in that The step of backing up the target data to obtain the backup data comprises: Based on a first association relationship between the preset scene information and the target data, backing up the target data to obtain backup data; The step of overwriting the target data based on the backup data to obtain the test data comprises: Based on the first association relationship between the preset scene information and the target data, the target data is overwritten to obtain test data.
3. The method according to claim 2, characterized in that The step of backing up the target data based on the first association relationship between the preset scene information and the target data includes: The target data is backed up based on a first association relationship between the preset scene information and the target data, and a preset backup location.
4. The method according to claim 1, characterized in that The step of backing up the target data in response to the backup instruction for the target data updated in the source database to obtain the backup data comprises: In response to a backup instruction for target data updated in a source database, obtaining a unique identifier of the target data; Locating the target data based on the unique identifier to obtain a target backup location of the target data; The target data is backed up based on the target backup location to obtain backup data.
5. The method according to claim 1, characterized in that The step of overwriting the target data based on the backup data in response to the data playback instruction to obtain the test data comprises: In response to the data playback instruction, the latest data within a preset time period in the backup data is obtained, where the preset time period is a time range between a current time point and a preset time point; Based on the latest data within the preset time period, the target data is overwritten to obtain test data.
6. The method according to claim 1, characterized in that The step of backing up the target data in response to the backup instruction for the target data updated in the source database to obtain the backup data comprises: In response to a backup instruction for target data updated in a source database, associated data of the target data is backed up to obtain backup data, wherein a second association relationship between the target data and the associated data is a logical relationship between a first rule and a second rule, wherein the first rule is a rule based on which the target data is constructed, and the second rule is a rule based on which the associated data is constructed.
7. A data preparation device, characterized in that: The device comprises: A data backup module, configured to respond to a backup instruction for target data updated in a source database, back up the target data to obtain backup data, wherein the target data includes data constructed based on rules; The data playback module is used to respond to the data playback instruction and overwrite the target data based on the backup data to obtain test data.
8. A data preparation device, characterized in that: The device comprises: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the data preparation method according to any one of claims 1 to 6.
9. A storage medium, characterized in that: The storage medium is a computer-readable storage medium. The storage medium is a computer-readable storage medium. A computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the data preparation method according to any one of claims 1 to 6 are implemented.
10. A computer program product, characterized in that The computer program product comprises a computer program, and when the computer program is executed by a processor, the steps of the method for data preparation according to any one of claims 1 to 6 are implemented.
