Creating test data

To test an application, you use data that is passed to get real-time results. Since creating test data manually is time-consuming, you can use the technical preview of HCL OneTest™ Data, an automated tool to create random test data. You can have test data in various file formats.

Test data is the core element in the process of testing any application. A sufficient amount of data is necessary to test all the possible scenarios of any application. To create test data, you can import data or an existing schema from a local file system or from any external resource. Before importing data from any external resource, you must establish a successful connection. As imported data is not structured, you must create a schema for the entire content. You can define the syntax, structure, and semantics of the data by using a schema designer. You can create test data from the group type of the designed schema.

Importing data or an existing schema

When you want to create test data, you require data or schema. If you have data or existing schema, you can import it as input into your project from various sources. You can import data or existing schema from your local file system or from any external resources. The following tasks explain how to import data or schema from various sources.

Importing data from a local file system

To import data from a local file system into your project, you must create a file.

Before you begin

  • You must have a project.
  • You must have a data file in your local file system in CSV or Plain text format.

About this task

The Files tab on the Data Fabrication page is one of the design components of a project. By clicking this tab, you can create a file. This tab helps you to import an existing file from the local file system, for which you want to generate test data.

Procedure

  1. Select your project in HCL OneTest Server and go to the Data Fabrication page.
  2. Click the Files tab.
  3. Click New from the Files menu to create a file. The New File dialog box appears.
  4. Select a file that you want to import from your local file system.
  5. Provide a name to a file, folder details, keyword as Tag for quick search, and a brief description of the file.
  6. Click OK to import and create a file.

Results

You achieve the following results:
  • View the list of all the files imported for this project in the Files tab.
  • Use the Search field to search any file from the existing files.
  • Sort the list of files by name, folder, and recently used files.

What to do next

After you create a file in your project, you can import a file to create a schema.

Importing files

To create a schema, you must import a file into your project.
Before you begin
You must have imported a file into your project from the local file system.
About this task

When you want to create a schema, you require data. You can use the data which you have imported from your local file system.

Procedure
  1. Click Import from the Schemas menu. The Import dialog box appears.
  2. Select the file type as CSV.
  3. Select the file that you want to import from the Sample File Path and define the import properties of the data.
  4. Provide a schema name for this data and click Import. The schema appears in the schema designer.
  5. Save the changes.
Results

You can view the imported file listed under the Schemas tab.

What to do next
You must define the types in the schema. For information about defining types, see related links at the end of this page.

Importing XSD or JSON files from the local file system

When you have an XSD or a JSON format file as your data, you can import the same files from the local file system to create a schema.

Before you begin

  • You must have a project.
  • You must have an XSD or a JSON format file in your local file system.

About this task

XSD or JSON files are in schema format. To create a schema, you can import an existing schema which is in XSD or JSON format from your local file system.

Procedure

  1. Select your project in HCL OneTest Server and go to the Data Fabrication page.
  2. Click the Schemas tab.
  3. Click Import XSD/JSON from the Schemas menu. The Import XSD/JSON dialog box appears.
  4. Select the JSON or XSD file that you want to import.
  5. Provide a schema name with a brief description and keywords as Tags.
  6. Click OK and save the changes.

Results

You achieve the following results:
  • View the imported file listed under the Schemas tab.
  • Use the Search field to search for any schema from the existing schemas.
  • Sort the list of schemas by name, folder, and recently used schemas.

What to do next

You must define the types in the schema. For information about defining types, see related links at the end of this page.

Importing data from an external resource

To create a schema, you can also import data or existing schema from any external resource. The external resource can be any server or a database. You must establish a connection to the resource and then import the data or existing schema into your project.

Establishing connections

To import data or schema from any external resource, you must establish a connection from your project to that resource.
Before you begin
  • You must have a project.
  • You must have the details of the resource adapter to which you want to establish the connection.
About this task
The Connections tab on the Data Fabrication tab is one of the design components of a project. In case you do not have data to import from your local file system and you want to import from some external resource, then you need to establish a connection to that resource.
Procedure
  1. Select your project in HCL OneTest Server and go to the Data Fabrication page.
  2. Click the Connections tab.
  3. Click New from the Connections menu to create a connection. Otherwise, select Connect to a resource from Quick Links. The New Connection dialog box appears.
  4. Select a connection type from the list of supported connections.
  5. Click Next to provide connection properties.
  6. If you select JDBC as a connection type, provide the IP address and credentials of the connection to which you want to connect.
  7. Click Test to validate the properties of resource connection.
  8. Click Next to enter the identification details such as name, description, and keywords for the new connection.
  9. Click OK to establish a connection.
Results
You achieve the following results:
  • View your connection listed in the Connections tab, if established successfully. You get a failure message if the connection fails.
  • Use Search to search for the existing connections.
  • Sort the list of connections by name, folder and recently used connections.
What to do next
After you establish a connection, you can import data or schema into your project.

Importing data

When the connection establishes with an external resource, you can import the data or schema into your project.
Before you begin

You must have an established connection with a resource adapter.

Procedure
  1. Click the context menu of the selected connection.
  2. Click New Action. The New Action dialog box appears.
  3. Provide the properties details of the data or schema that you want to import.
  4. Enter the identification details for the schema and click Generate.
  5. Save the changes.
Results

The data or schema is imported in your project. You can view the imported data or schema listed under Schemas tab.

What to do next
You must define the types in your schema. For information about defining types, see related links at the end of this page.

Sample data or a schema

To learn how to import data or an existing schema from your local file system, you can use the sample data provided in a compressed format.

About this task

The compressed format of the sample data comprises some Comma-Separated Values (CSV) files, JavaScript Object Notation (JSON) schemas, and XML Schema Definition (XSD). You can download the files into your local file system and then import the data into your project.

To download the file, click Sample Schemas.

Creating a schema

A schema is a logical structure to define various types of data. To create a schema, you can either import input data in the form of files or existing schema or can design using schema designer.

A schema classifies data into three types: category, group, and item. By using the type designer, you can define the properties of input types of data.

Designing new schema

You can design a new schema for your data if you do not have input data or an existing schema to import.

Before you begin

You must have a project.

Procedure

  1. Select your project in HCL OneTest Server and go to the Data Fabrication page.
  2. Click New from the Schemas Menu. Otherwise, select Create a schema from Quick Links. The New Schema dialog box appears.
  3. Provide a schema name.
  4. Select the default project folder or enter any project folder name.
  5. Enter keywords as tags which can help for quick search.
  6. Provide a brief description of the schema and click OK. The schema opens in the schema designer as Root as the data dictionary. You can view the schema name as a tab in the workspace.

Results

The schema appears in the schema designer.

What to do next

You must define the types in your schema. For information about defining types, see related links at the end of this page.

Defining types

For optimum test data generation, you must define entire data of schema into types. Types are the components of schemas. After you design schema in the schema designer, you must define entire data as types by using type designer.
Adding types to a schema
The types in the schema are arranged in a hierarchy. A new schema by default has Root type. You can add subtypes to the Root type to define a schema.
Before you begin
You have a schema for your project.
About this task

Types are the set of data objects. A new schema has a single Root type. All types are added as subtypes of the Root type and then as subtypes of other types.

Procedure
  1. Select the type under which you want to add a subtype. For example, select "Root".
  2. From the context menu of the selected type, click Add. The subtype is created of the similar type as of the selected type and it appears under the selected type.
    Note: You cannot add any type to a JSON or an XSD schema.
  3. Save the changes.
Results
You can view the nested structure of types.
What to do next
You must define the properties of the types of the schema. For information about how to setup type properties, see related links at the end of this page.
Copying a type
To create more types with similar properties, you can copy an existing type.
About this task

In addition to using the drag-and-drop method, you can use the context menu to copy a type.

Procedure
  1. Select the type that you want to copy and click Copy from the context menu.
  2. Select the target type—the type under which you want to copy the given type.
  3. Click Paste from the context menu of the target type.
Results
You can view a new type with the properties similar to an existing type.
What to do next
You can modify the name, description, and the properties of the copied type.
Deleting a type
When you want to remove any type from the schema, you can delete it.
Procedure
  1. Select the type that you want to delete and click Delete from the context menu.
  2. Click Yes to confirm and save the changes.

    You can select more than one type simultaneously by using Multiselect option.

    Note: You cannot delete any type of a JSON or an XSD schema.
Results
The selected type is deleted.

Setting up type properties

After you add types to your schema, you must set type properties.
Before you begin
You must have a schema with types.
Procedure
  1. Select a type and click the context menu of the type.
  2. Click Properties. The Properties dialog box appears.
  3. Enter the name, class and description details of the type.
  4. Choose the class of the type as Category, Group, or Item. The properties of the selected type appear.
  5. Define the required properties for the selected type.
  6. Click Advanced properties to provide additional property details of the type.

    For information about type properties, see related links at the end of this page.

    Note: In case you import any JSON or XSD format schema, you cannot modify the properties of any type of the schema.
  7. Save your changes.
Results
The type properties of the schema are defined and saved successfully.
What to do next
When you finish defining the properties for all the types of your schema, you must prepare a structure view of the schema by using drag-and-drop method.

Designing a structure view of a schema

To define how the item and group types are organized and are related to each other, you must design the structure view of a schema before generating the test data.
Before you begin
You must have a group type in your schema.
About this task
When you design the structure view of a massive schema, you can filter the item or group types of your schema by using Filter.
Procedure
  1. Double-click any group type from Dictionary. The Structure dialog box appears.
  2. Drag and drop the types from Dictionary to the Structure dialog box to map Item and Group types.
    Note: You can use the Category type to organize the data dictionary entities. You cannot map the Category type in the structure view.
  3. Save the changes.
What to do next
You can set restrictions and apply functions to define the component rules to any item type. You can also generate the test data without applying restrictions and functions.

Setting up restrictions

When you define any item type for a schema, you can specify valid values to that type. You can define validations to the types by setting the restrictions.
Before you begin
  • You must have a group type in your schema.
  • You must have a structured view of your schema.
About this task
You can set restrictions only for item types of your schema.
Procedure
  1. Open the structure view of your schema.
  2. Click the context menu for each item type and set the required restrictions.
    You can set the following restriction rules:
    • Optional
    • Required
    • Set Range
    • Unlimited
  3. Save the changes.

    You can modify the properties of the selected item type by using Properties in the context menu.

    For information about item restrictions, see related links at the end of this page.
What to do next
You can apply functions to define component rules to any item type. You can also generate test data without applying functions.

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.

Procedure
  1. Select the item type in the Structure dialog box.
  2. Click the context menu of the Structure dialog box. A blank field appears next of the item type.
  3. Click the blank field. The Functions panel appears on the page.
  4. Click the functions icon Function to view the list of functions.
  5. Select the function that you want to apply as a component rule and click Insert from the context menu of the selected function.
  6. Save the changes.
Results

You can view the structured schema with applied functions.

What to do next
You can generate the test data for the designed schema.

Managing schema

You can manage schema in many ways such as editing, deleting a schema, and splitting a schema view.

Editing a schema

At any point of time, you can edit the details of a schema of your project.
Procedure
  1. Select a schema that you want to edit from the list of schemas of your project. The schema appears in the schema designer.
  2. Click the edit icon edit. The Edit Schema dialog box appears.
  3. Edit the schema details and save the changes.

Deleting a schema

If you do not need a schema anymore, you can remove that specific schema from your project.
Procedure
  1. Select the schema that you want to delete from the list of schemas of your project. The schema appears in the schema editor.
  2. Click the delete icon Delete.
  3. Click Yes to confirm and save the changes.

Splitting a schema view

The schema designer displays a single schema. However, you can split the schema designer to view two schemas simultaneously. This is useful for copying, editing, or viewing different components of very large schemas.

Generating test data

When you have a defined and structured schema for the entire data, you can generate test data to perform application testing.

Before you begin

  • You must have a project.
  • The schema must have a Group type.
  • You must have a structured view of your defined schema.

About this task

You can generate the sample test data from the Group type of a schema. When you import the XSD format schema, then HCL OneTest Data generates only XML test data. If you import JSON format as input, the application generates only JSON test data.

Procedure

  1. Select your project in HCL OneTest Server and navigate to the Data Fabrication page.
  2. Select and open the defined schema in the schema designer.
  3. Select a Group type and click the context menu.
  4. Click Generate Data. The Generate data dialog box appears.
  5. Enter the number of records that you want to generate and the seed value for reference.

    Seed value acts as an instance of random data that can be repeated if required. By default, the seed value is blank.

  6. Choose the output file format of the test data that you want to generate from the Output File Format list. HCL OneTest Data supports the following formats:
    • CSV
    • Plain text files
    • JSON
    • XML
    • Excel files
    Notes:
    • If you create a schema by using the schema designer, by default, the output file format is CSV.
    • If you import a schema into your project or have a schema with nested groups, you can select only the Plain text file as the output file format.
    • You can generate line numbers in the output by creating an auto-increment rule by using functions and expressions.
  7. Click OK.

Results

The test data is generated successfully.

What to do next

You can view and download the generated test data on the Jobs page.

Feedback