robot.output package¶
Package for internal logging and other output.
Not part of the public API, and also subject to change in the future when test execution is refactored.
Subpackages¶
Submodules¶
robot.output.filelogger module¶
robot.output.librarylogger module¶
Implementation of the public test library logging API.
This is exposed via robot.api.logger
. Implementation must reside
here to avoid cyclic imports.
robot.output.listenerarguments module¶
-
class
robot.output.listenerarguments.
MessageArguments
(arguments)[source]¶ Bases:
robot.output.listenerarguments.ListenerArguments
-
classmethod
by_method_name
(name, arguments)¶
-
get_arguments
(version)¶
-
classmethod
-
class
robot.output.listenerarguments.
StartSuiteArguments
(arguments)[source]¶ Bases:
robot.output.listenerarguments._ListenerArgumentsFromItem
-
classmethod
by_method_name
(name, arguments)¶
-
get_arguments
(version)¶
-
classmethod
-
class
robot.output.listenerarguments.
EndSuiteArguments
(arguments)[source]¶ Bases:
robot.output.listenerarguments.StartSuiteArguments
-
classmethod
by_method_name
(name, arguments)¶
-
get_arguments
(version)¶
-
classmethod
-
class
robot.output.listenerarguments.
StartTestArguments
(arguments)[source]¶ Bases:
robot.output.listenerarguments._ListenerArgumentsFromItem
-
classmethod
by_method_name
(name, arguments)¶
-
get_arguments
(version)¶
-
classmethod
-
class
robot.output.listenerarguments.
EndTestArguments
(arguments)[source]¶ Bases:
robot.output.listenerarguments.StartTestArguments
-
classmethod
by_method_name
(name, arguments)¶
-
get_arguments
(version)¶
-
classmethod
-
class
robot.output.listenerarguments.
StartKeywordArguments
(arguments)[source]¶ Bases:
robot.output.listenerarguments._ListenerArgumentsFromItem
-
classmethod
by_method_name
(name, arguments)¶
-
get_arguments
(version)¶
-
classmethod
-
class
robot.output.listenerarguments.
EndKeywordArguments
(arguments)[source]¶ Bases:
robot.output.listenerarguments.StartKeywordArguments
-
classmethod
by_method_name
(name, arguments)¶
-
get_arguments
(version)¶
-
classmethod
robot.output.listenermethods module¶
robot.output.listeners module¶
robot.output.logger module¶
-
class
robot.output.logger.
Logger
(register_console_logger=True)[source]¶ Bases:
robot.output.loggerhelper.AbstractLogger
A global logger proxy to delegating messages to registered loggers.
Whenever something is written to LOGGER in code, all registered loggers are notified. Messages are also cached and cached messages written to new loggers when they are registered.
NOTE: This API is likely to change in future versions.
-
start_loggers
¶
-
end_loggers
¶
-
register_console_logger
(type='verbose', width=78, colors='AUTO', markers='AUTO', stdout=None, stderr=None)[source]¶
-
cache_only
¶
-
delayed_logging
¶
-
log_message
(msg)¶ Messages about what the framework is doing, warnings, errors, …
-
debug
(msg)¶
-
error
(msg)¶
-
fail
(msg)¶
-
info
(msg)¶
-
set_level
(level)¶
-
skip
(msg)¶
-
trace
(msg)¶
-
warn
(msg)¶
-
write
(message, level, html=False)¶
-
robot.output.loggerhelper module¶
-
class
robot.output.loggerhelper.
Message
(message, level='INFO', html=False, timestamp=None)[source]¶ Bases:
robot.model.message.Message
-
message
¶
-
ELSE
= 'ELSE'¶
-
ELSE_IF
= 'ELSE IF'¶
-
FOR
= 'FOR'¶
-
FOR_ITERATION
= 'FOR ITERATION'¶
-
IF
= 'IF'¶
-
IF_ELSE_ROOT
= 'IF/ELSE ROOT'¶
-
KEYWORD
= 'KEYWORD'¶
-
MESSAGE
= 'MESSAGE'¶
-
SETUP
= 'SETUP'¶
-
TEARDOWN
= 'TEARDOWN'¶
-
config
(**attributes)¶ Configure model object with given attributes.
obj.config(name='Example', doc='Something')
is equivalent to settingobj.name = 'Example'
andobj.doc = 'Something'
.New in Robot Framework 4.0.
-
copy
(**attributes)¶ Return shallow copy of this object.
Parameters: attributes – Attributes to be set for the returned copy automatically. For example, test.copy(name='New name')
.See also
deepcopy()
. The difference between these two is the same as with the standardcopy.copy
andcopy.deepcopy
functions that these methods also use internally.
-
deepcopy
(**attributes)¶ Return deep copy of this object.
Parameters: attributes – Attributes to be set for the returned copy automatically. For example, test.deepcopy(name='New name')
.See also
copy()
. The difference between these two is the same as with the standardcopy.copy
andcopy.deepcopy
functions that these methods also use internally.
-
html
¶
-
html_message
¶ Returns the message content as HTML.
-
id
¶
-
level
¶
-
parent
¶
-
repr_args
= ('message', 'level')¶
-
timestamp
¶
-
type
= 'MESSAGE'¶
-
visit
(visitor)[source]¶ Visitor interface
entry-point.
-
robot.output.output module¶
robot.output.pyloggingconf module¶
-
class
robot.output.pyloggingconf.
RobotHandler
(level=0)[source]¶ Bases:
logging.Handler
Initializes the instance - basically setting the formatter to None and the filter list to empty.
-
emit
(record)[source]¶ Do whatever it takes to actually log the specified logging record.
This version is intended to be implemented by subclasses and so raises a NotImplementedError.
-
acquire
()¶ Acquire the I/O thread lock.
-
addFilter
(filter)¶ Add the specified filter to this handler.
-
close
()¶ Tidy up any resources used by the handler.
This version removes the handler from an internal map of handlers, _handlers, which is used for handler lookup by name. Subclasses should ensure that this gets called from overridden close() methods.
-
createLock
()¶ Acquire a thread lock for serializing access to the underlying I/O.
-
filter
(record)¶ Determine if a record is loggable by consulting all the filters.
The default is to allow the record to be logged; any filter can veto this and the record is then dropped. Returns a zero value if a record is to be dropped, else non-zero.
-
flush
()¶ Ensure all logging output has been flushed.
This version does nothing and is intended to be implemented by subclasses.
-
format
(record)¶ Format the specified record.
If a formatter is set, use it. Otherwise, use the default formatter for the module.
-
get_name
()¶
-
handle
(record)¶ Conditionally emit the specified logging record.
Emission depends on filters which may have been added to the handler. Wrap the actual emission of the record with acquisition/release of the I/O thread lock. Returns whether the filter passed the record for emission.
-
handleError
(record)¶ Handle errors which occur during an emit() call.
This method should be called from handlers when an exception is encountered during an emit() call. If raiseExceptions is false, exceptions get silently ignored. This is what is mostly wanted for a logging system - most users will not care about errors in the logging system, they are more interested in application errors. You could, however, replace this with a custom handler if you wish. The record which was being processed is passed in to this method.
-
name
¶
-
release
()¶ Release the I/O thread lock.
-
removeFilter
(filter)¶ Remove the specified filter from this handler.
-
setFormatter
(fmt)¶ Set the formatter for this handler.
-
setLevel
(level)¶ Set the logging level of this handler.
-
set_name
(name)¶
-
robot.output.stdoutlogsplitter module¶
robot.output.xmllogger module¶
-
class
robot.output.xmllogger.
XmlLogger
(path, log_level='TRACE', rpa=False, generator='Robot')[source]¶ Bases:
robot.result.visitor.ResultVisitor
-
start_keyword
(kw)[source]¶ Called when keyword starts. Default implementation does nothing.
Can return explicit
False
to stop visiting.
-
start_if
(if_)[source]¶ Called when IF/ELSE structure starts. Default implementation does nothing.
Can return explicit
False
to stop visiting.
-
start_if_branch
(branch)[source]¶ Called when IF/ELSE branch starts. Default implementation does nothing.
Can return explicit
False
to stop visiting.
-
end_if_branch
(branch)[source]¶ Called when IF/ELSE branch ends. Default implementation does nothing.
-
start_for
(for_)[source]¶ Called when FOR loop starts. Default implementation does nothing.
Can return explicit
False
to stop visiting.
-
start_for_iteration
(iteration)[source]¶ Called when FOR loop iteration starts. Default implementation does nothing.
Can return explicit
False
to stop visiting.
-
end_for_iteration
(iteration)[source]¶ Called when FOR loop iteration ends. Default implementation does nothing.
-
start_test
(test)[source]¶ Called when test starts. Default implementation does nothing.
Can return explicit
False
to stop visiting.
-
start_suite
(suite)[source]¶ Called when suite starts. Default implementation does nothing.
Can return explicit
False
to stop visiting.
-
end_message
(msg)¶ Called when message ends. Default implementation does nothing.
-
end_result
(result)¶
-
end_stat
(stat)¶
-
start_message
(msg)¶ Called when message starts. Default implementation does nothing.
Can return explicit
False
to stop visiting.
-
start_result
(result)¶
-
start_stat
(stat)¶
-
visit_errors
(errors)¶
-
visit_for
(for_)¶ Implements traversing through FOR loops.
Can be overridden to allow modifying the passed in
for_
without callingstart_for()
orend_for()
nor visiting body.
-
visit_for_iteration
(iteration)¶ Implements traversing through single FOR loop iteration.
This is only used with the result side model because on the running side there are no iterations.
Can be overridden to allow modifying the passed in
iteration
without callingstart_for_iteration()
orend_for_iteration()
nor visiting body.
-
visit_if
(if_)¶ Implements traversing through IF/ELSE structures.
Notice that
if_
does not have any data directly. Actual IF/ELSE branches are in itsbody
and visited usingvisit_if_branch()
.Can be overridden to allow modifying the passed in
if_
without callingstart_if()
orend_if()
nor visiting branches.
-
visit_if_branch
(branch)¶ Implements traversing through single IF/ELSE branch.
Can be overridden to allow modifying the passed in
branch
without callingstart_if_branch()
orend_if_branch()
nor visiting body.
-
visit_keyword
(kw)¶ Implements traversing through keywords.
Can be overridden to allow modifying the passed in
kw
without callingstart_keyword()
orend_keyword()
nor visiting child keywords.
-
visit_message
(msg)¶ Implements visiting messages.
Can be overridden to allow modifying the passed in
msg
without callingstart_message()
orend_message()
.
-
visit_result
(result)¶
-
visit_statistics
(stats)¶
-
visit_suite
(suite)¶ Implements traversing through suites.
Can be overridden to allow modifying the passed in
suite
without callingstart_suite()
orend_suite()
nor visiting child suites, tests or keywords (setup and teardown) at all.
-
visit_suite_statistics
(stats)¶
-
visit_tag_statistics
(stats)¶
-
visit_test
(test)¶ Implements traversing through tests.
Can be overridden to allow modifying the passed in
test
without callingstart_test()
orend_test()
nor visiting keywords.
-
visit_total_statistics
(stats)¶
-