Test data generation method and device based on multi-time dimension recognition, and medium

By adopting a test data generation method based on multiple time dimensions, the problem of test data distortion was solved, accurate simulation of periodic changes was achieved, the authenticity and reliability of test data were improved, and potential system problems were exposed.

CN121116849BActive Publication Date: 2026-02-27ZHEJIANG ZHENSHU TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202511648802.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-11-12
Publication Date
2026-02-27
Estimated Expiration
2045-11-12

AI Technical Summary

Technical Problem

Existing technologies cannot accurately simulate real-world business patterns in test data, resulting in distorted test datasets that fail to reflect true cyclical trends and affect the accuracy of business intelligence analysis and reports.

Method used

A multi-time-dimensional test data generation method is adopted. By creating a system configuration table, defining the data generation rules of the target table, segmenting the date types and specifying the fluctuation coefficient, inserting initial data records, and using the fluctuation algorithm to generate test data, the actual fluctuation of the data in different time periods is ensured to conform to the actual business rules.

Benefits of technology

It improves the authenticity and reliability of test data, can expose performance bottlenecks and resource contention deadlocks under high pressure, achieves accurate simulation of periodic fluctuations, and enhances the effectiveness of testing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121116849B_ABST
    Figure CN121116849B_ABST
Patent Text Reader

Abstract

The present application relates to the field of test data calculation, in particular to the optimization of the authenticity of test data generation process. The present application provides a test data generation method based on multi-time dimension recognition, which comprises: dividing a date field into different date segment types, and specifying the fluctuation coefficient k corresponding to each date segment type; during the date cycle constituted by the start date field and the end date field, generating test data, performing date recognition on the date, identifying the date segment type into which the date falls, and generating the numerical value of the fluctuation numerical value field according to the corresponding fluctuation coefficient k and the reference value x using a fluctuation algorithm. The purpose of the present application solves the defect that the traditional test data is too smooth, can take the time period characteristics as an explicit test dimension, and improves the authenticity and reliability of the test data, which helps to expose performance bottlenecks, resource competition deadlocks or concurrent processing errors that only appear under high pressure.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of test data calculation, in particular to the optimization of the authenticity of test data generation process. BACKGROUND

[0002] Test data refers to a data set artificially or automatically generated in the software development and system testing stage to verify the function, performance, reliability and security of software, which simulates the real environment. Its core feature is its pertinence and simulation, which aims to trigger the preset system behavior in a specific test scenario to verify the correctness of the program logic. And the test scenario is extensive, such as tourism and travel scenario, business intelligence scenario, e-commerce retail scenario, education and technology scenario.

[0003] In the generation stage of test data, the industry mainly uses template scheme to generate data. For example, the Chinese patent document with publication number CN120448284A discloses a method for generating massive database table test data based on configuration. In this method, based on standardized table metadata, a data generation template is obtained; the data generation template is modified according to the target demand to generate a target data generation template. Finally, test data is generated based on the template and the preset rules.

[0004] The advantage of this technical solution is that a large amount of test data can be quickly and efficiently generated through templates. However, this technical solution has the defect of test data authenticity.

[0005] Specifically, the generated test data cannot accurately simulate the business rules of the real world. The fluctuation of the test data is only random noise, which cannot reflect the real and predictable periodic change trend, making the test data set distorted. Further, for systems that rely on time series data for business intelligence analysis and reporting, such as calculating week-on-week, daily average, and weekend proportion, reports generated based on uniform or random fluctuation data will not reflect the real business insight. The test cannot verify the accuracy of these analysis reports when processing periodic fluctuation data, which may lead decision makers to make wrong judgments based on distorted test reports, making the test meaningless. SUMMARY

[0006] The purpose of the present application is to provide a test data generation method, device and medium based on multi-time dimension recognition, which solves the defect of traditional test data being too smooth and can take the time period characteristics as an explicit test dimension. On the one hand, it improves the authenticity and reliability of test data, and on the other hand, it helps to expose performance bottlenecks, resource competition deadlocks or concurrent processing errors that only appear under high pressure, such as database connection pool depletion and cache avalanche.

[0007] According to a first aspect of the present disclosure, a test data generation method based on multi-time dimension recognition is provided, the method comprising:

[0008] creating a system configuration table;

[0009] defining a data generation rule of a target table, the generation rule including a date field, a data start date field, a data end date field, and a fluctuation value field;

[0010] dividing the date field into different date segment types and specifying a fluctuation coefficient k corresponding to each date segment type;

[0011] inserting an initial data record into the target table, the initial data record including a reference value x,

[0012] generating test data during a date cycle formed by the data start date field and the end date field, performing date identification on the dates, identifying the date segment types into which the dates fall, and generating values of the fluctuation value field using a fluctuation algorithm according to the corresponding fluctuation coefficient k and the reference value x.

[0013] According to a second aspect of the present disclosure, a test data generation device based on multi-time dimension identification is provided, and the device includes:

[0014] a system configuration table creation module;

[0015] a target table definition module configured to define a data generation rule of a target table, the generation rule including a date field, a data start date field, a data end date field, and a fluctuation value field;

[0016] a segmenting module configured to divide the date field into different date segment types and specify a fluctuation coefficient k corresponding to each date segment type;

[0017] an initial data record editing module configured to insert an initial data record into the target table, the initial data record including a reference value x,

[0018] a test data generation module configured to generate test data during a date cycle formed by the data start date field and the end date field, perform date identification on the dates, identify the date segment types into which the dates fall, and generate values of the fluctuation value field using a fluctuation algorithm according to the corresponding fluctuation coefficient k and the reference value x.

[0019] According to a third aspect of the present disclosure, an electronic device is provided, including one or more processors, and a memory associated with the one or more processors, the memory being configured to store program instructions, the program instructions being configured to perform the method according to the first aspect when read and executed by the one or more processors.

[0020] According to a fourth aspect of the present disclosure, a computer program product is provided, comprising a computer program which, when executed by a processor, implements the method according to the first aspect.

[0021] It should be understood that any reference in this summary to a "one embodiment" or "the embodiment" or "an embodiment" or "one implementation" or "the implementation" or "an implementation" means that a particular feature, structure, or characteristic described in connection with that embodiment is included in at least one implementation of the disclosure. The appearance of the phrases "in one embodiment" or "in the embodiment" or "in an embodiment" or "in one implementation" or "in the implementation" or "in an implementation" in various places in this specification are not necessarily all referring to the same embodiment, nor are they necessarily referring to a single implementation. Furthermore, the particular features, structures, or characteristics can be combined in any suitable manner in one or more implementations. BRIEF DESCRIPTION OF DRAWINGS

[0022] Figure 1 Flowcharts of some embodiments of the present specification are shown;

[0023] Figure 2 Flowcharts of some embodiments of the present specification are shown;

[0024] Figure 3 A structural schematic diagram of an electronic device of some embodiments of the present specification is shown. DETAILED DESCRIPTION

[0025] The present application will be further described below in conjunction with the accompanying drawings.

[0026] The technical solutions in the embodiments of the present specification will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present specification.

[0027] The terms "first", "second", "third", etc. in the specification and claims of the present specification and the above drawings are used to distinguish different objects, rather than to describe a particular order. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product or device including a series of steps or units is not limited to the listed steps or units, but can optionally include steps or units not listed, or can optionally include other steps or units inherent to the process, method, product or device.

[0028] The following description provides examples, and does not limit the scope, applicability or examples set forth in the claims. Changes can be made in the function and arrangement of described elements without departing from the scope of the present specification. Various examples can omit, substitute or add various procedures or components as appropriate. For example, the described methods can be performed in a different order than described, and various steps can be added, omitted or combined. In addition, features described with respect to some examples can be combined in other examples.

[0029] Embodiments of the present disclosure provide a test data generation method based on multi-time dimension recognition, Figure 1A flow chart of the test data generation method based on multi-time dimension recognition of the embodiments of the present specification is shown. Hereinafter, the specific operation steps of the method 100 are exemplarily explained by taking the test data generation of the business volume and turnover of a commercial body as an example.

[0030] In block 101, the method 100 can create a system configuration table and deploy a data generation stored procedure.

[0031] This step is similar to the prior art, and a SQL statement is executed in the database to create a system configuration table named y_sys_create_test_data_conf.

[0032] The y_sys_create_test_data_conf configuration table is the core carrier of the configuration. Exemplarily, the table structure design can be as follows: the table name is y_sys_create_test_data_conf.

[0033] The storage engine is InnoDB, the character set is utf8mb4, and the following fields are included:

[0034] The id field is a bigint(20) auto-increment primary key,

[0035] The v_table_schema field varchar(100) stores the target database name,

[0036] The v_table_name field varchar(100) stores the target table name,

[0037] The v_cycle_field field varchar(100) stores the time cycle field name,

[0038] The v_change_fields field varchar(1000) stores the list of data fields that need to be changed, and multiple fields are separated by English commas,

[0039] The v_start_date field date type stores the data generation start date,

[0040] The v_end_date field date type stores the data generation end date,

[0041] The percent_group_by_fields field varchar(1000) stores the percentage grouping fields,

[0042] The percent_field field varchar(100) stores the percentage calculation field,

[0043] The percent_max field int(11) stores the percentage maximum value, which is 1 or 100,

[0044] The percent_decimals field int(11) stores the number of decimal places,

[0045] The data_field field varchar(255) stores the basic data field,

[0046] The rate_fields field varchar(1000) stores the list of rate calculation fields,

[0047] The rate_type field varchar(1000) stores the corresponding rate type code,

[0048] The valid field tinyint(1) stores the configuration validity flag,

[0049] The create_time field datetime records the configuration creation time.

[0050] The stored procedure p_create_test_data is deployed to the database. This procedure is the execution engine of the system, which internally uses a cursor (DECLARE cur_conf CURSOR FOR...) to iterate through all valid (valid=1) records in the configuration table, and performs standardized processing procedures for each record.

[0051] In block 102, define the rules for the target table.

[0052] The target table is the table that needs to generate test data. Here, the example is the same as above, which is a summary table for simulating business sales and user flow. At this time, the rules need to be defined for the target table.

[0053] The definition content can be:

[0054] v_table_name: 'daily_sales_summary', specifies the target table name.

[0055] v_cycle_field:'sale_date'. Specifies the date field, here sale_date is the date field, and the system will judge the working day / weekend based on this field.

[0056] v_change_fields:'sale_amount, user_count'. Specifies the fluctuation value, that is, which numerical field needs to fluctuate with time, here it is sales amount sale_amount and user count user_count.

[0057] v_start_date: '2024-01-01'. Specifies the start date for data generation, which is January 1, 2024.

[0058] v_end_date: '2024-01-31' specifies the end date for data generation, which is January 31, 2024.

[0059] At this point, the core rules for generating the target table have been statically defined. The definition above states: For the `sale_date` field of the `daily_sales_summary` table, generate one record per day from January 1st to 31st, and ensure that the `sale_amount` and `user_count` fields fluctuate.

[0060] In box 103, an initial data record needs to be inserted, which provides the baseline value X.

[0061] Insert at least one initial data record into the target table. This record provides a baseline value X for data generation, which will be used as the basis for subsequent fluctuation algorithms. The initial data record is also known as the basic seed data.

[0062] For example, manually insert one or more "seed data" records into the `daily_sales_summary` table. Insert a record with `sale_date` of '2024-01-01', `sale_amount` of 10000, and `user_count` of 1000. Subsequent dates' data will be generated based on this record, with fluctuations applied through an algorithm. The system will read this data as the baseline for calculations.

[0063] In box 104, the date will be correctly identified and automatically generated. Deploy and invoke the execution engine to start the automated pipeline. Start the stored procedure named p_create_test_data by executing the database scheduling event or manually by calling the command CALL p_create_test_data();, and the entire test data generation process officially begins.

[0064] Box 104 is also a core step of the present invention, which is divided into the following sub-steps:

[0065] The time format recognition sub-step involves the stored procedure first reading the configuration and finding the value 'sale_date' in the v_cycle_field. It then executes a query to retrieve an existing value for this field from the target table, such as '2024-01-01'.

[0066] Then, a time format identifier needs to be called to effectively identify the format of this time date. Specifically, the identifier is integrated in the stored procedure p_create_test_data, and is realized by the combination of CHAR_LENGTH function and conditional judgment structure. Its construction features include: CHAR_LENGTH(@VAR_CYCLE_FIELD_VALUE) length detector, connected with IF-ELSEIF multi-branch conditional structure, each branch corresponding to a specific time format: length of 8 bits triggers yyyyMMdd format processing branch, length of 10 bits triggers yyyy-MM-dd format processing branch, length of 6 bits triggers yyyyMM format processing branch, length of 7 bits triggers yyyy-MM format processing branch, length of 4 bits triggers yyyy format processing branch. Each branch outputs the corresponding format string through the DATE_FORMAT function to realize automatic identification and format matching of the time dimension. That is, according to the identification result, automatically select the DATE_FORMAT format string: '%Y%m%d', '%Y-%m-%d', '%Y%m', '%Y-%m', '%Y', to ensure that the time data format is completely consistent with the target table.

[0067] At this time, '2024-01-01' is 10 bits, after the time format identifier is identified, the yyyy-MM-dd format processing branch is triggered, and accordingly it is determined that the subsequent data should be generated in cycles with "day" as the interval.

[0068] Data cycle generation sub-step.

[0069] The system enters a loop, starting from v_start_date (2024-01-01) to v_end_date (2024-01-31), and processing one day at a time.

[0070] Date segment division and data fluctuation sub-step.

[0071] This sub-step is to divide these time dates into different date segments according to the preset rules, and the date segment is two or more. Exemplarily, the date segment is divided into two here, which are date segment one, i.e. weekend date segment, and date segment two, i.e. non-weekend date segment.

[0072] Specifically, the built-in function DAYOFWEEK() can be called to determine what day of the week this date is. In MySQL, DAYOFWEEK('2024-01-06') returns 7, representing Saturday. DAYOFWEEK('2024-01-07') returns 1, representing Sunday.

[0073] In this sub-step, the fluctuation coefficient k of different date segments is assigned according to the preset rules. Specifically, the system executes IF DAYOFWEEK(@VAR_DATE) IN (1, 7) THEN... The condition is true (1 and 7 represent Sunday and Saturday), so the system dynamically assigns the fluctuation coefficient k1 a value of 0.25. If it is a weekday, assign k2 = 0.15.

[0074] Subsequently, the fluctuation algorithm sub-step.

[0075] The system reads the base value from the base data described above and calculates it in combination with the fluctuation coefficient k. For example, read the base value X = 10000 of sale_amount, and the currently determined fluctuation coefficient k = 0.25.

[0076] Execute the mathematical model Y = ROUND(RAND()*k*X+X, 0).

[0077] RAND() generates a random number with a value range of 0-1, assuming 0.8. The function of the ROUND function is to round a number to a specified number of decimal places.

[0078] Calculation: Y = ROUND(0.8*0.25*10000+10000, 0) = ROUND(2000+10000, 0) = 12000.

[0079] After calculation, the system generates a sale_amount value of 12000 for the data of 2024-01-06. Similarly, generate the value of the user_count field.

[0080] Subsequently, the system writes the generated data containing the date 2024-01-06 and the calculated field value into the daily_sales_summary table. The loop continues to process the next day (e.g. 2024-01-07, Sunday), and repeats the above process of matching different fluctuation coefficients according to different date segments to calculate the corresponding values until the date loop is completed, i.e. 2024-01-31 is processed, and the process ends.

[0081] Looking at the daily_sales_summary table, it can be found that all data on Saturday and Sunday, i.e. date segment one, has a larger random fluctuation in the values of fields such as sale_amount and user_count compared to weekdays, i.e. date segment two. During the entire process, the administrator only needs to configure the rules initially and does not need to manually specify which day is the weekend. The system efficiently realizes dynamic identification of time and achieves the technical effect of weekend adjustment.

[0082] In addition, in this step, the definition of the date segment type and the definition of the corresponding k value of each date segment are completed by the staff and can be defined in the 102 block above.

[0083] This scheme solves the defect of traditional test data being too smooth. Real-world business data (such as e-commerce sales, APP daily active, traffic flow, energy consumption) generally has a weekend effect. This mechanism has this rule built in through an algorithm.

[0084] In addition, taking the time period characteristic as an explicit test dimension can discover system defects that only appear under specific time pressure. For example, when performing load stress testing, the system will run under simulated weekend peak load. This helps to expose performance bottlenecks, resource contention deadlocks, or concurrent processing errors that only occur under high pressure, such as database connection pool depletion, cache avalanche, etc.

[0085] Moreover, this mechanism is fully automatic and does not require the test staff to manually adjust or write specific code to simulate weekends each time.

[0086] In certain embodiments of the present disclosure, a data self-correction mechanism is also adopted, as shown in Figure 2

[0087] The data self-correction mechanism is to ensure that the percent values (percent_field) of each record in a set of data, after rounding according to the specified precision, have a total that is strictly equal to the configured maximum value percent_max, which is usually 100 or 1.

[0088] If a set of percentages is simply rounded, the total will often be 99.98%, 100.01%, etc., rather than the exact 100%. This is not suitable for testing financial, statistical, and other applications that have very high requirements for data consistency. This mechanism is encapsulated in the stored procedure p_create_test_data and runs as a standard sub-process. Its core is three consecutive SQL UPDATE operations

[0089] For example, when generating test data for daily_sales_summary, the system identifies that there is percentage format data, i.e., the percent_field field is not empty, and the mechanism is started.

[0090] The execution of this mechanism is shown in Figure 2

[0091] ​​The system calculates the difference (dif) between the sum of the original percentages and 100% for each group, and then distributes the difference evenly to each record in the group. For example, the total difference is calculated as (100 - SUM(percent_field)) (e.g., 100 - 111.111... = -11.111...).

[0092] Then, / COUNT(*) distributes the total difference evenly to each member in the group (e.g., -11.111... / 3 ≈ -3.7037). UPDATE... SET a.percent_field = a.percent_field + b.dif performs the update.

[0093] For example, the dept_id of this group of data is A, B, and C, and the initial percentage values are 33.333…, 55.555…, and 22.222…, respectively. After adding the difference of -3.7037, ABC becomes approximately 29.6296, 51.8519, and 18.5185, respectively. The sum of these three values is very close to 100%, but not exactly 100%.

[0094] In block 202, the result of block 201 is rounded to the configured precision percent_decimals, such as 2 decimal places, to meet the display or storage requirements.

[0095] The specific implementation can call the function to control the decimal places by UPDATE table SET percent_field=ROUND(percent_field,decimals)

[0096] At this time, the values of ABC have new errors due to the control of rounding. It is possible that the sum is exactly 100%, or there may be a new error of -0.01% or +0.01%.

[0097] In block 203, the new error generated in the previous step is adjusted again to solve the new small error (-0.01% or +0.01%) generated after the second rounding, ensuring the absolute accuracy of the sum.

[0098] The system calculates the residual difference (100 - SUM(ROUND(percent_field, 2))) between the sum of the rounded percentages and 100% for each group, assuming it is -0.01.

[0099] The system identifies the record with the largest percentage value in each group, and precisely compensates the residual difference to this record with the largest value, which has the least impact on the data distribution. For example, -0.01 is compensated to the B data described above. At this point, the group percentage sum is precisely calibrated to 100% after three layers of correction.

[0100] In some embodiments of the present disclosure, an automatic rate calculation design is also adopted.

[0101] The automatic rate calculation function is implemented through a dynamic SQL construction mechanism. As described above, the v_table_schema field in the configuration table stores the target database name, the field stores the target table name, the field defines the loop field, the changing field is defined by connecting the data fields that need to change over time with English commas, the start date and end date fields determine the time range of data generation, the percentage grouping field defines the percentage calculation grouping field, the percentage field specifies the percentage field, the percentage type field sets the percentage maximum value (1 or 100), the precision field defines the precision, and the data field stores the basic data field.

[0102] The rate_fields field defines the rate calculation field, and the scale type field defines the rate type through numerical coding. For example, 1 represents daily data compared with the previous month, 2 represents daily data compared with the previous year, 3 represents monthly data compared with the previous month, 4 represents monthly data compared with the previous year, 5 represents annual data compared with the previous year, and 6 represents the proportion.

[0103] The type code identifier (rate_type field) triggers different calculation logics according to the coding values 1-6: type 1 performs daily data compared with the previous month calculation, type 2 performs daily data compared with the previous year calculation, type 3 performs monthly data compared with the previous month calculation, type 4 performs monthly data compared with the previous year calculation, type 5 performs annual data compared with the previous year calculation, and type 6 performs proportion calculation. Each type corresponds to a specific SQL template, which processes month calculation through the LEFT(DATE_ADD()) function and proportion calculation through the SUM() function in a subquery.

[0104] In this way, complex business calculation logics such as comparison, proportion, and proportion are separated from hard coding and converted into simple numerical coding (1-6) and configuration fields. Users do not need to understand or modify complex SQL codes, but only need to specify rate_type and rate_fields in the configuration table to achieve completely different calculation goals. In addition, each calculation type (1-6) corresponds to a pre-designed and verified standardized "SQL template". This avoids logic inconsistency, inconsistent standards, or errors caused by different personnel manually writing SQL.

[0105] In some embodiments of the present disclosure, there is a design of automatic execution. The automation execution framework realizes the timing task through the event scheduler: the e_create_test_data1 event is created to automatically increase the end date in the configuration table by one day at a predetermined time, for example, 7 o'clock, and the e_create_test_data2 event is created to automatically call the p_create_test_data stored procedure to execute data generation at a predetermined time, for example, 7:01, and the event scheduler is started through set global event_scheduler = 1, to realize the continuous automatic generation of data.

[0106] In the above embodiments, all or part of them can be realized by software, hardware, firmware or any combination thereof. When realized by software, all or part of them can be realized in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of the present specification are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in or transmitted by a computer-readable storage medium. The computer instructions can be transmitted from one website, computer, server or data center to another website, computer, server or data center through a wired (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (such as infrared, wireless, microwave, etc.) manner. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server, data center, etc. integrated with one or more available media sets. The available medium can be a magnetic medium (for example, a floppy disk, a hard disk, a magnetic tape), an optical medium (for example, a digital versatile disc (DVD)), or a semiconductor medium (for example, a solid state disk (SSD)) and the like.

[0107] Figure 3 A block diagram of an electronic device 300 in which a plurality of embodiments of the present disclosure can be implemented is shown. As Figure 3As shown, the device 300 includes a processor 301 that can execute various appropriate actions and processes according to computer program instructions stored in a read-only memory (ROM) 302 that are loaded into a random access memory (RAM) 303. Various programs and data required for operation of the device 300 can also be stored in the RAM 303. The processor 301, the ROM 302, and the RAM 303 are connected to each other through a bus 304. An input / output (I / O) interface 305 is also connected to the bus 304.

[0108] The various processes and processes described above, such as the method 100, can be performed by the processor 301. For example, in some embodiments, the method 100 can be implemented as a software program tangibly embodied in a machine-readable medium. In some embodiments, part or all of the software program can be loaded and / or installed on the device 300 via the ROM 302. When the software program is loaded into the RAM 303 and executed by the processor 301, one or more actions of the method 100 described above can be performed.

[0109] Program code for carrying out methods of the present disclosure can be written in any combination of one or more programming languages. The program code can be provided to a processor or controller of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the program code, when executed by the processor or controller, produces the functions / operations specified in the flowcharts and / or block diagrams. The program code can be entirely executed on a machine, partially executed on a machine, partially executed on a machine as a standalone software package and partially executed on a remote machine, or entirely executed on a remote machine or server.

[0110] In the context of this disclosure, a machine-readable medium can be a tangible medium that contains or stores a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include but is not limited to an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium will include one or more lines of electrical connections, portable computer disks, hard disk drives, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or Flash memory), optical fiber, portable compact disc read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination of the foregoing. Further, while operations are depicted in a particular, chronological sequence, this should not be understood as requiring such order or sequence of operations, or that all illustrated operations be performed to achieve desirable results. In certain circumstances, multitasking and parallel processing can be advantageous. Likewise, while specific implementations are discussed herein, the scope of the present disclosure is not limited to the specific details and representations herein. Certain features described in the context of separate embodiments can also be implemented in combination in a single embodiment. Conversely, various features described in the context of a single embodiment can also be implemented in multiple embodiments separately or in any suitable sub-combination.

[0111] Although the subject matter has been described in language specific to structural features and / or methodological acts, it is to be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are disclosed as example forms of implementing the claims.

Claims

1. A test data generation method based on multi-time dimension identification, characterized in that, The method includes: Create a system configuration table; Define the data generation rules for the target table, which include a date field, a data generation start date field, a data generation end date field, and a fluctuation value field; Divide the date field into different date segment types and specify the fluctuation coefficient k for each date segment type; Insert initial data records into the target table, the initial data records containing a baseline value X. During the date cycle formed by the data generation start date field and the data generation end date field, test data is generated, the dates are identified, the date segment type they fall into is identified, and the value of the fluctuation value field is generated using the fluctuation algorithm according to the corresponding fluctuation coefficient k and the benchmark value X. In the process of generating the value of the fluctuation numerical field using the fluctuation algorithm based on the corresponding fluctuation coefficient k and the benchmark value X: Read the baseline value X and the corresponding volatility coefficient k, use the rand function to generate random numbers, and execute the mathematical model Y = ROUND(RAND() * k * X + X, 0), where Y is the value of the volatility field.

2. The test data generation method based on multi-time dimension identification according to claim 1, characterized in that: The date format recognizer is used to identify the format of the values ​​in the date field, and the year processing branch, month processing branch, and day processing branch are triggered based on the recognition result.

3. The test data generation method based on multi-time dimension identification according to claim 2, characterized in that, The method further includes: the time format recognizer includes a length detector, which triggers a day processing branch when the numerical length in the date field is 8 or 10 digits; triggers a month processing branch when the numerical length is 6 or 7 digits; and triggers a year processing branch when the numerical length is 4 digits.

4. The test data generation method based on multi-time dimension identification according to claim 1, characterized in that, The method further includes: When the generated test data package contains percentage values, a data self-correction mechanism is used to ensure that the sum of the percentage values ​​of each record in the same data set is equal to 100% after rounding to the specified precision.

5. The test data generation method based on multi-time dimension identification according to claim 4, characterized in that: In the process of employing a data self-correction mechanism to ensure that the sum of the percentage values ​​of all records within the same data set, after rounding to a specified precision, equals 100%, By identifying the percent_field field, it can be determined whether the value is in percentage format. Group by dept_id, calculate the difference between the sum of the original percentages in each group and 100%, and distribute this difference evenly among the data records in the group; The corrected result is rounded to the nearest percent using the configured precision percent_decimals; The remaining difference between the sum of the rounded percentages of each group and 100% is calculated again, and the remaining difference is used to compensate the data record with the largest percentage value in that group.

6. A test data generation device based on multi-time dimension recognition, characterized in that, The device includes: System configuration table creation module; The target table definition module is configured to define data generation rules for the target table. The generation rules include a date field, a data generation start date field, a data generation end date field, and a fluctuation value field. The segmentation module is configured to divide the date field into different date segment types and specify the fluctuation coefficient k corresponding to each date segment type; The initial data record editing module is configured to insert initial data records into the target table, the initial data records containing a base value X. The test data generation module is configured to generate test data during the date cycle formed by the data generation start date field and the data generation end date field, perform date identification on the date, identify the date segment type it falls into, and generate the value of the fluctuation value field using a fluctuation algorithm based on the corresponding fluctuation coefficient k and the benchmark value X. In the process of generating the value of the fluctuation numerical field using the fluctuation algorithm based on the corresponding fluctuation coefficient k and the benchmark value X: Read the baseline value X and the corresponding volatility coefficient k, use the rand function to generate random numbers, and execute the mathematical model Y = ROUND(RAND() * k * X + X, 0), where Y is the value of the volatility field.

7. The test data generation device based on multi-time dimension recognition according to claim 6, characterized in that, The device further includes a percentage correction module, configured to employ a data self-correction mechanism when the generated test data packet contains percentage values, to ensure that the sum of the percentage values ​​of each record in the same group of data, after being rounded to a specified precision, equals 100%.

8. An electronic device, comprising: One or more processors, and A memory associated with the one or more processors, the memory being used to store program instructions that, when read and executed by the one or more processors, perform the steps of the test data generation method based on multi-time dimension identification as described in any one of claims 1-5.

9. A computer program product, comprising a computer program that, when executed by a processor, implements the test data generation method based on multi-time dimension identification according to any one of claims 1-5.

Citation Information

Patent Citations

  • Method and device for generating mass database table test data based on configuration

    CN120448284A

  • Test data generation method and device, electronic equipment and storage medium

    CN110908891A

  • Power transformer detection and energy efficiency evaluation method and system based on model analysis

    CN120724825A