robot.running package

Implements the core test execution logic.

The main public entry points of this package are of the following two classes:

  • TestSuiteBuilder for creating executable test suites based on existing test case files and directories.
  • TestSuite for creating an executable test suite structure programmatically.

It is recommended to import both of these classes via the robot.api package like in the examples below. Also TestCase and Keyword classes used internally by the TestSuite class are part of the public API. In those rare cases where these classes are needed directly, they can be imported from this package.

Examples

First, let’s assume we have the following test suite in file activate_skynet.robot:

*** Settings ***
Library    OperatingSystem

*** Test Cases ***
Should Activate Skynet
    [Tags]    smoke
    [Setup]    Set Environment Variable    SKYNET    activated
    Environment Variable Should Be Set    SKYNET

We can easily parse and create an executable test suite based on the above file using the TestSuiteBuilder class as follows:

from robot.api import TestSuiteBuilder

suite = TestSuiteBuilder().build('path/to/activate_skynet.robot')

That was easy. Let’s next generate the same test suite from scratch using the TestSuite class:

from robot.api import TestSuite

suite = TestSuite('Activate Skynet')
suite.resource.imports.library('OperatingSystem')
test = suite.tests.create('Should Activate Skynet', tags=['smoke'])
test.setup.config(name='Set Environment Variable', args=['SKYNET', 'activated'])
test.body.create_keyword('Environment Variable Should Be Set', args=['SKYNET'])

Not that complicated either, especially considering the flexibility. Notice that the suite created based on the file could also be edited further using the same API.

Now that we have a test suite ready, let’s execute it and verify that the returned Result object contains correct information:

result = suite.run(output='skynet.xml')

assert result.return_code == 0
assert result.suite.name == 'Activate Skynet'
test = result.suite.tests[0]
assert test.name == 'Should Activate Skynet'
assert test.passed
stats = result.suite.statistics
assert stats.total == 1 and stats.passed == 1 and stats.failed == 0

Running the suite generates a normal output XML file, unless it is disabled by using output=None. Generating log, report, and xUnit files based on the results is possible using the ResultWriter class:

from robot.api import ResultWriter

# Report and xUnit files can be generated based on the result object.
ResultWriter(result).write_results(report='skynet.html', log=None)
# Generating log files requires processing the earlier generated output XML.
ResultWriter('skynet.xml').write_results()

Submodules

robot.running.bodyrunner module

class robot.running.bodyrunner.BodyRunner(context, run=True, templated=False)[source]

Bases: object

run(body)[source]
class robot.running.bodyrunner.KeywordRunner(context, run=True)[source]

Bases: object

run(step, name=None)[source]
robot.running.bodyrunner.ForRunner(context, flavor='IN', run=True, templated=False)[source]
class robot.running.bodyrunner.ForInRunner(context, run=True, templated=False)[source]

Bases: object

flavor = 'IN'
run(data)[source]
class robot.running.bodyrunner.ForInRangeRunner(context, run=True, templated=False)[source]

Bases: robot.running.bodyrunner.ForInRunner

flavor = 'IN RANGE'
run(data)
class robot.running.bodyrunner.ForInZipRunner(context, run=True, templated=False)[source]

Bases: robot.running.bodyrunner.ForInRunner

flavor = 'IN ZIP'
run(data)
class robot.running.bodyrunner.ForInEnumerateRunner(context, run=True, templated=False)[source]

Bases: robot.running.bodyrunner.ForInRunner

flavor = 'IN ENUMERATE'
run(data)
class robot.running.bodyrunner.WhileRunner(context, run=True, templated=False)[source]

Bases: object

run(data)[source]
class robot.running.bodyrunner.IfRunner(context, run=True, templated=False)[source]

Bases: object

run(data)[source]
class robot.running.bodyrunner.TryRunner(context, run=True, templated=False)[source]

Bases: object

run(data)[source]
class robot.running.bodyrunner.WhileLimit[source]

Bases: object

is_valid = True
classmethod create(limit, variables)[source]
limit_exceeded()[source]
class robot.running.bodyrunner.DurationLimit(max_time)[source]

Bases: robot.running.bodyrunner.WhileLimit

classmethod create(limit, variables)
is_valid = True
limit_exceeded()
class robot.running.bodyrunner.IterationCountLimit(max_iterations)[source]

Bases: robot.running.bodyrunner.WhileLimit

classmethod create(limit, variables)
is_valid = True
limit_exceeded()
class robot.running.bodyrunner.NoLimit[source]

Bases: robot.running.bodyrunner.WhileLimit

classmethod create(limit, variables)
is_valid = True
limit_exceeded()
class robot.running.bodyrunner.InvalidLimit(reason)[source]

Bases: robot.running.bodyrunner.WhileLimit

is_valid = False
classmethod create(limit, variables)
limit_exceeded()

robot.running.context module

class robot.running.context.ExecutionContexts[source]

Bases: object

current
top
namespaces
start_suite(suite, namespace, output, dry_run=False)[source]
end_suite()[source]

robot.running.dynamicmethods module

robot.running.dynamicmethods.no_dynamic_method(*args)[source]
class robot.running.dynamicmethods.GetKeywordNames(lib)[source]

Bases: robot.running.dynamicmethods._DynamicMethod

name
class robot.running.dynamicmethods.RunKeyword(lib)[source]

Bases: robot.running.dynamicmethods._DynamicMethod

supports_kwargs
name
class robot.running.dynamicmethods.GetKeywordDocumentation(lib)[source]

Bases: robot.running.dynamicmethods._DynamicMethod

name
class robot.running.dynamicmethods.GetKeywordArguments(lib)[source]

Bases: robot.running.dynamicmethods._DynamicMethod

name
class robot.running.dynamicmethods.GetKeywordTypes(lib)[source]

Bases: robot.running.dynamicmethods._DynamicMethod

name
class robot.running.dynamicmethods.GetKeywordTags(lib)[source]

Bases: robot.running.dynamicmethods._DynamicMethod

name
class robot.running.dynamicmethods.GetKeywordSource(lib)[source]

Bases: robot.running.dynamicmethods._DynamicMethod

name

robot.running.handlers module

robot.running.handlers.Handler(library, name, method)[source]
robot.running.handlers.DynamicHandler(library, name, method, doc, argspec, tags=None)[source]
robot.running.handlers.InitHandler(library, method=None, docgetter=None)[source]
class robot.running.handlers.EmbeddedArgumentsHandler(name_regexp, orig_handler)[source]

Bases: object

library
matches(name)[source]
create_runner(name)[source]
resolve_arguments(args, variables=None)[source]

robot.running.handlerstore module

class robot.running.handlerstore.HandlerStore(source, source_type)[source]

Bases: object

LIBRARY_TYPE = 'Library'
TEST_CASE_FILE_TYPE = 'Test case file'
RESOURCE_FILE_TYPE = 'Resource file'
add(handler, embedded=False)[source]
create_runner(name)[source]

robot.running.importer module

class robot.running.importer.Importer[source]

Bases: object

reset()[source]
close_global_library_listeners()[source]
import_library(name, args, alias, variables)[source]
import_resource(path)[source]
class robot.running.importer.ImportCache[source]

Bases: object

Keeps track on and optionally caches imported items.

Handles paths in keys case-insensitively on case-insensitive OSes. Unlike dicts, this storage accepts mutable values in keys.

add(key, item=None)[source]
values()[source]

robot.running.librarykeywordrunner module

class robot.running.librarykeywordrunner.LibraryKeywordRunner(handler, name=None)[source]

Bases: object

library
libname
longname
run(kw, context, run=True)[source]
dry_run(kw, context)[source]
class robot.running.librarykeywordrunner.EmbeddedArgumentsRunner(handler, name)[source]

Bases: robot.running.librarykeywordrunner.LibraryKeywordRunner

dry_run(kw, context)
libname
library
longname
run(kw, context, run=True)
class robot.running.librarykeywordrunner.RunKeywordRunner(handler, default_dry_run_keywords=False)[source]

Bases: robot.running.librarykeywordrunner.LibraryKeywordRunner

dry_run(kw, context)
libname
library
longname
run(kw, context, run=True)

robot.running.libraryscopes module

robot.running.libraryscopes.LibraryScope(libcode, library)[source]
class robot.running.libraryscopes.GlobalScope(library)[source]

Bases: object

is_global = True
start_suite()[source]
end_suite()[source]
start_test()[source]
end_test()[source]
class robot.running.libraryscopes.TestSuiteScope(library)[source]

Bases: robot.running.libraryscopes.GlobalScope

is_global = False
start_suite()[source]
end_suite()[source]
end_test()
start_test()
class robot.running.libraryscopes.TestCaseScope(library)[source]

Bases: robot.running.libraryscopes.TestSuiteScope

start_test()[source]
end_test()[source]
end_suite()
is_global = False
start_suite()

robot.running.model module

Module implementing test execution related model objects.

When tests are executed normally, these objects are created based on the test data on the file system by TestSuiteBuilder, but external tools can also create an executable test suite model structure directly. Regardless the approach to create it, the model is executed by calling run() method of the root test suite. See the robot.running package level documentation for more information and examples.

The most important classes defined in this module are TestSuite, TestCase and Keyword. When tests are executed, these objects can be inspected and modified by pre-run modifiers and listeners. The aforementioned objects are considered stable, but other objects in this module may still be changed in the future major releases.

class robot.running.model.Body(parent=None, items=None)[source]

Bases: robot.model.body.Body

append(item)

S.append(value) – append value to the end of the sequence

break_class

alias of Break

clear() → None -- remove all items from S
continue_class

alias of Continue

count(value) → integer -- return number of occurrences of value
create
create_break(*args, **kwargs)
create_continue(*args, **kwargs)
create_for(*args, **kwargs)
create_if(*args, **kwargs)
create_keyword(*args, **kwargs)
create_message(*args, **kwargs)
create_return(*args, **kwargs)
create_try(*args, **kwargs)
create_while(*args, **kwargs)
extend(items)

S.extend(iterable) – extend sequence by appending elements from the iterable

filter(keywords=None, messages=None, predicate=None)

Filter body items based on type and/or custom predicate.

To include or exclude items based on types, give matching arguments True or False values. For example, to include only keywords, use body.filter(keywords=True) and to exclude messages use body.filter(messages=False). Including and excluding by types at the same time is not supported and filtering my messages is supported only if the Body object actually supports messages.

Custom predicate is a callable getting each body item as an argument that must return True/False depending on should the item be included or not.

Selected items are returned as a list and the original body is not modified.

It was earlier possible to filter also based on FOR and IF types. That support was removed in RF 5.0 because it was not considered useful in general and because adding support for all new control structures would have required extra work. To exclude all control structures, use body.filter(keywords=True, messages=True) and to only include them use body.filter(keywords=False, messages=False)``. For more detailed filtering it is possible to use predicate.

flatten()

Return steps so that IF and TRY structures are flattened.

Basically the IF/ELSE and TRY/EXCEPT root elements are replaced with their branches. This is how they are shown in log files.

for_class

alias of For

if_class

alias of If

index(value[, start[, stop]]) → integer -- return first index of value.

Raises ValueError if the value is not present.

Supporting start and stop arguments is optional, but recommended.

insert(index, item)

S.insert(index, value) – insert value before index

keyword_class

alias of Keyword

message_class = None
pop([index]) → item -- remove and return item at index (default last).

Raise IndexError if list is empty or index is out of range.

classmethod register(item_class)

Register a virtual subclass of an ABC.

Returns the subclass, to allow usage as a class decorator.

remove(value)

S.remove(value) – remove first occurrence of value. Raise ValueError if the value is not present.

return_class

alias of Return

reverse()

S.reverse() – reverse IN PLACE

sort()
try_class

alias of Try

visit(visitor)
while_class

alias of While

class robot.running.model.Keyword(name='', doc='', args=(), assign=(), tags=(), timeout=None, type='KEYWORD', parent=None, lineno=None)[source]

Bases: robot.model.keyword.Keyword

Represents a single executable keyword.

These keywords never have child keywords or messages. The actual keyword that is executed depends on the context where this model is executed.

See the base class for documentation of attributes not documented here.

lineno
source
run(context, run=True, templated=None)[source]
BREAK = 'BREAK'
CONTINUE = 'CONTINUE'
ELSE = 'ELSE'
ELSE_IF = 'ELSE IF'
EXCEPT = 'EXCEPT'
FINALLY = 'FINALLY'
FOR = 'FOR'
IF = 'IF'
IF_ELSE_ROOT = 'IF/ELSE ROOT'
ITERATION = 'ITERATION'
KEYWORD = 'KEYWORD'
MESSAGE = 'MESSAGE'
RETURN = 'RETURN'
SETUP = 'SETUP'
TEARDOWN = 'TEARDOWN'
TRY = 'TRY'
TRY_EXCEPT_ROOT = 'TRY/EXCEPT ROOT'
WHILE = 'WHILE'
args
assign
config(**attributes)

Configure model object with given attributes.

obj.config(name='Example', doc='Something') is equivalent to setting obj.name = 'Example' and obj.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 standard copy.copy and copy.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 standard copy.copy and copy.deepcopy functions that these methods also use internally.

doc
has_setup
has_teardown

Check does a keyword have a teardown without creating a teardown object.

A difference between using if kw.has_teardown: and if kw.teardown: is that accessing the teardown attribute creates a Keyword object representing a teardown even when the keyword actually does not have one. This typically does not matter, but with bigger suite structures having lot of keywords it can have a considerable effect on memory usage.

New in Robot Framework 4.1.2.

id

Item id in format like s1-t3-k1.

See TestSuite.id for more information.

name
parent
repr_args = ('name', 'args', 'assign')
tags

Keyword tags as a Tags object.

teardown

Keyword teardown as a Keyword object.

Teardown can be modified by setting attributes directly:

keyword.teardown.name = 'Example'
keyword.teardown.args = ('First', 'Second')

Alternatively the config() method can be used to set multiple attributes in one call:

keyword.teardown.config(name='Example', args=('First', 'Second'))

The easiest way to reset the whole teardown is setting it to None. It will automatically recreate the underlying Keyword object:

keyword.teardown = None

This attribute is a Keyword object also when a keyword has no teardown but in that case its truth value is False. If there is a need to just check does a keyword have a teardown, using the has_teardown attribute avoids creating the Keyword object and is thus more memory efficient.

New in Robot Framework 4.0. Earlier teardown was accessed like keyword.keywords.teardown. has_teardown is new in Robot Framework 4.1.2.

timeout
type
visit(visitor)[source]

Visitor interface entry-point.

class robot.running.model.For(variables, flavor, values, parent=None, lineno=None, error=None)[source]

Bases: robot.model.control.For

body_class

alias of Body

lineno
error
source
run(context, run=True, templated=False)[source]
BREAK = 'BREAK'
CONTINUE = 'CONTINUE'
ELSE = 'ELSE'
ELSE_IF = 'ELSE IF'
EXCEPT = 'EXCEPT'
FINALLY = 'FINALLY'
FOR = 'FOR'
IF = 'IF'
IF_ELSE_ROOT = 'IF/ELSE ROOT'
ITERATION = 'ITERATION'
KEYWORD = 'KEYWORD'
MESSAGE = 'MESSAGE'
RETURN = 'RETURN'
SETUP = 'SETUP'
TEARDOWN = 'TEARDOWN'
TRY = 'TRY'
TRY_EXCEPT_ROOT = 'TRY/EXCEPT ROOT'
WHILE = 'WHILE'
body
config(**attributes)

Configure model object with given attributes.

obj.config(name='Example', doc='Something') is equivalent to setting obj.name = 'Example' and obj.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 standard copy.copy and copy.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 standard copy.copy and copy.deepcopy functions that these methods also use internally.

flavor
has_setup
has_teardown
id

Item id in format like s1-t3-k1.

See TestSuite.id for more information.

keywords

Deprecated since Robot Framework 4.0. Use body instead.

parent
repr_args = ('variables', 'flavor', 'values')
type = 'FOR'
values
variables
visit(visitor)[source]
class robot.running.model.While(condition=None, limit=None, parent=None, lineno=None, error=None)[source]

Bases: robot.model.control.While

body_class

alias of Body

lineno
error
source
run(context, run=True, templated=False)[source]
BREAK = 'BREAK'
CONTINUE = 'CONTINUE'
ELSE = 'ELSE'
ELSE_IF = 'ELSE IF'
EXCEPT = 'EXCEPT'
FINALLY = 'FINALLY'
FOR = 'FOR'
IF = 'IF'
IF_ELSE_ROOT = 'IF/ELSE ROOT'
ITERATION = 'ITERATION'
KEYWORD = 'KEYWORD'
MESSAGE = 'MESSAGE'
RETURN = 'RETURN'
SETUP = 'SETUP'
TEARDOWN = 'TEARDOWN'
TRY = 'TRY'
TRY_EXCEPT_ROOT = 'TRY/EXCEPT ROOT'
WHILE = 'WHILE'
body
condition
config(**attributes)

Configure model object with given attributes.

obj.config(name='Example', doc='Something') is equivalent to setting obj.name = 'Example' and obj.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 standard copy.copy and copy.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 standard copy.copy and copy.deepcopy functions that these methods also use internally.

has_setup
has_teardown
id

Item id in format like s1-t3-k1.

See TestSuite.id for more information.

limit
parent
repr_args = ('condition', 'limit')
type = 'WHILE'
visit(visitor)[source]
class robot.running.model.IfBranch(type='IF', condition=None, parent=None, lineno=None)[source]

Bases: robot.model.control.IfBranch

body_class

alias of Body

lineno
source
BREAK = 'BREAK'
CONTINUE = 'CONTINUE'
ELSE = 'ELSE'
ELSE_IF = 'ELSE IF'
EXCEPT = 'EXCEPT'
FINALLY = 'FINALLY'
FOR = 'FOR'
IF = 'IF'
IF_ELSE_ROOT = 'IF/ELSE ROOT'
ITERATION = 'ITERATION'
KEYWORD = 'KEYWORD'
MESSAGE = 'MESSAGE'
RETURN = 'RETURN'
SETUP = 'SETUP'
TEARDOWN = 'TEARDOWN'
TRY = 'TRY'
TRY_EXCEPT_ROOT = 'TRY/EXCEPT ROOT'
WHILE = 'WHILE'
body
condition
config(**attributes)

Configure model object with given attributes.

obj.config(name='Example', doc='Something') is equivalent to setting obj.name = 'Example' and obj.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 standard copy.copy and copy.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 standard copy.copy and copy.deepcopy functions that these methods also use internally.

has_setup
has_teardown
id

Branch id omits IF/ELSE root from the parent id part.

parent
repr_args = ('type', 'condition')
type
visit(visitor)[source]
class robot.running.model.If(parent=None, lineno=None, error=None)[source]

Bases: robot.model.control.If

branch_class

alias of IfBranch

lineno
error
source
run(context, run=True, templated=False)[source]
BREAK = 'BREAK'
CONTINUE = 'CONTINUE'
ELSE = 'ELSE'
ELSE_IF = 'ELSE IF'
EXCEPT = 'EXCEPT'
FINALLY = 'FINALLY'
FOR = 'FOR'
IF = 'IF'
IF_ELSE_ROOT = 'IF/ELSE ROOT'
ITERATION = 'ITERATION'
KEYWORD = 'KEYWORD'
MESSAGE = 'MESSAGE'
RETURN = 'RETURN'
SETUP = 'SETUP'
TEARDOWN = 'TEARDOWN'
TRY = 'TRY'
TRY_EXCEPT_ROOT = 'TRY/EXCEPT ROOT'
WHILE = 'WHILE'
body
branches_class

alias of robot.model.body.Branches

config(**attributes)

Configure model object with given attributes.

obj.config(name='Example', doc='Something') is equivalent to setting obj.name = 'Example' and obj.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 standard copy.copy and copy.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 standard copy.copy and copy.deepcopy functions that these methods also use internally.

has_setup
has_teardown
id

Root IF/ELSE id is always None.

parent
repr_args = ()
type = 'IF/ELSE ROOT'
visit(visitor)[source]
class robot.running.model.TryBranch(type='TRY', patterns=(), pattern_type=None, variable=None, parent=None, lineno=None)[source]

Bases: robot.model.control.TryBranch

body_class

alias of Body

lineno
source
BREAK = 'BREAK'
CONTINUE = 'CONTINUE'
ELSE = 'ELSE'
ELSE_IF = 'ELSE IF'
EXCEPT = 'EXCEPT'
FINALLY = 'FINALLY'
FOR = 'FOR'
IF = 'IF'
IF_ELSE_ROOT = 'IF/ELSE ROOT'
ITERATION = 'ITERATION'
KEYWORD = 'KEYWORD'
MESSAGE = 'MESSAGE'
RETURN = 'RETURN'
SETUP = 'SETUP'
TEARDOWN = 'TEARDOWN'
TRY = 'TRY'
TRY_EXCEPT_ROOT = 'TRY/EXCEPT ROOT'
WHILE = 'WHILE'
body
config(**attributes)

Configure model object with given attributes.

obj.config(name='Example', doc='Something') is equivalent to setting obj.name = 'Example' and obj.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 standard copy.copy and copy.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 standard copy.copy and copy.deepcopy functions that these methods also use internally.

has_setup
has_teardown
id

Branch id omits TRY/EXCEPT root from the parent id part.

parent
pattern_type
patterns
repr_args = ('type', 'patterns', 'pattern_type', 'variable')
type
variable
visit(visitor)[source]
class robot.running.model.Try(parent=None, lineno=None, error=None)[source]

Bases: robot.model.control.Try

branch_class

alias of TryBranch

lineno
error
source
run(context, run=True, templated=False)[source]
BREAK = 'BREAK'
CONTINUE = 'CONTINUE'
ELSE = 'ELSE'
ELSE_IF = 'ELSE IF'
EXCEPT = 'EXCEPT'
FINALLY = 'FINALLY'
FOR = 'FOR'
IF = 'IF'
IF_ELSE_ROOT = 'IF/ELSE ROOT'
ITERATION = 'ITERATION'
KEYWORD = 'KEYWORD'
MESSAGE = 'MESSAGE'
RETURN = 'RETURN'
SETUP = 'SETUP'
TEARDOWN = 'TEARDOWN'
TRY = 'TRY'
TRY_EXCEPT_ROOT = 'TRY/EXCEPT ROOT'
WHILE = 'WHILE'
body
branches_class

alias of robot.model.body.Branches

config(**attributes)

Configure model object with given attributes.

obj.config(name='Example', doc='Something') is equivalent to setting obj.name = 'Example' and obj.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 standard copy.copy and copy.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 standard copy.copy and copy.deepcopy functions that these methods also use internally.

else_branch
except_branches
finally_branch
has_setup
has_teardown
id

Root TRY/EXCEPT id is always None.

parent
repr_args = ()
try_branch
type = 'TRY/EXCEPT ROOT'
visit(visitor)[source]
class robot.running.model.Return(values=(), parent=None, lineno=None, error=None)[source]

Bases: robot.model.control.Return

lineno
error
source
run(context, run=True, templated=False)[source]
BREAK = 'BREAK'
CONTINUE = 'CONTINUE'
ELSE = 'ELSE'
ELSE_IF = 'ELSE IF'
EXCEPT = 'EXCEPT'
FINALLY = 'FINALLY'
FOR = 'FOR'
IF = 'IF'
IF_ELSE_ROOT = 'IF/ELSE ROOT'
ITERATION = 'ITERATION'
KEYWORD = 'KEYWORD'
MESSAGE = 'MESSAGE'
RETURN = 'RETURN'
SETUP = 'SETUP'
TEARDOWN = 'TEARDOWN'
TRY = 'TRY'
TRY_EXCEPT_ROOT = 'TRY/EXCEPT ROOT'
WHILE = 'WHILE'
config(**attributes)

Configure model object with given attributes.

obj.config(name='Example', doc='Something') is equivalent to setting obj.name = 'Example' and obj.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 standard copy.copy and copy.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 standard copy.copy and copy.deepcopy functions that these methods also use internally.

has_setup
has_teardown
id

Item id in format like s1-t3-k1.

See TestSuite.id for more information.

parent
repr_args = ('values',)
type = 'RETURN'
values
visit(visitor)[source]
class robot.running.model.Continue(parent=None, lineno=None, error=None)[source]

Bases: robot.model.control.Continue

lineno
error
source
run(context, run=True, templated=False)[source]
BREAK = 'BREAK'
CONTINUE = 'CONTINUE'
ELSE = 'ELSE'
ELSE_IF = 'ELSE IF'
EXCEPT = 'EXCEPT'
FINALLY = 'FINALLY'
FOR = 'FOR'
IF = 'IF'
IF_ELSE_ROOT = 'IF/ELSE ROOT'
ITERATION = 'ITERATION'
KEYWORD = 'KEYWORD'
MESSAGE = 'MESSAGE'
RETURN = 'RETURN'
SETUP = 'SETUP'
TEARDOWN = 'TEARDOWN'
TRY = 'TRY'
TRY_EXCEPT_ROOT = 'TRY/EXCEPT ROOT'
WHILE = 'WHILE'
config(**attributes)

Configure model object with given attributes.

obj.config(name='Example', doc='Something') is equivalent to setting obj.name = 'Example' and obj.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 standard copy.copy and copy.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 standard copy.copy and copy.deepcopy functions that these methods also use internally.

has_setup
has_teardown
id

Item id in format like s1-t3-k1.

See TestSuite.id for more information.

parent
repr_args = ()
type = 'CONTINUE'
visit(visitor)[source]
class robot.running.model.Break(parent=None, lineno=None, error=None)[source]

Bases: robot.model.control.Break

lineno
error
source
run(context, run=True, templated=False)[source]
BREAK = 'BREAK'
CONTINUE = 'CONTINUE'
ELSE = 'ELSE'
ELSE_IF = 'ELSE IF'
EXCEPT = 'EXCEPT'
FINALLY = 'FINALLY'
FOR = 'FOR'
IF = 'IF'
IF_ELSE_ROOT = 'IF/ELSE ROOT'
ITERATION = 'ITERATION'
KEYWORD = 'KEYWORD'
MESSAGE = 'MESSAGE'
RETURN = 'RETURN'
SETUP = 'SETUP'
TEARDOWN = 'TEARDOWN'
TRY = 'TRY'
TRY_EXCEPT_ROOT = 'TRY/EXCEPT ROOT'
WHILE = 'WHILE'
config(**attributes)

Configure model object with given attributes.

obj.config(name='Example', doc='Something') is equivalent to setting obj.name = 'Example' and obj.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 standard copy.copy and copy.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 standard copy.copy and copy.deepcopy functions that these methods also use internally.

has_setup
has_teardown
id

Item id in format like s1-t3-k1.

See TestSuite.id for more information.

parent
repr_args = ()
type = 'BREAK'
visit(visitor)[source]
class robot.running.model.TestCase(name='', doc='', tags=None, timeout=None, template=None, lineno=None)[source]

Bases: robot.model.testcase.TestCase

Represents a single executable test case.

See the base class for documentation of attributes not documented here.

body_class

Internal usage only.

alias of Body

fixture_class

Internal usage only.

alias of Keyword

template
source
body

Test body as a Body object.

config(**attributes)

Configure model object with given attributes.

obj.config(name='Example', doc='Something') is equivalent to setting obj.name = 'Example' and obj.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 standard copy.copy and copy.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 standard copy.copy and copy.deepcopy functions that these methods also use internally.

doc
has_setup

Check does a suite have a setup without creating a setup object.

A difference between using if test.has_setup: and if test.setup: is that accessing the setup attribute creates a Keyword object representing the setup even when the test actually does not have one. This typically does not matter, but with bigger suite structures containing a huge about of tests it can have an effect on memory usage.

New in Robot Framework 5.0.

has_teardown

Check does a test have a teardown without creating a teardown object.

See has_setup for more information.

New in Robot Framework 5.0.

id

Test case id in format like s1-t3.

See TestSuite.id for more information.

keywords

Deprecated since Robot Framework 4.0

Use body, setup or teardown instead.

lineno
longname

Test name prefixed with the long name of the parent suite.

name
parent
repr_args = ('name',)
setup

Test setup as a Keyword object.

This attribute is a Keyword object also when a test has no setup but in that case its truth value is False.

Setup can be modified by setting attributes directly:

test.setup.name = 'Example'
test.setup.args = ('First', 'Second')

Alternatively the config() method can be used to set multiple attributes in one call:

test.setup.config(name='Example', args=('First', 'Second'))

The easiest way to reset the whole setup is setting it to None. It will automatically recreate the underlying Keyword object:

test.setup = None

New in Robot Framework 4.0. Earlier setup was accessed like test.keywords.setup.

tags

Test tags as a Tags object.

teardown

Test teardown as a Keyword object.

See setup for more information.

timeout
visit(visitor)[source]

Visitor interface entry-point.

class robot.running.model.TestSuite(name='', doc='', metadata=None, source=None, rpa=None)[source]

Bases: robot.model.testsuite.TestSuite

Represents a single executable test suite.

See the base class for documentation of attributes not documented here.

test_class

Internal usage only.

alias of TestCase

fixture_class

Internal usage only.

alias of Keyword

resource

ResourceFile instance containing imports, variables and keywords the suite owns. When data is parsed from the file system, this data comes from the same test case file that creates the suite.

classmethod from_file_system(*paths, **config)[source]

Create a TestSuite object based on the given paths.

paths are file or directory paths where to read the data from.

Internally utilizes the TestSuiteBuilder class and config can be used to configure how it is initialized.

New in Robot Framework 3.2.

classmethod from_model(model, name=None)[source]

Create a TestSuite object based on the given model.

The model can be created by using the get_model() function and possibly modified by other tooling in the robot.parsing module.

New in Robot Framework 3.2.

configure(randomize_suites=False, randomize_tests=False, randomize_seed=None, **options)[source]

A shortcut to configure a suite using one method call.

Can only be used with the root test suite.

Parameters:

Example:

suite.configure(included_tags=['smoke'],
                doc='Smoke test results.')

Not to be confused with config() method that suites, tests, and keywords have to make it possible to set multiple attributes in one call.

randomize(suites=True, tests=True, seed=None)[source]

Randomizes the order of suites and/or tests, recursively.

Parameters:
  • suites – Boolean controlling should suites be randomized.
  • tests – Boolean controlling should tests be randomized.
  • seed – Random seed. Can be given if previous random order needs to be re-created. Seed value is always shown in logs and reports.
run(settings=None, **options)[source]

Executes the suite based based the given settings or options.

Parameters:
  • settingsRobotSettings object to configure test execution.
  • options – Used to construct new RobotSettings object if settings are not given.
Returns:

Result object with information about executed suites and tests.

If options are used, their names are the same as long command line options except without hyphens. Some options are ignored (see below), but otherwise they have the same semantics as on the command line. Options that can be given on the command line multiple times can be passed as lists like variable=['VAR1:value1', 'VAR2:value2']. If such an option is used only once, it can be given also as a single string like variable='VAR:value'.

Additionally listener option allows passing object directly instead of listener name, e.g. run('tests.robot', listener=Listener()).

To capture stdout and/or stderr streams, pass open file objects in as special keyword arguments stdout and stderr, respectively.

Only options related to the actual test execution have an effect. For example, options related to selecting or modifying test cases or suites (e.g. --include, --name, --prerunmodifier) or creating logs and reports are silently ignored. The output XML generated as part of the execution can be configured, though. This includes disabling it with output=None.

Example:

stdout = StringIO()
result = suite.run(variable='EXAMPLE:value',
                   output='example.xml',
                   exitonfailure=True,
                   stdout=stdout)
print(result.return_code)

To save memory, the returned Result object does not have any information about the executed keywords. If that information is needed, the created output XML file needs to be read using the ExecutionResult factory method.

See the package level documentation for more examples, including how to construct executable test suites and how to create logs and reports based on the execution results.

See the robot.run function for a higher-level API for executing tests in files or directories.

config(**attributes)

Configure model object with given attributes.

obj.config(name='Example', doc='Something') is equivalent to setting obj.name = 'Example' and obj.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 standard copy.copy and copy.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 standard copy.copy and copy.deepcopy functions that these methods also use internally.

doc
filter(included_suites=None, included_tests=None, included_tags=None, excluded_tags=None)[source]

Select test cases and remove others from this suite.

Parameters have the same semantics as --suite, --test, --include, and --exclude command line options. All of them can be given as a list of strings, or when selecting only one, as a single string.

Child suites that contain no tests after filtering are automatically removed.

Example:

suite.filter(included_tests=['Test 1', '* Example'],
             included_tags='priority-1')
has_setup

Check does a suite have a setup without creating a setup object.

A difference between using if suite.has_setup: and if suite.setup: is that accessing the setup attribute creates a Keyword object representing the setup even when the suite actually does not have one. This typically does not matter, but with bigger suite structures containing a huge about of suites it can have some effect on memory usage.

New in Robot Framework 5.0.

has_teardown

Check does a suite have a teardown without creating a teardown object.

See has_setup for more information.

New in Robot Framework 5.0.

has_tests
id

An automatically generated unique id.

The root suite has id s1, its child suites have ids s1-s1, s1-s2, …, their child suites get ids s1-s1-s1, s1-s1-s2, …, s1-s2-s1, …, and so on.

The first test in a suite has an id like s1-t1, the second has an id s1-t2, and so on. Similarly keywords in suites (setup/teardown) and in tests get ids like s1-k1, s1-t1-k1, and s1-s4-t2-k5.

keywords

Deprecated since Robot Framework 4.0

Use setup or teardown instead.

longname

Suite name prefixed with the long name of the parent suite.

metadata

Free test suite metadata as a dictionary.

name

Test suite name. If not set, constructed from child suite names.

parent
remove_empty_suites(preserve_direct_children=False)[source]

Removes all child suites not containing any tests, recursively.

repr_args = ('name',)
rpa
set_tags(add=None, remove=None, persist=False)[source]

Add and/or remove specified tags to the tests in this suite.

Parameters:
  • add – Tags to add as a list or, if adding only one, as a single string.
  • remove – Tags to remove as a list or as a single string. Can be given as patterns where * and ? work as wildcards.
  • persist – Add/remove specified tags also to new tests added to this suite in the future.
setup

Suite setup as a Keyword object.

This attribute is a Keyword object also when a suite has no setup but in that case its truth value is False.

Setup can be modified by setting attributes directly:

suite.setup.name = 'Example'
suite.setup.args = ('First', 'Second')

Alternatively the config() method can be used to set multiple attributes in one call:

suite.setup.config(name='Example', args=('First', 'Second'))

The easiest way to reset the whole setup is setting it to None. It will automatically recreate the underlying Keyword object:

suite.setup = None

New in Robot Framework 4.0. Earlier setup was accessed like suite.keywords.setup.

source
suites

Child suites as a TestSuites object.

teardown

Suite teardown as a Keyword object.

See setup for more information.

test_count

Number of the tests in this suite, recursively.

tests

Tests as a TestCases object.

visit(visitor)[source]

Visitor interface entry-point.

class robot.running.model.Variable(name, value, source=None, lineno=None, error=None)[source]

Bases: object

report_invalid_syntax(message, level='ERROR')[source]
class robot.running.model.ResourceFile(doc='', source=None)[source]

Bases: object

imports
keywords
variables
class robot.running.model.UserKeyword(name, args=(), doc='', tags=(), return_=None, timeout=None, lineno=None, parent=None, error=None)[source]

Bases: object

body

Child keywords as a Body object.

keywords

Deprecated since Robot Framework 4.0.

Use body or teardown instead.

teardown
tags
source
class robot.running.model.Import(type, name, args=(), alias=None, source=None, lineno=None)[source]

Bases: object

ALLOWED_TYPES = ('Library', 'Resource', 'Variables')
directory
report_invalid_syntax(message, level='ERROR')[source]
class robot.running.model.Imports(source, imports=None)[source]

Bases: robot.model.itemlist.ItemList

append(item)

S.append(value) – append value to the end of the sequence

clear() → None -- remove all items from S
count(value) → integer -- return number of occurrences of value
create(*args, **kwargs)
extend(items)

S.extend(iterable) – extend sequence by appending elements from the iterable

index(value[, start[, stop]]) → integer -- return first index of value.

Raises ValueError if the value is not present.

Supporting start and stop arguments is optional, but recommended.

insert(index, item)

S.insert(index, value) – insert value before index

pop([index]) → item -- remove and return item at index (default last).

Raise IndexError if list is empty or index is out of range.

remove(value)

S.remove(value) – remove first occurrence of value. Raise ValueError if the value is not present.

reverse()

S.reverse() – reverse IN PLACE

sort()
visit(visitor)
library(name, args=(), alias=None, lineno=None)[source]
resource(path, lineno=None)[source]
variables(path, args=(), lineno=None)[source]

robot.running.modelcombiner module

class robot.running.modelcombiner.ModelCombiner(data, result, **priority)[source]

Bases: object

data
result
priority

robot.running.namespace module

class robot.running.namespace.Namespace(variables, suite, resource)[source]

Bases: object

libraries
handle_imports()[source]
import_resource(name, overwrite=True)[source]
import_variables(name, args, overwrite=False)[source]
import_library(name, args=(), alias=None, notify=True)[source]
set_search_order(new_order)[source]
start_test()[source]
end_test()[source]
start_suite()[source]
end_suite(suite)[source]
start_user_keyword()[source]
end_user_keyword()[source]
get_library_instance(libname)[source]
get_library_instances()[source]
reload_library(libname_or_instance)[source]
get_runner(name)[source]
class robot.running.namespace.KeywordStore(resource)[source]

Bases: object

get_library(name_or_instance)[source]
get_runner(name)[source]
class robot.running.namespace.KeywordRecommendationFinder(user_keywords, libraries, resources)[source]

Bases: object

recommend_similar_keywords(name, message)[source]

Return keyword names similar to name.

static format_recommendations(message, recommendations)[source]

robot.running.outputcapture module

class robot.running.outputcapture.OutputCapturer(library_import=False)[source]

Bases: object

class robot.running.outputcapture.PythonCapturer(stdout=True)[source]

Bases: object

release()[source]

robot.running.randomizer module

class robot.running.randomizer.Randomizer(randomize_suites=True, randomize_tests=True, seed=None)[source]

Bases: robot.model.visitor.SuiteVisitor

start_suite(suite)[source]

Called when a suite starts. Default implementation does nothing.

Can return explicit False to stop visiting.

visit_test(test)[source]

Implements traversing through tests.

Can be overridden to allow modifying the passed in test without calling start_test() or end_test() nor visiting the body of the test.

visit_keyword(kw)[source]

Implements traversing through keywords.

Can be overridden to allow modifying the passed in kw without calling start_keyword() or end_keyword() nor visiting the body of the keyword

end_body_item(item)

Called, by default, when keywords, messages or control structures end.

More specific end_keyword(), end_message(), :meth:`end_for, etc. can be implemented to visit only keywords, messages or specific control structures.

Default implementation does nothing.

end_break(break_)

Called when a BREAK element ends.

By default, calls end_body_item() which, by default, does nothing.

end_continue(continue_)

Called when a CONTINUE element ends.

By default, calls end_body_item() which, by default, does nothing.

end_for(for_)

Called when a FOR loop ends.

By default, calls end_body_item() which, by default, does nothing.

end_for_iteration(iteration)

Called when a FOR loop iteration ends.

By default, calls end_body_item() which, by default, does nothing.

end_if(if_)

Called when an IF/ELSE structure ends.

By default, calls end_body_item() which, by default, does nothing.

end_if_branch(branch)

Called when an IF/ELSE branch ends.

By default, calls end_body_item() which, by default, does nothing.

end_keyword(keyword)

Called when a keyword ends.

By default, calls end_body_item() which, by default, does nothing.

end_message(msg)

Called when a message ends.

By default, calls end_body_item() which, by default, does nothing.

end_return(return_)

Called when a RETURN element ends.

By default, calls end_body_item() which, by default, does nothing.

end_suite(suite)

Called when a suite ends. Default implementation does nothing.

end_test(test)

Called when a test ends. Default implementation does nothing.

end_try(try_)

Called when a TRY/EXCEPT structure ends.

By default, calls end_body_item() which, by default, does nothing.

end_try_branch(branch)

Called when TRY, EXCEPT, ELSE and FINALLY branches end.

By default, calls end_body_item() which, by default, does nothing.

end_while(while_)

Called when a WHILE loop ends.

By default, calls end_body_item() which, by default, does nothing.

end_while_iteration(iteration)

Called when a WHILE loop iteration ends.

By default, calls end_body_item() which, by default, does nothing.

start_body_item(item)

Called, by default, when keywords, messages or control structures start.

More specific start_keyword(), start_message(), :meth:`start_for, etc. can be implemented to visit only keywords, messages or specific control structures.

Can return explicit False to stop visiting. Default implementation does nothing.

start_break(break_)

Called when a BREAK element starts.

By default, calls start_body_item() which, by default, does nothing.

Can return explicit False to stop visiting.

start_continue(continue_)

Called when a CONTINUE element starts.

By default, calls start_body_item() which, by default, does nothing.

Can return explicit False to stop visiting.

start_for(for_)

Called when a FOR loop starts.

By default, calls start_body_item() which, by default, does nothing.

Can return explicit False to stop visiting.

start_for_iteration(iteration)

Called when a FOR loop iteration starts.

By default, calls start_body_item() which, by default, does nothing.

Can return explicit False to stop visiting.

start_if(if_)

Called when an IF/ELSE structure starts.

By default, calls start_body_item() which, by default, does nothing.

Can return explicit False to stop visiting.

start_if_branch(branch)

Called when an IF/ELSE branch starts.

By default, calls start_body_item() which, by default, does nothing.

Can return explicit False to stop visiting.

start_keyword(keyword)

Called when a keyword starts.

By default, calls start_body_item() which, by default, does nothing.

Can return explicit False to stop visiting.

start_message(msg)

Called when a message starts.

By default, calls start_body_item() which, by default, does nothing.

Can return explicit False to stop visiting.

start_return(return_)

Called when a RETURN element starts.

By default, calls start_body_item() which, by default, does nothing.

Can return explicit False to stop visiting.

start_test(test)

Called when a test starts. Default implementation does nothing.

Can return explicit False to stop visiting.

start_try(try_)

Called when a TRY/EXCEPT structure starts.

By default, calls start_body_item() which, by default, does nothing.

Can return explicit False to stop visiting.

start_try_branch(branch)

Called when TRY, EXCEPT, ELSE or FINALLY branches start.

By default, calls start_body_item() which, by default, does nothing.

Can return explicit False to stop visiting.

start_while(while_)

Called when a WHILE loop starts.

By default, calls start_body_item() which, by default, does nothing.

Can return explicit False to stop visiting.

start_while_iteration(iteration)

Called when a WHILE loop iteration starts.

By default, calls start_body_item() which, by default, does nothing.

Can return explicit False to stop visiting.

visit_break(break_)

Visits BREAK elements.

visit_continue(continue_)

Visits CONTINUE elements.

visit_for(for_)

Implements traversing through FOR loops.

Can be overridden to allow modifying the passed in for_ without calling start_for() or end_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 calling start_for_iteration() or end_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 its body and visited using visit_if_branch().

Can be overridden to allow modifying the passed in if_ without calling start_if() or end_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 calling start_if_branch() or end_if_branch() nor visiting body.

visit_message(msg)

Implements visiting messages.

Can be overridden to allow modifying the passed in msg without calling start_message() or end_message().

visit_return(return_)

Visits a RETURN elements.

visit_suite(suite)

Implements traversing through suites.

Can be overridden to allow modifying the passed in suite without calling start_suite() or end_suite() nor visiting child suites, tests or setup and teardown at all.

visit_try(try_)

Implements traversing through TRY/EXCEPT structures.

This method is used with the TRY/EXCEPT root element. Actual TRY, EXCEPT, ELSE and FINALLY branches are visited separately using visit_try_branch().

visit_try_branch(branch)

Visits individual TRY, EXCEPT, ELSE and FINALLY branches.

visit_while(while_)

Implements traversing through WHILE loops.

Can be overridden to allow modifying the passed in while_ without calling start_while() or end_while() nor visiting body.

visit_while_iteration(iteration)

Implements traversing through single WHILE 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 calling start_while_iteration() or end_while_iteration() nor visiting body.

robot.running.runkwregister module

robot.running.signalhandler module

robot.running.status module

class robot.running.status.Failure[source]

Bases: object

class robot.running.status.Exit(failure_mode=False, error_mode=False, skip_teardown_mode=False)[source]

Bases: object

failure_occurred(fatal=False)[source]
error_occurred()[source]
teardown_allowed
class robot.running.status.SuiteStatus(parent=None, exit_on_failure=False, exit_on_error=False, skip_teardown_on_exit=False)[source]

Bases: robot.running.status._ExecutionStatus

error_occurred()
failed
failure_occurred()
message
passed
setup_executed(error=None)
status
teardown_allowed
teardown_executed(error=None)
class robot.running.status.TestStatus(parent, test, skip_on_failure=None, rpa=False)[source]

Bases: robot.running.status._ExecutionStatus

test_failed(message=None, error=None)[source]
test_skipped(message)[source]
skip_on_failure_after_tag_changes
error_occurred()
failed
failure_occurred()
message
passed
setup_executed(error=None)
status
teardown_allowed
teardown_executed(error=None)
class robot.running.status.TestMessage(status)[source]

Bases: robot.running.status._Message

setup_message = 'Setup failed:\n%s'
teardown_message = 'Teardown failed:\n%s'
setup_skipped_message = '%s'
teardown_skipped_message = '%s'
also_teardown_message = '%s\n\nAlso teardown failed:\n%s'
also_teardown_skip_message = 'Skipped in teardown:\n%s\n\nEarlier message:\n%s'
exit_on_fatal_message = 'Test execution stopped due to a fatal error.'
exit_on_failure_message = 'Failure occurred and exit-on-failure mode is in use.'
exit_on_error_message = 'Error occurred and exit-on-error mode is in use.'
message
class robot.running.status.SuiteMessage(status)[source]

Bases: robot.running.status._Message

setup_message = 'Suite setup failed:\n%s'
setup_skipped_message = 'Skipped in suite setup:\n%s'
teardown_skipped_message = 'Skipped in suite teardown:\n%s'
teardown_message = 'Suite teardown failed:\n%s'
also_teardown_message = '%s\n\nAlso suite teardown failed:\n%s'
also_teardown_skip_message = 'Skipped in suite teardown:\n%s\n\nEarlier message:\n%s'
message
class robot.running.status.ParentMessage(status)[source]

Bases: robot.running.status.SuiteMessage

setup_message = 'Parent suite setup failed:\n%s'
setup_skipped_message = 'Skipped in parent suite setup:\n%s'
teardown_skipped_message = 'Skipped in parent suite teardown:\n%s'
teardown_message = 'Parent suite teardown failed:\n%s'
also_teardown_message = '%s\n\nAlso parent suite teardown failed:\n%s'
also_teardown_skip_message = 'Skipped in suite teardown:\n%s\n\nEarlier message:\n%s'
message

robot.running.statusreporter module

class robot.running.statusreporter.StatusReporter(data, result, context, run=True, suppress=False)[source]

Bases: object

robot.running.suiterunner module

class robot.running.suiterunner.SuiteRunner(output, settings)[source]

Bases: robot.model.visitor.SuiteVisitor

start_suite(suite)[source]

Called when a suite starts. Default implementation does nothing.

Can return explicit False to stop visiting.

end_suite(suite)[source]

Called when a suite ends. Default implementation does nothing.

visit_test(test)[source]

Implements traversing through tests.

Can be overridden to allow modifying the passed in test without calling start_test() or end_test() nor visiting the body of the test.

end_body_item(item)

Called, by default, when keywords, messages or control structures end.

More specific end_keyword(), end_message(), :meth:`end_for, etc. can be implemented to visit only keywords, messages or specific control structures.

Default implementation does nothing.

end_break(break_)

Called when a BREAK element ends.

By default, calls end_body_item() which, by default, does nothing.

end_continue(continue_)

Called when a CONTINUE element ends.

By default, calls end_body_item() which, by default, does nothing.

end_for(for_)

Called when a FOR loop ends.

By default, calls end_body_item() which, by default, does nothing.

end_for_iteration(iteration)

Called when a FOR loop iteration ends.

By default, calls end_body_item() which, by default, does nothing.

end_if(if_)

Called when an IF/ELSE structure ends.

By default, calls end_body_item() which, by default, does nothing.

end_if_branch(branch)

Called when an IF/ELSE branch ends.

By default, calls end_body_item() which, by default, does nothing.

end_keyword(keyword)

Called when a keyword ends.

By default, calls end_body_item() which, by default, does nothing.

end_message(msg)

Called when a message ends.

By default, calls end_body_item() which, by default, does nothing.

end_return(return_)

Called when a RETURN element ends.

By default, calls end_body_item() which, by default, does nothing.

end_test(test)

Called when a test ends. Default implementation does nothing.

end_try(try_)

Called when a TRY/EXCEPT structure ends.

By default, calls end_body_item() which, by default, does nothing.

end_try_branch(branch)

Called when TRY, EXCEPT, ELSE and FINALLY branches end.

By default, calls end_body_item() which, by default, does nothing.

end_while(while_)

Called when a WHILE loop ends.

By default, calls end_body_item() which, by default, does nothing.

end_while_iteration(iteration)

Called when a WHILE loop iteration ends.

By default, calls end_body_item() which, by default, does nothing.

start_body_item(item)

Called, by default, when keywords, messages or control structures start.

More specific start_keyword(), start_message(), :meth:`start_for, etc. can be implemented to visit only keywords, messages or specific control structures.

Can return explicit False to stop visiting. Default implementation does nothing.

start_break(break_)

Called when a BREAK element starts.

By default, calls start_body_item() which, by default, does nothing.

Can return explicit False to stop visiting.

start_continue(continue_)

Called when a CONTINUE element starts.

By default, calls start_body_item() which, by default, does nothing.

Can return explicit False to stop visiting.

start_for(for_)

Called when a FOR loop starts.

By default, calls start_body_item() which, by default, does nothing.

Can return explicit False to stop visiting.

start_for_iteration(iteration)

Called when a FOR loop iteration starts.

By default, calls start_body_item() which, by default, does nothing.

Can return explicit False to stop visiting.

start_if(if_)

Called when an IF/ELSE structure starts.

By default, calls start_body_item() which, by default, does nothing.

Can return explicit False to stop visiting.

start_if_branch(branch)

Called when an IF/ELSE branch starts.

By default, calls start_body_item() which, by default, does nothing.

Can return explicit False to stop visiting.

start_keyword(keyword)

Called when a keyword starts.

By default, calls start_body_item() which, by default, does nothing.

Can return explicit False to stop visiting.

start_message(msg)

Called when a message starts.

By default, calls start_body_item() which, by default, does nothing.

Can return explicit False to stop visiting.

start_return(return_)

Called when a RETURN element starts.

By default, calls start_body_item() which, by default, does nothing.

Can return explicit False to stop visiting.

start_test(test)

Called when a test starts. Default implementation does nothing.

Can return explicit False to stop visiting.

start_try(try_)

Called when a TRY/EXCEPT structure starts.

By default, calls start_body_item() which, by default, does nothing.

Can return explicit False to stop visiting.

start_try_branch(branch)

Called when TRY, EXCEPT, ELSE or FINALLY branches start.

By default, calls start_body_item() which, by default, does nothing.

Can return explicit False to stop visiting.

start_while(while_)

Called when a WHILE loop starts.

By default, calls start_body_item() which, by default, does nothing.

Can return explicit False to stop visiting.

start_while_iteration(iteration)

Called when a WHILE loop iteration starts.

By default, calls start_body_item() which, by default, does nothing.

Can return explicit False to stop visiting.

visit_break(break_)

Visits BREAK elements.

visit_continue(continue_)

Visits CONTINUE elements.

visit_for(for_)

Implements traversing through FOR loops.

Can be overridden to allow modifying the passed in for_ without calling start_for() or end_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 calling start_for_iteration() or end_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 its body and visited using visit_if_branch().

Can be overridden to allow modifying the passed in if_ without calling start_if() or end_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 calling start_if_branch() or end_if_branch() nor visiting body.

visit_keyword(kw)

Implements traversing through keywords.

Can be overridden to allow modifying the passed in kw without calling start_keyword() or end_keyword() nor visiting the body of the keyword

visit_message(msg)

Implements visiting messages.

Can be overridden to allow modifying the passed in msg without calling start_message() or end_message().

visit_return(return_)

Visits a RETURN elements.

visit_suite(suite)

Implements traversing through suites.

Can be overridden to allow modifying the passed in suite without calling start_suite() or end_suite() nor visiting child suites, tests or setup and teardown at all.

visit_try(try_)

Implements traversing through TRY/EXCEPT structures.

This method is used with the TRY/EXCEPT root element. Actual TRY, EXCEPT, ELSE and FINALLY branches are visited separately using visit_try_branch().

visit_try_branch(branch)

Visits individual TRY, EXCEPT, ELSE and FINALLY branches.

visit_while(while_)

Implements traversing through WHILE loops.

Can be overridden to allow modifying the passed in while_ without calling start_while() or end_while() nor visiting body.

visit_while_iteration(iteration)

Implements traversing through single WHILE 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 calling start_while_iteration() or end_while_iteration() nor visiting body.

robot.running.testlibraries module

robot.running.testlibraries.TestLibrary(name, args=None, variables=None, create_handlers=True, logger=<robot.output.logger.Logger object>)[source]

robot.running.usererrorhandler module

class robot.running.usererrorhandler.UserErrorHandler(error, name, libname=None, source=None, lineno=None)[source]

Bases: object

Created if creating handlers fail – running raises DataError.

The idea is not to raise DataError at processing time and prevent all tests in affected test case file from executing. Instead UserErrorHandler is created and if it is ever run DataError is raised then.

Parameters:
  • error (robot.errors.DataError) – Occurred error.
  • name (str) – Name of the affected keyword.
  • libname (str) – Name of the affected library or resource.
  • source (str) – Path to the source file.
  • lineno (int) – Line number of the failing keyword.
longname
doc
shortdoc
create_runner(name)[source]
run(kw, context, run=True)[source]
dry_run(kw, context, run=True)

robot.running.userkeyword module

class robot.running.userkeyword.UserLibrary(resource, source_type='Resource file')[source]

Bases: object

TEST_CASE_FILE_TYPE = 'Test case file'
RESOURCE_FILE_TYPE = 'Resource file'
class robot.running.userkeyword.UserKeywordHandler(keyword, libname)[source]

Bases: object

longname
shortdoc
create_runner(name)[source]
class robot.running.userkeyword.EmbeddedArgumentsHandler(keyword, libname, embedded)[source]

Bases: robot.running.userkeyword.UserKeywordHandler

matches(name)[source]
create_runner(name)[source]
longname
shortdoc

robot.running.userkeywordrunner module

class robot.running.userkeywordrunner.UserKeywordRunner(handler, name=None)[source]

Bases: object

longname
libname
arguments
Return type:robot.running.arguments.ArgumentSpec
run(kw, context, run=True)[source]
dry_run(kw, context)[source]
class robot.running.userkeywordrunner.EmbeddedArgumentsRunner(handler, name)[source]

Bases: robot.running.userkeywordrunner.UserKeywordRunner

arguments
Return type:robot.running.arguments.ArgumentSpec
dry_run(kw, context)
libname
longname
run(kw, context, run=True)