Uploaded image for project: 'Apache QPID Interoperability Test Suite'
  1. Apache QPID Interoperability Test Suite
  2. QPIDIT-93

Optionally produce xUnit XML report with test results

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 0.1.0
    • Fix Version/s: 0.2.0
    • Component/s: None
    • Labels:
      None
    • Flags:
      Patch

      Description

      Something like the following should do the job. Instead of https://pypi.python.org/pypi/unittest-xml-reporting, it might be possible to maybe switch from unittest package to py.test, which has xUnit reports built in.

      diff --git a/src/python/qpid_interop_test/jms_messages_test.py b/src/python/qpid_interop_test/jms_messages_test.py
      index 3b54510..3b94f3a 100755
      --- a/src/python/qpid_interop_test/jms_messages_test.py
      +++ b/src/python/qpid_interop_test/jms_messages_test.py
      @@ -24,19 +24,17 @@ Module to test JMS message types across different APIs
       from json import dumps
       from os import getenv, path
      
      +import xmlrunner
      
       from proton import symbol
       from qpid_interop_test.test_type_map import TestTypeMap
      @@ -302,7 +300,7 @@ class TestOptions(object):
           Class controlling command-line arguments used to control the test.
           """
           def __init__(self, shim_map):
      -        parser = argparse.ArgumentParser(description='Qpid-interop AMQP client interoparability test suite '
      +        parser = argparse.ArgumentParser(description='Qpid-interop AMQP client interoperability test suite '
                                                'for JMS message types')
               parser.add_argument('--sender', action='store', default='localhost:5672', metavar='IP-ADDR:PORT',
                                   help='Node to which test suite will send messages.')
      @@ -313,6 +311,8 @@ class TestOptions(object):
               parser.add_argument('--broker-type', action='store', metavar='BROKER_NAME',
                                   help='Disable test of broker type (using connection properties) by specifying the broker' +
                                   ' name, or "None".')
      +        parser.add_argument('--xunit-report-dir', action='store', metavar='REPORTS_DIRECTORY',
      +                            help='Generate xUnit report into REPORTS_DIRECTORY/TEST-<test_name>-<timestamp>.xml')
               type_group = parser.add_mutually_exclusive_group()
               type_group.add_argument('--include-type', action='append', metavar='JMS_MESSAGE-TYPE',
                                       help='Name of JMS message type to include. Supported types:\n%s' %
      @@ -421,6 +421,7 @@ if __name__ == '__main__':
                   TEST_SUITE.addTest(unittest.makeSuite(test_case_class))
       
           # Finally, run all the dynamically created tests
      -    RES = unittest.TextTestRunner(verbosity=2).run(TEST_SUITE)
      +#    RES = unittest.TextTestRunner(verbosity=2).run(TEST_SUITE)  # type: unittest.TextTestResult
      +    RES = xmlrunner.XMLTestRunner(verbosity=2).run(TEST_SUITE)  # type: unittest.TextTestResult
           if not RES.wasSuccessful():
               sys.exit(1)
      

      The main "problem" seems that each test has completely separate main method and builds up options from scratch. Adding this to every test would mean some unnecessary duplication. So maybe refactor this somewhat at first? On the other hand, there are good reasons to keep the tests simple...

      What do you think?

        Attachments

        1. jms_hdrs_props_test.2018-01-26T09-45-29.xml
          347 kB
          Kim van der Riet
        2. amqp_types_test.2018-01-26T09-24-24.xml
          67 kB
          Kim van der Riet
        3. xunit.xsd
          9 kB
          Kim van der Riet

          Issue Links

            Activity

              People

              • Assignee:
                kpvdr Kim van der Riet
                Reporter:
                jdanek Jiri Daněk
              • Votes:
                1 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: