A method and device for generating test data

By obtaining the data table and associated information that match the target business rules, the test data is generated and modified, which solves the problems of high test data construction cost and high error rate in the existing technology, and achieves efficient test data generation.

CN112612813BActive Publication Date: 2024-09-17AGRICULTURAL BANK OF CHINA
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202011588709.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-12-29
Publication Date
2024-09-17
Estimated Expiration
2040-12-29

AI Technical Summary

Technical Problem

Existing test data construction methods need to first determine the associated information of each set of test data and then construct the data, which results in high labor costs and error-prone. Especially when there are many data tables and different field attributes in the banking system, the process of constructing the data is complex and costly. high.

Method used

By obtaining the data tables that match the target business rules, obtain the associated information and associated data items of each data table, generate positive target test data based on this information, and modify it to generate anti-target test data, narrow the scope of data construction, and reduce Analyze the relationships between tables and modify only key fields to reduce costs.

Benefits of technology

It reduces the cost and error rate of test data construction, improves the efficiency of data creation, reduces labor costs, and only modifies the corresponding fields according to business rules to fully consider the forward and reverse test data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112612813B
    Figure CN112612813B
Patent Text Reader

Abstract

The present invention provides a method and device for generating test data. The scheme captures data tables from a database as a candidate data set according to target business rules that match business needs, preliminarily screens the data tables in the database based on the target business rules, narrows the data construction scope, and reduces the data volume of the data tables that need to be analyzed. Therefore, the analysis of the association relationship between tables, the association information and the preset contracts in the target business rules are reduced, the associated data items of each data table in the candidate data set are determined, positive target test data are generated based on the associated data items, and then the target data items in the positive target test data are modified. During the modification process, the target data items are determined by the target business rules and only the corresponding fields are modified, and other fields that do not affect the test effect remain unchanged, thereby greatly reducing the number of fields that need to construct data, improving the efficiency of number generation, and reducing labor costs.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of computer, and in particular to a method and device for generating test data. Background Art

[0002] Test data is the basis of testing work. In order to improve the efficiency of testing, when testing financial systems, we always hope that the test data comes from real data in production. Due to the particularity of the banking industry, there is a large amount of sensitive data in the data of the financial system. In order to avoid the problems caused by information leakage, desensitization is often performed. The so-called desensitization is mainly some data processing rules. The sensitive privacy data involved is deformed through certain rules. Under the condition of not violating the system rules, some real data (such as ID number, mobile phone number, card number, etc.) is transformed for testing. However, most of the desensitized data cannot match the business rules well and cannot be used directly as test data. Therefore, an effective test data construction method is particularly important.

[0003] The existing test data construction methods mainly include: obtaining the generation rules of each group of test data in the multiple groups of test data to be generated, and the association information of each group of test data in the multiple groups of test data; determining the associated data items between each group of test data in the multiple groups of test data and other groups of test data based on the association information; and generating multiple groups of test data with consistent data content of the associated data items based on the data generation rules.

[0004] The above methods have the following disadvantages: first, the association information of each group of test data needs to be determined, then the associated data items are determined, and then the data is constructed. It is necessary to find two associations (including table associations and field associations), and each field of each table constructs data, involving many data tables and fields with different attributes. Different data is constructed according to different attributes, so the labor cost is too high. Summary of the invention

[0005] In view of this, an embodiment of the present invention provides a method and apparatus for generating test data, so as to reduce the construction cost of the test data.

[0006] To achieve the above objectives, the embodiments of the present invention provide the following technical solutions:

[0007] A method for generating test data, comprising:

[0008] Obtain data tables matching the target business rules from the database as candidate data sets;

[0009] Acquire association information of each field in each data table, wherein the association information is the field content of each field in the data table;

[0010] Based on the preset contract in the target business rule, obtain the associated data items in each data table that match the field content, wherein the associated data items are fields in each data table that have an associated relationship with the field content;

[0011] Generate positive target test data based on associated data items with associated relationships, and create positive number table parameters based on the positive target test data, wherein the positive number table parameter parameters include but are not limited to the number of data items of the positive target test data, the separator between fields, and the directory location information of data generation;

[0012] The target data items in the positive target test data are modified to obtain the reverse target test data, and the positive number table parameters are created based on the reverse target test data. The reverse number table parameter parameters include but are not limited to the number of data items in the reverse target test data, the separators between fields, and the directory location information of the data generation.

[0013] Optionally, in the above test data generation method, obtaining a data table matching the target business rule from a database includes:

[0014] First, obtain the shell script of the target business rule;

[0015] A data table matching the shell script in a database is obtained as a data table matching the target business rule.

[0016] Optionally, in the above test data generation method, the step of obtaining association information of each field in each data table includes:

[0017] Obtain target identification information;

[0018] Acquire a data table matching the target identification information;

[0019] The field content of each field in each data table matching the target identification information is obtained as the associated information, wherein the target identification information includes but is not limited to the user ID, bill ID, and loan number.

[0020] Optionally, in the above test data generation method, the step of obtaining the associated data items in each data table that match the field content based on the preset contract in the target business rule includes:

[0021] Capturing a definition of the target content in the associated information based on a preset contract in the target business rule;

[0022] Determine the definition of target content with associated relationship based on the preset contract;

[0023] The fields corresponding to the target contents that have an associated relationship and consistent definition are obtained as associated data items.

[0024] Optionally, in the above test data generation method, before generating positive target test data based on the associated data items having an associated relationship, the method further includes:

[0025] Adjust the definition of the field contents of the fields in the data table that have an associated relationship so that the definition of the field contents of the associated relationship is consistent.

[0026] A device for generating test data, comprising:

[0027] A data table capture unit obtains data tables matching the target business rules from the database as candidate data sets;

[0028] A correlation information acquisition unit, used to acquire correlation information of each field in each data table, wherein the correlation information is the field content of each field in the data table;

[0029] A related data item capture unit, used for acquiring related data items in each data table that match the field content based on the preset contract in the target business rule, wherein the related data items are fields in each data table that have a related relationship with the field content;

[0030] A test number generating unit generates positive target test data based on associated data items with associated relationships, and creates positive number table parameters based on the positive target test data, wherein the positive number table parameter parameters include but are not limited to the number of data items in the positive target test data, separators between fields, and directory location information of data generation; modifies the target data items in the positive target test data to obtain negative target test data, and creates positive number table parameters based on the negative target test data, wherein the negative number table parameter parameters include but are not limited to the number of data items in the negative target test data, separators between fields, and directory location information of data generation.

[0031] Optionally, in the above-mentioned test data generation device, when the data table capture unit obtains the data table matching the target business rule from the database, it is specifically used to:

[0032] First, obtain the shell script of the target business rule;

[0033] A data table matching the shell script in a database is obtained as a data table matching the target business rule.

[0034] Optionally, in the above-mentioned test data generation device, when the associated information capturing unit acquires the associated information of each field in each data table, it is specifically used to:

[0035] Obtain target identification information;

[0036] Acquire a data table matching the target identification information;

[0037] The field content of each field in each data table matching the target identification information is obtained as the associated information, wherein the target identification information includes but is not limited to the user ID, bill ID, and loan number.

[0038] Optionally, in the above-mentioned test data generation device, when the associated data item capture unit obtains the associated data items matching the field content in each data table based on the preset contract in the target business rule, it is specifically used to:

[0039] Capturing a definition of the target content in the associated information based on a preset contract in the target business rule;

[0040] Determine the definition of target content with associated relationship based on the preset contract;

[0041] The fields corresponding to the target contents that have an associated relationship and consistent definition are obtained as associated data items.

[0042] Optionally, the above test data generating device further includes:

[0043] The data adjustment unit is used to adjust the definition of the field content with the association relationship in each field in the data table before generating the positive target test data based on the associated data items with the association relationship, so that the definition of the field content with the association relationship is consistent.

[0044] Based on the above technical solution, in the above solution, data tables are captured from the database as candidate data sets according to target business rules that match business needs, and the data tables in the database are preliminarily screened based on the target business rules, thereby narrowing the scope of data construction and reducing the amount of data in the data tables that need to be analyzed. Therefore, the analysis of the association relationship between tables, the association information and the preset contracts in the target business rules are reduced, the associated data items of each data table in the candidate data set are determined, the positive target test data are generated based on the associated data items, and then the target data items in the positive target test data are modified. During the modification process, the target data items are determined by the target business rules and only the corresponding fields are modified, and other fields that do not affect the test results remain unchanged, thereby greatly reducing the number of fields that need to construct data, improving number-making efficiency, and reducing labor costs. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] In order to more clearly illustrate the embodiments of the present invention 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, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.

[0046] Figure 1 A flowchart of a method for generating test data disclosed in an embodiment of the present application;

[0047] Figure 2 A flowchart for obtaining the associated information disclosed in the embodiment of the present application;

[0048] Figure 3 A flowchart for obtaining associated data items disclosed in the embodiments of the present application;

[0049] Figure 4 This is a schematic diagram of the structure of a test data generating device disclosed in an embodiment of the present application. DETAILED DESCRIPTION

[0050] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0051] At present, in the test phases of unit testing, assembly testing, functional testing, performance testing, etc. of data analysis systems, test data from multiple data source systems are often required for testing. These data are generally transmitted to the data analysis system in the form of tables.

[0052] Due to the complexity of business logic, many data analysis systems often need to obtain data from multiple data source systems for corresponding processing when processing data. There are generally associations between the data of these data source systems (for example, there are data items with the same fields in the data tables of the two data source systems). Therefore, the test data used to test these data analysis systems also needs to meet these associations (if they do not meet them, the program cannot be executed for testing). In the banking system, a very common data processing logic needs to reference two sets of data in the customer information table and account table of the core banking system. During the test process, the data content of these two sets of data must be generated to generate two corresponding sets of test data, and the data content of the customer number data item in the two sets of test data must be kept consistent. In other words, the customer numbers of the two tables should be the same value (only the same value can be equal and can be considered to be associated, otherwise they cannot be associated if they are not the same value). In order to generate test data with associated data items, the general practice now is to manually generate numbers in each table (that is, each set of test data), and the consistency of the associated data is controlled by humans when generating numbers. This method of generating numbers is time-consuming and labor-intensive, and is very prone to errors. In addition, since different data source systems often belong to different development departments, it is necessary to coordinate different personnel from the two departments to generate data, which greatly increases the communication cost between the two systems. This is the case of generating data between two different systems. When test data from multiple systems is needed, the process and cost of generating data will become uncontrollable, which will seriously affect the test data generation of data systems.

[0053] In view of the above problems, an embodiment of the present invention provides a method for generating test data, which can generate multiple groups of test data with consistent data content of associated data items after only modifying key fields according to the data generation rules of each group of test data in the multiple groups of test data to be generated and the associated information of each group of test data. This reduces the problems of high personnel costs and high data error rate caused by manual number generation.

[0054] For details, see Figure 1 The method for generating test data disclosed in the embodiment of the present application may include:

[0055] Step S101: obtaining a data table matching the target business rule from a database as a candidate data set;

[0056] In this solution, the database is pre-imported with multiple types of data tables, which can be data tables created by staff in daily work. When it is necessary to generate test data matching a certain target business rule, the data table matching the target business rule is retrieved from the database, and the retrieved data table set is used as a candidate data set;

[0057] Step S102: Acquire association information of each field in each data table, wherein the association information is the field content of each field in the data table;

[0058] In this step, the field contents contained in each field of each data table in the candidate data set are extracted. For example, data table A contains fields A1, A2, and A3, and the associated information refers to the data contents contained in fields A1, A2, and A3.

[0059] Step S103: acquiring, based on the preset contract in the target business rule, associated data items in the respective data tables that match the field content, wherein the associated data items are fields in the respective data tables that have an associated relationship with the field content;

[0060] The contents of the above-mentioned fields may contain definitions of some special functions, which may be associated with the definitions of some functions in the contents of some fields in other data tables. The association relationship between these function definitions is recorded in the preset contract in the target business rule. For example, field A1 may contain the definition of function a1 as 0, and the functions associated with function a1 recorded in the preset contract are b1 and function c1. When the definition of function a1 is 0, the definition of function b1 and function c1 need to be 0. At this time, the contents of the fields containing function b1 and function c1 are obtained to determine whether function b1 is 0 and whether function c1 is 0. If function b1 is 0 and function c1 is 0, the fields corresponding to function b1 and function c1 are determined, and the fields corresponding to function b1 and function c1 and the field corresponding to function a1 are taken as fields with an association relationship, and these fields with an association relationship are taken as associated data items.

[0061] Step S104: generating positive target test data based on the associated data items with associated relationships, and creating positive number table parameters based on the positive target test data, wherein the positive number table parameter parameters include but are not limited to the number of data items of the positive target test data, the separator between fields, and the directory location information of data generation;

[0062] In this step, the associated data items with an associated relationship are used as positive target test data. In this solution, multiple positive target test data can be created. Each positive target test data corresponds to a different core field. Each positive target test data has one core field. Other fields in the positive target test data have an associated relationship with the core field. The positive target test data is the test data used by the test model to train the test results of the core field. When analyzing the reliability of the test model's test results of the core field, the positive target test data can be used to test the test model.

[0063] Step S105: modify the target data item in the positive target test data to obtain the negative target test data, and create the negative forged table parameters based on the negative target test data, wherein the negative forged table parameters include but are not limited to the number of data items in the negative target test data, the separator between fields, and the directory location information of the data generation;

[0064] During the testing process, in order to ensure the reliability of the test model, in addition to using positive test data to perform reliability testing on the test model, it is also necessary to use negative test data to perform reliability testing on the test model. Therefore, in this scheme, negative target test data can also be generated based on the positive target test data. When generating the negative target test data, the negative target test data can be obtained by modifying the value of the target data item in the positive target test data. By modifying the value of the target data item in the positive target test data, the definition of the function with an associated relationship in the positive target test data is inconsistent, thereby obtaining the negative target test data.

[0065] It can be seen from the above technical scheme that in the above scheme, data tables are captured from the database as candidate data sets according to target business rules that match business needs, and the data tables in the database are preliminarily screened based on the target business rules, thereby narrowing the scope of data construction and reducing the amount of data in the data tables that need to be analyzed. Therefore, the analysis of the association relationship between tables, the association information and the preset contracts in the target business rules are reduced, the associated data items of each data table in the candidate data set are determined, the positive target test data are generated based on the associated data items, and then the target data items in the positive target test data are modified. During the modification process, the target data items are determined by the target business rules and only the corresponding fields are modified, and other fields that do not affect the test results remain unchanged, thereby greatly reducing the number of fields that need to construct data, improving the efficiency of number generation, and reducing labor costs. At the same time, only modifying the corresponding fields according to the business rules can fully consider the positive and directional test data, thereby improving the adequacy of the test.

[0066] In the technical solution disclosed in the above embodiment of the present application, since different types of data tables correspond to different shell scripts, when obtaining a data table matching the target business rule from a database, the data table in the database can be obtained by analyzing the script of the data table. Specifically, the data table matching the target business rule obtained from the database includes:

[0067] First, obtain the shell script of the target business rule. Of course, the shell script is only an example proposed in the present application. According to different coding rules and programs, other scripts can also be used to replace the shell script; obtain a data table matching the shell script in the database as a data table matching the target business rule. Each data table will store one or more groups of test data. Since these test data are test data in the database, the generation rules of these data will inevitably comply with the data table generation rules. The data table generation rules include but are not limited to the field length, field type (such as date, number, character, etc.), number of decimal places, etc. of each data item.

[0068] In the technical solution disclosed in the above embodiment, the candidate data set corresponding to the target business rule can be directly obtained from the database, and the step of parsing the data generation rule configuration file according to the preset method to determine the data generation rule of each group of test data in multiple groups of test data and then separately generating the number generation step of each group of test data can be omitted. In this way, when it is necessary to generate test data of a data source system (the data source system is loaded with a test model to be tested) corresponding to different target business rules, developers or testers only need to search and obtain from the database to generate the corresponding test data, without the need to generate data for each field of each data table through the generation rule. Thereby, the method provided by the embodiment of the present invention can be applied to different test scenarios.

[0069] In the technical solution disclosed in the embodiment of the present application, the associated information refers to the field content included in the field in the data table, see Figure 2 In this solution, when obtaining the association information of each field in each data table, it can be obtained in the following way:

[0070] Step S201: Obtain target identification information;

[0071] In this solution, the target identification information may refer to a unique data item marked in a data table, and the target identification information includes but is not limited to a user ID, a bill ID, and a loan number.

[0072] Step S202: Acquire a data table matching the target identification information;

[0073] In this step, a data table matching the target identification information is obtained from the candidate data set, and the data tables in the candidate data set are classified according to the target identification information, and the classified data tables are made to correspond to one target identification information.

[0074] Step S203: acquiring the field content of each field in each data table matching the target identification information as association information;

[0075] In this step, each data table matching the target identification information may refer to all data tables in the candidate data set matching the user ID / billing ID / loan number, and then the field content of each field of these data tables is obtained.

[0076] In this solution, the association information is used to represent the data items that are related to each other in different fields of the same data table or in fields of different data tables. According to the description content of the association information, the specific contract provisions in the preset contract can quickly determine the various related information that are related to each other. The fields with related contents are recorded as related data items. For details, see Figure 3 , when determining the associated data item, it is specifically obtained through the following analysis:

[0077] Step S301: grabbing the definition of target content from each of the associated information;

[0078] In this step, after the association information is obtained, based on the preset contract in the target business rule, the target content and its definition are captured from the association information, the preset contract stipulates the target content to be captured and the contract content matching the target content, and the contract content is used to characterize the association relationship between the target content and other target contents;

[0079] In this step, the definition of the target content in the associated information is captured from the associated information. The target content may be one or more, and the target content may be understood as the function a1, function b1, and function c1 described in the above embodiment.

[0080] Step S302: determining target content with an associated relationship based on the preset contract;

[0081] In this solution, each of the associated contents may include one or more target contents and their definitions. Different target contents may be associated with each other. For example, the definition of one target content A1 is a1. According to the target contract, the definition of the target content B1 associated with it is b1. In this step, after a certain target content is obtained, other target contents associated with the target content are obtained from other associated information.

[0082] Step S303: Acquire the fields corresponding to the target contents that have an associated relationship and a consistent definition as associated data items;

[0083] In this solution, the target contract stipulates the definitions of each interrelated target content. For example, when one of the target contents A1 is defined as a1, according to the target contract, the definition of the target content B1 associated with it is b1. If in this solution, the definition of the collected target content A1 is a1, and the definition of the target content B1 is b1, then the field corresponding to the target content B1 is considered to be an interrelated field with the field corresponding to the target content A1, and these two fields are called associated data items.

[0084] In the technical solution disclosed in the embodiment of the present application, in order to ensure that the amount of test data is sufficient, the target content may be adjusted so that the definitions of the mutually related target contents are consistent, thereby increasing the amount of the positive target test data. Specifically, before generating the positive target test data based on the associated data items having the associated relationship, the method further includes:

[0085] Adjust the definition of the field contents of the fields in the data table that have an associated relationship so that the definition of the field contents of the associated relationship is consistent.

[0086] For example, the association information includes first association information and second association information, and a specific data item (target content) in the first association information is associated with a specific data item (target content) in the second association information. According to the generation rule of the specific data item in the first association information, the value of the specific data item in the first association information is modified, and then the data item value in the second association information that is an associated data item with the specific data item in the first association information is modified to the same value (or a value that satisfies the preset contract), and so on, each group of associated different data items is associated and modified, so that more test data that meets the rules can be obtained.

[0087] In the technical solution disclosed in another embodiment of the present application, after the positive target test data is created, in order to ensure the reliability of the test data, the generated positive target test data can also be checked to check whether the generated positive target test data meets the business needs. After that, the contract content of the business rules corresponding to the key data items in the checked positive target test data is analyzed, the corresponding field values ​​of the key data items are modified, and the forward and reverse case test data that meet the business rules are generated.

[0088] In this embodiment, corresponding to the above method, a device for generating test data is also disclosed. For the specific working content of each unit in the device, please refer to the content of the above method embodiment. The device for generating test data provided by the embodiment of the present invention is described below. The device for generating test data described below and the method for generating test data described above can be referenced to each other.

[0089] See also Figure 4 , a test data generating device provided in an embodiment of the present application may include:

[0090] The data table capture unit 100 corresponds to step S101 in the above method, and obtains a data table matching the target business rule from the database as a candidate data set;

[0091] The associated information capturing unit 200 corresponds to step S102 in the above method and is used to obtain the associated information of each field in each data table, wherein the associated information is the field content of each field in the data table;

[0092] The associated data item capturing unit 300 corresponds to step S103 in the above method, and is used to obtain the associated data items matching the field content in each data table based on the preset contract in the target business rule, and the associated data items are fields with associated relationships between the field contents in each data table;

[0093] A test number generating unit 400, which corresponds to steps S104 and S105 in the above method, generates positive target test data based on associated data items with associated relationships, and creates positive number table parameters based on the positive target test data, wherein the positive number table parameter parameters include but are not limited to the number of data items in the positive target test data, the separators between fields, and the directory location information of the data generation; modifies the target data items in the positive target test data to obtain negative target test data, and creates negative number table parameters based on the negative target test data, wherein the negative number table parameter parameters include but are not limited to the number of data items in the negative target test data, the separators between fields, and the directory location information of the data generation.

[0094] Corresponding to the above method, when the data table capturing unit obtains the data table matching the target business rule from the database, it is specifically used to:

[0095] First, obtain the shell script of the target business rule;

[0096] A data table matching the shell script in a database is obtained as a data table matching the target business rule.

[0097] Corresponding to the above method, when acquiring the association information of each field in each data table, the association information capturing unit is specifically used to:

[0098] Obtain target identification information;

[0099] Acquire a data table matching the target identification information;

[0100] The field content of each field in each data table matching the target identification information is obtained as the associated information, wherein the target identification information includes but is not limited to the user ID, bill ID, and loan number.

[0101] Corresponding to the above method, when the associated data item capturing unit acquires the associated data items in the respective data tables that match the field content based on the preset contract in the target business rule, it is specifically used to:

[0102] Capturing a definition of the target content in the associated information based on a preset contract in the target business rule;

[0103] Determine the definition of target content with associated relationship based on the preset contract;

[0104] The fields corresponding to the target contents that have an associated relationship and consistent definition are obtained as associated data items.

[0105] Corresponding to the above method, it also includes:

[0106] The data adjustment unit is used to adjust the definition of the field content with the association relationship in each field in the data table before generating the positive target test data based on the associated data items with the association relationship, so that the definition of the field content with the association relationship is consistent.

[0107] For the convenience of description, the above system is described as being divided into various modules according to their functions. Of course, when implementing the present invention, the functions of each module can be implemented in the same or multiple software and / or hardware.

[0108] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can refer to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system or system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can refer to the partial description of the method embodiment. The system and system embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without creative work.

[0109] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.

[0110] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.

[0111] It should also be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.

[0112] The above description of the disclosed embodiments enables one skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to one skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A method for generating test data, characterized in that: include: Obtain data tables matching the target business rules from the database as candidate data sets; Acquire association information of each field in each data table, wherein the association information is the field content of each field in the data table; Based on the preset contract in the target business rule, obtain the associated data items in each data table that match the field content, wherein the associated data items are fields in each data table that have an associated relationship with the field content; Generate positive target test data based on associated data items with associated relationships, and create positive number table parameters based on the positive target test data, wherein the positive number table parameter parameters include but are not limited to the number of data items of the positive target test data, the separator between fields, and the directory location information of data generation; Modify the target data item in the positive target test data to obtain the negative target test data, and create the negative forged table parameters based on the negative target test data, wherein the negative forged table parameters are generated but not limited to the number of data items in the negative target test data, the separator between fields, and the directory location information of the data generation; The step of obtaining the association information of each field in each data table includes: Obtain target identification information; Acquire a data table matching the target identification information; The field content of each field in each data table matching the target identification information is obtained as the associated information, wherein the target identification information includes but is not limited to the user ID, bill ID, and loan number.

2. The method for generating test data according to claim 1, characterized in that: The step of obtaining a data table matching the target business rule from the database includes: First, obtain the shell script of the target business rule; A data table matching the shell script in a database is obtained as a data table matching the target business rule.

3. The method for generating test data according to claim 1, characterized in that: The acquiring, based on the preset contract in the target business rule, the associated data items in the respective data tables that match the field content includes: Capturing target content and its definition from each of the associated information; Determine target content with an associated relationship based on the preset contract; The fields corresponding to the target contents that have an associated relationship and consistent definition are obtained as associated data items.

4. The method for generating test data according to claim 1, characterized in that: Before generating positive target test data based on the associated data items with the associated relationship, it also includes: Adjust the definition of the field contents of the fields in the data table that have an associated relationship so that the definition of the field contents of the associated relationship is consistent.

5. A test data generating device, characterized in that: include: A data table capture unit obtains data tables matching the target business rules from the database as candidate data sets; A correlation information grabbing unit, used to obtain correlation information of each field in each data table, wherein the correlation information is the field content of each field in the data table; A related data item capture unit, used for acquiring related data items in each data table that match the field content based on the preset contract in the target business rule, wherein the related data items are fields in each data table that have a related relationship with the field content; A test number generating unit generates positive target test data based on associated data items with associated relationships, and creates positive number table parameters based on the positive target test data, wherein the positive number table parameter parameters include but are not limited to the number of data items of the positive target test data, the separator between fields, and the directory location information of the data generation; Modify the target data item in the positive target test data to obtain the negative target test data, and create the negative forged table parameters based on the negative target test data, wherein the negative forged table parameters are generated but not limited to the number of data items in the negative target test data, the separator between fields, and the directory location information of the data generation; When acquiring the association information of each field in each data table, the association information capturing unit is specifically used to: Obtain target identification information; Acquire a data table matching the target identification information; The field content of each field in each data table matching the target identification information is obtained as the associated information, wherein the target identification information includes but is not limited to the user ID, bill ID, and loan number.

6. The test data generating device according to claim 5, characterized in that: When the data table fetching unit obtains the data table matching the target business rule from the database, it is specifically used to: First, obtain the shell script of the target business rule; A data table matching the shell script in a database is obtained as a data table matching the target business rule.

7. The test data generating device according to claim 5, characterized in that: When the associated data item capturing unit acquires the associated data items in the respective data tables that match the field content based on the preset contract in the target business rule, it is specifically used to: Capturing target content and its definition from each of the associated information; Determine target content with an associated relationship based on the preset contract; The fields corresponding to the target contents that have an associated relationship and consistent definition are obtained as associated data items.

8. The test data generating device according to claim 5, characterized in that: Also includes: The data adjustment unit is used to adjust the definition of the field content with the association relationship in each field in the data table before generating the positive target test data based on the associated data items with the association relationship, so that the definition of the field content with the association relationship is consistent.