Applying Copybook schemas to messages

After you add a Copybook schema to HCL OneTest API, you can apply the schema to messages in applicable test actions.

About this task

The following example uses the sample Calculator project and a Send Request action. You can apply the same steps to a Receive Reply action to apply validation options. For more information about messages, schemas, and validation, see API Tester Reference.

Procedure

  1. Create an empty test.
  2. Add a Send Request action to the Test Steps phase of the test. A Receive Reply action is also created automatically.
    Send request action
  3. Open the Send Request action for editing.
  4. For Message Type, choose one of the following options:
    The Byte Array option is shown in the screen capture.
    Byte Array
    To enter sample data in EBCDIC
    Text
    To enter sample data in ASCII
  5. Select the data row and double-click the Value column. Enter one of the following strings:
    F1F0F0F0F0F0F0F0F0F2F3
    If the Message Type is Byte Array
    10000000023
    If the Message Type is Text
    The data value in the screen capture is an EBCDIC string
    This string represents compressed data that has not yet been formatted by a copybook.
  6. Right-click the data element and select Schema.
  7. In the Schema Selector window, Schema Type field, select Mainframe > COBOL Copybooks and select the schema that you imported into the HCL OneTest API Schema Library.
  8. In the pane below the Schema Type, select a copybook and root.
    This example uses a copybook with a PIC9(1) and a PIC9(10) variable. A sample message is displayed.
  9. In the Formatter Properties section, select a value for the Encoding field.
    In this example, the default values are acceptable for the other fields.
  10. Accept the default values for the Content Options section and click OK.

Results

The schema is applied to the original message, expanding the data field as defined in the schema.
The data field is expanded.

What to do next

If you used the REDEFINES clause in the schema, the field definitions in that clause are not enabled when you import the schema into HCL OneTest API.