Generating test data by using data definitions or schema and exporting it to a database

You can generate test data by using data defintions or and schema, and export it directly to a connected database in HCL DevOps Test Hub (Test Hub). This process supports populating or updating database tables with realistic and schema-aligned test data used in development, testing, or validation workflows.

Before you begin

You must have completed the following tasks:

Procedure

  1. Log in to Test Hub.

    The Projects page of the initial team space is displayed.

  2. Click My projects > project_name to open the project that contains the test assets.

    The Overview page of the project is displayed.

  3. Click Author > Data.

    The Data page and the data navigator panel are displayed.

  4. Select the branch from the Branch list.
    The navigation panel displays all the existing projects in the selected branch.
  5. Select the data definition or schema from which you want to generate and export test data in the data navigator panel.

    The selected data definition or schema is displayed in the Data page.

    Note: You can either enter the name of the data definition or schema in the Search field or expand the project and manually search in the data navigator panel.
  6. Click the Preview icon to preview the test data that you want to generate.

    The test data is generated in the preview dialog.

    Note: You can preview test data to ensure whether the data is in the expected format. If you modify the data definition or schema and do not save it, you can still preview the corresponding test data. However, you can generate the test data only after you save.
  7. Click the Generate icon on the Data page.
    The Generate data dialog is displayed.
  8. Perform the following steps to generate test data by using data definitions:
    1. Select the appropriate database from the Select a Database Connection list.
    2. Select a table from the Table dropdown.

      The selected table name appears in the Table field.

      If the selected table structure does not match the data definition for data generation, a Mismatch indicator is displayed next to the table name, and the Export button is disabled.

      The Current Contents field displays the existing number of rows in the selected table.

    3. Enter the number of rows you want to generate in the Number of Rows field.
  9. Perform the following steps to generate schema based test data:
    1. Select the appropriate database from the Select a Database Connection list.

      The Tables column lists the available tables from the schema.

      The Current column displays the number of existing rows in each table.

    2. Enter the number of rows to generate for each table in the Generate column.

      If there is a mismatch between the selected table and the schema used for data generation, a Schema mismatch indicator is dispalyed, and you cannot generate data for that table.

    3. Enter a value in the Target field to customize the number of rows to be generated in the tables.

      The default value in the Target field is set to 100%.

      For example, if a table in the database contains 10 rows and if you set the Target field to 200%, then the generated data displays 20 rows.

  10. Optional: Enter the seed value in the Seed field.
    Whenever you generate data to perform application testing, the generated data is different. You can produce the same set of data multiple times by setting the seed value.
    For example, consider that you have used the seed value of 1 to generate data from a data defintion or schema. When you want to create another data with the same set of values, then you can provide the seed value as 1 during the creation of the test data.
  11. Optional: Select the Overwrite checkbox to overwrite the rows in the tables for generating data.
    This option is not selected initially.
    For example, if a table in the database contains 10 rows and if you select the Overwrite checkbox, then the generated data replaces the existing 10 rows with new data generated.
  12. Click the Export option to initiate the generation of the test data.
    The generated data is exported to the database.

Results

You have generated the test data by using data definition or schema and exported it to directly to the connected database.

What to do next

You can create a dataset by using the database query. See Creating a dataset by using a database query.