22 from .context
import EXECUTION_CONTEXTS
23 from .steprunner
import StepRunner
24 from .namespace
import Namespace
25 from .status
import SuiteStatus, TestStatus
26 from .timeouts
import TestTimeout
46 return EXECUTION_CONTEXTS.current
49 self.
_output_output.library_listeners.new_suite_scope()
53 metadata=suite.metadata,
57 result.set_criticality(self.
_settings_settings.critical_tags,
58 self.
_settings_settings.non_critical_tags)
60 self.
resultresult.configure(status_rc=self.
_settings_settings.status_rc,
61 stat_config=self.
_settings_settings.statistics_config)
63 self.
_suite_suite.suites.append(result)
68 self.
_settings_settings.skip_teardown_on_exit)
71 ns.variables.set_from_variable_table(suite.resource.variables)
72 EXECUTION_CONTEXTS.start_suite(result, ns, self.
_output_output,
77 ns.variables.resolve_delayed()
80 for n, v
in result.metadata.items()]
85 test_count=suite.test_count))
92 return self.
_variables_variables.replace_list(value, ignore_errors=
True)
93 return self.
_variables_variables.replace_string(value, ignore_errors=
True)
98 self.
_suite_suite.full_message)
102 self.
_suite_suite.suite_teardown_failed(
unic(failure))
103 if self.
_suite_suite.statistics.critical.failed:
110 self.
_output_output.library_listeners.discard_suite_scope()
114 self.
_output_output.
warn(
"Multiple test cases with name '%s' executed in "
115 "test suite '%s'." % (test.name, self.
_suite_suite.longname))
117 result = self.
_suite_suite.tests.create(name=test.name,
127 result.tags.add(
'robot:exit')
128 if not status.failures
and not test.name:
129 status.test_failed(
'Test case name cannot be empty.')
130 if not status.failures
and not test.keywords.normal:
131 status.test_failed(
'Test case contains no keywords.')
132 self.
_run_setup_run_setup(test.keywords.setup, status, result)
134 if not status.failures:
136 test.template).run_steps(test.keywords.normal)
138 status.test_failed(status.message)
139 except PassExecution
as exception:
140 err = exception.earlier_failures
142 status.test_failed(err)
144 result.message = exception.message
145 except ExecutionStatus
as err:
146 status.test_failed(err)
147 result.status = status.status
148 result.message = status.message
or result.message
149 if status.teardown_allowed:
151 failure = self.
_run_teardown_run_teardown(test.keywords.teardown, status,
153 if failure
and result.critical:
154 status.critical_failure_occurred()
155 if not status.failures
and result.timeout
and result.timeout.timed_out():
156 status.test_failed(result.timeout.get_message())
157 result.message = status.message
158 result.status = status.status
164 exit_combine = (
'NOT robot:exit',
'')
165 if exit_combine
not in self.
_settings_settings[
'TagStatCombine']:
166 self.
_settings_settings[
'TagStatCombine'].append(exit_combine)
171 return TestTimeout(test.timeout.value, test.timeout.message,
172 self.
_variables_variables, rpa=test.parent.rpa)
175 if not status.failures:
177 status.setup_executed(exception)
178 if result
and isinstance(exception, PassExecution):
179 result.message = exception.message
182 if status.teardown_allowed:
184 status.teardown_executed(exception)
185 failed =
not isinstance(exception, PassExecution)
186 if result
and exception:
187 result.message = status.message
if failed
else exception.message
188 return exception
if failed
else None
194 name = self.
_variables_variables.replace_string(data.name)
195 except DataError
as err:
199 if name.upper()
in (
'',
'NONE'):
203 except ExecutionStatus
as err:
217 if hasattr(self.
resultresult, name):
218 return getattr(self.
resultresult, name)
219 if hasattr(self.
datadata, name):
220 return getattr(self.
datadata, name)
Interface to ease traversing through a test suite structure.
def start_test(self, test)
Called when test starts.
def end_test(self, test)
Called when test ends.
Represents results of a single test suite.
def __init__(self, data, result, **priority)
def __getattr__(self, name)
def _run_setup(self, setup, status, result=None)
def end_suite(self, suite)
Called when suite ends.
def _resolve_setting(self, value)
def _add_exit_combine(self)
def visit_test(self, test)
Implements traversing through the test and its keywords.
def _run_teardown(self, teardown, status, result=None)
def start_suite(self, suite)
Called when suite starts.
def __init__(self, output, settings)
def _run_setup_or_teardown(self, data)
def _get_timeout(self, test)
def warn(msg, html=False)
Writes the message to the log file using the WARN level.
def get_timestamp(daysep='', daytimesep=' ', timesep=':', millissep='.')