Details
-
Improvement
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
0.1.0
-
None
-
None
-
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
Attachments
Issue Links
- relates to
-
QPIDIT-22 Add ability to run on Jenkins CI
- Closed