def main(): parser = optparse.OptionParser( description='Publish the results of Automated Cloud Tests in TestRail') parser.add_option('-r', '--run-name', dest='run_name', help='The name of a test run. ' 'The name should describe the configuration ' 'of the environment where Tempest tests were run') parser.add_option('-i', '--id', dest='test_suite_id', default="1595", help='The id of test suite that should be updated with results of' 'the test run') parser.add_option('-n', '--case_name', dest='test_case_name', default="SimpleTestCase", help='Name of the test case') (options, args) = parser.parse_args() if options.run_name is None: raise optparse.OptionValueError('No run name was specified!') # STEP #1 # Initialize TestRail project client LOG.info('Initializing TestRail project client...') client = TestRailProject(url=TestRailSettings.url, user="******", password="", project=TestRailSettings.project) LOG.info('TestRail project client has been initialized.') the_suite = client.get_suite(int(options.test_suite_id)) LOG.info('Tests suite is "{0}".'.format(the_suite['name'])) try: report_test_results_for_run(client, options.run_name, options.test_suite_id, options.test_case_name, 'passed') except APIError as api_error: LOG.exception(api_error)
def main(): parser = optparse.OptionParser( description='Publish the results of Automated Cloud Tests in TestRail') parser.add_option('-r', '--run-name', dest='run_name', help='The name of a test run. ' 'The name should describe the configuration ' 'of the environment where Tempest tests were run') parser.add_option( '-i', '--id', dest='test_suite_id', default="1595", help='The id of test suite that should be updated with results of' 'the test run') parser.add_option('-n', '--case_name', dest='test_case_name', default="SimpleTestCase", help='Name of the test case') (options, args) = parser.parse_args() if options.run_name is None: raise optparse.OptionValueError('No run name was specified!') # STEP #1 # Initialize TestRail project client LOG.info('Initializing TestRail project client...') client = TestRailProject(url=TestRailSettings.url, user="******", password="", project=TestRailSettings.project) LOG.info('TestRail project client has been initialized.') the_suite = client.get_suite(int(options.test_suite_id)) LOG.info('Tests suite is "{0}".'.format(the_suite['name'])) try: report_test_results_for_run(client, options.run_name, options.test_suite_id, options.test_case_name, 'passed') except APIError as api_error: LOG.exception(api_error)