Skip to main content

Generate Test Data

NineData supports the automatic generation of random data in the database that conforms to specific business scenarios, simulating the actual production environment data situation, and helping users perform functional testing, stress testing, and other verification work without using real data.

Feature Description

  • Custom Data Generation: Supports customizing field generation rules and algorithms according to specific business needs, ensuring that the generated data complies with actual business logic. For example, the name field can generate names in a specific format, and the date field can generate dates within a specific range.

  • Data Volume Control: The quantity of generated data can be controlled, supporting the generation of data from a small scale to tens of millions of data records, meeting different testing needs.

  • Field Association and Dependency: Data can be automatically generated based on the association relationships between fields, ensuring the consistency of data between tables and fields, such as the maintenance of foreign key relationships.

  • Data Distribution Settings: Users can set the distribution ratio of generated data, including NULL value ratio, unique values, duplicate values, etc., helping to simulate the data distribution characteristics in the production environment.

Usage Scenarios

  • Functional Testing: During the development process, test data is generated to verify whether the system's functions operate as expected. For example, in user registration functional testing, a batch of simulated user data can be generated to test the correctness of user registration, login, and data storage.

  • Performance Testing: By generating a large amount of data, the system's operation under high load is simulated, testing the system's response speed, resource consumption, and scalability. For example, generating millions of order data for performance testing to check the database's query and insertion performance.

  • Migration Functional Testing: When performing data migration or version upgrades, generating test data can verify whether the data migration process is correct, ensuring that the data remains complete and consistent in the environment after migration or upgrade.

Prerequisites

  • The data source that needs to generate test data has been added to NineData. For how to add it, please refer to Add Data Source.
  • The supported data source type is MySQL, Oracle, OceanBase for Oracle, OceanBase for MySQL, TiDB, GreatSQL, ClickHouse, Doris, StarRocks, TDSQL MySQL.

Create Data Generation Task

  1. Log in to the NineData Console.

  2. Click on > in the left navigation bar.
  1. Under the tab, click on in the upper right corner, and then configure the following parameters according to the table below, and click .

    ParameterDescription
    Enter the name of the data generation task.
    Select the target data source and database (Schema) for the data generation task.
    Click , select the target table for the data generation task. On the right side of , you can click the name of the simulation template to change the simulation template. Simulation templates support custom configuration, please refer to Manage Simulation Templates.
    After the table is added, the page will automatically list the table and all its fields.
    • : In the text box in the left table name area, you can configure the amount of data to be generated. This data volume is affected by the rule, with a maximum of 10 million records. For rule configuration methods, please refer to Edit Policy.
    • : In the right field name area, you can manually configure simulation rules for each field, and click under the column on the right side of each field to configure simulation algorithms for each column.
    Select the processing strategy for duplicate objects encountered during data generation, supporting , , three strategies.
    【Not displayed in personal mode】The person responsible for executing the current data generation task after approval.
    Description: The options in the drop-down list depend on the following two situations:
    • The current data source has configured development specifications: The options in the list are based on the rule configured in the current specification. This rule is located in the tab, for how to configure development specifications, please refer to Edit Policy.
    • The current data source has not configured development specifications: The options in the list are users who have permission for the current data source. More about authorization, please refer to Configure User Permissions.
    (Optional)【Not displayed in personal mode】Used to record and explain the purpose and background of creating the data generation task, especially in team collaboration, task auditing, and approval processes, recording the reason for generation helps to verify the rationality of the task and promote the progress of the task flow.
  2. Enter the node, the system will pre-audit the task based on the SQL Development Specifications associated with the current data source, and there will be the following results:

    • Pre-audit passed: Depending on the configuration of the approval process, the task status will change to or . If it is the former, please continue to the next step. If it is the latter, this process ends.
    • Pre-audit not passed: The task status will change to , you can Withdraw Data Generation Task to re-edit and submit.

Withdraw Data Generation Task

When the task status is , , , or , you can withdraw the application for the task. After withdrawal, the task will no longer be executed, and you can re-edit the task form and submit it again.

Prerequisites

  • The task status is , , , or .
  • You are the or of the target task.

Operation Steps

  1. Log in to the NineData Console.

  2. Click on > in the left navigation bar.
  1. Under the tab, find the target task, click on the task ID or the column on the right side of the task, and click . Click in the upper right corner of the page.

  2. In the pop-up confirmation window, click or .

    • : The task status changes to . If you need to re-edit the task, you can find the task in the list, click on under the column on the right, and re-submit the task form.
    • : The task status changes to and automatically jumps to the task editing page.

Approve Data Generation Task

Prerequisites

  • The task status is .
  • You are the or of the target task.

Operation Steps

  1. Log in to the NineData Console.

  2. Click on > in the left navigation bar.
  1. Under the tab, find the target task, click on the task ID or the column on the right side of the task, and click .

  2. On the page, approve the task, and choose , , or according to the actual situation.

    Operation
    Description
    Transfer the task to another user for approval.
    Approve the application, click , you can input as needed, and click .
    Reject the application and do not execute the task. Click , you also need to input , and click .

Execute Data Generation Task

When the task status is , you can execute the task.

Prerequisites

  • The task status is .
  • You are the or of the target task.

Operation Steps

  1. Log in to the NineData Console.

  2. Click on > in the left navigation bar.
  1. Under the tab, click on the task ID of the target status .

  2. On the page, click in the upper right corner.

  3. In the pop-up window, select , click , and then wait for the task status to change to .

    • : Execute the SQL statement immediately.
    • : Choose a time to execute the SQL statement.

    After successful execution, you can open the SQL Console to verify the generated data.