Editing a dataset in Test Editor

You can now create and edit a dataset in Test Editor either through the catalog in the Visual view or through the written code in the Code view. However, for encrypted datasets, switching to the Code view is disabled to ensure data confidentiality.

Before you begin

  1. Ensured that you are assigned a Team Space Owner, Project Owner, or Member with a Tester role to create or edit a test resource.
  2. Read and understood the information in Edit branch overview and Create or select an Edit branch.
  3. Ensured that you have created a dataset or configured a repository that contains the dataset.

About this task

If you are a project Owner or Tester in HCL DevOps Test Hub (Test Hub), you can perform basic tasks in datasets by right-clicking any row, column, or cell in the dataset to organize your data more efficiently. For example, you can cut, copy, paste, insert, or delete rows or columns, show encrypted data, encrypt column data, or rename column names.

After you edit the dataset, you can save the changes made to the dataset, and then you can publish the dataset to the Git repository. If you save and close the edited dataset, the Changes page lists the edited dataset, and later you can publish it to the Git repository for other members to use.

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 > Test Editor.
    The Test Editor page and the test navigator panel are displayed.
  4. Select the branch that contains your project with the datasets that you want to edit.

    The projects in the selected branch are displayed in the Test Editor navigator panel. The datasets are listed under the folder you created to contain the dataset within a logical folder named Datasets.

  5. Click the dataset in the Test Editor navigator panel.

    The dataset opens in the right pane.

    The dataset is displayed in the Visual view, where you can add, modify, remove, import, or export data by using the toolbar actions or the right-click menu. If needed, you can switch to the Code view to edit the dataset in code form.
    Note:
    For encrypted columns, switching to the Code view is not allowed.
  6. Click Edit.

    Alternatively, right-click the dataset in the Test Editor navigator panel, and then click Edit.

    The Edit Branch dialog is displayed.

    If the Edit Branch dialog is not displayed, then go to step 8.

  7. Select an existing branch or create a new branch.
  8. Perform the following actions to use the top-level editing controls available in the toolbar:
    Editing Options Actions
    Find and Replace Find and replace icon To find:
    1. Click the Find and Replace icon Image of the Find icon.
    2. Enter the content that you want to search for in the Find field.
    3. Select any of the following options to refine your search content:
      • Select the Case sensitive icon Image of the case sensitive option icon to search the content that matches the exact letter case entered in the Find field.
      • Select the Match entire cell contents icon Image of the entire cell contents option icon to search for cells that contain only the characters that you have entered in the Find field.
      • Select the Search using regular expression icon Image of the regular expression option icon to search the pattern that matches strings.
        For example, to search a cell that contains any number between 0 to 9, do the following:
        1. Enter \d in the Find field.
        2. Select the Search using regular expression checkbox.
        3. Click Find.
    4. Click the Find icon Image of the Find icon. If the text is found, the cell containing that text is selected.
    5. Click the Find icon Image of the Find icon again to find further instances of the search text.

    To find and replace:

    1. Click the Find and Replace icon Image of the Find icon.
    2. Enter the content that you want to search for in the Find field.
    3. Enter the content that you want to replace in the Replace field.
    4. Select any or all of the following options to find and replace the content more effectively:
      • Select the Case sensitive icon Image of the case sensitive option icon to find the content that is the exact letter case of the content entered in the Find field.
      • Select the Match entire cell contents icon Image of the entire cell contents option icon to find and replace for cells that contain only the characters that you have entered in the Find and Replace fields.
      • Select the Search using regular expression icon Image of the regular expression option icon to find and replace the pattern that matches strings.
    5. Click the Replace icon Image of the replace option icon to replace the individual instances.
    6. Click the Replace All icon Image of the replace all option icon to replace every instance of the content throughout the dataset.
    Undo Undo_icon
    1. Click the Undo icon icon_undo.
    2. From the list, click the change that you want to undo.
    The Undo option reverts the change you made in the dataset.
    Redo icon_redo
    1. Click the Redo icon icon_redo.
    2. From the list, click the change that you want to redo.
    Import import_icon
    You can import variable data into a dataset from the following sources:
    • When there is a large amount of data stored in a CSV file

    • When you use the data fabrication feature to generate test data

    • When you import data by using a database query

    Importing data from a CSV file

    1. Click the Import icon import_icon.

    2. Select Import a CSV file from the drop-down list.

    3. Click Select file, and choose the CSV file that contains variable data to import into the dataset.

    4. Enable the First row contains headers if your CSV file contains the header.

    5. Select one of the following import options to append or overwrite data in the dataset:

      • Enable Overwrite existing data to add the rows and columns from the beginning of the dataset.
      • Enable Append existing data to add rows and columns to the end of the dataset.
    6. Click Import.

    Importing data by using data fabrication

    1. Click the Import icon import_icon.

    2. Select Fabricate data from the drop-down list.

    3. Select a data definition from the drop-down list.

    4. Enter the number of rows that you want to generate in the Number of Rows field.

    5. Enter a seed value in the Seed (optional) field.

    6. Enable Fabricate headers if your schema contains the headers.

    7. Select one of the following options to append or overwrite data in the dataset:

      • Enable Overwrite existing data to add the rows and columns from the beginning of the dataset.
      • Enable Append existing data to add rows and columns to the end of the dataset.
    8. Click Import.

    Importing data by using a database query

    1. Click the Import icon import_icon.

    2. Select Import a Database Query from the drop-down list.

    3. Select a database query from the drop-down list.

    4. Enter the number of rows that you want to generate in the Number of Rows field.

    5. Select one of the following options to append or overwrite data in the dataset:

      • Enable Overwrite existing data to add the rows and columns from the beginning of the dataset.
      • Enable Append existing data to add rows and columns to the end of the dataset.
    Export export_icon You can export variable data from a dataset to a CSV file to reuse the data in future tests. You must open the dataset from which you want to export the data.

    Click the Export icon export_icon to download the dataset as a CSV file.

    Configure You can configure the dataset by clicking the Menu icon Image of the menu icon, and then selecting Configure. In the Configure Dataset dialog, you can change the row and column settings and configure the string values in the dataset that contain variable data for tests to use when they run.
    • Select any of the separator values that you used in the CSV file.

      The available options are Comma, Semicolon, Space, Tab, and Other. If the CSV file uses any separator characters that are not listed, select Other, and then you can specify the character.

      For example, if the data in the CSV file is separated by a character #, then select the Other option and enter # in the field.

    • Configure the following options to change the row and column settings:

      • Column header - Use an up-down control button to increment or decrement the value of the column header.

      • Data start point - Use an up-down control button to increment or decrement the value of the data starting pointer.

      • Current row - Use an up-down control button to increment or decrement the value of the current row.

    • Configure the following options to change the string values in the dataset:

      • Treat as null - Enter a string value that is to be treated as null when running the test.

      • Treat as empty - Enter a string value that is to be treated as empty when running the test.

        For example, when you run the test, and the data 123 in the dataset is to be treated as empty, then you must specify 123 in the Treat as empty field.

      • Treat empty text as null - Select this field when you want the dataset that contains any blank cells, and the value of those blank cells to be interpreted as null.

    • Click Update to apply the changes.

    Discard discard_icon Click the Menu icon Image of the menu icon and select Discard to discard the changes made to the dataset.
  9. Perform the following actions using the editing options available in the column header:
    Editing Options Actions
    Rename columnImage of Rename Coulmn Hover over the column header and click the Rename column icon Image of Rename Coulmn to update the column name.
    Delete columnImage of Delete Column Hover over the column header and click the Delete column icon Image of Delete Column to delete the column.
  10. Perform the following actions to use the cell-level editing options available in the right-click context menu.
    Option Actions
    CutCut icon Right-click the cell and click the Cut icon Cut icon to remove the content from the selected cell and paste it into another cell.
    Copy Copy icon Right-click the cell and click the Copy icon Copy icon to copy the content.
    Paste Past eicon Right-click the cell and click the Paste icon Paste icon to insert the copied or cut content.
    Insert row above Right-click the row and click Insert row above to add a new row above.
    Insert row below Right-click the row and click Insert row below to add a new row below.
    Insert column left Right-click the column and click Insert column left to add a column on the left.
    Insert column right Right-click the column and click Insert column right to add a column on the right.
    Delete row(s) Right-click the selected row and click Delete row(s).
    Delete column(s) Right-click the selected column and click Delete column(s).
    Show encrypted dataShow encrypted column data icon Right-click the encrypted column and click the Show encrypted data icon Show encrypted column data icon to view the encrypted data.

    Right-click the decrypted column and select Hide encrypted data to encrypt the data again.

    Important:
    The Show encrypted data option is available only when you have added the encrypted dataset to the respective classification.

    For more information about adding an encrypted dataset to a classification, see Adding an encrypted dataset to a classification.

    Encrypt column data lock icon

    Perform the following steps to encrypt the column data:

    1. Right-click any cell in a column that you want to encrypt and select the Encrypt column data icon lock icon.

      The Encrypt Column window is displayed.

    2. Enter an encryption key in the Encryption Key field to encrypt the data in the column.
      Remember:
      When you have already encrypted other columns in the dataset, you must enter the same encryption key that you used previously. You can use only one encryption key to encrypt columns in a dataset.
      Important:

      The encryption keys that you use to encrypt data in a dataset are not stored on the server, nor they can be retrieved from the server. Therefore, you must remember to store the encryption keys in a secure location. You must use the same encryption keys to perform the following operations:

      • View the encrypted values

      • Decrypt data

      • Enable the use of the encrypted dataset during test runs

    3. Click Encrypt Column.

      Asterisks are displayed instead of actual data for the encrypted column.

    Decrypt column dataDecrypt column data

    Perform the following steps to decrypt the column data:

    1. Right-click the encrypted cells that display the contents with asterisks, and then select the Decrypt column data icon Decrypt column data .

      The Decrypt Column window is displayed.

    2. Enter an encryption key in the Encryption Key field to decrypt the data in the column.
    3. Click Decrypt Column.

      Asterisks are replaced with the actual data in the decrypted column. When you run a test that uses a dataset that contains decrypted data, the variable data is substituted for the original data in the recorded test without prompting for the encryption.

    Set as current rowSet as current row icon During the test run, if you want variable data to be selected from the current row instead of the first row in a dataset, right-click any cell in a row and select the Set as current row icon Set as current row icon.

    When rows are deleted:

    If you delete any row between row 1 and the current row, the current row data is taken from the next row. For example, when you set the current row as 6, and then you delete any row between row 1 to row 6, the current row remains at row 6, but the content of row 7 is moved to row 6.

    When rows are inserted:

    If you insert any new row between row 1 to the current row, the current row data is taken from the previous row. For example, when you set the current row as 6, and then you insert any row between row 1 to row 6, the current row remains at row 6, but the content of row 5 is moved to row 6.

  11. Click the Save icon Image of the Save icon to save the changes made to the dataset or the Save All icon Image of the Save all icon in the Test Editor navigator panel to save all changes made to different datasets by using the same Edit branch.
  12. Click the Publish icon publish_icon to publish the dataset to the Git repository.

Results

You have edited the dataset in the Test Editor.