Creating data models

A data model enables you to understand the data held by the system that you want to simulate, and it can provide persistent storage of that data.

About this task

To create a new data model:

Procedure

  1. Open the HCL OneTest™ API Architecture School perspective.
  2. Click the Data Models tab.

    The Data Models window is displayed.

  3. Click the plus button ().

    The Input dialog box is displayed.

  4. Enter a name for the new data model.
  5. Click OK.

    The name of the new data model is displayed on the upper left of the Data Models window.

  6. Click the new data model.
  7. Click Edit Data Model. The HCL OneTest API Tools application is opened.
    Starting in HCL OneTest API version 9.1.0, the Data Model Editor is replaced by Eclipse Modeling Framework (EMF) Ecore editor. You can use the Ecore editor to define Ecore models in a tree view. The following table describes how to use the Ecore tree view (found in the model.ecore tab) to add entities, attributes, and references:
    To add... Do this...
    An entity.

    For example, Customer.

    1. Right-click model.
    2. Click New Child.
    3. Click EClass. A new entity is created.
    4. Right-click the new entity.
    5. Click Show Properties View in the context menu. The Properties tab is opened.
    6. In the Name field, enter a name for the new entity and press ENTER (or move to another field on the Properties tab) to apply the new name.
    An attribute to an entity.

    An attribute is a named scalar property of an instance of an entity. For example, an entity Customer might have an attribute emailAddress of a Java™ java.lang.String type.

    1. Right-click an entity and then click New Child > EAttribute. The Properties tab is opened, if it is not already.
    2. Enter a name for the attribute against the Name property. For example, emailID.
    3. To select a data type for the attribute, click the downward arrow seen along the EType row.
    A reference between entities.

    A reference indicates a relationship between two entities. For example, there might be a relationship between a customer and the number of orders that customer has placed.

    1. Right-click an entity and then click New Child > EReference. The Properties tab is opened, if it is not already.
    2. Enter a name for the reference against the Name property. For example, RefToOrders.
    3. To establish the relationship with another entity, click the downward arrow seen along the EType row and select a value.
    4. For the Upper Bound property, enter 1 (for a 0..1 reference) or -1 (for a 0..* reference).
    For help with creating data models with the Ecore editor, see EMF Documentation.
  8. To view the instance data associated with the data model, right-click on a model class or attribute and select View Instance Data.

    The instance data for a data model is stored within a set of comma-separated value (CSV) files. Whenever you use the Ecore editor to make changes to a data model, you must also make appropriate changes to the CSV files and datamodel tag references within the project.

Results

After you create a data model, the data is held inside a set of entities, and each entity has a set of attributes.

Feedback