Skip to content

Commit e8d845e

Browse files
committed
fix: set the correct detail message for passed steps (#835)
1 parent 04a9655 commit e8d845e

1 file changed

Lines changed: 14 additions & 8 deletions

File tree

allure-robotframework/src/listener/allure_listener.py

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,10 @@ def start_before_fixture(self, name):
106106
fixture.name = name
107107

108108
def stop_before_fixture(self, attributes, messages):
109-
self._report_messages(messages)
109+
status = attributes.get('status')
110+
self._report_messages(status, messages)
110111
with self.lifecycle.update_before_fixture() as fixture:
111-
fixture.status = get_allure_status(attributes.get('status'))
112+
fixture.status = get_allure_status(status)
112113
fixture.statusDetails = StatusDetails(message=self._current_msg, trace=self._current_tb)
113114
self.lifecycle.stop_before_fixture()
114115

@@ -117,9 +118,10 @@ def start_after_fixture(self, name):
117118
fixture.name = name
118119

119120
def stop_after_fixture(self, attributes, messages):
120-
self._report_messages(messages)
121+
status = attributes.get('status')
122+
self._report_messages(status, messages)
121123
with self.lifecycle.update_after_fixture() as fixture:
122-
fixture.status = get_allure_status(attributes.get('status'))
124+
fixture.status = get_allure_status(status)
123125
fixture.statusDetails = StatusDetails(message=self._current_msg, trace=self._current_tb)
124126
self.lifecycle.stop_after_fixture()
125127

@@ -136,7 +138,7 @@ def start_test(self, name, attributes):
136138
container.children.append(uuid)
137139

138140
def stop_test(self, _, attributes, messages):
139-
self._report_messages(messages)
141+
self._report_messages(attributes.get('status'), messages)
140142

141143
if 'skipped' in [tag.lower() for tag in attributes['tags']]:
142144
attributes['status'] = RobotStatus.SKIPPED
@@ -168,17 +170,21 @@ def start_keyword(self, name):
168170
step.name = name
169171

170172
def stop_keyword(self, attributes, messages):
171-
self._report_messages(messages)
173+
status = attributes.get('status')
174+
self._report_messages(status, messages)
172175
with self.lifecycle.update_step() as step:
173-
step.status = get_allure_status(attributes.get('status'))
176+
step.status = get_allure_status(status)
174177
step.parameters = get_allure_parameters(attributes.get('args'))
175178
step.statusDetails = StatusDetails(message=self._current_msg, trace=self._current_tb)
176179
self.lifecycle.stop_step()
177180

178-
def _report_messages(self, messages):
181+
def _report_messages(self, status, messages):
179182
has_trace = BuiltIn().get_variable_value("${LOG LEVEL}") in (RobotLogLevel.DEBUG, RobotLogLevel.TRACE)
180183
attachment = ""
181184

185+
if status == RobotStatus.PASSED:
186+
self._current_tb, self._current_msg = None, None
187+
182188
for message, next_message in zip_longest(messages, messages[1:]):
183189
name = message.get('message')
184190
level = message.get('level')

0 commit comments

Comments
 (0)