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 moduleBases: ModelObject
Item id in format like s1-t3-k1
.
See TestSuite.id
for more information.
id
is None
only in these special cases:
Serialize this object into a dictionary.
The object can be later restored by using the from_dict()
method.
With robot.running
model objects new in Robot Framework 6.1, with robot.result
new in Robot Framework 7.0.
Bases: ItemList
[BodyItem
], Generic
[KW
, F
, W
, G
, I
, T
, V
, R
, C
, B
, M
, E
]
Base class for Body and Branches objects.
alias of type
alias of type
alias of type
alias of type
alias of type
alias of type
alias of type
alias of type
alias of type
alias of type
alias of type
alias of type
Register a virtual subclass of an ABC.
Returns the subclass, to allow usage as a class decorator.
Create a new item using the provided arguments.
Filter body items based on type and/or custom predicate.
To include or exclude items based on types, give matching arguments True
or False
values. For example, to include only keywords, use body.filter(keywords=True)
and to exclude messages use body.filter(messages=False)
. Including and excluding by types at the same time is not supported and filtering my messages
is supported only if the Body
object actually supports messages.
Custom predicate
is a callable getting each body item as an argument that must return True/False
depending on should the item be included or not.
Selected items are returned as a list and the original body is not modified.
It was earlier possible to filter also based on FOR and IF types. That support was removed in RF 5.0 because it was not considered useful in general and because adding support for all new control structures would have required extra work. To exclude all control structures, use body.filter(keywords=True, messages=True)
and to only include them use body.filter(keywords=False
, messages=False)``. For more detailed filtering it is possible to use predicate
.
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 the log file.
filter_config
can be used to filter steps using the filter()
method before flattening. New in Robot Framework 7.2.
Bases: BaseBody
[Keyword, For, While, Group, If, Try, Var, Return, Continue, Break, Message, Error]
A list-like object representing a body of a test, keyword, etc.
Body contains the keywords and other structures such as FOR loops.
alias of Break
alias of Continue
alias of Error
alias of For
alias of Group
alias of If
alias of Keyword
alias of Return
alias of Try
alias of Var
alias of While
Bases: Generic
[IT
]
Bases: BaseBody
[KW
, F
, W
, G
, I
, T
, V
, R
, C
, B
, M
, E
], BranchType
[IT
]
A list-like object representing IF and TRY branches.
alias of type
Bases: Generic
[FW
]
Bases: BaseBody
[KW
, F
, W
, G
, I
, T
, V
, R
, C
, B
, M
, E
], IterationType
[FW
]
alias of type
Bases: SuiteVisitor
Implements traversing through suites.
Can be overridden to allow modifying the passed in suite
without calling start_suite()
or end_suite()
nor visiting child suites, tests or setup and teardown at all.
Bases: BaseBranches
[Keyword, For, While, Group, If, Try, Var, Return, Continue, Break, Message, Error, IT
]
Bases: BaseIterations
[Keyword, For, While, Group, If, Try, Var, Return, Continue, Break, Message, Error, FW
]
Bases: BodyItem
Represents one FOR loop iteration.
alias of Body
Deprecated since Robot Framework 7.0. Use assign
instead.
Serialize this object into a dictionary.
The object can be later restored by using the from_dict()
method.
With robot.running
model objects new in Robot Framework 6.1, with robot.result
new in Robot Framework 7.0.
Bases: BodyItem
Represents FOR
loops.
alias of Body
Deprecated since Robot Framework 7.0. Use assign
instead.
Serialize this object into a dictionary.
The object can be later restored by using the from_dict()
method.
With robot.running
model objects new in Robot Framework 6.1, with robot.result
new in Robot Framework 7.0.
Bases: BodyItem
Represents one WHILE loop iteration.
alias of Body
Serialize this object into a dictionary.
The object can be later restored by using the from_dict()
method.
With robot.running
model objects new in Robot Framework 6.1, with robot.result
new in Robot Framework 7.0.
Bases: BodyItem
Represents WHILE
loops.
alias of Body
Serialize this object into a dictionary.
The object can be later restored by using the from_dict()
method.
With robot.running
model objects new in Robot Framework 6.1, with robot.result
new in Robot Framework 7.0.
Bases: BodyItem
Represents GROUP
.
alias of Body
Serialize this object into a dictionary.
The object can be later restored by using the from_dict()
method.
With robot.running
model objects new in Robot Framework 6.1, with robot.result
new in Robot Framework 7.0.
Bases: BodyItem
Represents individual IF
, ELSE IF
or ELSE
branch.
alias of Body
Branch id omits IF/ELSE root from the parent id part.
Serialize this object into a dictionary.
The object can be later restored by using the from_dict()
method.
With robot.running
model objects new in Robot Framework 6.1, with robot.result
new in Robot Framework 7.0.
Bases: BodyItem
IF/ELSE structure root. Branches are stored in body
.
alias of IfBranch
Root IF/ELSE id is always None
.
Serialize this object into a dictionary.
The object can be later restored by using the from_dict()
method.
With robot.running
model objects new in Robot Framework 6.1, with robot.result
new in Robot Framework 7.0.
Bases: BodyItem
Represents individual TRY
, EXCEPT
, ELSE
or FINALLY
branch.
alias of Body
Deprecated since Robot Framework 7.0. Use assign
instead.
Branch id omits TRY/EXCEPT root from the parent id part.
Serialize this object into a dictionary.
The object can be later restored by using the from_dict()
method.
With robot.running
model objects new in Robot Framework 6.1, with robot.result
new in Robot Framework 7.0.
Bases: BodyItem
TRY/EXCEPT structure root. Branches are stored in body
.
alias of TryBranch
Root TRY/EXCEPT id is always None
.
Serialize this object into a dictionary.
The object can be later restored by using the from_dict()
method.
With robot.running
model objects new in Robot Framework 6.1, with robot.result
new in Robot Framework 7.0.
Bases: BodyItem
Represents VAR
.
Serialize this object into a dictionary.
The object can be later restored by using the from_dict()
method.
With robot.running
model objects new in Robot Framework 6.1, with robot.result
new in Robot Framework 7.0.
Bases: BodyItem
Represents RETURN
.
Serialize this object into a dictionary.
The object can be later restored by using the from_dict()
method.
With robot.running
model objects new in Robot Framework 6.1, with robot.result
new in Robot Framework 7.0.
Bases: BodyItem
Represents CONTINUE
.
Serialize this object into a dictionary.
The object can be later restored by using the from_dict()
method.
With robot.running
model objects new in Robot Framework 6.1, with robot.result
new in Robot Framework 7.0.
Bases: BodyItem
Represents BREAK
.
Serialize this object into a dictionary.
The object can be later restored by using the from_dict()
method.
With robot.running
model objects new in Robot Framework 6.1, with robot.result
new in Robot Framework 7.0.
Bases: BodyItem
Represents syntax error in data.
For example, an invalid setting like [Setpu]
or END
in wrong place.
Serialize this object into a dictionary.
The object can be later restored by using the from_dict()
method.
With robot.running
model objects new in Robot Framework 6.1, with robot.result
new in Robot Framework 7.0.
Bases: SuiteVisitor
Called when a suite ends. Default implementation does nothing.
Implements traversing through tests.
Can be overridden to allow modifying the passed in test
without calling start_test()
or end_test()
nor visiting the body of the test.
Implements traversing through keywords.
Can be overridden to allow modifying the passed in kw
without calling start_keyword()
or end_keyword()
nor visiting the body of the keyword
Bases: EmptySuiteRemover
Called when a suite starts. Default implementation does nothing.
Can return explicit False
to stop visiting.
Create or configure a fixture_class instance.
Bases: MutableSequence
[T
]
List of items of a certain enforced type.
New items can be created using the create()
method and existing items added using the common list methods like append()
or insert()
. In addition to the common type, items can have certain common and automatically assigned attributes.
Starting from Robot Framework 6.1, items can be added as dictionaries and actual items are generated based on them automatically. If the type has a from_dict
class method, it is used, and otherwise dictionary data is passed to the type as keyword arguments.
alias of type
Create a new item using the provided arguments.
S.append(value) – append value to the end of the sequence
S.extend(iterable) – extend sequence by appending elements from the iterable
S.insert(index, value) – insert value before index
Raises ValueError if the value is not present.
Supporting start and stop arguments is optional, but recommended.
S.reverse() – reverse IN PLACE
Return list of items converted to dictionaries.
Items are converted to dictionaries using the to_dict
method, if they have it, or the built-in vars()
.
New in Robot Framework 6.1.
Bases: BodyItem
Base model for a single keyword.
Extended by robot.running.model.Keyword
and robot.result.model.Keyword
.
Item id in format like s1-t3-k1
.
See TestSuite.id
for more information.
id
is None
only in these special cases:
Visitor interface
entry-point.
Serialize this object into a dictionary.
The object can be later restored by using the from_dict()
method.
With robot.running
model objects new in Robot Framework 6.1, with robot.result
new in Robot Framework 7.0.
Bases: 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.
Returns the message content as HTML.
Item id in format like s1-t3-k1
.
See TestSuite.id
for more information.
id
is None
only in these special cases:
Visitor interface
entry-point.
Serialize this object into a dictionary.
The object can be later restored by using the from_dict()
method.
With robot.running
model objects new in Robot Framework 6.1, with robot.result
new in Robot Framework 7.0.
Bases: NormalizedDict
[str
]
Free suite metadata as a mapping.
Keys are case, space, and underscore insensitive.
Initialized with possible initial value and normalizing spec.
Initial values can be either a dictionary or an iterable of name/value pairs.
Normalizing spec has exact same semantics as with the normalize()
function.
Bases: object
Create this object based on data in a dictionary.
Data can be got from the to_dict()
method or created externally.
With robot.running
model objects new in Robot Framework 6.1, with robot.result
new in Robot Framework 7.0.
Create this object based on JSON data.
The data is given as the source
parameter. It can be:
a string (or bytes) containing the data directly,
an open file object where to read the data from, or
a path (pathlib.Path
or string) to a UTF-8 encoded file to read.
The JSON data is first converted to a Python dictionary and the object created using the from_dict()
method.
Notice that the source
is considered to be JSON data if it is a string and contains {
. If you need to use {
in a file system path, pass it in as a pathlib.Path
instance.
With robot.running
model objects new in Robot Framework 6.1, with robot.result
new in Robot Framework 7.0.
Serialize this object into a dictionary.
The object can be later restored by using the from_dict()
method.
With robot.running
model objects new in Robot Framework 6.1, with robot.result
new in Robot Framework 7.0.
Serialize this object into JSON.
The object is first converted to a Python dictionary using the to_dict()
method and then the dictionary is converted to JSON.
The file
parameter controls what to do with the resulting JSON data. It can be:
None
(default) to return the data as a string,
an open file object where to write the data to, or
a path (pathlib.Path
or string) to a file where to write the data using UTF-8 encoding.
JSON formatting can be configured using optional parameters that are passed directly to the underlying json module. Notice that the defaults differ from what json
uses.
With robot.running
model objects new in Robot Framework 6.1, with robot.result
new in Robot Framework 7.0.
Configure model object with given attributes.
obj.config(name='Example', doc='Something')
is equivalent to setting obj.name = 'Example'
and obj.doc = 'Something'
.
New in Robot Framework 4.0.
Return a shallow copy of this object.
attributes – Attributes to be set to the returned copy. For example, obj.copy(name='New name')
.
See also deepcopy()
. The difference between copy
and deepcopy
is the same as with the methods having same names in the copy module.
Return a deep copy of this object.
attributes – Attributes to be set to the returned copy. For example, obj.deepcopy(name='New name')
.
See also copy()
. The difference between deepcopy
and copy
is the same as with the methods having same names in the copy module.
Bases: SuiteVisitor
Implements traversing through suites.
Can be overridden to allow modifying the passed in suite
without calling start_suite()
or end_suite()
nor visiting child suites, tests or setup and teardown at all.
Bases: Iterable
[str
]
Bases: object
Container for total, suite and tag statistics.
Accepted parameters have the same semantics as the matching command line options.
Bases: SuiteVisitor
Called when a suite starts. Default implementation does nothing.
Can return explicit False
to stop visiting.
Called when a suite ends. Default implementation does nothing.
Implements traversing through tests.
Can be overridden to allow modifying the passed in test
without calling start_test()
or end_test()
nor visiting the body of the test.
Implements traversing through keywords.
Can be overridden to allow modifying the passed in kw
without calling start_keyword()
or end_keyword()
nor visiting the body of the keyword
Bases: Sortable
Generic statistic object used for storing all the statistic values.
Human readable identifier of the object these statistics belong to. All Tests for TotalStatistics
, long name of the suite for SuiteStatistics
or name of the tag for TagStatistics
Bases: Stat
Stores statistic values for a test run.
Bases: Stat
Stores statistics values for a single suite.
Bases: Stat
Stores statistic values for a single tag.
Documentation of tag as a string.
List of tuples in which the first value is the link URL and the second is the link title. An empty list by default.
Pattern as a string if the tag is combined, None
otherwise.
Returns additional information of the tag statistics are about. Either combined or an empty string.
Bases: TagStat
Bases: object
Container for suite statistics.
Bases: object
Bases: Sequence
[str
]
Check do tags contain a reserved tag in format robot:<name>.
This is same as ‘robot:<name>’ in tags but considerably faster.
Bases: Sequence
[TagPattern
]
Bases: ABC
Bases: TagPattern
Returns True when the argument is true, False otherwise. The builtins True and False are the only two instances of the class bool. The class bool is a subclass of the class int, and cannot be subclassed.
Bases: TagPattern
Bases: TagPattern
Bases: TagPattern
Performance optimization to normalize tags only once.
Bases: list
Bases: 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 calling start_test()
or end_test()
nor visiting the body of the test.
Implements traversing through keywords.
Can be overridden to allow modifying the passed in kw
without calling start_keyword()
or end_keyword()
nor visiting the body of the keyword
Bases: object
Container for tag statistics.
Bases: object
Bases: object
Bases: object
Bases: object
Bases: ModelObject
, Generic
[KW
]
Base model for a single test case.
Extended by robot.running.model.TestCase
and robot.result.model.TestCase
.
alias of Body
alias of Keyword
Test body as a Body
object.
Test tags as a Tags
object.
Test setup as a Keyword
object.
This attribute is a Keyword
object also when a test has no setup but in that case its truth value is False
.
Setup can be modified by setting attributes directly:
test.setup.name = 'Example' test.setup.args = ('First', 'Second')
Alternatively the config()
method can be used to set multiple attributes in one call:
test.setup.config(name='Example', args=('First', 'Second'))
The easiest way to reset the whole setup is setting it to None
. It will automatically recreate the underlying Keyword
object:
New in Robot Framework 4.0. Earlier setup was accessed like test.keywords.setup
.
Check does a suite have a setup without creating a setup object.
A difference between using if test.has_setup:
and if test.setup:
is that accessing the setup
attribute creates a Keyword
object representing the setup even when the test actually does not have one. This typically does not matter, but with bigger suite structures containing a huge about of tests it can have an effect on memory usage.
New in Robot Framework 5.0.
Check does a test have a teardown without creating a teardown object.
See has_setup
for more information.
New in Robot Framework 5.0.
Test case id in format like s1-t3
.
See TestSuite.id
for more information.
Test name prefixed with the full name of the parent suite.
Deprecated since Robot Framework 7.0. Use full_name
instead.
Visitor interface
entry-point.
Serialize this object into a dictionary.
The object can be later restored by using the from_dict()
method.
With robot.running
model objects new in Robot Framework 6.1, with robot.result
new in Robot Framework 7.0.
Bases: ItemList
[TC
]
Bases: ModelObject
, Generic
[KW
, TC
]
Base model for single suite.
Extended by robot.running.model.TestSuite
and robot.result.model.TestSuite
.
alias of Keyword
alias of TestCase
Create suite name based on the given source
.
This method is used by Robot Framework itself when it builds suites. External parsers and other tools that want to produce suites with names matching names created by Robot Framework can use this method as well. This method is also used if name
is not set and someone accesses it.
The algorithm is as follows:
If the source is None
or empty, return an empty string.
Get the base name of the source. Read more below.
Remove possible prefix separated with __
.
Convert underscores to spaces.
If the name is all lower case, title case it.
The base name of files is got by calling Path.stem that drops the file extension. It typically works fine, but gives wrong result if the extension has multiple parts like in tests.robot.zip
. That problem can be avoided by giving valid file extension or extensions as the optional extension
argument.
Examples:
TestSuite.name_from_source(source) TestSuite.name_from_source(source, extension='.robot.zip') TestSuite.name_from_source(source, ('.robot', '.robot.zip'))
Suite name.
If name is not set, it is constructed from source. If source is not set, name is constructed from child suite names by concatenating them with `` & ``. If there are no child suites, name is an empty string.
Adjust suite source and child suite sources, recursively.
relative_to – Make suite source relative to the given path. Calls pathlib.Path.relative_to() internally. Raises ValueError
if creating a relative path is not possible.
root – Make given path a new root directory for the source. Raises ValueError
if suite source is absolute.
Adjusting the source is especially useful when moving data around as JSON:
from robot.api import TestSuite # Create a suite, adjust source and convert to JSON. suite = TestSuite.from_file_system('/path/to/data') suite.adjust_source(relative_to='/path/to') suite.to_json('data.rbt') # Recreate suite elsewhere and adjust source accordingly. suite = TestSuite.from_json('data.rbt') suite.adjust_source(root='/new/path/to')
New in Robot Framework 6.1.
Suite name prefixed with the full name of the possible parent suite.
Deprecated since Robot Framework 7.0. Use full_name
instead.
Free suite metadata as a Metadata
object.
Validate that suite execution mode is set consistently.
Raise an exception if the execution mode is not set (i.e. the rpa
attribute is None
) and child suites have conflicting execution modes.
The execution mode is returned. New in RF 6.1.1.
Suite setup.
This attribute is a Keyword
object also when a suite has no setup but in that case its truth value is False
. The preferred way to check does a suite have a setup is using has_setup
.
Setup can be modified by setting attributes directly:
suite.setup.name = 'Example' suite.setup.args = ('First', 'Second')
Alternatively the config()
method can be used to set multiple attributes in one call:
suite.setup.config(name='Example', args=('First', 'Second'))
The easiest way to reset the whole setup is setting it to None
. It will automatically recreate the underlying Keyword
object:
New in Robot Framework 4.0. Earlier setup was accessed like suite.keywords.setup
.
Check does a suite have a setup without creating a setup object.
A difference between using if suite.has_setup:
and if suite.setup:
is that accessing the setup
attribute creates a Keyword
object representing the setup even when the suite actually does not have one. This typically does not matter, but with bigger suite structures it can have some effect on memory usage.
New in Robot Framework 5.0.
Suite teardown.
See setup
for more information.
Check does a suite have a teardown without creating a teardown object.
See has_setup
for more information.
New in Robot Framework 5.0.
An automatically generated unique id.
The root suite has id s1
, its child suites have ids s1-s1
, s1-s2
, …, their child suites get ids s1-s1-s1
, s1-s1-s2
, …, s1-s2-s1
, …, and so on.
The first test in a suite has an id like s1-t1
, the second has an id s1-t2
, and so on. Similarly, keywords in suites (setup/teardown) and in tests get ids like s1-k1
, s1-t1-k1
, and s1-s4-t2-k5
.
Yields all tests this suite and its child suites contain.
New in Robot Framework 6.1.
Total number of the tests in this suite and in its child suites.
Add and/or remove specified tags to the tests in this suite.
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.
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')
A shortcut to configure a suite using one method call.
Can only be used with the root test suite.
options – Passed to SuiteConfigurer
that will then set suite attributes, call filter()
, 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.
Removes all child suites not containing any tests, recursively.
Visitor interface
entry-point.
Serialize this object into a dictionary.
The object can be later restored by using the from_dict()
method.
With robot.running
model objects new in Robot Framework 6.1, with robot.result
new in Robot Framework 7.0.
Bases: ItemList
[TS
]
Bases: object
Container for total statistics.
Instance of TotalStat
for all the tests.
String representation of the statistics.
2 tests, 1 passed, 1 failed
Bases: SuiteVisitor
Implements traversing through tests.
Can be overridden to allow modifying the passed in test
without calling start_test()
or end_test()
nor visiting the body of the test.
Implements traversing through keywords.
Can be overridden to allow modifying the passed in kw
without calling start_keyword()
or end_keyword()
nor visiting the body of the keyword
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 start_time
.
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.
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.
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
.
Visitor methods have type hints to give more information about the model objects they receive to editors. Because visitors can be used with both running and result models, the types that are used as type hints are base classes from the robot.model
module. Actual visitor implementations can import appropriate types from the robot.running
or the robot.result
module instead. For example, this visitor uses the result side model objects:
from robot.api import SuiteVisitor from robot.result import TestCase, TestSuite class FailurePrinter(SuiteVisitor): def start_suite(self, suite: TestSuite): print(f"{suite.full_name}: {suite.statistics.failed} failed") def visit_test(self, test: TestCase): if test.failed: print(f'- {test.name}: {test.message}')
Type hints were added in Robot Framework 6.1. They are optional and can be removed altogether if they get in the way.
Bases: object
Abstract class to ease traversing through the suite structure.
See the module level
documentation for more information and an example.
Implements traversing through suites.
Can be overridden to allow modifying the passed in suite
without calling start_suite()
or end_suite()
nor visiting child suites, tests or setup and teardown at all.
Called when a suite starts. Default implementation does nothing.
Can return explicit False
to stop visiting.
Called when a suite ends. Default implementation does nothing.
Implements traversing through tests.
Can be overridden to allow modifying the passed in test
without calling start_test()
or end_test()
nor visiting the body of the test.
Called when a test starts. Default implementation does nothing.
Can return explicit False
to stop visiting.
Called when a test ends. Default implementation does nothing.
Implements traversing through keywords.
Can be overridden to allow modifying the passed in kw
without calling start_keyword()
or end_keyword()
nor visiting the body of the keyword
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 keyword ends.
By default, calls end_body_item()
which, by default, does nothing.
Implements traversing through FOR loops.
Can be overridden to allow modifying the passed in for_
without calling start_for()
or end_for()
nor visiting body.
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 ends.
By default, calls end_body_item()
which, by default, does nothing.
Implements traversing through single FOR loop iteration.
This is only used with the result side model because on the running side there are no iterations.
Can be overridden to allow modifying the passed in iteration
without calling start_for_iteration()
or end_for_iteration()
nor visiting body.
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 a FOR loop iteration ends.
By default, calls end_body_item()
which, by default, does nothing.
Implements traversing through IF/ELSE structures.
Notice that if_
does not have any data directly. Actual IF/ELSE branches are in its body
and they are visited separately using visit_if_branch()
.
Can be overridden to allow modifying the passed in if_
without calling start_if()
or end_if()
nor visiting branches.
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 structure ends.
By default, calls end_body_item()
which, by default, does nothing.
Implements traversing through single IF/ELSE branch.
Can be overridden to allow modifying the passed in branch
without calling start_if_branch()
or end_if_branch()
nor visiting body.
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 an IF/ELSE branch ends.
By default, calls end_body_item()
which, by default, does nothing.
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()
.
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 a TRY/EXCEPT structure ends.
By default, calls end_body_item()
which, by default, does nothing.
Visits individual TRY, EXCEPT, ELSE and FINALLY branches.
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 TRY, EXCEPT, ELSE and FINALLY branches end.
By default, calls end_body_item()
which, by default, does nothing.
Implements traversing through WHILE loops.
Can be overridden to allow modifying the passed in while_
without calling start_while()
or end_while()
nor visiting body.
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 ends.
By default, calls end_body_item()
which, by default, does nothing.
Implements traversing through single WHILE loop iteration.
This is only used with the result side model because on the running side there are no iterations.
Can be overridden to allow modifying the passed in iteration
without calling start_while_iteration()
or end_while_iteration()
nor visiting body.
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.
Called when a WHILE loop iteration ends.
By default, calls end_body_item()
which, by default, does nothing.
Visits GROUP elements.
Can be overridden to allow modifying the passed in group
without calling start_group()
or end_group()
nor visiting body.
Called when a GROUP element starts.
By default, calls start_body_item()
which, by default, does nothing.
Can return explicit False
to stop visiting.
Called when a GROUP element ends.
By default, calls end_body_item()
which, by default, does nothing.
Visits a VAR elements.
Called when a VAR element starts.
By default, calls start_body_item()
which, by default, does nothing.
Can return explicit False
to stop visiting.
Called when a VAR element ends.
By default, calls end_body_item()
which, by default, does nothing.
Visits a RETURN elements.
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 RETURN element ends.
By default, calls end_body_item()
which, by default, does nothing.
Visits CONTINUE elements.
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 CONTINUE element ends.
By default, calls end_body_item()
which, by default, does nothing.
Visits BREAK elements.
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 BREAK element ends.
By default, calls end_body_item()
which, by default, does nothing.
Visits body items resulting from invalid syntax.
Examples include syntax like END
or ELSE
in wrong place and invalid setting like [Invalid]
.
Called when a ERROR element starts.
By default, calls start_body_item()
which, by default, does nothing.
Can return explicit False
to stop visiting.
Called when a ERROR element ends.
By default, calls end_body_item()
which, by default, does nothing.
Implements visiting messages.
Can be overridden to allow modifying the passed in msg
without calling start_message()
or end_message()
.
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 message 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, 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.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4