Generate test data
NineData can generate simulated data that follows selected business rules and table relationships. Use generated data for functional testing, stress testing, migration validation, and other non-production verification work without using real customer data.
What data generation supports
Custom generation rules: Define field-level generation rules and algorithms for specific business needs. For example, generate names in a specific format or dates within a specific range.
Data volume control: Generate anything from small test samples to tens of millions of records for different test scenarios.
Field associations and dependencies: Generate data based on relationships between fields and tables, such as foreign key relationships, to keep generated data consistent.
Data distribution settings: Configure distribution ratios such as NULL values, unique values, and duplicate values to simulate production-like data distribution.
Use cases
Functional testing: Generate test data during development to verify whether application features work as expected. For example, generate simulated user data to test registration, login, and data storage.
Performance testing: Generate large datasets to simulate high-load scenarios and test response time, resource consumption, and scalability. For example, generate millions of order records to test query and insert performance.
Migration validation: Generate test data before migration or version upgrades to verify whether the migration process keeps data complete and consistent.
Prerequisites
- The data source for test data generation has been added to NineData. See Add a data source.
- Supported data source types are MySQL, Oracle, OceanBase for Oracle, OceanBase for MySQL, TiDB, GreatSQL, ClickHouse, Doris, StarRocks, and TDSQL MySQL.
Create a data generation task
Log in to the NineData Console.
- Click on DevOps > Data Generation in the left navigation bar.
On the Data Generation tab, click Create Task in the toolbar, configure the parameters, and click Create Task.
Parameter Description Name Enter a name for the data generation task. Datasource/Database Select the target data source and database (Schema) for the data generation task. Tables Click Add Tables and select the target table for the data generation task. Next to Tables, click the simulation template name to change the simulation template. Simulation templates can be customized. See Manage simulation templates.
After the table is added, NineData lists the table and all its fields.- Generated data volume: In the Generated data volume text box in the left table-name area, configure the amount of data to generate. This data volume is affected by the Data generation record number threshold configuration rule, with a maximum of 10 million records. For rule configuration, see Edit Policy.
- Simulation Rule: In the right field-name area, manually configure simulation rules for each field. Click Actions under the Configure Algorithm column of each field to configure simulation algorithms for each column.
Conflict strategy Select the strategy for handling duplicate objects during data generation. Supported strategies are Encounter conflict termination, Encounter conflict skip, and Encounter conflict repalce. Executor Not displayed in personal mode. Select the user responsible for executing the current data generation task after approval.
Description: The options in the Executor drop-down list depend on whether the current data source uses development specifications:- The current data source has development specifications configured: The options are based on the Generate task executor configuration rule configured in the current specification. This rule is located in the Data Generation tab. For configuration details, see Edit Policy.
- The current data source does not have development specifications configured: The options are users who have Data Generation Task - Submit permission for the current data source. For permission configuration, see Configure User Permissions.
Reason (Optional) Not displayed in personal mode. Record the purpose and background of the data generation task. In team collaboration, task auditing, and approval workflows, this reason helps reviewers understand why the task is needed. Enter the Pre-check node. NineData runs a pre-check based on the SQL development policy associated with the current data source. One of these outcomes occurs:
- Pre-check passed: Depending on the approval process configuration, the task status changes to Pending or Approved. If the task is pending submission, continue to the next step. If the task is approved, continue with the execution workflow.
- Pre-check failed: The task status changes to Pre-Check Failed. You can withdraw the data generation task, edit it, and submit it again.
Withdraw a data generation task
When the task status is Pre-Checking, Pending Approval, Approved, or Scheduled, you can withdraw the task request. After withdrawal, the task is no longer executed. You can edit the task form and submit it again.
Prerequisites
- The task status is Pre-Checking, Pending Approval, Approved, or Scheduled.
- You are the Submitter or Administrator of the target task.
Procedure
Log in to the NineData Console.
- Click on DevOps > Data Generation in the left navigation bar.
On the Data Generation tab, find the target task. Click the task ID, or click Details in the Actions column. On the Details page, click Withdraw in the toolbar.
In the confirmation window, click Withdraw or Withdraw and Edit.
- Withdraw: The task status changes to Withdraw. To edit the task again, find it in the Data Generation list, click Duplicate in the Actions column, and submit the task form again.
- Withdraw and Edit: The task status changes to Withdraw, and NineData opens the task editing page.
Approve a data generation task
Prerequisites
- The task status is Pending Approval.
- You are the Approver or Administrator of the target task.
Procedure
Log in to the NineData Console.
- Click on DevOps > Data Generation in the left navigation bar.
On the Data Generation tab, find the target task. Click the task ID, or click Details in the Actions column.
On the Details page, review the task and select the action that matches your decision: Transfer, Approved, or Rejected.
Operation Description Transfer Transfer the task to another user for approval. Approved Approve the request. After you click Approved, enter Reason if needed, then click OK. Rejected Reject the request and do not execute the task. After you click Rejected, enter Reason for rejection, then click OK.
Execute a data generation task
When the task status is Approved, you can execute the task.
Prerequisites
- The task status is Approved.
- You are the Executor or Administrator of the target task.
Procedure
Log in to the NineData Console.
- Click on DevOps > Data Generation in the left navigation bar.
On the Data Generation tab, click the task ID whose status is Approved.
On the Details page, click Execute in the toolbar.
In the dialog, select Execution Method, click OK, and wait until the task status changes to Success.
- Execute Now: Execute the data generation task immediately.
- Scheduled Execution: Choose a time to execute the data generation task.
After execution succeeds, open SQL Console to verify the generated data.
Result
The data generation task creates simulated records in the selected target tables. Verify the generated data in SQL Console before using it for functional tests, performance tests, or migration validation.