Harmony
  1. Harmony
  2. HARMONY-268

Custom JUnit results formatters to provide console progress messages

    Details

    • Type: Improvement Improvement
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Misc
    • Labels:
      None
    • Environment:
      All
    • Estimated Complexity:
      Novice

      Description

      This is related to HARMONY-263. If the "junit" task is used with a "test" child element rather than a "batchtest" child element then there is no information written out to the console to let the tester know how the tests are getting on - the tester just has to wait until the run eventually terminates and the XML or plain text report gets written. This can be a bit disconcerting if the tests run for several minutes.

      The suggested improvement to this is to specify a custom results formatter class in the "formatter" element that generates the required reports but also writes passed/failed/error messages to console as each test completes.

      Patch to follow.

      Best regards,
      George

        Issue Links

          Activity

          Hide
          George Harley added a comment -

          Hi Alexey,

          Probably not. The issue was opened because of minor irritations I had
          when running the JUnit test suite. If the consensus is that the
          described behaviour is not irritating for anybody else then it's fine by
          me if this one gets closed.

          Best regards,
          George

          Show
          George Harley added a comment - Hi Alexey, Probably not. The issue was opened because of minor irritations I had when running the JUnit test suite. If the consensus is that the described behaviour is not irritating for anybody else then it's fine by me if this one gets closed. Best regards, George
          Hide
          Alexey Petrenko added a comment -

          George,

          is this issue still relevant?

          Show
          Alexey Petrenko added a comment - George, is this issue still relevant?
          George Harley made changes -
          Attachment Harmony-268-part1.txt [ 12324700 ]
          Hide
          George Harley added a comment -

          Two very simple custom JUnit result formatters that I propose we drop straight into folder support/src/tests/java/tests/util/junit.

          • tests.util.junit.HarmonyXMLJUnitResultsFormatter - simply extends org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter and sends status messages to stdout when test events are received after delegating to the parent to do the report-building work.
          • tests.util.junit.HarmonyPlainJUnitResultsFormatter - simply extends org.apache.tools.ant.taskdefs.optional.junit.PlainJUnitResultFormatter and sends status messages to stdout when test events are received after delegating to the parent to do the report-building work.

          An example of using these in an Ant script would be as follows (keeping my fingers crossed that this renders alright) ...

          <test name="tests.luni.AllTestsWithExclusions"
          todir="$

          {hy.tests.reports}

          "
          haltonfailure="no" >

          <formatter
          classname="tests.util.junit.HarmonyPlainJUnitResultsFormatter"
          extension=".txt"/>

          </test>

          If using the tests.util.junit.HarmonyXMLJUnitResultsFormatter class then the "extension" attribute value would be changed to ".xml" .

          Hope this helps,
          George

          Show
          George Harley added a comment - Two very simple custom JUnit result formatters that I propose we drop straight into folder support/src/tests/java/tests/util/junit. tests.util.junit.HarmonyXMLJUnitResultsFormatter - simply extends org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter and sends status messages to stdout when test events are received after delegating to the parent to do the report-building work. tests.util.junit.HarmonyPlainJUnitResultsFormatter - simply extends org.apache.tools.ant.taskdefs.optional.junit.PlainJUnitResultFormatter and sends status messages to stdout when test events are received after delegating to the parent to do the report-building work. An example of using these in an Ant script would be as follows (keeping my fingers crossed that this renders alright) ... <test name="tests.luni.AllTestsWithExclusions" todir="$ {hy.tests.reports} " haltonfailure="no" > <formatter classname="tests.util.junit.HarmonyPlainJUnitResultsFormatter" extension=".txt"/> </test> If using the tests.util.junit.HarmonyXMLJUnitResultsFormatter class then the "extension" attribute value would be changed to ".xml" . Hope this helps, George
          George Harley made changes -
          Field Original Value New Value
          Link This issue is related to HARMONY-263 [ HARMONY-263 ]
          George Harley created issue -

            People

            • Assignee:
              Unassigned
              Reporter:
              George Harley
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:

                Development