Realistic data generation method, device, and storage medium

By loading external configuration files and recursively constructing data skeletons, realistic test data containing both normal and abnormal data is generated. This solves the problems of insufficient flexibility and coverage in test data generation in existing technologies, and achieves efficient and highly realistic test data generation.

CN122240511APending Publication Date: 2026-06-19SHENZHEN SHIXI TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
SHENZHEN SHIXI TECH CO LTD
Filing Date
2026-05-21
Publication Date
2026-06-19

Smart Images

  • Figure CN122240511A_ABST
    Figure CN122240511A_ABST
Patent Text Reader

Abstract

This application discloses a method, device, and storage medium for generating simulated data, relating to the field of data engineering technology. The method includes: creating a data generation task based on a global configuration object, with the data generation task associated with a data structure template; during the execution of the data generation task, recursive construction is performed according to the probability model and structural constraint information in the associated data structure template to generate a data skeleton to be filled; based on the field name generation strategy, distortion rate parameter, field content generation strategy, and distortion generation strategy in the data structure template, key placeholders and value placeholders in the data skeleton are filled to obtain a structured data object containing normal and abnormal data; and serialization processing is performed on the structured data object according to the target output format to obtain simulated data. This solves the technical problem that existing technologies cannot efficiently generate simulated test data with dynamically variable structures that contains both normal and abnormal data, achieving efficient and high-fidelity simulated data generation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the fields of software testing and data engineering technology, and in particular to a method, apparatus and storage medium for generating realistic data. Background Technology

[0002] In current software system testing scenarios, especially in microservice architectures, big data platforms, and high-concurrency systems, mainstream test data generation tools, such as the Python-based Faker library or JavaScript-based Mock.js, typically hard-code data structure definitions and generation logic into scripts, resulting in severely insufficient configuration flexibility. When business requirements change (e.g., adding fields, adjusting nesting levels, or introducing abnormal data scenarios), the source code must be modified and redeployed, leading to high development costs and making it difficult for non-technical personnel to participate in strategy adjustments. Furthermore, these test data generation tools lack the systematic ability to generate abnormal or "dirty" data, tending to output only normal data conforming to preset specifications and failing to automatically construct abnormal data. This makes it difficult to efficiently generate realistic test data that combines high throughput, dynamically variable structure, and includes both normal and abnormal data, failing to meet the data requirements for system function verification, stress testing, and chaos testing in complex scenarios.

[0003] The above content is only used to help understand the technical solution of this application and does not represent an admission that the above content is prior art. Summary of the Invention

[0004] The main objective of this application is to provide a method, device, and storage medium for generating realistic data, aiming to solve the technical problem that existing technologies cannot efficiently generate realistic test data with dynamically variable structures that include both normal and abnormal data.

[0005] To achieve the above objectives, this application proposes a method for generating realistic data, the method comprising: Load an external configuration file, parse the external configuration file and map it to a structure in memory to obtain a global configuration object, which includes a target output format and at least one data structure template; A data generation task is created based on the global configuration object, and the data generation task is associated with a data structure template. When performing the data generation task, recursive construction is performed based on the probability model and structural constraint information in the associated data structure template to generate a data skeleton to be filled. Based on the field name generation strategy, distortion rate parameter, field content generation strategy and distortion generation strategy in the data structure template, the key placeholders and value placeholders in the data skeleton are filled to obtain a structured data object containing normal data and abnormal data. The structured data object is serialized according to the target output format to obtain simulated data.

[0006] In one embodiment, the step of generating a data skeleton to be filled by recursively constructing data based on the probability model and structural constraint information in the associated data structure template when performing the data generation task includes: Starting from the root node, initialize the current recursion depth to zero; At the current node, based on the probability model and the node type of the parent node corresponding to the current node, the target node type of the current node is randomly determined from multiple candidate node types, and a placeholder for the target node type is inserted into the current node. The candidate node types include objects, arrays, keys, and values. When the current recursion depth is less than the maximum recursion depth in the structural constraint information, determine whether to create a child node for the current node based on the target node type of the current node; If so, create at least one child node for the current node, increment the current recursion depth by one, and set the child node as the current node. Then, return to the step of randomly determining the target node type of the current node from multiple candidate node types based on the probability model and the node type of the parent node corresponding to the current node, until the current recursion depth equals the maximum recursion depth, and end the recursion of the current branch. If not, terminate the recursion of the current branch; When the recursion of all branches ends, the data skeleton with multiple nested layers is obtained.

[0007] In one embodiment, during the recursive construction process, an estimation algorithm is used to dynamically estimate the total number of characters in the currently generated data skeleton, thereby obtaining the estimated total number of characters in the currently generated data skeleton. When the estimated total reaches the maximum character length in the structural constraint information, the recursion of all branches stops.

[0008] In one embodiment, the step of filling the key placeholders and value placeholders in the data skeleton with the field name generation strategy, distortion rate parameter, field content generation strategy, and distortion generation strategy in the data structure template to obtain a structured data object containing normal and abnormal data includes: For each key placeholder in the data skeleton, a corresponding key name is generated according to the field name generation strategy, and the key name is written into the corresponding key placeholder to obtain the filled key node; For each value placeholder in the data skeleton, a first random number is generated based on the probability corresponding to the distortion rate. When the first random number does not fall into the preset range, a corresponding business simulation value is generated based on the key node paired with the field content generation strategy and the value placeholder. The business simulation value is then written into the value placeholder to obtain the filled value node. When the random number falls into the preset interval, the distortion generation strategy is invoked to generate corresponding abnormal data, and the abnormal data is written into the corresponding value placeholder to obtain the filled value node; By combining all the filled key nodes and value nodes, a structured data object containing normal and abnormal data is obtained.

[0009] In one embodiment, the step of generating a corresponding key name for each key placeholder in the data skeleton according to the field name generation strategy, and writing the key name into the corresponding key placeholder to obtain the filled key node includes: For each key placeholder in the data skeleton, a second random number is generated based on the various key name types and corresponding generation probabilities defined in the field name generation strategy, and the target key name type of the key placeholder is determined, and the key name of the target key name type is generated. The key name type includes Chinese key name, English key name, numeric key name and empty key name, and the target key name type is one of the Chinese key name, the English key name, the numeric key name or the empty key name; Write the key name of the target key name type into the corresponding key placeholder to obtain the key node corresponding to the key placeholder.

[0010] In one embodiment, the field content generation strategy includes a name generation sub-strategy, a Uniform Resource Locator (URL) generation sub-strategy, a time generation sub-strategy, and a basic type generation sub-strategy. The step of generating a corresponding business simulation value based on the key node paired with the field content generation strategy and the value placeholder, and writing the business simulation value into the value placeholder to obtain the filled value node includes: Based on the field semantic information carried by the key node paired with the value placeholder, a corresponding target field content generation sub-strategy is matched from the field content generation strategy. The target field content generation sub-strategy is one of the name generation sub-strategy, the URL generation sub-strategy, the time generation sub-strategy, and the basic type generation sub-strategy. Based on the content of the target field, a sub-strategy is generated to generate the business simulation value that conforms to the distribution of real business scenarios, and the business simulation value is written into the value placeholder to obtain the filled value node.

[0011] In one embodiment, the step of calling the distortion generation strategy to generate corresponding abnormal data and writing the abnormal data into the corresponding value placeholder to obtain the filled value node includes: Based on the various distortion types and corresponding distortion probabilities defined in the distortion generation strategy, a third random number is generated and the target distortion type of the value placeholder is determined. Perform the distortion operation corresponding to the target distortion type to obtain the corresponding distortion value; The distorted value is written as the abnormal data into the corresponding value placeholder to obtain the filled value node; The distortion types include minimal distortion, maximum distortion, and content contamination, and the target distortion type is one of the minimal distortion, maximum distortion, or content contamination.

[0012] In one embodiment, when the target distortion type is minimal distortion, the step of performing the distortion operation corresponding to the target distortion type to obtain the corresponding distortion value includes: Generate an empty object, an empty array, or an empty string as a distorted value; When the target distortion type is the maximum distortion, the step of performing the distortion operation corresponding to the target distortion type to obtain the corresponding distortion value includes: The target text block is extracted from the text library preloaded into memory as the distortion value. The target text block is a character sequence that conforms to a general text format, has a length greater than a preset super-large threshold, has no actual business semantics, and is preloaded into memory during system initialization. When the target distortion type is content contamination, the step of performing the distortion operation corresponding to the target distortion type to obtain the corresponding distortion value includes: The aberration value is generated as at least one of the following: an illegal Uniform Character Encoding Standard sequence, a mixed-encoding character, a four-byte non-basic multilingual planar emoji character, a Structured Query Language (SQL) injection string, or a Cross-Site Scripting (XSS) attack string.

[0013] Furthermore, to achieve the above objectives, this application also proposes a simulated data generation apparatus, which includes: A configuration loading module is used to load external configuration files, parse the external configuration files and map them into a structure in memory to obtain a global configuration object. The global configuration object includes a target output format and at least one data structure template. The task creation module is used to create a data generation task based on the global configuration object, and the data generation task is associated with a data structure template. The skeleton construction module is used to perform recursive construction based on the probability model and structural constraint information in the associated data structure template when executing the data generation task, to generate a data skeleton to be filled. The skeleton filling module is used to fill the key placeholders and value placeholders in the data skeleton according to the field name generation strategy, distortion rate parameter, field content generation strategy and distortion generation strategy in the data structure template, so as to obtain a structured data object containing normal data and abnormal data. The format conversion module is used to perform serialization processing on the structured data object according to the target output format to obtain simulated data.

[0014] In addition, to achieve the above objectives, this application also proposes a simulated data generation device, the device comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, the computer program being configured to implement the steps of the simulated data generation method as described above.

[0015] In addition, to achieve the above objectives, this application also proposes a storage medium, which is a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, it implements the steps of the simulated data generation method described above.

[0016] In addition, to achieve the above objectives, this application also provides a computer program product, which includes a computer program that, when executed by a processor, implements the steps of the simulated data generation method described above.

[0017] The one or more technical solutions proposed in this application have at least the following technical effects: Loading an external configuration file, parsing the external configuration file and mapping it to a structure in memory to obtain a global configuration object. The global configuration object includes a target output format and at least one data structure template, uniformly managing the output format and data structure template, and achieving separation of configuration and logic. Data generation tasks are created based on the global configuration object, with each data generation task bound to a data structure template, allowing for the independent generation of various heterogeneous simulated data as needed, supporting diverse simulation needs in complex testing environments. When executing data generation tasks, instead of relying on a fixed template, recursive construction is performed based on the dynamic decision branches of the probabilistic model in the associated data structure template, combined with structural constraint information to control the boundaries, generating a data skeleton to be filled, forming a variable structural framework. During the filling phase, not only compliant data is generated based on field content generation strategies and field name generation strategies, but also abnormal data is actively triggered based on the distortion rate parameter to generate a distortion generation strategy, filling the key placeholders and value placeholders in the data skeleton, generating a structured data object containing normal and abnormal data, improving the test coverage of boundary and fault scenarios. Finally, the structured data object is serialized according to the target output format to obtain simulated data in the target output format, which serves as standard test data that can be directly used for testing, achieving efficient, high-fidelity, and high-coverage simulated data generation. This application achieves separation of generation rules and execution logic by loading an external configuration file and constructing an independent data generation task. During task execution, it recursively constructs data based on probability models and structural constraint information, enabling dynamic changes and deep nesting of data structures, thus solving the problem of single and rigid structures in existing technologies. Furthermore, by combining field name generation strategies, field content generation strategies, and distortion generation strategies, abnormal data is automatically mixed in according to the distortion rate during the filling of key-value placeholders, so that the filled structured data object contains both normal and abnormal data. Finally, the simulated data is serialized and output according to the target format, thereby efficiently generating simulated test data with dynamically variable structures and containing both normal and abnormal data. This solves the technical problem that existing technologies cannot efficiently generate simulated test data with dynamically variable structures and containing both normal and abnormal data, achieving efficient, high-fidelity, and high-coverage simulated data generation. Attached Figure Description

[0018] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.

[0019] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0020] Figure 1 This is a flowchart illustrating an embodiment of the method for generating realistic data in this application. Figure 2 A schematic diagram of the execution flow of a high-performance random integer generation method provided in this application; Figure 3 A schematic diagram of the execution flow of a high-performance random floating-point number generation method provided in this application; Figure 4 This is a schematic diagram of the module structure of the simulated data generation device according to an embodiment of this application; Figure 5 This is a schematic diagram of the device structure of the hardware operating environment involved in the simulated data generation method in this application embodiment. Detailed Implementation

[0021] It should be understood that the specific embodiments described herein are merely illustrative of the technical solutions of this application and are not intended to limit this application.

[0022] To better understand the technical solution of this application, a detailed description will be provided below in conjunction with the accompanying drawings and specific implementation methods.

[0023] The main solution of this application embodiment is as follows: Load an external configuration file, parse the external configuration file and map it to a structure in memory to obtain a global configuration object. The global configuration object includes a target output format and at least one data structure template. Create a data generation task based on the global configuration object, and associate the data generation task with a data structure template. When executing the data generation task, perform recursive construction according to the probability model and structural constraint information in the associated data structure template to generate a data skeleton to be filled. Based on the field name generation strategy, distortion rate parameter, field content generation strategy, and distortion generation strategy in the data structure template, fill the key placeholders and value placeholders in the data skeleton to obtain a structured data object containing normal data and abnormal data. Perform serialization processing on the structured data object according to the target output format to obtain simulated data.

[0024] In this embodiment, for ease of description, the simulation data generation system will be used as the execution subject for the following description.

[0025] In the field of modern software engineering, the widespread adoption of microservice architecture, big data processing platforms, and high-concurrency business systems has driven an exponential increase in the demand for test data. Throughout the entire system development lifecycle, from unit testing and integration testing to stress testing and chaos testing, developers and test engineers need to build highly realistic data environments to verify the system's functional correctness, performance limits, and fault tolerance capabilities. Since real business data often contains sensitive information and is costly to obtain and has poor reusability, simulated data, as a core alternative to real sensitive data, has been widely used in the industry and has become an important support for ensuring testing efficiency and data security.

[0026] Currently, the mainstream methods for generating simulated data in the industry mainly fall into three categories: First, manual construction, where developers manually write test data files in formats such as JavaScript Object Notation JSON and Extensible Markup Language (XML) based on technical documents such as interface documentation. This method is only suitable for testing needs in small and simple scenarios. Second, script generation, which uses interpreted languages ​​such as Python and JavaScript and third-party libraries such as Faker and Mock.js to write custom scripts to achieve random data generation. This is currently a commonly used solution for generating medium-sized data. Third, online tools, which use online generators on web pages to quickly generate small amounts of static test data. This is mostly used for temporary testing or verification scenarios.

[0027] However, while the aforementioned existing technical solutions can meet the basic testing needs of simple scenarios, they reveal significant technical bottlenecks and shortcomings when facing enterprise-level large-scale, highly complex, and highly realistic testing scenarios. Firstly, there are performance bottlenecks and throughput limitations. Most mainstream simulation data tools are developed based on interpreted languages ​​such as Python and JavaScript, and their execution efficiency is limited by the Global Interpreter Lock (GIL). In scenarios requiring the generation of massive amounts of test data (GB or even TB levels) or simulating tens of thousands of QPS (queries per second) in high-concurrency stress testing, the data generation rate is often lower than the processing rate of the system under test. This results in the testing bottleneck being concentrated in the "data generation" stage rather than the system under test itself, severely restricting the improvement of testing efficiency and scale. Secondly, there is the problem of rigid configuration and high maintenance costs. The core logic of existing solutions, such as data generation rules, field types, and structural nesting depth, is usually hard-coded into the script code. Once business requirements change, such as adding fields, adjusting numerical ranges, or modifying structural constraints, the source code must be modified and redeployed. This "code as configuration" model has extremely poor flexibility, and it is difficult for non-developers (such as QA testers) to independently adjust the generation strategy, resulting in high strategy adaptation costs and low iteration efficiency. Furthermore, there is a lack of "dirty data" and boundary testing capabilities. Existing test data generation tools generally tend to generate data in a standardized format that conforms to... Normal business logic generates normal data, but real-world system failures are often triggered by various abnormal data, such as excessively large packets (leading to buffer overflows), empty packets (leading to null pointer exceptions), garbled characters or rare characters (leading to encoding errors), and SQL injection / XSS attack strings (leading to security vulnerabilities). Because existing test data generation tools lack systematic and automated abnormal injection mechanisms, test coverage is insufficient, making it difficult to discover potential robustness vulnerabilities and security risks. Finally, there are issues with the limited data structure and localization support. Most existing methods can only generate fixed-format, simple-level data structures, making it difficult to generate deeply nested, dynamically changing data trees, failing to meet the data structure requirements of complex business systems. Furthermore, support for localized data in specific regions is weak, such as Chinese names containing rare characters or ID numbers conforming to specific validation rules. This results in generated data that differs significantly from real business data, lacking simulation and failing to meet the high-precision testing requirements of complex business scenarios. These shortcomings collectively make it difficult for existing technologies to efficiently generate test data with high throughput, high flexibility, high simulation, and high coverage, thus failing to adapt to the comprehensive testing needs of complex enterprise-level systems.

[0028] This application provides a solution that loads and parses external configuration files to form a global configuration object, unifying the management of output formats and data structure templates. This separates configuration from generation logic, improving the flexibility and configurability of structure generation. Data generation tasks are created based on the global configuration object and associated with the data structure template, supporting parallel generation of multiple structure types to meet the needs of complex systems for heterogeneous test data. During task execution, a data skeleton is recursively constructed based on a probability model and structural constraints, allowing for dynamic changes in data hierarchy and nesting relationships, breaking through fixed structure limitations and achieving a dynamically variable structure. Subsequently, key-value placeholders are filled using field name generation strategies, field content generation strategies, and distortion rate and distortion generation strategies. While generating highly realistic normal business data, abnormal data is automatically injected, ensuring that the final simulated data contains both normal and abnormal types, significantly improving test coverage and simulation accuracy. Finally, serialization is completed according to the target output format, forming simulated data that can be directly used for testing. By configuring drivers, dynamically constructing skeletons, and generating a mixture of normal and abnormal data, this technology efficiently generates test data with variable structures, high simulation fidelity, and both normal and abnormal data, solving the technical problem that existing technologies cannot efficiently generate realistic test data with dynamically variable structures and both normal and abnormal data.

[0029] It should be noted that the executing entity in this embodiment can be a computing service device with data processing, network communication, and program execution functions, such as a tablet computer, personal computer, or mobile phone, or a simulated data generation device capable of performing the above functions. The following description uses a simulated data generation system as an example to illustrate this embodiment and the subsequent embodiments.

[0030] Based on this, embodiments of this application provide a method for generating simulated data, referring to... Figure 1 , Figure 1 This is a flowchart illustrating the first embodiment of the simulated data generation method of this application.

[0031] In this embodiment, the simulated data generation method includes steps 101-105: Step 101: Load the external configuration file, parse the external configuration file and map it to a structure in memory to obtain a global configuration object. The global configuration object includes the target output format and at least one data structure template.

[0032] Optionally, the following steps are included before loading the external configuration file: Receive configuration parameters entered by the user on the visual configuration page; Generate an external configuration file based on configuration parameters.

[0033] Specifically, the external configuration file is independent of the program code. It can be in formats such as JSON, YAML, or Tom's Obvious Minimal Language (TOML). This file stores the target output format, structural constraints, generation strategy, distortion rate parameters, etc., of the final generated simulated data. It predefines all rules for data generation, is not coupled with the code, and can be independently edited, modified, and maintained. The in-memory structure is a contiguous, strongly typed data area allocated in memory during program runtime, such as a C++ Struct or Class. This structure serves as a high-speed cache for configuration data, providing nanosecond-level parameter access speeds and avoiding the performance overhead of repetitive file input / output (IO). The global configuration object is a unified configuration carrier instantiated from the in-memory structure using the singleton pattern. It carries all the rule information required for the entire simulated data generation process and serves as the overall control basis for simulated data generation. The target output format is the final simulated data output format defined in the global configuration object, such as standardized formats like JSON or XML. A data structure template is a structured rule unit contained in a global configuration object. It is used to define the hierarchical structure of data, structural constraint information, probability model, field name generation strategy, distortion rate parameter, field content generation strategy, and distortion generation strategy, etc. One data structure template can correspond to one type of business object.

[0034] In some embodiments, the system can provide a visual configuration page, which includes interactive modules such as target output format selection options, data structure template editing area, and field rule configuration bar. Users input configuration parameters through the visual configuration page, including but not limited to the target output format of the simulated data (such as JSON, XML), hierarchical constraints of the data structure, field type definitions, probability model parameters, distortion rate parameters, etc. After the user submits the configuration parameters, the system backend automatically converts the configuration parameters input on the visual page into a structured external configuration file (such as YAML or JSON format) according to the preset configuration file format specifications and stores it in a specified path. Subsequently, the system starts the configuration loading process, reads the external configuration file from the storage path, and performs syntax verification and structured parsing on the content of the external configuration file through the built-in parsing engine, converting the text-based configuration data into intermediate data that the program can recognize. Finally, the system maps the parsed intermediate data to the corresponding fields one by one according to the predefined memory structure, completing the in-memory storage of the configuration data, and finally forming a global configuration object. This global configuration object uniformly carries the target output format set by the user and at least one data structure template containing complete generation rules. By reading external configuration files, the text configuration in the external configuration files is parsed into memory structures that can be directly used by the program, and finally a global configuration object is formed. This object uniformly manages all generation rules such as output format and data structure templates, providing a complete and unified configuration basis for subsequent data skeleton construction, key-value filling, and exception injection, thus achieving complete separation of configuration and code.

[0035] Furthermore, while loading and parsing external configuration files, a singleton pattern is used to uniformly load external resource files such as the Chinese surname dictionary, rare character set, and extremely large text blocks. This ensures that external resource files are loaded once and remain resident in memory, avoiding redundant I / O and construction. Simultaneously, thread pools and memory pools are initialized, and the Permuted Congruential Generator (PCG) high-efficiency random number engine is started, constructing a high-performance runtime environment containing various resident resource pools and fully initialized. By uniformly loading resident resources, pre-allocating threads and memory, and employing high-performance random number algorithms, runtime overhead can be significantly reduced, improving data generation throughput in high-concurrency scenarios and providing stable and efficient underlying support for the subsequent high-speed generation of realistic and aberrant data.

[0036] Step 102: Create a data generation task based on the global configuration object. The data generation task is associated with a data structure template.

[0037] Specifically, a data generation task is an independent, schedulable, and executable work unit, containing all the rules and runtime context required for this data generation. Association means that each data generation task is explicitly bound to one and only one data structure template at creation, ensuring that the simulated data generated by the task strictly follows the structure and rules defined by that data structure template.

[0038] In some embodiments, the system reads information such as the target output format and data structure template list carried in the global configuration object. For each data structure template, a fully encapsulated data generation task is instantiated, and the data structure template is completely associated with the corresponding data generation task. Simultaneously, relevant configuration information such as the target output format, distortion rate, field name generation strategy, field content generation strategy, and distortion generation strategy are synchronized to the task context. This ensures that the data generation task possesses all the rule parameters required to independently generate data, forming an independent task unit with complete execution conditions. Each data generation task corresponds to only one data structure template, ensuring that structural constraint information, probability models, field strategies, and distortion rules remain consistent and do not interfere with each other during the generation process. After the data generation task is created, it can be scheduled and executed by the thread pool. All subsequent structure construction, key-value filling, and distortion injection are based solely on the data structure template associated with this task. Through the one-to-one correspondence between tasks and templates, the isolation and reuse of generation rules are achieved, supporting parallel scheduling and execution of multiple tasks, and providing a stable and independent execution context for subsequent recursive structure construction and data filling.

[0039] Step 103: When performing the data generation task, recursive construction is performed based on the probability model and structural constraint information in the associated data structure template to generate the data skeleton to be filled.

[0040] Specifically, the probabilistic model is a set of quantified structural growth rules in the data structure template. It defines the probability weights of various types of nodes (such as objects, arrays, keys, and values), the expected number of child nodes, and the dynamic insertion probability. The probabilistic model is not a fixed template, but rather a set of decision parameters for the generation algorithm, used to simulate the uncertainty of real data. Structural constraints are the mandatory structural rules in the data structure template, such as maximum recursion depth and maximum character length. These constraints impose hard limitations on the data structure objects. The data skeleton to be filled is an intermediate data structure containing field paths and placeholder structures (such as key placeholders and value placeholders) but not yet filled with specific business content. The shape of the data skeleton is entirely determined by the template and probabilistic decisions.

[0041] In some embodiments, when performing a data generation task, the system first reads the data structure template associated with the currently executing data generation task and extracts the probability model and structural constraint information from it. Starting from the current node, the system randomly determines the type of the current node as a regular field, object, or array based on the probability model, and checks whether the nesting depth, field mandatory selection, etc., exceed the limits based on the structural constraint information. If the current node is a nested object or subarray, the structure construction logic is recursively called to continue generating the lower-level structure; if it is a basic field node, the corresponding value placeholder is directly retained. Throughout the process, the probability model is used to dynamically control the selection of structural branches, the appearance of fields, and the number of array elements, while the structural constraint information is used to ensure that the overall structure does not exceed the preset range. Finally, the construction of all levels and branches is completed layer by layer, forming a data skeleton containing only placeholders and content to be filled later.

[0042] Optionally, the global configuration object also includes a thread count parameter. Before the step of recursively constructing and generating the data skeleton to be populated based on the probability model and structural constraint information in the associated data structure template during the data generation task, the following parameters are also included: Based on the thread count parameter, initialize a thread pool consisting of threads generated from the number of data points specified in the thread count parameter; Submit the data generation task to the thread pool, allocate the data generation task to the idle data generation thread, and execute the data generation task through the data generation thread.

[0043] Specifically, the global configuration object contains a thread count parameter to control concurrency, the thread pool is a reusable thread management set containing a fixed number of data generation threads, and the data generation thread is a work unit used to execute data generation tasks in parallel.

[0044] For example, a preset thread count parameter is read from the global configuration object, and the thread pool is initialized according to this parameter. A corresponding number of data generation threads are created and kept in a ready state. The completed data generation tasks are submitted to the task queue of the thread pool. The thread pool's scheduling module continuously monitors the thread status, automatically identifies and filters idle data generation threads, and assigns the data generation tasks in the task queue to the idle threads. After the thread is awakened, it officially begins to execute the data generation tasks. Subsequent processes such as recursively building the data skeleton, filling key-value pairs, and malformation injection all run in parallel in this independent thread.

[0045] In some embodiments, after the global configuration object is parsed and mapped, the configured thread count parameter is further read, and a corresponding number of data generation threads are initialized based on this parameter to construct a thread pool. Simultaneously, the memory pool and the PCG random number engine are initialized, forming a unified, resident, high-performance runtime environment. The memory pool is used to uniformly allocate and reclaim memory space during data generation, avoiding the overhead of frequent dynamic allocation and release. The PCG random number engine, as an efficient random number generation unit, provides a high-speed random source for recursive structure construction, probability determination, and distortion triggering. After the runtime environment initialization is complete, the system submits the data generation tasks created based on the global configuration object to the thread pool. The thread pool's scheduling module monitors the running status of each data generation thread in real time. When an idle thread is detected, the system automatically assigns the data generation task to that thread, allowing the data generation tasks to be executed concurrently in independent threads. During task execution, the data generation thread manages the memory of structural nodes and data content using a pre-initialized memory pool. It then calls the PCG random number engine to perform probability model calculations, structural branch selection, and distortion trigger judgment. Subsequently, it recursively constructs a data skeleton of key-value placeholders to be filled based on the probability model and structural constraints in the associated data structure template. By using a thread pool to achieve multi-task parallel processing, a memory pool to reduce runtime overhead, and a PCG random number engine to improve random operation efficiency, these three elements work together to form a high-performance kernel, significantly improving the data generation throughput and concurrency capabilities, and solving the performance bottleneck problem of existing technologies in massive data generation scenarios.

[0046] This application adopts a multi-threaded parallel architecture, using thread pool technology to initialize corresponding threads based on the thread count parameter in the global configuration object, and executes data generation tasks in parallel. This architecture supports flexible concurrent generation modes, enabling single-threaded multi-template, multi-threaded single-template, and multi-threaded multi-template data generation methods. Single-threaded multi-template refers to a single data generation thread sequentially executing data generation tasks corresponding to multiple data structure templates, suitable for lightweight or sequentially dependent scenarios. Multi-threaded single-template refers to dividing large-scale data generation tasks of the same data structure template into multiple sub-tasks, processed in parallel by multiple data structure threads, improving the generation throughput of a single type of data. Multi-threaded multi-template refers to multiple data generation threads simultaneously executing tasks of different data structure templates, achieving concurrent generation of heterogeneous data. During task execution, data generation threads maintain data isolation, avoiding resource contention between threads without additional locking, reducing thread synchronization overhead, and fully utilizing the multi-core processing power of the Central Processing Unit (CPU), maximizing hardware utilization and data generation throughput efficiency, providing stable and efficient parallel execution support for realistic data generation in massive, high-concurrency scenarios.

[0047] Step 104: Based on the field name generation strategy, distortion rate parameter, field content generation strategy, and distortion generation strategy in the data structure template, fill in the key placeholders and value placeholders in the data skeleton to obtain a structured data object containing normal and abnormal data.

[0048] Specifically, the field name generation strategy refers to the rules used to generate key placeholders in the data skeleton, such as English camelCase, Chinese names, and custom field names. The distortion rate parameter is a configuration parameter that controls the probability of abnormal data appearing, determining the probability that value placeholders will be replaced with abnormal data. The field content generation strategy refers to the rules used to generate normal business values, such as simulated content like names, numbers, times, URLs, and ID numbers. The distortion generation strategy defines the rules for abnormal data types, such as null values, excessively large text blocks, illegal encoding, excessively long strings, and attack strings. Key placeholders are reserved markers in the data skeleton representing the positions of field names. Value placeholders are reserved markers in the data skeleton representing the positions where field values ​​are taken. The structured data object is a complete nested structure of data containing normal and abnormal data after key-value population is completed.

[0049] In some embodiments, the nodes at each level of the data skeleton are traversed, and field names conforming to business specifications are generated sequentially for the key placeholders according to the field name generation strategy, replacing the key placeholders. For each value placeholder, it is first randomly determined whether to trigger the abnormal data generation logic based on the distortion rate parameter. If distortion is not triggered, highly realistic normal values ​​conforming to business logic, such as name, number, time, and URL, are constructed according to the field content generation strategy. If the distortion triggering condition is met, abnormal data such as null values, excessively large text blocks, illegal encoded characters, and excessively long strings are generated according to the distortion generation strategy. After all key-value placeholders are filled, they are integrated to form a structured data object with a complete structure. After recursively constructing the data skeleton, the key placeholders and value placeholders in the data skeleton are batch-filled according to the field name generation strategy, distortion rate parameter, field content generation strategy, and distortion generation strategy in the corresponding data structure template. Finally, a structured data object that combines normal business data and abnormal test data is formed. Thus, normal data and abnormal data are output simultaneously in one generation process. This ensures the business authenticity of the test data and can actively construct boundary scenarios and abnormal scenarios. It effectively makes up for the lack of dirty data construction capabilities in existing tools, significantly improves test coverage, and provides reliable data support for verifying the system's fault tolerance and robustness.

[0050] Optionally, the steps to fill in the key placeholders and value placeholders in the data skeleton to obtain a structured data object containing normal and abnormal data, based on the field name generation strategy, distortion rate parameter, field content generation strategy, and distortion generation strategy in the data structure template, include: For each key placeholder in the data skeleton, generate the corresponding key name according to the field name generation strategy, and write the key name into the corresponding key placeholder to obtain the filled key node; For each value placeholder in the data skeleton, a first random number is generated based on the probability corresponding to the distortion rate. When the first random number does not fall into the preset range, a key node is generated based on the field content generation strategy and the value placeholder to generate the corresponding business simulation value. The business simulation value is then written into the value placeholder to obtain the filled value node. When the first random number falls into the preset range, the distortion generation strategy is called to generate the corresponding abnormal data, and the abnormal data is written into the corresponding value placeholder to obtain the filled value node; Combine all the filled key nodes and value nodes to obtain a structured data object containing both normal and abnormal data.

[0051] Specifically, business simulation values ​​are simulated data that conform to real business logic, such as names containing uncommon characters, URLs with parameters, and timestamps in a specific format. The distortion rate parameter is a probability value between 0 and 1 configured for each field. For example, 0.05 means that there is a 5% probability that the field will generate abnormal data. The preset range can refer to the numerical range [0, distortion rate parameter). The system generates a first random number (such as a floating-point number between 0.0 and 1.0). If the first random number falls into the preset range, distortion is triggered; otherwise, normal data is generated.

[0052] For example, the system traverses the constructed data skeleton, processes each key placeholder sequentially, generates key names that conform to business specifications or custom rules based on the field name generation strategy in the data structure template, and writes the key names into the corresponding key placeholders to complete the key node filling. Then, the value placeholders paired with the key nodes are processed. The distortion rate parameter configured for each value placeholder's associated field (e.g., 0.05, representing a 5% anomaly probability) is read, and a first random number within the range [0,1) is generated. If the first random number does not fall into the preset range with the distortion rate as the upper limit (i.e., random number ≥ distortion rate), it is determined to be normal data generation. The system then calls the corresponding field content generation strategy based on the key node paired with the current value placeholder. According to the field content generation strategy and the business meaning of the corresponding key node, highly realistic business simulation values ​​such as names, numbers, times, URLs, and Chinese text containing uncommon characters are generated. These simulated business values ​​are written into the value placeholders to form normal value nodes. When the first random number falls within a preset range, the abnormal data generation logic is triggered. This involves invoking a distortion generation strategy to construct abnormal data such as null values, excessively large text blocks, illegally encoded characters, excessively long strings, and incorrectly formatted data. This abnormal data is then written into the corresponding value placeholder, forming an abnormal value node. After filling all key and value nodes within the data skeleton, all nodes are integrated and assembled according to the original nested structure and hierarchical relationship, ultimately resulting in a structured data object that is complete and contains both normal business data and abnormal test data. By using probability control to automate and controllably inject abnormal data, the system achieves the mixed generation of normal business data and abnormal distorted data. This ensures both the business authenticity and structural rationality of the data, while also covering boundary scenarios and fault-tolerant scenarios. This improves the comprehensiveness and effectiveness of the final generated test simulation data, effectively solving the problems of existing technologies being unable to automatically construct abnormal data and having insufficient test coverage, thus providing reliable support for system robustness verification.

[0053] Step 105: Perform serialization processing on the structured data object according to the target output format to obtain simulated data.

[0054] Specifically, the target output format is the final data format specified by the user in the visualization configuration or external configuration file, such as JSON, XML, Protobuf, etc. The simulated data is the final output, dynamically variable in structure, containing both normal and abnormal content—available test data.

[0055] In some embodiments, the target output format recorded in the global configuration object is read, and the corresponding serialization engine, such as a JSON serializer or an XML serializer, is matched according to the target output format. Then, the structured data objects in memory are traversed, and nested key nodes, value nodes, array structures, and object structures are encoded and converted layer by layer according to the syntax specifications of the target output format, serializing them into strings or byte streams that conform to the format standard. During serialization, the original hierarchical structure, field correspondences, and mixed distribution of normal and abnormal data of the structured data objects are maintained, without changing the data content or distortion characteristics. After serialization, the generated standard format data is output to a specified location or directly returned to the calling end, forming realistic data with a true structure, complete content, and both normal and abnormal testing capabilities. By performing serialization processing on structured data objects that have completed key-value filling and contain normal and abnormal data according to the target output format set in the global configuration object, a directly usable realistic data is obtained, achieving a standardized conversion from memory structure to standard format. This allows the generated results to be directly integrated into the testing process, improving the versatility and practicality of the solution.

[0056] Based on the simulated data generation method provided in this application, an external configuration file is loaded, parsed, and mapped into a structure in memory to obtain a global configuration object. This global configuration object includes the target output format and at least one data structure template, enabling unified management of the output format and data structure template, thus separating configuration from logic. Data generation tasks are created based on the global configuration object, with each task bound to a data structure template. This allows for the independent generation of various heterogeneous simulated data as needed, supporting diverse simulation requirements in complex testing environments. When executing data generation tasks, instead of relying on fixed templates, recursive construction is performed based on the dynamic decision branches of the probabilistic model in the associated data structure template. Combined with structural constraint information to control boundaries, a data skeleton to be filled is generated, forming a variable structural framework. During the filling phase, not only are compliant data generated based on field content and field name generation strategies, but also abnormal data is actively generated based on the distortion rate parameter to trigger a distortion generation strategy. This abnormal data is used to fill the key and value placeholders in the data skeleton, generating a structured data object containing both normal and abnormal data, improving the test coverage of boundary and fault scenarios. Finally, the structured data object is serialized according to the target output format to obtain simulated data in the target output format, which serves as standard test data that can be directly used for testing, achieving efficient, high-fidelity, and high-coverage simulated data generation. This application achieves separation of generation rules and execution logic by loading an external configuration file and constructing an independent data generation task. During task execution, it recursively constructs data based on probability models and structural constraint information, enabling dynamic changes and deep nesting of data structures, thus solving the problem of single and rigid structures in existing technologies. Furthermore, by combining field name generation strategies, field content generation strategies, and distortion generation strategies, abnormal data is automatically mixed in according to the distortion rate during the filling of key-value placeholders, so that the filled structured data object contains both normal and abnormal data. Finally, the simulated data is serialized and output according to the target format, thereby efficiently generating simulated test data with dynamically variable structures and containing both normal and abnormal data. This solves the technical problem that existing technologies cannot efficiently generate simulated test data with dynamically variable structures and containing both normal and abnormal data, achieving efficient, high-fidelity, and high-coverage simulated data generation.

[0057] In some embodiments, when performing a data generation task, the step of recursively constructing a data skeleton to be filled based on the probabilistic model and structural constraint information in the associated data structure template includes: Starting from the root node, initialize the current recursion depth to zero; At the current node, based on the probability model and the node type of the parent node corresponding to the current node, the target node type of the current node is randomly determined from multiple candidate node types, and a placeholder of the target node type is inserted into the current node. Candidate node types include objects, arrays, keys, and numbers. When the current recursion depth is less than the maximum recursion depth in the structural constraint information, determine whether to create a child node for the current node based on the target node type of the current node. If so, create at least one child node for the current node, increment the current recursion depth by one, set the child node as the current node, return to the execution at the current node, and randomly determine the target node type of the current node from multiple candidate node types based on the probability model and the node type of the parent node corresponding to the current node, until the current recursion depth equals the maximum recursion depth, and end the recursion of the current branch. If not, terminate the recursion of the current branch; When the recursion of all branches ends, a multi-level nested data skeleton is obtained.

[0058] Specifically, the probabilistic model is a set of quantified decision tables that define the probability weights of a child node becoming an object, array, key, or value under a specific parent node type.

[0059] Candidate node types include objects, arrays, keys, and values. An object represents a collection of key-value pairs, such as {} in JSON; an array represents an ordered list of elements, such as []; a key is a placeholder for field names within an object; and a value can be a placeholder for primitive types such as strings, numbers, and booleans. Candidate node types serve as the basic atoms of the data structure. Objects ({}) and arrays ([]) are container nodes, recursively containing child nodes; keys (field names) and values ​​(the actual data) are leaf nodes, terminating the recursion. The recursion depth is the nesting level of the current node relative to the root node. The maximum recursion depth is the maximum allowed nesting level to prevent excessively deep or infinite recursion.

[0060] As an example, starting from the root node, the current recursion depth is initialized to zero. Then, at the current node, based on the probability model defined in the data structure template (e.g., "when the parent node is an object, the child node has a 70% probability of being a key, a 20% probability of being a nested object, and a 10% probability of being an array") and the parent node type corresponding to the current node (e.g., object, array, and other context information), a target node type is randomly selected from the preset candidate node types (including object, array, key, value, etc.) according to probability. A placeholder of the corresponding type is then inserted at the current node position. For example...<KEY_PLACEHOLDER> or<ARRAY_PLACEHOLDER> Next, the system determines whether the current recursion depth is less than the maximum recursion depth specified by the structural constraints in the data structure template (e.g., a maximum nesting depth of 10). If the maximum depth is not reached, it further determines whether child nodes need to be created based on the target node type already determined for the current node. Object and array type nodes can continue to expand child nodes, while key and numeric type nodes do not create child nodes. If it is determined that child nodes need to be created, the system generates at least one child node for the current node, increments the current recursion depth by one, sets the child node as the new current node, and returns to the step of randomly determining the node type to continue recursively building downwards. If no child nodes need to be created, or if the current recursion depth is equal to the maximum recursion depth, the recursive process of the current branch is directly terminated. The system recursively builds all branches in sequence according to the above logic until all branches have completed recursion and terminated, ultimately forming a data skeleton containing multi-level nested structures, retaining only various placeholders and not filling in specific business content. Based on the probability model and structural constraints in the preset data structure template, an abstract data tree (i.e., data skeleton) with multiple nesting layers, diverse types, and a reasonable structure is automatically generated. Dynamic selection of node types is achieved through probabilistic randomness, and the structural logic is ensured by combining parent node type constraints. At the same time, the nesting level is limited by the maximum recursion depth. This can generate flexible and complex data structures while avoiding system anomalies caused by infinite recursion or excessively deep structures. It effectively improves the structural realism and scenario adaptability of simulated test data, and provides a standardized structural foundation for subsequent filling of real field names, normal values, and abnormal values. This ensures that the final output simulated data is highly close to the real business scenario in terms of hierarchical complexity, type distribution, and nesting logic.

[0061] In some embodiments, during the recursive construction process, an estimation algorithm is used to dynamically estimate the total number of characters in the currently generated data skeleton, thereby obtaining the estimated total number of characters in the currently generated data skeleton. When the estimated total reaches the maximum character length in the structural constraint information, stop the recursion of all branches.

[0062] Specifically, the maximum character length is the upper limit of the maximum string length corresponding to the allowed data skeleton. The estimation algorithm is a lightweight character count prediction method that does not require complete serialization. Since the data skeleton is still composed of placeholders at this time (not yet filled with real field names and values), the final string length cannot be directly calculated. Therefore, it is necessary to dynamically estimate the approximate total number of characters that may be generated if the current skeleton is completely filled and serialized, based on parameters such as the current node type, the preset average field name length, the average length, and the structural overhead (such as the symbols {}, [], , : in JSON).

[0063] As an example, after initiating the recursive construction of the data skeleton, an estimation algorithm is synchronously invoked during the creation of each node and the insertion of placeholders. Based on the number, type, and nesting level of various types of nodes such as objects, arrays, keys, and values ​​that have been generated, the total number of characters in the string corresponding to the currently constructed data skeleton is dynamically estimated, resulting in a real-time updated estimated total. Before each node type is determined and child node is created, this estimated total is compared with the maximum character length in the structural constraints information within the data structure template. If the current estimated total does not reach the maximum character length, the recursive construction process of subsequent nodes continues. If the estimated total has reached or exceeded the preset maximum character length, the system immediately triggers a global termination command, forcibly stopping all incomplete recursive branches, ceasing the creation of any new child nodes and structural branches, and directly locking the currently constructed structure as the final data skeleton.

[0064] By dynamically estimating and implementing non-intrusive, low-overhead data scale monitoring, combined with the maximum recursion depth to form a dual constraint, the generated data skeleton is guaranteed to meet the business interface's specifications for message length and data volume. At the same time, it avoids problems such as excessive memory consumption and system processing abnormalities caused by unlimited structural expansion and exceeding the character limit from the source. This ensures that the entire data generation process is stable, efficient, and controllable, providing a safe and compliant structural foundation for subsequent data filling and serialization output.

[0065] In some embodiments, for each key placeholder in the data skeleton, the steps of generating a corresponding key name according to the field name generation strategy and writing the key name into the corresponding key placeholder to obtain the filled key node include: For each key placeholder in the data skeleton, based on the various key name types and their corresponding generation probabilities defined in the field name generation strategy, a second random number is generated to determine the target key name type of the key placeholder, and a key name of the target key name type is generated. The key name types include Chinese key names, English key names, numeric key names, and empty key names, and the target key name type is one of Chinese key names, English key names, numeric key names, or empty key names; Write the key name of the target key name type into the corresponding key placeholder to obtain the key node corresponding to the key placeholder.

[0066] Specifically, the key name types include Chinese key names, English key names, numeric key names, and empty key names. A Chinese key name, such as "User Name", is used to test Chinese compatibility; an English key name, such as "userName", is used to simulate conventional development naming; a numeric key name, such as "123", is used to verify the system's handling of keys not starting with letters; an empty key name is the empty string "", which is used to test the system's reaction when the field name is missing or illegal (such as whether an exception is thrown or the field is ignored). The second random number is an independent random value specifically generated during the key name generation phase, usually generated by a PCG engine. The target key name type is the specific key name type determined by the second random number.

[0067] As an example, traverse each key placeholder in the data skeleton. According to the four key name types (Chinese key names, English key names, numeric key names, and empty key names) and their respective generation probabilities defined in the preset field name generation strategy (such as 70% for English, 20% for Chinese, 8% for numeric, and 2% for empty), for each key placeholder, call the PCG random number engine to generate a second random number (usually a floating point number between 0 and 1), and based on the position of this second random number in the cumulative probability interval, determine the target key name type corresponding to the current key placeholder. Subsequently, call the generation logic matching the target key name type. For example, if the target key name type is a Chinese key name, randomly select a word from a preset Chinese word library (such as "User ID", "Order Status") as the key name; if the target key name type is an English key name, generate a legal identifier according to camel case or underscore rules (such as "userName" or "order_id") as the key name; if the target key name type is a numeric key name, generate a random numeric string (such as "12345") as the key name; if the target key name type is an empty key name, directly use the empty string. Finally, write the generated key name into the corresponding key placeholder, complete the filling, and form a key node. The mixed generation of multi-type key names through probability-driven not only ensures the business authenticity and diversity of key names but also covers boundary test scenarios through abnormal types such as empty key names, laying a standardized and flexible field name foundation for subsequent value placeholder filling and the generation of the overall structured data object.

[0068] In some embodiments, the field content generation strategy includes a name generation sub-strategy, a uniform resource locator (URL) generation sub-strategy, a time generation sub-strategy, and a basic type generation sub-strategy. The steps of generating corresponding business simulation values based on the field content generation strategy and the key nodes paired with value placeholders and writing the business simulation values into the value placeholders to obtain the filled value nodes include: Based on the field semantic information carried by the key node paired with the value placeholder, the corresponding target field content generation sub-strategy is matched from the field content generation strategy. The target field content generation sub-strategy is one of the name generation sub-strategy, URL generation sub-strategy, time generation sub-strategy, and basic type generation sub-strategy. Based on the target field content, a sub-strategy is generated to produce business simulation values ​​that conform to the distribution of real business scenarios. The business simulation values ​​are then written into value placeholders to obtain the filled value nodes.

[0069] Specifically, field semantic information refers to the implicit business meaning identifier in the key node name. For example, the key name "user_name" implies "name," and the key name "profile_url" implies "network address." This field semantic information serves as the routing basis, guiding the system to select which specific sub-strategy to generate the value. The name generation sub-strategy is used to generate compliant Chinese / English names; the URL generation sub-strategy is used to generate valid website addresses, API paths, and other network addresses; the time generation sub-strategy is used to generate standard timestamps and date / time formats; and the basic type generation sub-strategy is used to generate basic data types such as numbers, strings, and booleans. The target field content generation sub-strategy is a specific generation sub-strategy selected based on semantic matching.

[0070] As an example, based on the content of the key node paired with the current value placeholder, the semantic information of the fields it carries is extracted. Using this information as a basis, the corresponding target field content generation sub-strategy is matched from the name generation sub-strategy, URL generation sub-strategy, time generation sub-strategy, and basic type generation sub-strategy included in the field content generation strategy. After determining the target field content generation sub-strategy, business simulation values ​​conforming to the real business format and distribution characteristics are generated based on the rules built into that sub-strategy. For example, the name sub-strategy generates standardized personal names, the URL sub-strategy generates valid URLs, the time sub-strategy generates standard format times, and the basic type sub-strategy generates regular data such as integers and strings. The generated business simulation values ​​are then written into the corresponding value placeholders, completing the filling and forming the filled value node. This achieves intelligent matching of field name semantics and numerical types, ensuring that the generated data possesses real business logic and format specifications. This effectively improves the authenticity and usability of the test data, providing high-quality normal business data support for system interface testing and logic verification.

[0071] Optionally, if the target field content generation sub-strategy is a name generation sub-strategy, the steps of generating business simulation values ​​that conform to the distribution of real business scenarios based on the target field content generation sub-strategy, and writing the business simulation values ​​into value placeholders to obtain the filled value nodes include: Load the pre-set surname dictionary and rare character dictionary, select characters from the surname dictionary and rare character dictionary through hash mapping or random combination, and generate real names containing common surnames and rare Chinese characters; Write the real name as a business simulation value into the corresponding value placeholder to obtain a filled value node, which is used to test the compatibility and rendering ability of multi-byte character encoding. The multi-byte character encoding includes Chinese Internal Code Specification (GBK), Unicode Transformation Format–8-bit (UTF-8), and Chinese coded character set GB18030 for information technology.

[0072] Specifically, the surname dictionary is a pre-set list of common Chinese surnames (such as "Wang", "Li", "Zhang", "Ouyang", etc.), usually covering the high-frequency surnames in "Hundred Family Surnames" and modern population statistics data. The rare character dictionary contains Chinese characters that belong to the extended area of common Chinese characters in Unicode but have extremely low daily usage frequencies (such as "䶮", "犇", "喆", "䶮", etc.), and is used to simulate non-standard names that real users may use.

[0073] Exemplarily, when the target field content generation sub-strategy is the name generation sub-strategy, the system loads the pre-resident surname dictionary and rare character dictionary in memory, and based on the hash mapping fast retrieval or random combination method, selects standard Chinese characters from the surname dictionary as the surname, and selects Chinese characters with complex encoding and easy compatibility problems from the rare character dictionary as the name, and combines them to generate a simulated real name containing common surnames and rare Chinese characters; write the generated real name as a business simulation value into the corresponding value placeholder to complete the filling to obtain a normal value node. This type of name data containing rare characters is specifically used to test the parsing compatibility, storage correctness, and interface rendering effect of the system for multi-byte character encodings such as GBK, UTF-8, and GB18030, and can effectively expose compatibility defects such as garbled characters, loss, truncation, and abnormal display that occur when the system processes complex Chinese characters, improving the comprehensiveness and severity of the test scenario.

[0074] Optionally, when the target field content generation sub-strategy is the URL generation sub-strategy, the steps of generating a business simulation value that conforms to the real business scenario distribution based on the target field content generation sub-strategy and writing the business simulation value into the value placeholder to obtain a filled value node include: Concatenate the protocol header, randomly generated domain name, multi-level path, Universally Unique Identifier (UUID) string, and query parameters to construct an initial URL, and the protocol header is http, https, or ftp; Inject a special character sequence into the initial URL with a configured probability. The special character sequence includes the null byte %00, the path traversal symbol .. / , or script tag fragments to obtain the target URL. The target URL is written as the business simulation value into the corresponding value placeholder to obtain the filled value node, which is used to test the input filtering, path parsing and security protection mechanisms of the web application.

[0075] Specifically, the configuration probability is the preset trigger probability of injecting special characters. The target URL is the final generated URL data that can be used for security testing.

[0076] For example, when the target field content generation sub-policy is a URL generation sub-policy, http, https, or ftp is randomly selected as the protocol header. The protocol header, randomly generated domain name, multi-level path, UUID string, and query parameters are concatenated according to a standard format to construct a compliant initial URL. Then, based on the configured probability, it is determined whether to inject a special character sequence. If the injection condition is triggered, an empty byte %00, a path traversal symbol .. / , or a script tag fragment is inserted into the path or parameter position of the initial URL to form a target URL with security testing capabilities. If no injection is triggered, the initial URL is directly used as the target URL. Finally, the generated target URL is written as the business simulation value into the corresponding value placeholder, completing the filling to obtain the filled value node. This type of URL can be directly used to test the input filtering effectiveness, path parsing correctness, and security risk protection mechanisms such as cross-site scripting and path traversal in web applications. Security vulnerability verification can be completed simultaneously in regular business testing, significantly improving test coverage and system security verification capabilities.

[0077] Optionally, when the target field content generation sub-strategy is a time-based generation sub-strategy, the steps of generating business simulation values ​​that conform to the distribution of real business scenarios based on the target field content generation sub-strategy, and writing the business simulation values ​​into value placeholders to obtain the filled value nodes include: Generate time strings that conform to the International Organization for Standardization 8601 (ISO 8601), Date and Time on the Internet: Timestamps (RFC 3339) standard, or Unix timestamp format, where the time string represents any of the past, present, or future moments. The time string is written as the business simulation value into the corresponding value placeholder to obtain the filled value node, which is used to verify the parsing capability of multiple time formats and the correctness of the timing logic processing.

[0078] For example, when the semantics of the key node paired with the value placeholder match the time generation sub-policy, the current system timestamp is obtained as a baseline based on the time format preference defined in the configuration (ISO 8601 / RFC 3339 / Unix timestamp). Then, according to the distribution probability set in the policy, a time offset (such as a random number of days within the range of [-365 days, +365 days]) is randomly generated to determine whether the target time point is in the past, present, or future. Subsequently, a dedicated formatting function is called: if the ISO 8601 standard is selected, the time is converted to a time string in YYYY-MM-DDTHH:mm:ss.sssZ format; if the RFC 3339 standard is selected, it is converted to a time string in YYYY-MM-DD HH:mm:ss+HH:MM format; if the Unix timestamp is selected, a second-level or millisecond-level integer value is directly output. Finally, the generated time string or value is written as the business simulation value to the memory address of the value placeholder, completing the filling of the value node. This type of multi-format, cross-time period time data can be directly used to verify the system's compatibility in parsing different standard time formats, as well as the correctness of processing business logic such as time sequence, validity period judgment, and time-series calculation. It can comprehensively cover time-related interface logic, data storage, and front-end display scenarios, improving the sufficiency of testing time-related functions and system stability.

[0079] Optionally, when the target field content generation sub-strategy is based on the basic type generation sub-strategy, the steps of generating business simulation values ​​that conform to the distribution of real business scenarios based on the target field content generation sub-strategy, and writing the business simulation values ​​into value placeholders to obtain the filled value nodes include: Based on the field type identifier associated with the value placeholder, the basic type value is generated using the permutation congruence generator algorithm. The basic type value is any one of Boolean value, integer value, floating-point value or ordinary string. The basic type value is written as the business simulation value into the corresponding value placeholder to obtain the filled value node, which is used to support the data filling of general fields and interface contract verification.

[0080] Specifically, the field type identifier associated with the value placeholder refers to the field type explicitly declared in the data skeleton or interface definition (such as JSONSchema, OpenAPI, Protobuf), for example: "type":"boolean", "type":"integer", "type":"number", "type":"string". This field type identifier is a key basis for selecting the generation logic. The Permuted Congruential Generator (PCG) algorithm is a modern pseudo-random number generation algorithm. Compared with the traditional Linear Congruential Generator (LCG), it has a longer period, better statistical properties, and predictable seed control capabilities.

[0081] For example, when the target field content generation sub-strategy is based on the basic type generation sub-strategy, the system first obtains the field type identifier associated with the current value placeholder. Based on the field type identifier, it determines the data type to be generated, including Boolean values, integer values, floating-point values, and ordinary strings. Then, a permutation congruence generator algorithm is used to generate pseudo-random values ​​that conform to the actual business distribution. This algorithm is characterized by high computational efficiency, uniform distribution, and no obvious bias, and can quickly produce stable and reliable basic data. For example, it generates true or false for Boolean values, integers within a specified range such as 100 and 520 for integer values, values ​​with decimal places such as 3.14 and 99.88 for floating-point values, and regular character sequences composed of letters and numbers such as "test789" and "data2025" for ordinary strings. After generation, the basic type value is written as the business simulation value into the corresponding value placeholder, completing the filling and obtaining the filled value node. When the target field content generation sub-strategy is based on the basic type generation sub-strategy, standardized basic type business simulation values ​​are generated. This can efficiently support the data filling needs of various general fields without special semantics. At the same time, it provides standard test data with strict type matching for interface contract verification, ensuring the correctness of interface interaction and operational stability in terms of parameter type, data format, field constraints, etc.

[0082] refer to Figure 2 , Figure 2This diagram illustrates the execution flow of a high-performance random integer generation method. Starting with an interval preprocessor, it sequentially performs boundary standardization and interval upper bound establishment. Then, it pre-calculates the rejection threshold and extracts random bits, determining if the interval upper bound is a power of 2. If it is, it directly enters the fast path for mask value extraction and returns the result. If it is not a power of 2, it enters an interval loop, generating the low and high bits through multiplication, and checking if the low bit is less than the upper bound and greater than or equal to the rejection threshold. If the conditions are not met, it resamples and recalculates until a valid random integer is generated and returned. This process, through interval preprocessing, power-law judgment, and fast path branch optimization, combined with a rejection sampling loop, achieves efficient and low-bias random integer generation, significantly improving computational performance in batch data generation scenarios.

[0083] refer to Figure 3 , Figure 3 This diagram illustrates the execution flow of a high-performance random floating-point number generation method. The method consists of two parallel processing paths: "division-free normalization" and "interval geometry construction," followed by unified projection and interpolation to generate the final result. First, an arbitrary interval and a random entropy source are input. In the "division-free normalization" path, the system acquires discrete random bits and extracts high bit entropy. A normalization factor is generated through bit-level synthesis of the mantissa field using the IEEE 754 standard, resulting in uniform random numbers within the interval [0,1). In the "interval geometry construction" path, the input interval is standardized to eliminate order dependence, and then a monotonically closed interval is established. Subsequently, the results from both paths are input into a precision-preserving linear projection stage, mapping the normalized values ​​of [0,1) to the target interval. Finally, robust numerical interpolation generates the final random floating-point number, ending the process. This method achieves division-free normalization through bit-level synthesis, and combined with linear projection and interpolation, ensures the uniformity and numerical stability of the generated floating-point numbers, making it suitable for high-performance, high-concurrency floating-point number generation scenarios.

[0084] In some embodiments, the steps of invoking a distortion generation strategy to generate corresponding abnormal data and writing the abnormal data into the corresponding value placeholders to obtain the filled value nodes include: Based on the various distortion types and corresponding distortion probabilities defined in the distortion generation strategy, a third random number is generated and the target distortion type of the value placeholder is determined. Perform the distortion operation corresponding to the target distortion type to obtain the corresponding distortion value; The distorted values ​​are written as anomalous data into the corresponding value placeholders to obtain the filled value nodes; The distortion types include minimal distortion, maximum distortion, and content contamination, and the target distortion type is one of minimal distortion, maximum distortion, or content contamination.

[0085] Specifically, the distortion generation strategy is a set of rules configured with three distortion types: minimal distortion, maximal distortion, and content contamination, along with their respective trigger probabilities. The third random number is a random value used to randomly select the distortion type based on probability. Minimal distortion is an abnormal operation that generates null values, including empty objects {}, empty arrays [], and empty strings "". Minimal distortion is used to simulate scenarios with missing or uninitialized fields, testing null pointer exceptions and default value handling logic. Maximal distortion is an abnormal operation that generates extremely large amounts of data, typically referring to inserting MB-level text blocks. Maximal distortion is used to simulate large packet attacks or buffer overflows, testing system memory management, input restrictions, and flow control mechanisms. Content contamination is an abnormal operation that generates illegal or malicious content, including garbled characters, special characters (Emoji), and attack scripts, used to simulate encoding errors or security attacks, testing character set compatibility and security protection (WAF / filtering) capabilities.

[0086] As an example, when the generated first random number falls within a pre-defined distortion trigger range, the system invokes the corresponding distortion generation strategy. Based on the three distortion types defined in the strategy—minor distortion, major distortion, and content contamination—and their respective trigger probabilities, a third random number is generated. The target distortion type of the current placeholder is then determined based on the probability range of this third random number. For instance, if the third random number is in the range [0, 0.4), the target distortion type is minor distortion; if it is in the range [0.4, 0.7), the target distortion type is major distortion; and if it is in the range [0.7, 1.0], the target distortion type is content contamination. If the target distortion type is a minimal distortion, an empty object, empty array, or empty string can be directly generated to simulate a data missing scenario. If the target distortion type is a massive distortion, a data block reference can be obtained from the large text resource pool preloaded into memory during system initialization, achieving zero-copy instantaneous large-capacity injection. If the target distortion type is content contamination, illegal encoding sequences, extended characters, or attack pattern strings are dynamically generated. Finally, the generated distorted values ​​are overwritten to value placeholders to complete the filling of abnormal nodes. Through the above distortion generation strategy, abnormal data can be automatically mixed into regular test data, realizing the integrated execution of boundary testing, anomaly injection testing, and business logic testing, and comprehensively verifying the system's data legality verification, anomaly capture, and stable operation capabilities.

[0087] Optionally, when the target distortion type is minimal distortion, the steps to perform the distortion operation corresponding to the target distortion type and obtain the corresponding distortion value include: Generate an empty object, an empty array, or an empty string as a distorted value.

[0088] Specifically, an empty object is an empty structure data {} without any attributes; an empty array is an empty collection [] that does not contain any elements; and an empty string is a blank string "" with a length of 0.

[0089] For example, when the target distortion type is minimal distortion, a null distortion operation corresponding to the target distortion type is performed. One of the following is randomly selected as the distorted value: an empty object, an empty array, or an empty string. An empty object is an empty structure without any attribute fields; an empty array is an empty collection containing no elements; and an empty string is blank characters of zero length. After generation, this null distorted value is written as exception data to the corresponding value placeholder, and then filled to obtain the filled value node. This type of minimal distorted null data is specifically used to test the system's parsing fault tolerance capability when receiving null values, missing fields, or empty collections, and whether the system has robust default value handling logic. It can effectively expose system defects such as parsing anomalies, program crashes, and data loss caused by null input, strengthen the system's robustness and stability verification for extreme null scenarios, and improve the exception handling capabilities of interfaces and business systems.

[0090] Optionally, when the target distortion type is maximal distortion, the steps to perform the distortion operation corresponding to the target distortion type and obtain the corresponding distortion value include: The target text block is extracted from the text library preloaded into memory as a distortion value to simulate large-capacity data packet attacks or buffer overflow scenarios. The target text block is a character sequence that conforms to a general text format, has a length greater than a preset super-large threshold, has no actual business semantics, and is preloaded into memory during system initialization.

[0091] For example, when the target distortion type is extreme distortion, a target text block with a length greater than a preset extreme threshold is directly extracted from the text library pre-loaded into the runtime memory during the initialization phase as the distortion value. This target text block is a continuous character sequence that conforms to a general text format and has no actual business semantics, which can avoid early interception by format validation while ensuring loading and generation efficiency. After generating the target text block, this extreme text block is written as an abnormal distortion value to the corresponding value placeholder, forming the filled value node. Extreme distortion data is used to simulate large-capacity data packet attacks or buffer overflow test scenarios. By injecting extremely long data beyond the system's normal processing capacity, the system's input length validation logic, maximum packet capacity limit, memory allocation and release mechanism, and buffer security management capabilities are verified. This can effectively expose problems such as parsing anomalies, memory overflows, service lag, or program crashes that may occur when the system faces extremely large data inputs, strengthening the comprehensive testing of system robustness and memory security.

[0092] Optionally, when the target distortion type is content contamination, the steps to perform the distortion operation corresponding to the target distortion type and obtain the corresponding distortion value include: Generate at least one of the following as aberration values: an illegal Unicode standard sequence, a mixed-encoded character, a four-byte non-basic multilingual planar emoji character, an SQL injection string, or an XSS attack string.

[0093] Specifically, the Unified Character Encoding Standard Sequence (Unicode) refers to Unicode encoding. An illegal Unicode sequence specifically refers to an incorrectly formatted Unicode sequence that cannot be parsed correctly. Mixed-encoded characters are hybrid characters that simultaneously contain multiple encoding formats such as UTF-8, GBK, and GB18030. Four-byte non-basic multilingual plane emojis are complex extended characters such as Emojis that exist outside the basic multilingual plane and require four-byte encoding. SQL injection strings are attack statement fragments used to attempt to bypass validation and execute database operations. XSS attack strings are attack code fragments used to attempt to inject front-end scripts.

[0094] For example, when the target distortion type is content contamination, the system performs the corresponding content contamination operation, randomly generating at least one of the following as the distortion value: an illegal Unicode encoding sequence, a mixed character with multiple encodings, a four-byte non-basic multilingual flat emoji, an SQL injection statement fragment, or an XSS script fragment. After generation, the distortion value is written as abnormal data to the corresponding value placeholder, resulting in a filled value node. This type of distortion data can be used for multi-dimensional testing: on the one hand, it verifies the system's fault tolerance for parsing illegal and mixed encodings, as well as its storage, transmission, and rendering support capabilities for four-byte extended character sets; on the other hand, by injecting typical attack strings, it verifies the system's input filtering mechanism, parameter validation logic, and protection capabilities against network attacks such as SQL injection and XSS, effectively exposing potential defects in the system's character processing, encoding compatibility, and security protection, ensuring the stable and secure operation of the system under complex and malicious input scenarios.

[0095] By automatically generating illegal encodings, mixed encodings, four-byte extended characters, and typical attack payloads, malicious or abnormal content can be mixed into normal data. This allows for simultaneous testing of the system's compatibility with illegal encodings, its ability to store and display complex characters, and its defense effectiveness against common network attacks such as SQL injection and XSS. Business testing and security testing can be integrated without the need to construct separate security test cases, effectively improving system security and robustness.

[0096] The simulated data generation method provided in this application is applied to a simulated data generation system. The simulated data generation system mainly consists of five core modules: a configuration management module, a core data generation engine, a diversified key-value generator, a distortion and anomaly injection module, and a resource management and optimization module. The simulated data generation system is ultimately encapsulated into a dynamic link library that can be directly called by external programs. It is compatible with common dynamic library formats such as .so and .dll, and has high versatility and embeddability.

[0097] The configuration management module is implemented using the singleton pattern and is responsible for system initialization and global parameter control, ensuring the global consistency of configuration parameters in the runtime environment. When the system starts, the configuration management module loads the external configuration file, maps the external configuration file to a C++ structure in memory, and generates a global configuration object. It can perform fine-grained configuration and unified scheduling of parameters such as global output format, number of generation threads, number of data templates, recursion depth, character length limit, node construction probability, and abnormal distortion ratio, providing a stable parameter basis for subsequent full-process data generation and exception injection.

[0098] The core data generation engine, as the core execution unit of the realistic data generation system, employs a multi-threaded parallel architecture and a probability-driven recursive construction algorithm to achieve efficient data skeleton construction. Based on thread pool technology, the core data generation engine executes data generation tasks in parallel according to the configured thread count parameter, supporting various concurrency modes such as single-threaded multi-template, multi-threaded single-template, and multi-threaded multi-template. Data isolation between threads reduces lock contention, significantly improving CPU utilization. The core data generation engine abstracts structured data such as JSON and XML into four basic primitives: OBJECT objects, ARRAY arrays, KEY names, and VALUE values. It recursively constructs the data structure starting from the root node, dynamically determining the current node type based on a probability model, and using a node pool to achieve random scheduling and reuse of nodes, making the generated structure closer to real business data. Simultaneously, during the recursive process, a capacity estimation algorithm is used to monitor the length of the generated data in real time. When the length approaches the preset maximum character capacity, the recursive process is forcibly terminated, ensuring the realism of the data volume while effectively avoiding memory overflow and excessive recursion.

[0099] The diversified key-value generator is used to fill the aforementioned data skeleton with highly realistic business data, realizing diversified and standardized generation of keys and values. Key name generation can randomly switch to various forms such as Chinese, English, numbers, and empty key names according to the configured probability. Value generation integrates a variety of dedicated generation algorithms, supports basic data types such as Boolean, integer, floating-point, regular strings, and standard time, and can generate simulated data for specific business scenarios, including name data containing rare characters based on the hash combination of surname dictionary and rare character dictionary, URL data that can be concatenated with protocol headers and multi-level paths and supports special character injection, and time data that conforms to ISO8601, RFC3339 and Unix timestamp formats, which can fully meet the testing needs of multiple scenarios such as character set compatibility and Web security.

[0100] The distortion and anomaly injection module is the core improvement of this system (simulated data generation system) compared to conventional data generation tools, enabling automated construction of chaotic test data. During the value node filling phase, the module uses random numbers to determine distortion trigger conditions. Upon triggering, it interrupts the normal data generation process and executes anomaly injection. Specifically, it includes three types of distortion: minimal distortion, maximal distortion, and content contamination. Minimal distortion generates empty objects, empty arrays, or empty strings to test the system's null value tolerance capability. Maximal distortion inserts preloaded, extremely large text blocks to simulate large-capacity data packet attacks and buffer overflow scenarios. Content contamination injects illegal encoding, four-byte Emoji characters, SQL injection statements, and XSS attack strings, achieving comprehensive testing of the system's encoding parsing, extended character storage, and network security protection capabilities.

[0101] The resource management and optimization module ensures high-performance system operation from the underlying algorithm and data structure level. It adopts the PCG permutation congruence generator algorithm to replace the traditional rand() random function, which has higher generation efficiency and better statistical characteristics in high-frequency call scenarios. It uses a high-performance hash table structure to replace the standard library container to improve the efficiency of dictionary lookup and key-value access, and realizes one-time loading and persistent memory of external dictionary resources through singleton file read cache, avoiding frequent I / O operations at runtime. At the same time, a memory pool mechanism is introduced for high-frequency string concatenation scenarios. By pre-allocating memory, the overhead of dynamic memory allocation and release is reduced, and the overall system's operating efficiency and stability are improved in high-concurrency, large-batch data generation scenarios.

[0102] It should be noted that the above examples are only for understanding this application and do not constitute a limitation on the simulated data generation method of this application. Any simple modifications based on this technical concept are within the protection scope of this application.

[0103] This application also provides a simulated data generation device; please refer to [reference needed]. Figure 4 The simulated data generation device includes: Configuration loading module 401 is used to load external configuration files, parse the external configuration files and map them into a structure in memory to obtain a global configuration object. The global configuration object includes the target output format and at least one data structure template. Task creation module 402 is used to create data generation tasks based on a global configuration object. Each data generation task is associated with a data structure template. The skeleton construction module 403 is used to perform recursive construction based on the probability model and structural constraint information in the associated data structure template when executing the data generation task, and generate the data skeleton to be filled. The skeleton filling module 404 is used to fill the key placeholders and value placeholders in the data skeleton according to the field name generation strategy, distortion rate parameter, field content generation strategy and distortion generation strategy in the data structure template, so as to obtain a structured data object containing normal data and abnormal data. The format conversion module 405 is used to perform serialization processing on the structured data object according to the target output format to obtain simulated data.

[0104] The simulated data generation apparatus provided in this application, employing the simulated data generation method in the above embodiments, can solve the technical problem that existing technologies cannot efficiently generate simulated test data with dynamically variable structures that includes both normal and abnormal data. Compared with the prior art, the beneficial effects of the simulated data generation apparatus provided in this application are the same as those of the simulated data generation method provided in the above embodiments, and other technical features in the simulated data generation apparatus are the same as those disclosed in the methods of the above embodiments, and will not be repeated here.

[0105] This application provides a simulated data generation 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 to enable the at least one processor to perform the simulated data generation method in the first embodiment described above.

[0106] The following is for reference. Figure 5 The diagram illustrates a structural schematic of a simulated data generation device suitable for implementing embodiments of this application. The simulated data generation device in the embodiments of this application may include, but is not limited to, mobile terminals such as laptops, digital broadcast receivers, tablet computers (PADs), in-vehicle terminals (e.g., in-vehicle navigation terminals), and fixed terminals such as digital TVs and desktop computers. Figure 5 The simulated data generation device shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of this application.

[0107] like Figure 5As shown, the simulated data generation device may include a processing unit 1001 (e.g., a central processing unit, a graphics processing unit, etc.), which can perform various appropriate actions and processes according to a program stored in read-only memory (ROM) 1002 or a program loaded from storage device 1003 into random access memory (RAM) 1004. The random access memory 1004 also stores various programs and data required for the operation of the simulated data generation device. The processing unit 1001, ROM 1002, and RAM 1004 are interconnected via a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Typically, the following systems can be connected to the input / output interface 1006: input devices 1007 including, for example, touchscreens, touchpads, keyboards, mice, image sensors, microphones, accelerometers, gyroscopes, etc.; output devices 1008 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 1003 including, for example, magnetic tapes, hard disks, etc.; and communication devices 1009. Communication device 1009 allows the simulation data generation device to communicate wirelessly or wiredly with other devices to exchange data. Although simulation data generation devices with various systems are shown in the figures, it should be understood that it is not required to implement or possess all the systems shown. More or fewer systems can be implemented alternatively.

[0108] Specifically, according to the embodiments disclosed in this application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments disclosed in this application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device, or installed from storage device 1003, or installed from read-only memory 1002. When the computer program is executed by processing device 1001, it performs the functions defined in the methods of the embodiments disclosed in this application.

[0109] The simulated data generation device provided in this application, employing the simulated data generation method in the above embodiments, can solve the technical problem that existing technologies cannot efficiently generate simulated test data with dynamically variable structures that includes both normal and abnormal data. Compared with the prior art, the beneficial effects of the simulated data generation device provided in this application are the same as those of the simulated data generation method provided in the above embodiments, and other technical features in this simulated data generation device are the same as those disclosed in the method of the previous embodiment, and will not be repeated here.

[0110] It should be understood that the various parts disclosed in this application can be implemented using 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 suitable manner in one or more embodiments or examples.

[0111] The above are merely specific embodiments of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

[0112] This application provides a computer-readable storage medium having computer-readable program instructions (i.e., a computer program) stored thereon, the computer-readable program instructions being used to execute the simulated data generation method in the above embodiments.

[0113] The computer-readable storage medium provided in this application may be, for example, a USB flash drive, but is not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to: electrical connections having one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. 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 conjunction with an instruction execution system, system, or device. The program code contained on the computer-readable storage medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination thereof.

[0114] The aforementioned computer-readable storage medium may be included in the simulation data generation device; or it may exist independently and not assembled into the simulation data generation device.

[0115] The aforementioned computer-readable storage medium carries one or more programs. When these programs are executed by the simulated data generation device, the simulated data generation device performs the following actions: loads an external configuration file, parses and maps the external configuration file into a structure in memory to obtain a global configuration object, which includes a target output format and at least one data structure template; creates a data generation task based on the global configuration object, which is associated with a data structure template; when executing the data generation task, performs recursive construction based on the probability model and structural constraint information in the associated data structure template to generate a data skeleton to be filled; fills the key placeholders and value placeholders in the data skeleton according to the field name generation strategy, distortion rate parameter, field content generation strategy, and distortion generation strategy in the data structure template to obtain a structured data object containing normal and abnormal data; and performs serialization processing on the structured data object according to the target output format to obtain simulated data.

[0116] Computer program code for performing the operations of this application can be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, and C++, and conventional procedural programming languages ​​such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a Local Area Network (LAN) or a Wide Area Network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0117] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation that may be implemented in systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0118] The modules described in the embodiments of this application can be implemented in software or hardware. The names of the modules do not necessarily limit the functionality of the unit itself.

[0119] The readable storage medium provided in this application is a computer-readable storage medium that stores computer-readable program instructions (i.e., a computer program) for executing the above-described simulated data generation method. This solves the technical problem that existing technologies cannot efficiently generate simulated test data with dynamically variable structures that include both normal and abnormal data. Compared with existing technologies, the beneficial effects of the computer-readable storage medium provided in this application are the same as those of the simulated data generation method provided in the above embodiments, and will not be elaborated upon here.

[0120] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the simulated data generation method described above.

[0121] The computer program product provided in this application can solve the technical problem that existing technologies cannot efficiently generate simulated test data with dynamically variable structures that include both normal and abnormal data. Compared with the prior art, the beneficial effects of the computer program product provided in this application are the same as those of the simulated data generation method provided in the above embodiments, and will not be repeated here.

[0122] The above description is only a part of the embodiments of this application and does not limit the patent scope of this application. All equivalent structural transformations made under the technical concept of this application and using the contents of the specification and drawings of this application, or direct / indirect applications in other related technical fields, are included in the patent protection scope of this application.

Claims

1. A method for generating simulated data, characterized in that, The method for generating realistic data includes: Load an external configuration file, parse the external configuration file and map it to a structure in memory to obtain a global configuration object, which includes a target output format and at least one data structure template; A data generation task is created based on the global configuration object, and the data generation task is associated with a data structure template. When performing the data generation task, recursive construction is performed based on the probability model and structural constraint information in the associated data structure template to generate a data skeleton to be filled. Based on the field name generation strategy, distortion rate parameter, field content generation strategy and distortion generation strategy in the data structure template, the key placeholders and value placeholders in the data skeleton are filled to obtain a structured data object containing normal data and abnormal data. The structured data object is serialized according to the target output format to obtain simulated data.

2. The method for generating simulated data as described in claim 1, characterized in that, The step of generating a data skeleton to be filled by recursively constructing data based on the probability model and structural constraint information in the associated data structure template when performing the data generation task includes: Starting from the root node, initialize the current recursion depth to zero; At the current node, based on the probability model and the node type of the parent node corresponding to the current node, the target node type of the current node is randomly determined from multiple candidate node types, and a placeholder for the target node type is inserted into the current node. The candidate node types include objects, arrays, keys, and values. When the current recursion depth is less than the maximum recursion depth in the structural constraint information, determine whether to create a child node for the current node based on the target node type of the current node; If so, create at least one child node for the current node, increment the current recursion depth by one, and set the child node as the current node. Then, return to the step of randomly determining the target node type of the current node from multiple candidate node types based on the probability model and the node type of the parent node corresponding to the current node, until the current recursion depth equals the maximum recursion depth, and end the recursion of the current branch. If not, terminate the recursion of the current branch; When the recursion of all branches ends, the data skeleton with multiple nested layers is obtained.

3. The method for generating simulated data as described in claim 2, characterized in that, Also includes: During the recursive construction process, an estimation algorithm is used to dynamically estimate the total number of characters in the currently generated data skeleton, and the estimated total number of characters in the currently generated data skeleton is obtained. When the estimated total reaches the maximum character length in the structural constraint information, the recursion of all branches stops.

4. The method for generating simulated data as described in claim 1, characterized in that, The step of filling the key placeholders and value placeholders in the data skeleton according to the field name generation strategy, distortion rate parameter, field content generation strategy and distortion generation strategy in the data structure template to obtain a structured data object containing normal data and abnormal data includes: For each key placeholder in the data skeleton, a corresponding key name is generated according to the field name generation strategy, and the key name is written into the corresponding key placeholder to obtain the filled key node; For each value placeholder in the data skeleton, a first random number is generated based on the probability corresponding to the distortion rate. When the first random number does not fall into the preset range, a corresponding business simulation value is generated based on the key node paired with the field content generation strategy and the value placeholder. The business simulation value is then written into the value placeholder to obtain the filled value node. When the first random number falls into the preset interval, the distortion generation strategy is invoked to generate corresponding abnormal data, and the abnormal data is written into the corresponding value placeholder to obtain the filled value node. By combining all the filled key nodes and value nodes, a structured data object containing normal and abnormal data is obtained.

5. The method for generating realistic data as described in claim 4, characterized in that, The step of generating a corresponding key name for each key placeholder in the data skeleton according to the field name generation strategy, and writing the key name into the corresponding key placeholder to obtain the filled key node includes: For each key placeholder in the data skeleton, a second random number is generated based on the various key name types and corresponding generation probabilities defined in the field name generation strategy, and the target key name type of the key placeholder is determined, and the key name of the target key name type is generated. The key name type includes Chinese key name, English key name, numeric key name and empty key name, and the target key name type is one of the Chinese key name, the English key name, the numeric key name or the empty key name; Write the key name of the target key name type into the corresponding key placeholder to obtain the key node corresponding to the key placeholder.

6. The method for generating realistic data as described in claim 4, characterized in that, The field content generation strategy includes a name generation sub-strategy, a Uniform Resource Locator (URL) generation sub-strategy, a time generation strategy, and a basic type generation strategy. The step of generating a corresponding business simulation value based on the key node paired with the field content generation strategy and the value placeholder, and writing the business simulation value into the value placeholder to obtain the filled value node, includes: Based on the field semantic information carried by the key node paired with the value placeholder, a corresponding target field content generation sub-strategy is matched from the field content generation strategy. The target field content generation sub-strategy is one of the name generation sub-strategy, the URL generation sub-strategy, the time generation sub-strategy, and the basic type generation sub-strategy. Based on the content of the target field, a sub-strategy is generated to generate the business simulation value that conforms to the distribution of real business scenarios, and the business simulation value is written into the value placeholder to obtain the filled value node.

7. The method for generating realistic data as described in claim 4, characterized in that, The steps of calling the distortion generation strategy to generate corresponding abnormal data and writing the abnormal data into the corresponding value placeholder to obtain the filled value node include: Based on the various distortion types and corresponding distortion probabilities defined in the distortion generation strategy, a third random number is generated and the target distortion type of the value placeholder is determined. Perform the distortion operation corresponding to the target distortion type to obtain the corresponding distortion value; The distorted value is written as the abnormal data into the corresponding value placeholder to obtain the filled value node; The distortion types include minimal distortion, maximum distortion, and content contamination, and the target distortion type is one of the minimal distortion, maximum distortion, or content contamination.

8. The method for generating realistic data as described in claim 7, characterized in that, When the target distortion type is minimal distortion, the step of performing the distortion operation corresponding to the target distortion type to obtain the corresponding distortion value includes: Generate an empty object, an empty array, or an empty string as a distorted value; When the target distortion type is the maximum distortion, the step of performing the distortion operation corresponding to the target distortion type to obtain the corresponding distortion value includes: The target text block is extracted from the text library preloaded into memory as the distortion value. The target text block is a character sequence that conforms to a general text format, has a length greater than a preset super-large threshold, has no actual business semantics, and is preloaded into memory during system initialization. When the target distortion type is content contamination, the step of performing the distortion operation corresponding to the target distortion type to obtain the corresponding distortion value includes: The aberration value is generated by generating at least one of the following: an illegal Uniform Character Encoding Standard sequence, a mixed-encoding character, a four-byte non-basic multilingual planar emoji character, a Structured Query Language (SQL) injection string, or a Cross-Site Scripting (XSS) attack string.

9. A simulated data generation device, characterized in that, The device includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, the computer program being configured to implement the steps of the simulated data generation method as described in any one of claims 1 to 8.

10. A storage medium, characterized in that, The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, it implements the steps of the simulated data generation method as described in any one of claims 1 to 8.