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
- Ensured that you are assigned a role as a Project Owner or Tester in the project. See Managing access to the server projects.
- Ensured that your project contains data definition or schema.
Procedure
-
Log in to Test Hub.
The Projects page of the initial team space is displayed.
-
Click to open the project that contains the test assets.
The Overview page of the project is displayed.
-
Click .
The Data page and the data navigator panel are displayed.
-
Select the branch from the Branch list.
The navigation panel displays all the existing projects in the selected branch.
-
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. -
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. -
Click the Generate icon
on the Data page.
The Generate data dialog is displayed. -
Perform the following steps to generate test data by using data
definitions:
- Select the appropriate database from the Select a Database Connection list.
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.
- Enter the number of rows you want to generate in the Number of Rows field.
-
Perform the following steps to generate schema based test data:
- 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.
-
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.
-
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.
- Select the appropriate database from the Select a Database
Connection list.
-
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.
-
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.
-
Click the Export option to initiate the generation of
the test data.
The generated data is exported to the database.
Results
What to do next
You can create a dataset by using the database query. See Creating a dataset by using a database query.