All Products
Search
Document Center

Data Management:Generate test data

Last Updated:Feb 22, 2024

Data Management (DMS) provides the test data generation feature that allows you to batch generate various test data at a time, including random values, region names, and virtual IP addresses. This feature helps simplify test data generation.

Preparations

A table is created in the database. For more information, see the "Create a table" section in the Manage a database on the SQLConsole tab topic.

In this example, a database named poc_dev and a table named big_table are created.

Procedure

This example shows how to generate 1 million rows of test data for the big_table table.

  1. Log on to the DMS console V5.0.

  2. In the top navigation bar, choose Database Development > Environment Construction > Test Data Generation.

    Note

    If you use the DMS console in simple mode, move the pointer over the 2022-10-21_15-25-22.pngicon in the upper-left corner of the DMS console and choose All functions > Database Development > Environment Construction > Test Data Generation.

  3. Click Test Data Generation in the upper-right corner of the page. In the Application step on the Test Data Generation Tickets page, set the parameters for submitting a test data generation ticket.

    Select one of the following options for the Conflict Handling parameter:

    • Skip when encountering data conflicts: If a data conflict occurs while writing data of the primary key or a unique key, DMS skips the conflicting data records and continues to write other data records.

    • Replace when encountering data conflict: If a data conflict occurs while writing data of the primary key or a unique key, DMS updates the original data records and continues to write other data records.

  4. After the parameters are configured, click Submit.

  5. After the ticket is approved, DMS automatically generates and executes SQL statements. You can view the execution progress on the Ticket Details page.

  6. After the test data is generated, go to the SQL Console tab and query the generated test data in the poc_dev database.

    1. Move the pointer over the database name in the Basic Information section of the page.

    2. Click Query in the menu and you are automatically redirected to the page of SQL Console.

    3. Enter the following SQL statement to query the number of rows in the big_table table, and click Execute.

      SELECT COUNT(*) FROM `big_table`;

For more information, see Generate test data.