Creating non-schema specific data masks

In the Recording Studio perspective, you can create a non-schema specific data mask in a HCL OneTest API project. The mask will replace sensitive data in specified fields in messages recorded against any schema and, thus, prevent that data from appearing in any assets created from those messages.

About this task

If permissions in HCL OneTest API are being used to control which users can create, modify, or delete data masks, you might require permissions before you can create a data mask.

You must record unmasked data before you can create a non-schema specific data mask.

When creating a non-schema specific data mask, there are three possible data masking methods that can be used:
  • Creating a fixed value substitution data mask involves entering a value to mask the "real value" of a field and that value will replace any data recorded for that field.
  • Creating a data source substitution data mask involves using a data source, such as a Microsoft Excel spreadsheet or a .csv file, to supply a list of values that can be used to replace recorded data.
    Note: Before you can create a data source substitution data mask, you must complete the following tasks:
    • Create a spreadsheet or a .csv file that contains a series of "fake" values that you want to use to mask real values of the relevant message element.
    • In the Test Factory perspective, create a new Excel data source and select the spreadsheet or .csv file that you created.
  • Creating an automatic value creation data mask involves selecting or creating a regular expression (Regex) and HCL OneTest API will create new values that match that expression.

Procedure

  1. Open the Recording Studio perspective.
  2. Create an event monitor if required.
  3. Start a recording session.
  4. Generate events or wait for the system under test to generate events (whichever is applicable).
  5. On the upper half of the Events View window, select one or more recorded events.
  6. On the lower half of the Events View window, click the Body tab or the Header tab.
  7. Select the text node of the relevant message element.
  8. Click Add Data Mask on the toolbar on the lower half of the Events View window. Alternatively, right-click the text node and click Add Data Mask on the pop-up menu.

    The Data Mask Creation Wizard is displayed.

  9. In the Technique Selection list, click the required option:
    1. If you want to create a fixed value substitution data mask, complete the following tasks:
      1. Click Fixed Value Substitution.
      2. Click Next.
      3. In the Fixed Value field, enter the value that you want to mask the "real value" of the selected element.
    2. If you want to create a data source substitution data mask, complete the following tasks:
      1. Click Data Source Substitution.
      2. Click Next.
        A Technique Configuration area is displayed.
        Note: The Technique Configuration area is not displayed if there is no Excel data source associated with your HCL OneTest API project.
      3. In the Data Source list, click the relevant Excel data source.
      4. In the Column list, click the column in the spreadsheet or .csv file that contains the "fake" values.
      5. Optional: Select the Enforce Data Integrity check box if you want the same data to always be masked by the same value.
      6. Click Return to Start (default) or Use Fixed Value:
        • Clicking Return to Start means that HCL OneTest API will loop through the data source to reuse masks.
        • Clicking Use Fixed Value means that HCL OneTest API will use a fixed value if there is an insufficient number of masks in the data source.
        • If you click Use Fixed Value, you must enter a value in the Fixed Value field.
    3. If you want to create an automatic value creation data mask, complete the following tasks:
      1. Click Automatic Value Creation.
      2. Click Next.
      3. In the Regex field, you have two options:
        • Enter a Regex in the field if you want to create a new Regex for this data mask. For example, to generate 16-digit numbers to mask credit card numbers, you might enter \d{16} in the Regex field.
        • Alternatively, click Discover to select a regular expression already in use in your project.
      4. Click Test to verify that the Regex entered or selected provides the correct "fake" value format.

        For example, if masking credit card numbers, verify that a 16-digit number is displayed after you click Test.

      5. Optional: Select the Enforce Data Integrity check box if you want the same data to always be masked by the same value:
        • Selecting the Enforce Data Integrity check box enables the Label list, which enables you to use the same label for a pair of data masks that use the same Regex and thus enforce data integrity across multiple fields.
        • For example, if you want to mask credit card numbers, the label could be CardNumbers.
  10. Click Next.
  11. Optional: Clear the Apply to existing events check box.
  12. Click All schemas (if required) to make this mask a non-schema specific mask.
    Note: If you click Just this schema, the mask will be only a schema specific mask. If Just this schema is unavailable, there is no schema in your project for the operations that you are recording.
  13. Click Finish.

Results

A mask icon is displayed next to the selected message element.

To verify that the new data mask works, use Recording Studio to record and view new events. On the Events View window, double-click a recorded event for the relevant operation:
  • If you selected fixed value data substitution, verify that the value of the relevant message element has been replaced by the value that you entered for the data mask.
  • If you selected data source substitution, verify that the value of the relevant message element has been replaced by a fake value from the specified data source. If you record more events, you should notice that the fake values displayed change as the real values change.
  • If you selected automatic value creation, verify that the value of the relevant message element has been replaced by a fake value from the specified Regex. If you record more events, you should notice that the fake values displayed change as the real values change.