robot.model package¶
Package with generic, reusable and extensible model classes.
This package contains, for example, TestSuite
,
TestCase
, Keyword
and SuiteVisitor
base classes.
These classes are extended both by execution
and result
related model objects and used also
elsewhere.
This package is considered stable.
Submodules¶
robot.model.body module¶
-
class
robot.model.body.
BodyItem
[source]¶ Bases:
robot.model.modelobject.ModelObject
-
KEYWORD
= 'KEYWORD'¶
-
SETUP
= 'SETUP'¶
-
TEARDOWN
= 'TEARDOWN'¶
-
FOR
= 'FOR'¶
-
ITERATION
= 'ITERATION'¶
-
IF_ELSE_ROOT
= 'IF/ELSE ROOT'¶
-
IF
= 'IF'¶
-
ELSE_IF
= 'ELSE IF'¶
-
ELSE
= 'ELSE'¶
-
TRY_EXCEPT_ROOT
= 'TRY/EXCEPT ROOT'¶
-
TRY
= 'TRY'¶
-
EXCEPT
= 'EXCEPT'¶
-
FINALLY
= 'FINALLY'¶
-
WHILE
= 'WHILE'¶
-
RETURN
= 'RETURN'¶
-
CONTINUE
= 'CONTINUE'¶
-
BREAK
= 'BREAK'¶
-
MESSAGE
= 'MESSAGE'¶
-
type
= None¶
-
id
¶ Item id in format like
s1-t3-k1
.See
TestSuite.id
for more information.
-
has_setup
¶
-
has_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.
-
parent
¶
-
repr_args
= ()¶
-
-
class
robot.model.body.
BaseBody
(parent=None, items=None)[source]¶ Bases:
robot.model.itemlist.ItemList
Base class for Body and Branches objects.
-
keyword_class
= None¶
-
for_class
= None¶
-
if_class
= None¶
-
try_class
= None¶
-
while_class
= None¶
-
return_class
= None¶
-
continue_class
= None¶
-
break_class
= None¶
-
message_class
= None¶
-
classmethod
register
(item_class)[source]¶ Register a virtual subclass of an ABC.
Returns the subclass, to allow usage as a class decorator.
-
create
¶
-
filter
(keywords=None, messages=None, predicate=None)[source]¶ Filter body items based on type and/or custom predicate.
To include or exclude items based on types, give matching arguments
True
orFalse
values. For example, to include only keywords, usebody.filter(keywords=True)
and to exclude messages usebody.filter(messages=False)
. Including and excluding by types at the same time is not supported and filtering mymessages
is supported only if theBody
object actually supports messages.Custom
predicate
is a callable getting each body item as an argument that must returnTrue/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 usebody.filter(keywords=False
, messages=False)``. For more detailed filtering it is possible to usepredicate
.
-
flatten
()[source]¶ 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.
-
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¶
-
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)¶
-
-
class
robot.model.body.
Body
(parent=None, items=None)[source]¶ Bases:
robot.model.body.BaseBody
A list-like object representing body of a suite, a test or a keyword.
Body contains the keywords and other structures such as FOR loops.
-
append
(item)¶ S.append(value) – append value to the end of the sequence
-
break_class
¶ alias of
robot.model.control.Break
-
clear
() → None -- remove all items from S¶
-
continue_class
¶ alias of
robot.model.control.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
orFalse
values. For example, to include only keywords, usebody.filter(keywords=True)
and to exclude messages usebody.filter(messages=False)
. Including and excluding by types at the same time is not supported and filtering mymessages
is supported only if theBody
object actually supports messages.Custom
predicate
is a callable getting each body item as an argument that must returnTrue/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 usebody.filter(keywords=False
, messages=False)``. For more detailed filtering it is possible to usepredicate
.
-
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
robot.model.control.For
-
if_class
¶ alias of
robot.model.control.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
robot.model.keyword.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
robot.model.control.Return
-
reverse
()¶ S.reverse() – reverse IN PLACE
-
sort
()¶
-
try_class
¶ alias of
robot.model.control.Try
-
visit
(visitor)¶
-
while_class
¶ alias of
robot.model.control.While
-
-
class
robot.model.body.
Branches
(branch_class, parent=None, items=None)[source]¶ Bases:
robot.model.body.BaseBody
A list-like object representing branches IF and TRY objects contain.
-
branch_class
¶
-
append
(item)¶ S.append(value) – append value to the end of the sequence
-
break_class
= None¶
-
clear
() → None -- remove all items from S¶
-
continue_class
= None¶
-
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
orFalse
values. For example, to include only keywords, usebody.filter(keywords=True)
and to exclude messages usebody.filter(messages=False)
. Including and excluding by types at the same time is not supported and filtering mymessages
is supported only if theBody
object actually supports messages.Custom
predicate
is a callable getting each body item as an argument that must returnTrue/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 usebody.filter(keywords=False
, messages=False)``. For more detailed filtering it is possible to usepredicate
.
-
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
= None¶
-
if_class
= None¶
-
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
= None¶
-
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
= None¶
-
reverse
()¶ S.reverse() – reverse IN PLACE
-
sort
()¶
-
try_class
= None¶
-
visit
(visitor)¶
-
while_class
= None¶
-
robot.model.configurer module¶
-
class
robot.model.configurer.
SuiteConfigurer
(name=None, doc=None, metadata=None, set_tags=None, include_tags=None, exclude_tags=None, include_suites=None, include_tests=None, empty_suite_ok=False)[source]¶ Bases:
robot.model.visitor.SuiteVisitor
-
visit_suite
(suite)[source]¶ 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 setup and teardown at all.
-
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_suite
(suite)¶ Called when a suite starts. Default implementation 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 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 the body of the keyword
-
visit_message
(msg)¶ Implements visiting messages.
Can be overridden to allow modifying the passed in
msg
without callingstart_message()
orend_message()
.
-
visit_return
(return_)¶ Visits a RETURN elements.
-
visit_test
(test)¶ Implements traversing through tests.
Can be overridden to allow modifying the passed in
test
without callingstart_test()
orend_test()
nor visiting the body of the test.
-
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 callingstart_while()
orend_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 callingstart_while_iteration()
orend_while_iteration()
nor visiting body.
-
robot.model.control module¶
-
class
robot.model.control.
For
(variables=(), flavor='IN', values=(), parent=None)[source]¶ Bases:
robot.model.body.BodyItem
-
type
= 'FOR'¶
-
body_class
¶ alias of
robot.model.body.Body
-
repr_args
= ('variables', 'flavor', 'values')¶
-
variables
¶
-
flavor
¶
-
values
¶
-
parent
¶
-
body
¶
-
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 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.
-
has_setup
¶
-
has_teardown
¶
-
id
¶ Item id in format like
s1-t3-k1
.See
TestSuite.id
for more information.
-
-
class
robot.model.control.
While
(condition=None, limit=None, parent=None)[source]¶ Bases:
robot.model.body.BodyItem
-
type
= 'WHILE'¶
-
body_class
¶ alias of
robot.model.body.Body
-
repr_args
= ('condition', 'limit')¶
-
condition
¶
-
limit
¶
-
parent
¶
-
body
¶
-
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 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.
-
has_setup
¶
-
has_teardown
¶
-
id
¶ Item id in format like
s1-t3-k1
.See
TestSuite.id
for more information.
-
-
class
robot.model.control.
IfBranch
(type='IF', condition=None, parent=None)[source]¶ Bases:
robot.model.body.BodyItem
-
body_class
¶ alias of
robot.model.body.Body
-
repr_args
= ('type', 'condition')¶
-
type
¶
-
condition
¶
-
parent
¶
-
body
¶
-
id
¶ Branch id omits IF/ELSE root from the parent id part.
-
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 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.
-
has_setup
¶
-
has_teardown
¶
-
-
class
robot.model.control.
If
(parent=None)[source]¶ Bases:
robot.model.body.BodyItem
IF/ELSE structure root. Branches are stored in
body
.-
type
= 'IF/ELSE ROOT'¶
-
branches_class
¶ alias of
robot.model.body.Branches
-
parent
¶
-
body
¶
-
id
¶ Root IF/ELSE id is always
None
.
-
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 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.
-
has_setup
¶
-
has_teardown
¶
-
repr_args
= ()¶
-
-
class
robot.model.control.
TryBranch
(type='TRY', patterns=(), pattern_type=None, variable=None, parent=None)[source]¶ Bases:
robot.model.body.BodyItem
-
body_class
¶ alias of
robot.model.body.Body
-
repr_args
= ('type', 'patterns', 'pattern_type', 'variable')¶
-
type
¶
-
patterns
¶
-
pattern_type
¶
-
variable
¶
-
parent
¶
-
body
¶
-
id
¶ Branch id omits TRY/EXCEPT root from the parent id part.
-
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 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.
-
has_setup
¶
-
has_teardown
¶
-
-
class
robot.model.control.
Try
(parent=None)[source]¶ Bases:
robot.model.body.BodyItem
TRY/EXCEPT structure root. Branches are stored in
body
.-
type
= 'TRY/EXCEPT ROOT'¶
-
branches_class
¶ alias of
robot.model.body.Branches
-
parent
¶
-
body
¶
-
try_branch
¶
-
except_branches
¶
-
else_branch
¶
-
finally_branch
¶
-
id
¶ Root TRY/EXCEPT id is always
None
.
-
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 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.
-
has_setup
¶
-
has_teardown
¶
-
repr_args
= ()¶
-
-
class
robot.model.control.
Return
(values=(), parent=None)[source]¶ Bases:
robot.model.body.BodyItem
-
type
= 'RETURN'¶
-
repr_args
= ('values',)¶
-
values
¶
-
parent
¶
-
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 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.
-
has_setup
¶
-
has_teardown
¶
-
id
¶ Item id in format like
s1-t3-k1
.See
TestSuite.id
for more information.
-
-
class
robot.model.control.
Continue
(parent=None)[source]¶ Bases:
robot.model.body.BodyItem
-
type
= 'CONTINUE'¶
-
parent
¶
-
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 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.
-
has_setup
¶
-
has_teardown
¶
-
id
¶ Item id in format like
s1-t3-k1
.See
TestSuite.id
for more information.
-
repr_args
= ()¶
-
-
class
robot.model.control.
Break
(parent=None)[source]¶ Bases:
robot.model.body.BodyItem
-
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 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.
-
has_setup
¶
-
has_teardown
¶
-
id
¶ Item id in format like
s1-t3-k1
.See
TestSuite.id
for more information.
-
repr_args
= ()¶
-
type
= 'BREAK'¶
-
parent
¶
-
robot.model.filter module¶
-
class
robot.model.filter.
EmptySuiteRemover
(preserve_direct_children=False)[source]¶ Bases:
robot.model.visitor.SuiteVisitor
-
visit_test
(test)[source]¶ Implements traversing through tests.
Can be overridden to allow modifying the passed in
test
without callingstart_test()
orend_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 callingstart_keyword()
orend_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_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_suite
(suite)¶ Called when a suite starts. Default implementation 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 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_message
(msg)¶ Implements visiting messages.
Can be overridden to allow modifying the passed in
msg
without callingstart_message()
orend_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 callingstart_suite()
orend_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 callingstart_while()
orend_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 callingstart_while_iteration()
orend_while_iteration()
nor visiting body.
-
-
class
robot.model.filter.
Filter
(include_suites=None, include_tests=None, include_tags=None, exclude_tags=None)[source]¶ Bases:
robot.model.filter.EmptySuiteRemover
-
include_suites
¶
-
include_tests
¶
-
start_suite
(suite)[source]¶ Called when a suite starts. Default implementation does nothing.
Can return explicit
False
to stop visiting.
-
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 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 the body of the keyword
-
visit_message
(msg)¶ Implements visiting messages.
Can be overridden to allow modifying the passed in
msg
without callingstart_message()
orend_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 callingstart_suite()
orend_suite()
nor visiting child suites, tests or setup and teardown at all.
-
visit_test
(test)¶ Implements traversing through tests.
Can be overridden to allow modifying the passed in
test
without callingstart_test()
orend_test()
nor visiting the body of the test.
-
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 callingstart_while()
orend_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 callingstart_while_iteration()
orend_while_iteration()
nor visiting body.
-
robot.model.itemlist module¶
-
class
robot.model.itemlist.
ItemList
(item_class, common_attrs=None, items=None)[source]¶ Bases:
collections.abc.MutableSequence
-
index
(value[, start[, stop]]) → integer -- return first index of value.[source]¶ Raises ValueError if the value is not present.
Supporting start and stop arguments is optional, but recommended.
-
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.
-
robot.model.keyword module¶
-
class
robot.model.keyword.
Keyword
(name='', doc='', args=(), assign=(), tags=(), timeout=None, type='KEYWORD', parent=None)[source]¶ Bases:
robot.model.body.BodyItem
Base model for a single keyword.
Extended by
robot.running.model.Keyword
androbot.result.model.Keyword
.-
repr_args
= ('name', 'args', 'assign')¶
-
doc
¶
-
args
¶
-
assign
¶
-
timeout
¶
-
type
¶
-
parent
¶
-
name
¶
-
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 underlyingKeyword
object:keyword.teardown = None
This attribute is a
Keyword
object also when a keyword has no teardown but in that case its truth value isFalse
. If there is a need to just check does a keyword have a teardown, using thehas_teardown
attribute avoids creating theKeyword
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.
-
has_teardown
¶ Check does a keyword have a teardown without creating a teardown object.
A difference between using
if kw.has_teardown:
andif kw.teardown:
is that accessing theteardown
attribute creates aKeyword
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.
Keyword tags as a
Tags
object.
-
visit
(visitor)[source]¶ Visitor interface
entry-point.
-
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 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.
-
has_setup
¶
-
id
¶ Item id in format like
s1-t3-k1
.See
TestSuite.id
for more information.
-
-
class
robot.model.keyword.
Keywords
(parent=None, keywords=None)[source]¶ Bases:
robot.model.itemlist.ItemList
A list-like object representing keywords in a suite, a test or a keyword.
Read-only and deprecated since Robot Framework 4.0.
-
deprecation_message
= "'keywords' attribute is read-only and deprecated since Robot Framework 4.0. Use 'body', 'setup' or 'teardown' instead."¶
-
setup
¶
-
teardown
¶
-
all
¶ Iterates over all keywords, including setup and teardown.
-
normal
¶ Iterates over normal keywords, omitting setup and teardown.
-
pop
([index]) → item -- remove and return item at index (default last).[source]¶ Raise IndexError if list is empty or index is out of range.
-
remove
(item)[source]¶ S.remove(value) – remove first occurrence of value. Raise ValueError if the value is not present.
-
count
(value) → integer -- return number of occurrences of value¶
-
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.
-
visit
(visitor)¶
-
robot.model.message module¶
-
class
robot.model.message.
Message
(message='', level='INFO', html=False, timestamp=None, parent=None)[source]¶ Bases:
robot.model.body.BodyItem
A message created during the test execution.
Can be a log message triggered by a keyword, or a warning or an error that occurred during parsing or test execution.
-
type
= 'MESSAGE'¶
-
repr_args
= ('message', 'level')¶
-
message
¶ The message content as a string.
-
level
¶ Severity of the message. Either
TRACE
,DEBUG
,INFO
,WARN
,ERROR
,FAIL
or ``SKIP`. The last two are only used with keyword failure messages.
-
html
¶ True
if the content is in HTML,False
otherwise.
-
timestamp
¶ Timestamp in format
%Y%m%d %H:%M:%S.%f
.
-
parent
¶ The object this message was triggered by.
-
html_message
¶ Returns the message content as HTML.
-
id
¶ Item id in format like
s1-t3-k1
.See
TestSuite.id
for more information.
-
visit
(visitor)[source]¶ Visitor interface
entry-point.
-
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 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.
-
has_setup
¶
-
has_teardown
¶
-
-
class
robot.model.message.
Messages
(message_class=<class 'robot.model.message.Message'>, parent=None, messages=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)¶
-
robot.model.metadata module¶
-
class
robot.model.metadata.
Metadata
(initial=None)[source]¶ Bases:
robot.utils.normalizing.NormalizedDict
-
clear
() → None. Remove all items from D.¶
-
copy
()¶
-
get
(k[, d]) → D[k] if k in D, else d. d defaults to None.¶
-
items
() → a set-like object providing a view on D's items¶
-
keys
() → a set-like object providing a view on D's keys¶
-
pop
(k[, d]) → v, remove specified key and return the corresponding value.¶ If key is not found, d is returned if given, otherwise KeyError is raised.
-
popitem
() → (k, v), remove and return some (key, value) pair¶ as a 2-tuple; but raise KeyError if D is empty.
-
setdefault
(k[, d]) → D.get(k,d), also set D[k]=d if k not in D¶
-
update
([E, ]**F) → None. Update D from mapping/iterable E and F.¶ If E present and has a .keys() method, does: for k in E: D[k] = E[k] If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is followed by: for k, v in F.items(): D[k] = v
-
values
() → an object providing a view on D's values¶
-
robot.model.modelobject module¶
-
class
robot.model.modelobject.
ModelObject
[source]¶ Bases:
object
-
repr_args
= ()¶
-
config
(**attributes)[source]¶ 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)[source]¶ 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)[source]¶ 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.
-
robot.model.modifier module¶
-
class
robot.model.modifier.
ModelModifier
(visitors, empty_suite_ok, logger)[source]¶ Bases:
robot.model.visitor.SuiteVisitor
-
visit_suite
(suite)[source]¶ 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 setup and teardown at all.
-
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_suite
(suite)¶ Called when a suite starts. Default implementation 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 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 the body of the keyword
-
visit_message
(msg)¶ Implements visiting messages.
Can be overridden to allow modifying the passed in
msg
without callingstart_message()
orend_message()
.
-
visit_return
(return_)¶ Visits a RETURN elements.
-
visit_test
(test)¶ Implements traversing through tests.
Can be overridden to allow modifying the passed in
test
without callingstart_test()
orend_test()
nor visiting the body of the test.
-
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 callingstart_while()
orend_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 callingstart_while_iteration()
orend_while_iteration()
nor visiting body.
-
robot.model.namepatterns module¶
-
class
robot.model.namepatterns.
SuiteNamePatterns
(patterns=None)[source]¶ Bases:
robot.model.namepatterns.NamePatterns
-
match
(name, longname=None)¶
-
-
class
robot.model.namepatterns.
TestNamePatterns
(patterns=None)[source]¶ Bases:
robot.model.namepatterns.NamePatterns
-
match
(name, longname=None)¶
-
robot.model.statistics module¶
-
class
robot.model.statistics.
Statistics
(suite, suite_stat_level=-1, tag_stat_include=None, tag_stat_exclude=None, tag_stat_combine=None, tag_doc=None, tag_stat_link=None, rpa=False)[source]¶ Bases:
object
Container for total, suite and tag statistics.
Accepted parameters have the same semantics as the matching command line options.
-
total
= None¶ Instance of
TotalStatistics
.
-
suite
= None¶ Instance of
SuiteStatistics
.
Instance of
TagStatistics
.
-
-
class
robot.model.statistics.
StatisticsBuilder
(total_builder, suite_builder, tag_builder)[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 callingstart_test()
orend_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 callingstart_keyword()
orend_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_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 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_message
(msg)¶ Implements visiting messages.
Can be overridden to allow modifying the passed in
msg
without callingstart_message()
orend_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 callingstart_suite()
orend_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 callingstart_while()
orend_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 callingstart_while_iteration()
orend_while_iteration()
nor visiting body.
-
robot.model.stats module¶
-
class
robot.model.stats.
Stat
(name)[source]¶ Bases:
robot.utils.sortable.Sortable
Generic statistic object used for storing all the statistic values.
-
name
= None¶ Human readable identifier of the object these statistics belong to. All Tests for
TotalStatistics
, long name of the suite forSuiteStatistics
or name of the tag forTagStatistics
-
passed
= None¶ Number of passed tests.
-
failed
= None¶ Number of failed tests.
-
skipped
= None¶ Number of skipped tests.
-
elapsed
= None¶ Number of milliseconds it took to execute.
-
get_attributes
(include_label=False, include_elapsed=False, exclude_empty=True, values_as_strings=False, html_escape=False)[source]¶
-
total
¶
-
-
class
robot.model.stats.
TotalStat
(name)[source]¶ Bases:
robot.model.stats.Stat
Stores statistic values for a test run.
-
type
= 'total'¶
-
add_test
(test)¶
-
get_attributes
(include_label=False, include_elapsed=False, exclude_empty=True, values_as_strings=False, html_escape=False)¶
-
total
¶
-
visit
(visitor)¶
-
-
class
robot.model.stats.
SuiteStat
(suite)[source]¶ Bases:
robot.model.stats.Stat
Stores statistics values for a single suite.
-
type
= 'suite'¶
-
id
= None¶ Identifier of the suite, e.g. s1-s2.
-
elapsed
= None¶ Number of milliseconds it took to execute this suite, including sub-suites.
-
add_test
(test)¶
-
get_attributes
(include_label=False, include_elapsed=False, exclude_empty=True, values_as_strings=False, html_escape=False)¶
-
total
¶
-
visit
(visitor)¶
-
-
class
robot.model.stats.
TagStat
(name, doc='', links=None, combined=None)[source]¶ Bases:
robot.model.stats.Stat
Stores statistic values for a single tag.
-
type
= 'tag'¶
-
doc
= None¶ Documentation of tag as a string.
-
links
= None¶ List of tuples in which the first value is the link URL and the second is the link title. An empty list by default.
-
combined
= None¶ Pattern as a string if the tag is combined,
None
otherwise.
-
info
¶ Returns additional information of the tag statistics are about. Either combined or an empty string.
-
add_test
(test)¶
-
get_attributes
(include_label=False, include_elapsed=False, exclude_empty=True, values_as_strings=False, html_escape=False)¶
-
total
¶
-
visit
(visitor)¶
-
-
class
robot.model.stats.
CombinedTagStat
(pattern, name=None, doc='', links=None)[source]¶ Bases:
robot.model.stats.TagStat
-
add_test
(test)¶
-
get_attributes
(include_label=False, include_elapsed=False, exclude_empty=True, values_as_strings=False, html_escape=False)¶
-
info
¶ Returns additional information of the tag statistics are about. Either combined or an empty string.
-
total
¶
-
type
= 'tag'¶
-
visit
(visitor)¶
-
robot.model.suitestatistics module¶
robot.model.tags module¶
Bases:
object
Bases:
object
Bases:
object
Bases:
object
Bases:
object
Bases:
object
robot.model.tagsetter module¶
Bases:
robot.model.visitor.SuiteVisitor
Called when a suite starts. Default implementation does nothing.
Can return explicit
False
to stop visiting.
Implements traversing through tests.
Can be overridden to allow modifying the passed in
test
without callingstart_test()
orend_test()
nor visiting the body of the test.
Implements traversing through keywords.
Can be overridden to allow modifying the passed in
kw
without callingstart_keyword()
orend_keyword()
nor visiting the body of the keyword
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.
Called when a BREAK element ends.
By default, calls
end_body_item()
which, by default, does nothing.
Called when a CONTINUE element ends.
By default, calls
end_body_item()
which, by default, does nothing.
Called when a FOR loop ends.
By default, calls
end_body_item()
which, by default, does nothing.
Called when a FOR loop iteration ends.
By default, calls
end_body_item()
which, by default, does nothing.
Called when an IF/ELSE structure ends.
By default, calls
end_body_item()
which, by default, does nothing.
Called when an IF/ELSE branch ends.
By default, calls
end_body_item()
which, by default, does nothing.
Called when a keyword ends.
By default, calls
end_body_item()
which, by default, does nothing.
Called when a message ends.
By default, calls
end_body_item()
which, by default, does nothing.
Called when a RETURN element ends.
By default, calls
end_body_item()
which, by default, does nothing.
Called when a suite ends. Default implementation does nothing.
Called when a test ends. Default implementation does nothing.
Called when a TRY/EXCEPT structure ends.
By default, calls
end_body_item()
which, by default, does nothing.
Called when TRY, EXCEPT, ELSE and FINALLY branches end.
By default, calls
end_body_item()
which, by default, does nothing.
Called when a WHILE loop ends.
By default, calls
end_body_item()
which, by default, does nothing.
Called when a WHILE loop iteration ends.
By default, calls
end_body_item()
which, by default, does nothing.
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.
Called when a BREAK element starts.
By default, calls
start_body_item()
which, by default, does nothing.Can return explicit
False
to stop visiting.
Called when a CONTINUE element starts.
By default, calls
start_body_item()
which, by default, does nothing.Can return explicit
False
to stop visiting.
Called when a FOR loop starts.
By default, calls
start_body_item()
which, by default, does nothing.Can return explicit
False
to stop visiting.
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.
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.
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.
Called when a keyword starts.
By default, calls
start_body_item()
which, by default, does nothing.Can return explicit
False
to stop visiting.
Called when a message starts.
By default, calls
start_body_item()
which, by default, does nothing.Can return explicit
False
to stop visiting.
Called when a RETURN element starts.
By default, calls
start_body_item()
which, by default, does nothing.Can return explicit
False
to stop visiting.
Called when a test starts. Default implementation does nothing.
Can return explicit
False
to stop visiting.
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.
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.
Called when a WHILE loop starts.
By default, calls
start_body_item()
which, by default, does nothing.Can return explicit
False
to stop visiting.
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.
Visits BREAK elements.
Visits CONTINUE elements.
Implements traversing through FOR loops.
Can be overridden to allow modifying the passed in
for_
without callingstart_for()
orend_for()
nor visiting body.
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.
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.
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.
Implements visiting messages.
Can be overridden to allow modifying the passed in
msg
without callingstart_message()
orend_message()
.
Visits a RETURN elements.
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 setup and teardown at all.
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()
.
Visits individual TRY, EXCEPT, ELSE and FINALLY branches.
Implements traversing through WHILE loops.
Can be overridden to allow modifying the passed in
while_
without callingstart_while()
orend_while()
nor visiting body.
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 callingstart_while_iteration()
orend_while_iteration()
nor visiting body.
robot.model.tagstatistics module¶
Bases:
object
Container for tag statistics.
Dictionary, where key is the name of the tag as a string and value is an instance of
TagStat
.
List of
CombinedTagStat
objects.
Bases:
object
Bases:
object
Bases:
object
Bases:
object
robot.model.testcase module¶
-
class
robot.model.testcase.
TestCase
(name='', doc='', tags=None, timeout=None, lineno=None, parent=None)[source]¶ Bases:
robot.model.modelobject.ModelObject
Base model for a single test case.
Extended by
robot.running.model.TestCase
androbot.result.model.TestCase
.-
body_class
¶ alias of
robot.model.body.Body
-
fixture_class
¶ alias of
robot.model.keyword.Keyword
-
repr_args
= ('name',)¶
-
name
¶
-
doc
¶
-
timeout
¶
-
lineno
¶
-
parent
¶
Test tags as a
Tags
object.
-
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 isFalse
.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 underlyingKeyword
object:test.setup = None
New in Robot Framework 4.0. Earlier setup was accessed like
test.keywords.setup
.
-
has_setup
¶ Check does a suite have a setup without creating a setup object.
A difference between using
if test.has_setup:
andif test.setup:
is that accessing thesetup
attribute creates aKeyword
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.
-
longname
¶ Test name prefixed with the long name of the parent suite.
-
source
¶
-
visit
(visitor)[source]¶ Visitor interface
entry-point.
-
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.
-
-
class
robot.model.testcase.
TestCases
(test_class=<class 'robot.model.testcase.TestCase'>, parent=None, tests=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)¶
-
robot.model.testsuite module¶
-
class
robot.model.testsuite.
TestSuite
(name='', doc='', metadata=None, source=None, rpa=False, parent=None)[source]¶ Bases:
robot.model.modelobject.ModelObject
Base model for single suite.
Extended by
robot.running.model.TestSuite
androbot.result.model.TestSuite
.-
test_class
¶ alias of
robot.model.testcase.TestCase
-
fixture_class
¶ alias of
robot.model.keyword.Keyword
-
repr_args
= ('name',)¶
-
doc
¶
-
source
¶ Path to the source file or directory.
-
parent
¶ Parent suite.
None
with the root suite.
-
rpa
¶ True
when RPA mode is enabled.
-
name
¶ Test suite name. If not set, constructed from child suite names.
-
longname
¶ Suite name prefixed with the long name of the parent suite.
-
metadata
¶ Free test suite metadata as a dictionary.
-
suites
¶ Child suites as a
TestSuites
object.
-
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 isFalse
.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 underlyingKeyword
object:suite.setup = None
New in Robot Framework 4.0. Earlier setup was accessed like
suite.keywords.setup
.
-
has_setup
¶ Check does a suite have a setup without creating a setup object.
A difference between using
if suite.has_setup:
andif suite.setup:
is that accessing thesetup
attribute creates aKeyword
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.
-
id
¶ An automatically generated unique id.
The root suite has id
s1
, its child suites have idss1-s1
,s1-s2
, …, their child suites get idss1-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 ids1-t2
, and so on. Similarly keywords in suites (setup/teardown) and in tests get ids likes1-k1
,s1-t1-k1
, ands1-s4-t2-k5
.
-
test_count
¶ Number of the tests in this suite, recursively.
-
has_tests
¶
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.
-
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')
-
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.
-
configure
(**options)[source]¶ A shortcut to configure a suite using one method call.
Can only be used with the root test suite.
Parameters: options – Passed to SuiteConfigurer
that will then set suite attributes, callfilter()
, etc. as needed.Not to be confused with
config()
method that suites, tests, and keywords have to make it possible to set multiple attributes in one call.
-
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.
-
remove_empty_suites
(preserve_direct_children=False)[source]¶ Removes all child suites not containing any tests, recursively.
-
visit
(visitor)[source]¶ Visitor interface
entry-point.
-
-
class
robot.model.testsuite.
TestSuites
(suite_class=<class 'robot.model.testsuite.TestSuite'>, parent=None, suites=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)¶
-
robot.model.totalstatistics module¶
-
class
robot.model.totalstatistics.
TotalStatistics
(rpa=False)[source]¶ Bases:
object
Container for total statistics.
-
total
¶
-
passed
¶
-
skipped
¶
-
failed
¶
-
message
¶ String representation of the statistics.
- For example::
- 2 tests, 1 passed, 1 failed
-
-
class
robot.model.totalstatistics.
TotalStatisticsBuilder
(suite=None, rpa=False)[source]¶ Bases:
robot.model.visitor.SuiteVisitor
-
visit_test
(test)[source]¶ Implements traversing through tests.
Can be overridden to allow modifying the passed in
test
without callingstart_test()
orend_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 callingstart_keyword()
orend_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_suite
(suite)¶ Called when a suite starts. Default implementation 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 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_message
(msg)¶ Implements visiting messages.
Can be overridden to allow modifying the passed in
msg
without callingstart_message()
orend_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 callingstart_suite()
orend_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 callingstart_while()
orend_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 callingstart_while_iteration()
orend_while_iteration()
nor visiting body.
-
robot.model.visitor module¶
Interface to ease traversing through a test suite structure.
Visitors make it easy to modify test suite structures or to collect information
from them. They work both with the executable model
and the result model
, but the objects passed to
the visitor methods are slightly different depending on the model they are
used with. The main differences are that on the execution side keywords do
not have child keywords nor messages, and that only the result objects have
status related attributes like status
and starttime
.
This module contains SuiteVisitor
that implements the core logic to
visit a test suite structure, and the result
package contains
ResultVisitor
that supports visiting the whole
test execution result structure. Both of these visitors should be imported
via the robot.api
package when used by external code.
Visitor algorithm¶
All suite, test, keyword and message objects have a visit()
method that
accepts a visitor instance. These methods will then call the correct visitor
method visit_suite()
, visit_test()
,
visit_keyword()
or visit_message()
,
depending on the instance where the visit()
method exists.
The recommended and definitely the easiest way to implement a visitor is extending
the SuiteVisitor
base class. The default implementation of its
visit_x()
methods take care of traversing child elements of the object
x
recursively. A visit_x()
method first calls a corresponding
start_x()
method (e.g. visit_suite()
calls start_suite()
),
then calls visit()
for all child objects of the x
object, and
finally calls the corresponding end_x()
method. The default
implementations of start_x()
and end_x()
do nothing.
All items that can appear inside tests have their own visit methods. These
include visit_keyword()
, visit_message()
(only applicable with
results, not with executable data), visit_for()
, visit_if()
, and
so on, as well as their appropriate start/end
methods like start_keyword()
and end_for()
. If there is a need to visit all these items, it is possible to
implement only start_body_item()
and end_body_item()
methods that are,
by default, called by the appropriate start/end
methods. These generic methods
are new in Robot Framework 5.0.
Visitors extending the SuiteVisitor
can stop visiting at a certain
level either by overriding suitable visit_x()
method or by returning
an explicit False
from any start_x()
method.
Examples¶
The following example visitor modifies the test suite structure it visits.
It could be used, for example, with Robot Framework’s --prerunmodifier
option to modify test data before execution.
"""Pre-run modifier that selects only every Xth test for execution.
Starts from the first test by default. Tests are selected per suite.
"""
from robot.api import SuiteVisitor
class SelectEveryXthTest(SuiteVisitor):
def __init__(self, x: int, start: int = 0):
self.x = x
self.start = start
def start_suite(self, suite):
"""Modify suite's tests to contain only every Xth."""
suite.tests = suite.tests[self.start::self.x]
def end_suite(self, suite):
"""Remove suites that are empty after removing tests."""
suite.suites = [s for s in suite.suites if s.test_count > 0]
def visit_test(self, test):
"""Avoid visiting tests and their keywords to save a little time."""
pass
For more examples it is possible to look at the source code of visitors used
internally by Robot Framework itself. Some good examples are
TagSetter
and
keyword removers
.
-
class
robot.model.visitor.
SuiteVisitor
[source]¶ Bases:
object
Abstract class to ease traversing through the suite structure.
See the
module level
documentation for more information and an example.-
visit_suite
(suite)[source]¶ 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 setup and teardown at all.
-
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 callingstart_test()
orend_test()
nor visiting the body of the test.
-
start_test
(test)[source]¶ Called when a test starts. Default implementation does nothing.
Can return explicit
False
to stop visiting.
-
visit_keyword
(kw)[source]¶ Implements traversing through keywords.
Can be overridden to allow modifying the passed in
kw
without callingstart_keyword()
orend_keyword()
nor visiting the body of the keyword
-
start_keyword
(keyword)[source]¶ Called when a keyword starts.
By default, calls
start_body_item()
which, by default, does nothing.Can return explicit
False
to stop visiting.
-
end_keyword
(keyword)[source]¶ Called when a keyword ends.
By default, calls
end_body_item()
which, by default, does nothing.
-
visit_for
(for_)[source]¶ Implements traversing through FOR loops.
Can be overridden to allow modifying the passed in
for_
without callingstart_for()
orend_for()
nor visiting body.
-
start_for
(for_)[source]¶ Called when a FOR loop starts.
By default, calls
start_body_item()
which, by default, does nothing.Can return explicit
False
to stop visiting.
-
end_for
(for_)[source]¶ Called when a FOR loop ends.
By default, calls
end_body_item()
which, by default, does nothing.
-
visit_for_iteration
(iteration)[source]¶ 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.
-
start_for_iteration
(iteration)[source]¶ 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.
-
end_for_iteration
(iteration)[source]¶ Called when a FOR loop iteration ends.
By default, calls
end_body_item()
which, by default, does nothing.
-
visit_if
(if_)[source]¶ 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.
-
start_if
(if_)[source]¶ 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.
-
end_if
(if_)[source]¶ Called when an IF/ELSE structure ends.
By default, calls
end_body_item()
which, by default, does nothing.
-
visit_if_branch
(branch)[source]¶ 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.
-
start_if_branch
(branch)[source]¶ 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.
-
end_if_branch
(branch)[source]¶ Called when an IF/ELSE branch ends.
By default, calls
end_body_item()
which, by default, does nothing.
-
visit_try
(try_)[source]¶ 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()
.
-
start_try
(try_)[source]¶ 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.
-
end_try
(try_)[source]¶ Called when a TRY/EXCEPT structure ends.
By default, calls
end_body_item()
which, by default, does nothing.
-
start_try_branch
(branch)[source]¶ 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.
-
end_try_branch
(branch)[source]¶ Called when TRY, EXCEPT, ELSE and FINALLY branches end.
By default, calls
end_body_item()
which, by default, does nothing.
-
visit_while
(while_)[source]¶ Implements traversing through WHILE loops.
Can be overridden to allow modifying the passed in
while_
without callingstart_while()
orend_while()
nor visiting body.
-
start_while
(while_)[source]¶ Called when a WHILE loop starts.
By default, calls
start_body_item()
which, by default, does nothing.Can return explicit
False
to stop visiting.
-
end_while
(while_)[source]¶ Called when a WHILE loop ends.
By default, calls
end_body_item()
which, by default, does nothing.
-
visit_while_iteration
(iteration)[source]¶ 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 callingstart_while_iteration()
orend_while_iteration()
nor visiting body.
-
start_while_iteration
(iteration)[source]¶ 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.
-
end_while_iteration
(iteration)[source]¶ Called when a WHILE loop iteration ends.
By default, calls
end_body_item()
which, by default, does nothing.
-
start_return
(return_)[source]¶ Called when a RETURN element starts.
By default, calls
start_body_item()
which, by default, does nothing.Can return explicit
False
to stop visiting.
-
end_return
(return_)[source]¶ Called when a RETURN element ends.
By default, calls
end_body_item()
which, by default, does nothing.
-
start_continue
(continue_)[source]¶ Called when a CONTINUE element starts.
By default, calls
start_body_item()
which, by default, does nothing.Can return explicit
False
to stop visiting.
-
end_continue
(continue_)[source]¶ Called when a CONTINUE element ends.
By default, calls
end_body_item()
which, by default, does nothing.
-
start_break
(break_)[source]¶ Called when a BREAK element starts.
By default, calls
start_body_item()
which, by default, does nothing.Can return explicit
False
to stop visiting.
-
end_break
(break_)[source]¶ Called when a BREAK element ends.
By default, calls
end_body_item()
which, by default, does nothing.
-
visit_message
(msg)[source]¶ Implements visiting messages.
Can be overridden to allow modifying the passed in
msg
without callingstart_message()
orend_message()
.
-
start_message
(msg)[source]¶ Called when a message starts.
By default, calls
start_body_item()
which, by default, does nothing.Can return explicit
False
to stop visiting.
-
end_message
(msg)[source]¶ Called when a message ends.
By default, calls
end_body_item()
which, by default, does nothing.
-
start_body_item
(item)[source]¶ 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.
-
end_body_item
(item)[source]¶ 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.
-