Uploaded image for project: 'Daffodil'
  1. Daffodil
  2. DFDL-1293

TDML Runner Unparse: Actual vs Expected Failure Diagnostics Unclear

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: 1.1.0
    • Fix Version/s: 1.1.0
    • Component/s: Unparsing
    • Labels:
      None

      Description

      I wrote up a few negative tests of the unparse functionality of the TDML runner, where the actual output did not match the expected output specified in the TDML test. In these tests, I purposefully put invalid values as the expected output. In the first case, the "expected" output is significantly longer than the actual output:

      Expected: <tdml:document>incorrect</tdml:document>
      Actual: <tdml:document>0</tdml:document>

      and this is the failure message:

      [error] Test edu.illinois.ncsa.daffodil.section00.general.TestUnparserGeneralDebug.test_negativeUnparseTest01 failed: edu.illinois.ncsa.daffodil.tdml.TDMLException: output data length 1 for List(48) doesn't match expected value 9 for List(105, 110, 99, 111, 114, 114, 101, 99, 116)
      [error]     at edu.illinois.ncsa.daffodil.tdml.UnparserTestCase.verifyData(TDMLRunner.scala:735)
      [error]     at edu.illinois.ncsa.daffodil.tdml.UnparserTestCase.runUnparserExpectSuccess(TDMLRunner.scala:769)
      [error]     at edu.illinois.ncsa.daffodil.tdml.UnparserTestCase.runProcessor(TDMLRunner.scala:709)
      [error]     at edu.illinois.ncsa.daffodil.tdml.TestCase.run(TDMLRunner.scala:458)
      [error]     at edu.illinois.ncsa.daffodil.tdml.DFDLTestSuite.runOneTestWithDataVolumes(TDMLRunner.scala:272)
      [error]     at edu.illinois.ncsa.daffodil.tdml.DFDLTestSuite.runOneTest(TDMLRunner.scala:263)
      [error]     at edu.illinois.ncsa.daffodil.section00.general.TestUnparserGeneralDebug.test_negativeUnparseTest01(TestUnparserGeneralDebug.scala:20)
      [error]     ...

      The error technically seems correct, but it is not very user-friendly.

      In the second case:
      Expected Output: <tdml:document>1</tdml:document>
      Actual Output: <tdml:document>0</tdml:document>

      Error:

      [error] Test edu.illinois.ncsa.daffodil.section00.general.TestUnparserGeneralDebug.test_negativeUnparseTest02 failed: edu.illinois.ncsa.daffodil.tdml.TDMLException: Unparsed data differs at byte 1. Expected 0x31. Actual was 0x30.
      [error]     at edu.illinois.ncsa.daffodil.tdml.UnparserTestCase$$anonfun$verifyData$2.apply(TDMLRunner.scala:744)
      [error]     at edu.illinois.ncsa.daffodil.tdml.UnparserTestCase$$anonfun$verifyData$2.apply(TDMLRunner.scala:740)
      [error]     at scala.collection.immutable.List.foreach(List.scala:318)
      [error]     at edu.illinois.ncsa.daffodil.tdml.UnparserTestCase.verifyData(TDMLRunner.scala:740)
      [error]     at edu.illinois.ncsa.daffodil.tdml.UnparserTestCase.runUnparserExpectSuccess(TDMLRunner.scala:769)
      [error]     at edu.illinois.ncsa.daffodil.tdml.UnparserTestCase.runProcessor(TDMLRunner.scala:709)
      [error]     at edu.illinois.ncsa.daffodil.tdml.TestCase.run(TDMLRunner.scala:458)
      [error]     at edu.illinois.ncsa.daffodil.tdml.DFDLTestSuite.runOneTestWithDataVolumes(TDMLRunner.scala:272)
      [error]     at edu.illinois.ncsa.daffodil.tdml.DFDLTestSuite.runOneTest(TDMLRunner.scala:263)
      [error]     at edu.illinois.ncsa.daffodil.section00.general.TestUnparserGeneralDebug.test_negativeUnparseTest02(TestUnparserGeneralDebug.scala:21)
      [error]     ...

      This error seems more accessible, but it is using the byte value of the data rather than the ASCII, more human-readable text.

      See tests:
      test_negativeUnparseTest01
      test_negativeUnparseTest02
      In the following files:
      daffodil-test/src/test/resources/edu/illinois/ncsa/daffodil/section00/general/testUnparserGeneral.tdml
      daffodil-test/src/test/scala-debug/edu/illinois/ncsa/daffodil/section00/TestUnparserGeneralDebug.scala

      I realize the unparse functionality of the TDML Runner is extremely new, and things like this are likely to be fixed during the course of regular development, but I wanted to make a note.

        Gliffy Diagrams

          Attachments

            Activity

              People

              Assignee:
              jchab Jessie Chab
              Reporter:
              jchab Jessie Chab
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Tasks