Add predefined description to testrail reporter

Added possibility to specify custom description
in testrail reporter.
Closes-bug: #1618427

Change-Id: Id859378f72343b512e45b58f64c28ef4a1fc8e4a
This commit is contained in:
vrovachev 2016-08-30 15:14:43 +03:00 committed by Vadim Rovachev
parent 79cb36faed
commit d724813593
2 changed files with 13 additions and 2 deletions

View File

@ -588,16 +588,26 @@ def main():
'-{0}'.format(prefix) if prefix
else '')
iso_link = '/'.join([JENKINS['url'], 'job', iso_job_name, str(iso_number)])
test_run = TestRailSettings.tests_description
description = test_run if test_run else iso_link
if not test_plan:
test_plan = project.add_plan(test_plan_name,
description=iso_link,
description=description,
milestone_id=milestone['id'],
entries=[]
)
logger.info('Created new TestPlan "{0}".'.format(test_plan_name))
else:
logger.info('Found existing TestPlan "{0}".'.format(test_plan_name))
test_plan_description = test_plan.get('description')
if description not in test_plan_description:
new_description = test_plan_description + '\n' + description
logger.info('Update description for existing TestPlan "{0}" '
'from "{1}" to {2}.'.format(test_plan_name,
test_plan_description,
new_description))
project.update_plan(test_plan.get('id'),
description=new_description)
if options.create_plan_only:
return

View File

@ -60,6 +60,7 @@ class TestRailSettings(object):
password = os.environ.get('TESTRAIL_PASSWORD', 'password')
project = os.environ.get('TESTRAIL_PROJECT', 'Fuel')
milestone = os.environ.get('TESTRAIL_MILESTONE', '9.0')
tests_description = os.environ.get('TESTRAIL_DESCRIPTION', None)
tests_suite = os.environ.get('TESTRAIL_TEST_SUITE',
'[{0}] Swarm'.format(milestone))
tests_section = os.environ.get('TESTRAIL_TEST_SECTION', 'All')