Applying functions

You can apply functions on the item types of a schema to define the component rules.

Before you begin

You must have a defined schema in a schema designer. See Schema design overview.

About this task

You can also apply functions on the types of the imported JSON or XSD schemas.

Procedure

  1. Log in to HCL OneTest Server and open the team space that contains your project.
  2. Open your project.
    The Overview page is displayed.
  3. Click Author > Data Fabrication.
    The Data Fabrication page is displayed.
  4. Click Schemas, and then select the schema for which you want to generate the test data.
  5. Select the group type, and then open the structural view of the schema.
  6. Select the item type on which you want to apply the function, in the Structure dialog box.
  7. Click the menu on the right side of the Structure dialog box.
    A blank field is displayed next to the item type.
  8. Click the blank field.
    The Rule Editor pane is displayed on the page.
  9. Enter the equal sign (=) in the Rule Editor pane.
  10. Provide the function in the Rule Editor pane.

    You can enter the function by performing any one of the following methods:

    • Enter the function manually.
    • Select from the list of functions by using the following steps:
      1. Click the Insert mapping functions icon Function.
      2. Select the function that you want to apply as a component rule, and then click Insert from the menu of the selected function.

    For example, if you want the generated value of an item type in uppercase, then you must enter or select the UPPERCASE() function.

    =UPPERCASE(RANDDATA())
  11. Optional: Enter a parameter for the selected function.

    You can provide the parameter value either as a constant value or as a reference of the item type.

    You must use the following syntax to provide the parameter in any function:

    <item type name>:Out1

    where:

    • item type name - Represents the name of the item type.
    • :Out1 - Represents a standard output argument.

    For example, consider that you have a group type as Flowers with Colors and Pattern as two item types. If you want to generate the value of Colors item type in uppercase, then you can select the item type Pattern in the Structure dialog box. You must open the Rule Editor pane, and then select the UPPERCASE() function with reference of Colors item type as the parameter.

    = Uppercase (Colors:Out1)

  12. Press the Enter key.
    The selected function is displayed in the item type field of the Structure dialog box.
  13. Save the changes.

Results

You have successfully applied the function on an item type of the schema.

What to do next

You can generate the test data for the designed schema. See Generating test data.