Skip to content

Commit

Permalink
Add support of milestones
Browse files Browse the repository at this point in the history
Change-Id: I5d1acb225ec1aee69b85686bf3c34fea7ff786c9
  • Loading branch information
ibumarskov committed Nov 8, 2019
1 parent 65d0559 commit c27346e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
16 changes: 12 additions & 4 deletions lib/testrailreporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,23 +82,31 @@ def get_config_id(self, group, conf):
raise Exception("Can't find configuration for plan entry:\n"
"{}:{}".format(group, conf))

def get_milestone_id(self, name):
for m in self.project.milestones:
if m['name'] == name:
return m['id']
raise Exception("Can't find milestone {}".format(name))

def report_test_plan(self, plan_name, suite_name, run_name,
configuration=None, milestone=None,
milestone=None, configuration=None,
update_existing=False, remove_untested=False):
suite = self.project.get_suite_by_name(suite_name)
plans_list = self.project.get_plans_project()
plan = None
milestone_id = None
conf_ids = []
if configuration:
isinstance(configuration, dict)
for k, v in configuration.iteritems():
conf_ids.append(self.get_config_id(k, v))

if milestone:
milestone_id = self.get_milestone_id(milestone)
for p in plans_list:
if p['name'] == plan_name:
if p['name'] == plan_name and p['milestone_id'] == milestone_id:
plan = self.project.get_plan(p['id'])
if plan is None:
plan_data = {'name': plan_name}
plan_data = {'name': plan_name, 'milestone_id': milestone_id}
plan = self.project.add_plan_project(plan_data)

run_present = False
Expand Down
5 changes: 3 additions & 2 deletions reporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,9 @@ def upload(args):
if args.update_ts:
reporter_obj.update_test_suite(args.tr_suite)

reporter_obj.report_test_plan(args.tr_plan, args.tr_suite,
args.tr_run, configuration=tr_conf,
reporter_obj.report_test_plan(args.tr_plan, args.tr_suite, args.tr_run,
milestone=args.tr_milestone,
configuration=tr_conf,
update_existing=True,
remove_untested=args.remove_untested)

Expand Down

0 comments on commit c27346e

Please sign in to comment.