Testing a DFDL schema by serializing test output data

You can produce serialized test data from your DFDL schemas by using the DFDL Test Perspective.

Before you begin

Create or open a DFDL schema file.

About this task

You can use the DFDL Test Perspective to test-serialize sample data against your selected DFDL message to verify that the DFDL schema is correct.

Procedure

  1. Open the DFDL schema that you want to test.
  2. In the DFDL schema editor, expand the Messages section.
  3. Select the message that you want to test.
  4. Click Test serialize model, or right-click the message that you want to test and click Test serialize model.
    The Test Serialize Model window opens.
  5. In the Serializer Input section, select the location of the logical instance data that you want to test-serialize:
    • If you have a populated 'DFDL Test - Logical Instance' view, select Content from 'DFDL Test - Logical Instance' to test-serialize the data that is displayed there.
    • If you do not have a populated 'DFDL Test - Logical Instance' view:
      1. Select Content from a logical instance file.
      2. In the Input file name field, enter the location of your file of logical instance data, or click Browse to locate it.
  6. Enter Runtime encoding options as required.
  7. Optional: Select Validate data against schema to check for validation errors.
  8. If prompted, confirm that you want to open the DFDL Test Perspective.

Results

  • The DFDL Test Perspective opens, and the results of your test-serialize are displayed in the DFDL Test - Serialize view.
  • You can view a log of parser actions in the DFDL Test - Trace view.
  • You can view the logical instance in the DFDL Test - Logical Instance view, as a tree, or as XML.
  • You can change the following settings, and then test-serialize again by clicking the Run Serializer button in the DFDL Test - Serialize view.
    • In the DFDL Test - Serialize view, you can change the logical instance and encoding.
    All other settings from the last test-serialize are retained.

What to do next

Next:

  • You can continue to edit your DFDL schema by using the DFDL schema editor.
  • You can generate a structural preview of a message from your DFDL schema; see Testing a DFDL schema by creating a logical instance.
  • You can test-parse sample data against your DFDL schemas, see Testing a DFDL schema by parsing test input data.
  • You can change the following settings, and then test-serialize again by clicking the Run Serializer button in the DFDL Test - Serialize view.
    • In the DFDL Test - Serialize view, you can change the logical instance and encoding.
    All other settings from the last test-serialize are retained.
  • If the DFDL schema is complete, you can add it to a BAR file for deployment; see Creating a BAR file.

Debugging

About this task

If an error occurs during parsing, the following resources are available to help correct the model:
  • An error message is displayed. The message summarizes the problem, and contains links to view the trace output.
  • The DFDL Test - Serialize view shows the location of the error in the data. At the top of this view is a hyperlink that opens the DFDL Test - Trace view.