Commit d958dd54 authored by Federico Sismondi's avatar Federico Sismondi

feat every event sent into control.testcoordination topic embeds testcase info on it

parent 5eae22a2
......@@ -385,9 +385,9 @@ class TestCase:
d = OrderedDict()
d['testcase_id'] = self.id
d['testcase_ref'] = self.uri
if verbose:
d['testcase_ref'] = self.uri
d['objective'] = self.objective
d['pre_conditions'] = self.pre_conditions
d['state'] = self.state
......@@ -605,24 +605,27 @@ class Coordinator:
def notify_step_to_execute(self):
step_info_dict = self.current_tc.current_step.to_dict(verbose=True)
tc_info_dict = self.current_tc.to_dict(verbose=False)
event = MsgStepExecute(
message='Next test step to be executed is %s' % self.current_tc.current_step.id,
**step_info_dict
**step_info_dict,
**tc_info_dict,
)
publish_message(self.channel, event)
def notify_testcase_finished(self):
tc_info_dict = self.current_tc.to_dict(verbose=True)
tc_info_dict = self.current_tc.to_dict(verbose=False)
event = MsgTestCaseFinished(
testcase_id = self.current_tc.id,
message='Testcase %s finished' % self.current_tc.id,
message='Testcase %s finished' % tc_info_dict['testcase_id'],
**tc_info_dict
)
publish_message(self.channel, event)
def notify_testcase_verdict(self):
event = MsgTestCaseVerdict(
**self.current_tc.report,
**self.current_tc.to_dict(verbose=True)
**self.current_tc.to_dict(verbose=False)
)
publish_message(self.channel, event)
......@@ -671,6 +674,7 @@ class Coordinator:
f.write(event.to_json())
def notify_current_configuration(self):
tc_info_dict = self.current_tc.to_dict(verbose=False)
config_id = self.current_tc.configuration_id
config = self.tc_configs[config_id] # Configuration object
......@@ -682,8 +686,7 @@ class Coordinator:
configuration_id=config_id,
node=node,
message=message,
testcase_id=self.current_tc.id,
testcase_ref=self.current_tc.uri
**tc_info_dict,
)
publish_message(self.channel, event)
......@@ -1042,13 +1045,11 @@ class Coordinator:
def get_testcases_list(self):
return list(self.teds.keys())
# def select_testcases(self, tc_id):
def select_testcase(self, params):
"""
this is more like a jump to function rather than select
:param params: test case id
:return: dict repr of the selected testcase if found
:return: current testcase object
:raises: CoordinatorError when test case not found
"""
tc_id = params
......@@ -1057,7 +1058,7 @@ class Coordinator:
# in case is was already executed once
self.current_tc.reinit()
logger.debug("Test case selected to be executed: %s" % self.current_tc.id)
return self.current_tc.to_dict(verbose=True)
return self.current_tc
else:
logger.error("%s not found in : %s " % (tc_id, self.teds))
raise CoordinatorError('Testcase not found')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment