Creating a data definition by importing fields from a database query

You can create data definition to generate a random test data that is required to run a test in HCL DevOps Test Hub (Test Hub) using the specific database fields.

Before you begin

You must have completed the following tasks:

About this task

You must first create a database query and then create a data definition using the database query to import the specific fields from the database query. After you import fields to the data definition, you can edit the data definition and add generators for the specific fields before you generate the test data.

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 in the project repository from the Branch list.

    The assets and resources in the selected branch are displayed in the data navigator panel.

  5. Perform any of the following actions:
    • Click the Open action menu icon in the data navigator, and then click Data definition.
    • Click Add files in the right panel, and then click Data definition.
    • Right-click the application in the data navigator panel, select New > Data definition.

    The Edit Branch dialog is displayed.

    If the Edit branch dialog is not displayed, then go to step 7.

  6. Select your action to either select an existing Edit branch or create an Edit branch:
    • Perform the following steps to select an existing Edit branch:
      1. Select Use an existing edit branch.
      2. Select an Edit branch from the Select branch list if Edit branches already exist for your repository.
        Note: A warning message is displayed if the Edit branch, which you selected, is behind the source branch. To update the selected edit branch and maintain synchronization with the source branch, you can select the Update branch option when switching checkbox.
      3. Click Ok.
    • Perform the following steps to create the Edit branch:
      1. Select Create new edit branch.
      2. Enter a name for the Edit branch in the Branch Name field.
      3. Click Save.
  7. In Step 1 of the Create Data Definition dialog, perform the following tasks:
    1. Select the Application for which you want to create a data definition.
    2. Select Location from the drop-down list to store the dataset.
    3. Type a Name for the data definition.
    4. Add a description about the data definition in the Description field.
    5. Click Next to proceed to Step 2.
  8. In Step 2 of the Create Data Definition dialog, perform the following tasks:
    1. Select Source as Import fields from a database query.
    2. Select the required database query file in your project.
    3. Click Create.

    The new data definition opens in the Data page in the editing mode. The columns in the database query are added as the fields of the new Data definition but no generators are added. The data definition created is listed under the logical folder Data definitions under the application selected..

Results

You have created a data definition in your project by importing fields from a database query.

What to do next

You can perform the following tasks: