robot.running package¶
Implements the core test execution logic.
The public API of this module consists of the following objects:
TestSuite
for creating an executable test suite structure programmatically.TestSuiteBuilder
for creating executable test suites based on data on a file system. Instead of using this class directly, it is possible to use theTestSuite.from_file_system
classmethod that uses it internally.- Classes used by
TestSuite
, such asTestCase
,Keyword
andIf
that are defined in therobot.running.model
module. These classes are typically only needed in type hints. TestDefaults
that is part of the external parsing API and also typically needed only in type hints.
TestSuite
and
TestSuiteBuilder
can be imported also via
the robot.api
package.
Note
Prior to Robot Framework 6.1, only some classes in
robot.running.model
were exposed via robot.running
.
Examples¶
First, let’s assume we have the following test suite in file
activate_skynet.robot
:
*** Settings ***
Library OperatingSystem
*** Test Cases ***
Should Activate Skynet
[Tags] smoke
[Setup] Set Environment Variable SKYNET activated
Environment Variable Should Be Set SKYNET
We can easily create an executable test suite based on the above file:
from robot.api import TestSuite
suite = TestSuite.from_file_system('path/to/activate_skynet.robot')
That was easy. Let’s next generate the same test suite from scratch:
from robot.api import TestSuite
suite = TestSuite('Activate Skynet')
suite.resource.imports.library('OperatingSystem')
test = suite.tests.create('Should Activate Skynet', tags=['smoke'])
test.setup.config(name='Set Environment Variable', args=['SKYNET', 'activated'])
test.body.create_keyword('Environment Variable Should Be Set', args=['SKYNET'])
Not that complicated either, especially considering the flexibility. Notice that the suite created based on the file could also be edited further using the same API.
Now that we have a test suite ready, let’s execute it
and verify that the returned
Result
object contains correct
information:
result = suite.run(output='skynet.xml')
assert result.return_code == 0
assert result.suite.name == 'Activate Skynet'
test = result.suite.tests[0]
assert test.name == 'Should Activate Skynet'
assert test.passed
stats = result.suite.statistics
assert stats.total == 1 and stats.passed == 1 and stats.failed == 0
Running the suite generates a normal output XML file, unless it is disabled
by using output=None
. Generating log, report, and xUnit files based on
the results is possible using the
ResultWriter
class:
from robot.api import ResultWriter
# Report and xUnit files can be generated based on the result object.
ResultWriter(result).write_results(report='skynet.html', log=None)
# Generating log files requires processing the earlier generated output XML.
ResultWriter('skynet.xml').write_results()
Subpackages¶
- robot.running.arguments package
- Submodules
- robot.running.arguments.argumentconverter module
- robot.running.arguments.argumentmapper module
- robot.running.arguments.argumentparser module
- robot.running.arguments.argumentresolver module
- robot.running.arguments.argumentspec module
- robot.running.arguments.argumentvalidator module
- robot.running.arguments.customconverters module
- robot.running.arguments.embedded module
- robot.running.arguments.typeconverters module
- robot.running.arguments.typevalidator module
- robot.running.builder package
- robot.running.timeouts package
Submodules¶
robot.running.bodyrunner module¶
-
class
robot.running.bodyrunner.
BodyRunner
(context, run=True, templated=False)[source]¶ Bases:
object
-
class
robot.running.bodyrunner.
ForInRunner
(context, run=True, templated=False)[source]¶ Bases:
object
-
flavor
= 'IN'¶
-
-
class
robot.running.bodyrunner.
ForInRangeRunner
(context, run=True, templated=False)[source]¶ Bases:
robot.running.bodyrunner.ForInRunner
-
flavor
= 'IN RANGE'¶
-
run
(data)¶
-
-
class
robot.running.bodyrunner.
ForInZipRunner
(context, run=True, templated=False)[source]¶ Bases:
robot.running.bodyrunner.ForInRunner
-
flavor
= 'IN ZIP'¶
-
run
(data)¶
-
-
class
robot.running.bodyrunner.
ForInEnumerateRunner
(context, run=True, templated=False)[source]¶ Bases:
robot.running.bodyrunner.ForInRunner
-
flavor
= 'IN ENUMERATE'¶
-
run
(data)¶
-
-
class
robot.running.bodyrunner.
WhileRunner
(context, run=True, templated=False)[source]¶ Bases:
object
-
class
robot.running.bodyrunner.
WhileLimit
(on_limit=None, on_limit_message=None)[source]¶ Bases:
object
-
class
robot.running.bodyrunner.
DurationLimit
(max_time, on_limit, on_limit_message)[source]¶ Bases:
robot.running.bodyrunner.WhileLimit
-
classmethod
create
(limit, on_limit, on_limit_message, variables)¶
-
limit_exceeded
()¶
-
classmethod
parse_on_limit
(variables, on_limit)¶
-
classmethod
-
class
robot.running.bodyrunner.
IterationCountLimit
(max_iterations, on_limit, on_limit_message)[source]¶ Bases:
robot.running.bodyrunner.WhileLimit
-
classmethod
create
(limit, on_limit, on_limit_message, variables)¶
-
limit_exceeded
()¶
-
classmethod
parse_on_limit
(variables, on_limit)¶
-
classmethod
-
class
robot.running.bodyrunner.
NoLimit
(on_limit=None, on_limit_message=None)[source]¶ Bases:
robot.running.bodyrunner.WhileLimit
-
classmethod
create
(limit, on_limit, on_limit_message, variables)¶
-
limit_exceeded
()¶
-
classmethod
parse_on_limit
(variables, on_limit)¶
-
classmethod
-
exception
robot.running.bodyrunner.
LimitExceeded
(on_limit_pass, message)[source]¶ Bases:
robot.errors.ExecutionFailed
-
add_note
()¶ Exception.add_note(note) – add a note to the exception
-
args
¶
-
can_continue
(context, templated=False)¶
-
continue_on_failure
¶
-
dont_continue
¶
-
get_errors
()¶
-
message
¶
-
status
¶
-
timeout
¶
-
with_traceback
()¶ Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
-
robot.running.context module¶
robot.running.dynamicmethods module¶
-
class
robot.running.dynamicmethods.
GetKeywordNames
(lib)[source]¶ Bases:
robot.running.dynamicmethods._DynamicMethod
-
name
¶
-
-
class
robot.running.dynamicmethods.
RunKeyword
(lib)[source]¶ Bases:
robot.running.dynamicmethods._DynamicMethod
-
supports_kwargs
¶
-
name
¶
-
-
class
robot.running.dynamicmethods.
GetKeywordDocumentation
(lib)[source]¶ Bases:
robot.running.dynamicmethods._DynamicMethod
-
name
¶
-
-
class
robot.running.dynamicmethods.
GetKeywordArguments
(lib)[source]¶ Bases:
robot.running.dynamicmethods._DynamicMethod
-
name
¶
-
-
class
robot.running.dynamicmethods.
GetKeywordTypes
(lib)[source]¶ Bases:
robot.running.dynamicmethods._DynamicMethod
-
name
¶
-
robot.running.handlers module¶
robot.running.handlerstore module¶
robot.running.librarykeywordrunner module¶
-
class
robot.running.librarykeywordrunner.
LibraryKeywordRunner
(handler, name=None, languages=None)[source]¶ Bases:
object
-
library
¶
-
libname
¶
-
longname
¶
-
robot.running.libraryscopes module¶
robot.running.model module¶
Module implementing test execution related model objects.
When tests are executed by Robot Framework, a TestSuite
structure using
classes defined in this module is created by
TestSuiteBuilder
based on data on a file system. In addition to that, external tools can
create executable suite structures programmatically.
Regardless the approach to construct it, a TestSuite
object is executed
by calling its run()
method as shown in the example in
the robot.running
package level documentation. When a suite is run,
test, keywords, and other objects it contains can be inspected and modified
by using pre-run modifiers and listeners.
The TestSuite
class is exposed via the robot.api
package. If other
classes are needed, they can be imported from robot.running
.
-
class
robot.running.model.
Body
(parent: Union[TestSuite, TestCase, UserKeyword, For, ForIteration, If, IfBranch, Try, TryBranch, While, WhileIteration, Keyword, Return, Continue, Break, Error, None] = None, items: Iterable[BodyItem|DataDict] = ())[source]¶ Bases:
robot.model.body.BaseBody
-
append
(item: Union[T, Dict[str, Any]]) → T¶ 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
¶ Create a new item using the provided arguments.
-
create_break
(*args, **kwargs) → type¶
-
create_continue
(*args, **kwargs) → type¶
-
create_error
(*args, **kwargs) → type¶
-
create_for
(*args, **kwargs) → type¶
-
create_if
(*args, **kwargs) → type¶
-
create_keyword
(*args, **kwargs) → type¶
-
create_message
(*args, **kwargs) → type¶
-
create_return
(*args, **kwargs) → type¶
-
create_try
(*args, **kwargs) → type¶
-
create_while
(*args, **kwargs) → type¶
-
extend
(items: Iterable[Union[T, Dict[str, Any]]])¶ S.extend(iterable) – extend sequence by appending elements from the iterable
-
filter
(keywords: bool | None[bool, None] = None, messages: bool | None[bool, None] = None, predicate: Optional[Callable[[T], bool], None] = 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
() → list¶ 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.
-
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: int, item: Union[T, Dict[str, Any]])¶ S.insert(index, value) – insert value before index
-
item_type
¶ alias of
builtins.type
-
message_class
¶ alias of
builtins.type
-
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: Type[BI]) → Type[BI]¶ 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.
-
reverse
()¶ S.reverse() – reverse IN PLACE
-
sort
(**config)¶
-
to_dicts
() → list¶ Return list of items converted to dictionaries.
Items are converted to dictionaries using the
to_dict
method, if they have it, or the built-invars()
.New in Robot Framework 6.1.
-
visit
(visitor: SuiteVisitor)¶
-
-
class
robot.running.model.
Keyword
(name: str = '', args: Sequence[str] = (), assign: Sequence[str] = (), type: str = 'KEYWORD', parent: Union[TestSuite, TestCase, UserKeyword, For, If, IfBranch, Try, TryBranch, While, None] = None, lineno: int | None[int, None] = None)[source]¶ Bases:
robot.model.keyword.Keyword
,robot.running.model.WithSource
Represents an executable keyword call.
A keyword call consists only of a keyword name, arguments and possible assignment in the data:
Keyword arg ${result} = Another Keyword arg1 arg2
The actual keyword that is executed depends on the context where this model is executed.
-
lineno
¶
-
to_dict
() → Dict[str, Any][source]¶ Serialize this object into a dictionary.
The object can be later restored by using the
from_dict()
method.
-
BREAK
= 'BREAK'¶
-
CONTINUE
= 'CONTINUE'¶
-
ELSE
= 'ELSE'¶
-
ELSE_IF
= 'ELSE IF'¶
-
ERROR
= 'ERROR'¶
-
EXCEPT
= 'EXCEPT'¶
-
FINALLY
= 'FINALLY'¶
-
FOR
= 'FOR'¶
-
IF
= 'IF'¶
-
IF_ELSE_ROOT
= 'IF/ELSE ROOT'¶
-
ITERATION
= 'ITERATION'¶
-
KEYWORD
= 'KEYWORD'¶
-
MESSAGE
= 'MESSAGE'¶
-
RETURN
= 'RETURN'¶
-
SETUP
= 'SETUP'¶
-
TEARDOWN
= 'TEARDOWN'¶
-
TRY
= 'TRY'¶
-
TRY_EXCEPT_ROOT
= 'TRY/EXCEPT ROOT'¶
-
WHILE
= 'WHILE'¶
-
args
¶
-
assign
¶
-
config
(**attributes) → T¶ 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) → T¶ Return a shallow copy of this object.
Parameters: attributes – Attributes to be set to the returned copy. For example, obj.copy(name='New name')
.See also
deepcopy()
. The difference betweencopy
anddeepcopy
is the same as with the methods having same names in the copy module.
-
deepcopy
(**attributes) → T¶ Return a deep copy of this object.
Parameters: attributes – Attributes to be set to the returned copy. For example, obj.deepcopy(name='New name')
.See also
copy()
. The difference betweendeepcopy
andcopy
is the same as with the methods having same names in the copy module.
-
classmethod
from_dict
(data: Dict[str, Any]) → T¶ Create this object based on data in a dictionary.
Data can be got from the
to_dict()
method or created externally.
-
classmethod
from_json
(source: str | bytes | typing.TextIO | pathlib.Path[str, bytes, TextIO, pathlib.Path]) → T¶ 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, 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 apathlib.Path
instance.
-
id
¶ Item id in format like
s1-t3-k1
.See
TestSuite.id
for more information.id
isNone
only in these special cases:
-
name
¶
-
parent
¶
-
repr_args
= ('name', 'args', 'assign')¶
-
source
¶
-
to_json
(file: None | typing.TextIO | pathlib.Path | str[None, TextIO, pathlib.Path, str] = None, *, ensure_ascii: bool = False, indent: int = 0, separators: tuple = (', ', ':')) → None | str[None, str]¶ 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, 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.
-
type
¶
-
visit
(visitor: SuiteVisitor)[source]¶ Visitor interface
entry-point.
-
-
class
robot.running.model.
For
(variables: Sequence[str] = (), flavor: Literal[IN, IN RANGE, IN ENUMERATE, IN ZIP] = 'IN', values: Sequence[str] = (), start: str | None[str, None] = None, mode: str | None[str, None] = None, fill: str | None[str, None] = None, parent: Union[TestSuite, TestCase, UserKeyword, For, If, IfBranch, Try, TryBranch, While, None] = None, lineno: int | None[int, None] = None, error: str | None[str, None] = None)[source]¶ Bases:
robot.model.control.For
,robot.running.model.WithSource
-
lineno
¶
-
error
¶
-
to_dict
() → Dict[str, Any][source]¶ Serialize this object into a dictionary.
The object can be later restored by using the
from_dict()
method.
-
BREAK
= 'BREAK'¶
-
CONTINUE
= 'CONTINUE'¶
-
ELSE
= 'ELSE'¶
-
ELSE_IF
= 'ELSE IF'¶
-
ERROR
= 'ERROR'¶
-
EXCEPT
= 'EXCEPT'¶
-
FINALLY
= 'FINALLY'¶
-
FOR
= 'FOR'¶
-
IF
= 'IF'¶
-
IF_ELSE_ROOT
= 'IF/ELSE ROOT'¶
-
ITERATION
= 'ITERATION'¶
-
KEYWORD
= 'KEYWORD'¶
-
MESSAGE
= 'MESSAGE'¶
-
RETURN
= 'RETURN'¶
-
SETUP
= 'SETUP'¶
-
TEARDOWN
= 'TEARDOWN'¶
-
TRY
= 'TRY'¶
-
TRY_EXCEPT_ROOT
= 'TRY/EXCEPT ROOT'¶
-
WHILE
= 'WHILE'¶
-
body
¶
-
config
(**attributes) → T¶ 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) → T¶ Return a shallow copy of this object.
Parameters: attributes – Attributes to be set to the returned copy. For example, obj.copy(name='New name')
.See also
deepcopy()
. The difference betweencopy
anddeepcopy
is the same as with the methods having same names in the copy module.
-
deepcopy
(**attributes) → T¶ Return a deep copy of this object.
Parameters: attributes – Attributes to be set to the returned copy. For example, obj.deepcopy(name='New name')
.See also
copy()
. The difference betweendeepcopy
andcopy
is the same as with the methods having same names in the copy module.
-
fill
¶
-
flavor
¶
-
classmethod
from_dict
(data: Dict[str, Any]) → T¶ Create this object based on data in a dictionary.
Data can be got from the
to_dict()
method or created externally.
-
classmethod
from_json
(source: str | bytes | typing.TextIO | pathlib.Path[str, bytes, TextIO, pathlib.Path]) → T¶ 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, 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 apathlib.Path
instance.
-
id
¶ Item id in format like
s1-t3-k1
.See
TestSuite.id
for more information.id
isNone
only in these special cases:
-
mode
¶
-
parent
¶
-
repr_args
= ('variables', 'flavor', 'values', 'start', 'mode', 'fill')¶
-
source
¶
-
start
¶
-
to_json
(file: None | typing.TextIO | pathlib.Path | str[None, TextIO, pathlib.Path, str] = None, *, ensure_ascii: bool = False, indent: int = 0, separators: tuple = (', ', ':')) → None | str[None, str]¶ 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, 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.
-
type
= 'FOR'¶
-
values
¶
-
variables
¶
-
-
class
robot.running.model.
While
(condition: str | None[str, None] = None, limit: str | None[str, None] = None, on_limit: str | None[str, None] = None, on_limit_message: str | None[str, None] = None, parent: Union[TestSuite, TestCase, UserKeyword, For, If, IfBranch, Try, TryBranch, While, None] = None, lineno: int | None[int, None] = None, error: str | None[str, None] = None)[source]¶ Bases:
robot.model.control.While
,robot.running.model.WithSource
-
lineno
¶
-
error
¶
-
to_dict
() → Dict[str, Any][source]¶ Serialize this object into a dictionary.
The object can be later restored by using the
from_dict()
method.
-
BREAK
= 'BREAK'¶
-
CONTINUE
= 'CONTINUE'¶
-
ELSE
= 'ELSE'¶
-
ELSE_IF
= 'ELSE IF'¶
-
ERROR
= 'ERROR'¶
-
EXCEPT
= 'EXCEPT'¶
-
FINALLY
= 'FINALLY'¶
-
FOR
= 'FOR'¶
-
IF
= 'IF'¶
-
IF_ELSE_ROOT
= 'IF/ELSE ROOT'¶
-
ITERATION
= 'ITERATION'¶
-
KEYWORD
= 'KEYWORD'¶
-
MESSAGE
= 'MESSAGE'¶
-
RETURN
= 'RETURN'¶
-
SETUP
= 'SETUP'¶
-
TEARDOWN
= 'TEARDOWN'¶
-
TRY
= 'TRY'¶
-
TRY_EXCEPT_ROOT
= 'TRY/EXCEPT ROOT'¶
-
WHILE
= 'WHILE'¶
-
body
¶
-
condition
¶
-
config
(**attributes) → T¶ 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) → T¶ Return a shallow copy of this object.
Parameters: attributes – Attributes to be set to the returned copy. For example, obj.copy(name='New name')
.See also
deepcopy()
. The difference betweencopy
anddeepcopy
is the same as with the methods having same names in the copy module.
-
deepcopy
(**attributes) → T¶ Return a deep copy of this object.
Parameters: attributes – Attributes to be set to the returned copy. For example, obj.deepcopy(name='New name')
.See also
copy()
. The difference betweendeepcopy
andcopy
is the same as with the methods having same names in the copy module.
-
classmethod
from_dict
(data: Dict[str, Any]) → T¶ Create this object based on data in a dictionary.
Data can be got from the
to_dict()
method or created externally.
-
classmethod
from_json
(source: str | bytes | typing.TextIO | pathlib.Path[str, bytes, TextIO, pathlib.Path]) → T¶ 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, 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 apathlib.Path
instance.
-
id
¶ Item id in format like
s1-t3-k1
.See
TestSuite.id
for more information.id
isNone
only in these special cases:
-
limit
¶
-
on_limit
¶
-
on_limit_message
¶
-
parent
¶
-
repr_args
= ('condition', 'limit', 'on_limit', 'on_limit_message')¶
-
source
¶
-
to_json
(file: None | typing.TextIO | pathlib.Path | str[None, TextIO, pathlib.Path, str] = None, *, ensure_ascii: bool = False, indent: int = 0, separators: tuple = (', ', ':')) → None | str[None, str]¶ 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, 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.
-
type
= 'WHILE'¶
-
-
class
robot.running.model.
IfBranch
(type: str = 'IF', condition: str | None[str, None] = None, parent: Union[TestSuite, TestCase, UserKeyword, For, If, IfBranch, Try, TryBranch, While, None] = None, lineno: int | None[int, None] = None)[source]¶ Bases:
robot.model.control.IfBranch
,robot.running.model.WithSource
-
lineno
¶
-
to_dict
() → Dict[str, Any][source]¶ Serialize this object into a dictionary.
The object can be later restored by using the
from_dict()
method.
-
BREAK
= 'BREAK'¶
-
CONTINUE
= 'CONTINUE'¶
-
ELSE
= 'ELSE'¶
-
ELSE_IF
= 'ELSE IF'¶
-
ERROR
= 'ERROR'¶
-
EXCEPT
= 'EXCEPT'¶
-
FINALLY
= 'FINALLY'¶
-
FOR
= 'FOR'¶
-
IF
= 'IF'¶
-
IF_ELSE_ROOT
= 'IF/ELSE ROOT'¶
-
ITERATION
= 'ITERATION'¶
-
KEYWORD
= 'KEYWORD'¶
-
MESSAGE
= 'MESSAGE'¶
-
RETURN
= 'RETURN'¶
-
SETUP
= 'SETUP'¶
-
TEARDOWN
= 'TEARDOWN'¶
-
TRY
= 'TRY'¶
-
TRY_EXCEPT_ROOT
= 'TRY/EXCEPT ROOT'¶
-
WHILE
= 'WHILE'¶
-
body
¶
-
condition
¶
-
config
(**attributes) → T¶ 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) → T¶ Return a shallow copy of this object.
Parameters: attributes – Attributes to be set to the returned copy. For example, obj.copy(name='New name')
.See also
deepcopy()
. The difference betweencopy
anddeepcopy
is the same as with the methods having same names in the copy module.
-
deepcopy
(**attributes) → T¶ Return a deep copy of this object.
Parameters: attributes – Attributes to be set to the returned copy. For example, obj.deepcopy(name='New name')
.See also
copy()
. The difference betweendeepcopy
andcopy
is the same as with the methods having same names in the copy module.
-
classmethod
from_dict
(data: Dict[str, Any]) → T¶ Create this object based on data in a dictionary.
Data can be got from the
to_dict()
method or created externally.
-
classmethod
from_json
(source: str | bytes | typing.TextIO | pathlib.Path[str, bytes, TextIO, pathlib.Path]) → T¶ 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, 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 apathlib.Path
instance.
-
id
¶ Branch id omits IF/ELSE root from the parent id part.
-
parent
¶
-
repr_args
= ('type', 'condition')¶
-
source
¶
-
to_json
(file: None | typing.TextIO | pathlib.Path | str[None, TextIO, pathlib.Path, str] = None, *, ensure_ascii: bool = False, indent: int = 0, separators: tuple = (', ', ':')) → None | str[None, str]¶ 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, 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.
-
type
¶
-
-
class
robot.running.model.
If
(parent: Union[TestSuite, TestCase, UserKeyword, For, If, IfBranch, Try, TryBranch, While, None] = None, lineno: int | None[int, None] = None, error: str | None[str, None] = None)[source]¶ Bases:
robot.model.control.If
,robot.running.model.WithSource
-
lineno
¶
-
error
¶
-
to_dict
() → Dict[str, Any][source]¶ Serialize this object into a dictionary.
The object can be later restored by using the
from_dict()
method.
-
BREAK
= 'BREAK'¶
-
CONTINUE
= 'CONTINUE'¶
-
ELSE
= 'ELSE'¶
-
ELSE_IF
= 'ELSE IF'¶
-
ERROR
= 'ERROR'¶
-
EXCEPT
= 'EXCEPT'¶
-
FINALLY
= 'FINALLY'¶
-
FOR
= 'FOR'¶
-
IF
= 'IF'¶
-
IF_ELSE_ROOT
= 'IF/ELSE ROOT'¶
-
ITERATION
= 'ITERATION'¶
-
KEYWORD
= 'KEYWORD'¶
-
MESSAGE
= 'MESSAGE'¶
-
RETURN
= 'RETURN'¶
-
SETUP
= 'SETUP'¶
-
TEARDOWN
= 'TEARDOWN'¶
-
TRY
= 'TRY'¶
-
TRY_EXCEPT_ROOT
= 'TRY/EXCEPT ROOT'¶
-
WHILE
= 'WHILE'¶
-
body
¶
-
branches_class
= robot.model.control.Branches[robot.model.control.IfBranch]¶
-
config
(**attributes) → T¶ 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) → T¶ Return a shallow copy of this object.
Parameters: attributes – Attributes to be set to the returned copy. For example, obj.copy(name='New name')
.See also
deepcopy()
. The difference betweencopy
anddeepcopy
is the same as with the methods having same names in the copy module.
-
deepcopy
(**attributes) → T¶ Return a deep copy of this object.
Parameters: attributes – Attributes to be set to the returned copy. For example, obj.deepcopy(name='New name')
.See also
copy()
. The difference betweendeepcopy
andcopy
is the same as with the methods having same names in the copy module.
-
classmethod
from_dict
(data: Dict[str, Any]) → T¶ Create this object based on data in a dictionary.
Data can be got from the
to_dict()
method or created externally.
-
classmethod
from_json
(source: str | bytes | typing.TextIO | pathlib.Path[str, bytes, TextIO, pathlib.Path]) → T¶ 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, 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 apathlib.Path
instance.
-
id
¶ Root IF/ELSE id is always
None
.
-
parent
¶
-
repr_args
= ()¶
-
source
¶
-
to_json
(file: None | typing.TextIO | pathlib.Path | str[None, TextIO, pathlib.Path, str] = None, *, ensure_ascii: bool = False, indent: int = 0, separators: tuple = (', ', ':')) → None | str[None, str]¶ 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, 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.
-
type
= 'IF/ELSE ROOT'¶
-
-
class
robot.running.model.
TryBranch
(type: str = 'TRY', patterns: Sequence[str] = (), pattern_type: str | None[str, None] = None, variable: str | None[str, None] = None, parent: Union[TestSuite, TestCase, UserKeyword, For, If, IfBranch, Try, TryBranch, While, None] = None, lineno: int | None[int, None] = None)[source]¶ Bases:
robot.model.control.TryBranch
,robot.running.model.WithSource
-
lineno
¶
-
to_dict
() → Dict[str, Any][source]¶ Serialize this object into a dictionary.
The object can be later restored by using the
from_dict()
method.
-
BREAK
= 'BREAK'¶
-
CONTINUE
= 'CONTINUE'¶
-
ELSE
= 'ELSE'¶
-
ELSE_IF
= 'ELSE IF'¶
-
ERROR
= 'ERROR'¶
-
EXCEPT
= 'EXCEPT'¶
-
FINALLY
= 'FINALLY'¶
-
FOR
= 'FOR'¶
-
IF
= 'IF'¶
-
IF_ELSE_ROOT
= 'IF/ELSE ROOT'¶
-
ITERATION
= 'ITERATION'¶
-
KEYWORD
= 'KEYWORD'¶
-
MESSAGE
= 'MESSAGE'¶
-
RETURN
= 'RETURN'¶
-
SETUP
= 'SETUP'¶
-
TEARDOWN
= 'TEARDOWN'¶
-
TRY
= 'TRY'¶
-
TRY_EXCEPT_ROOT
= 'TRY/EXCEPT ROOT'¶
-
WHILE
= 'WHILE'¶
-
body
¶
-
config
(**attributes) → T¶ 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) → T¶ Return a shallow copy of this object.
Parameters: attributes – Attributes to be set to the returned copy. For example, obj.copy(name='New name')
.See also
deepcopy()
. The difference betweencopy
anddeepcopy
is the same as with the methods having same names in the copy module.
-
deepcopy
(**attributes) → T¶ Return a deep copy of this object.
Parameters: attributes – Attributes to be set to the returned copy. For example, obj.deepcopy(name='New name')
.See also
copy()
. The difference betweendeepcopy
andcopy
is the same as with the methods having same names in the copy module.
-
classmethod
from_dict
(data: Dict[str, Any]) → T¶ Create this object based on data in a dictionary.
Data can be got from the
to_dict()
method or created externally.
-
classmethod
from_json
(source: str | bytes | typing.TextIO | pathlib.Path[str, bytes, TextIO, pathlib.Path]) → T¶ 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, 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 apathlib.Path
instance.
-
id
¶ Branch id omits TRY/EXCEPT root from the parent id part.
-
parent
¶
-
pattern_type
¶
-
patterns
¶
-
repr_args
= ('type', 'patterns', 'pattern_type', 'variable')¶
-
source
¶
-
to_json
(file: None | typing.TextIO | pathlib.Path | str[None, TextIO, pathlib.Path, str] = None, *, ensure_ascii: bool = False, indent: int = 0, separators: tuple = (', ', ':')) → None | str[None, str]¶ 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, 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.
-
type
¶
-
variable
¶
-
-
class
robot.running.model.
Try
(parent: Union[TestSuite, TestCase, UserKeyword, For, If, IfBranch, Try, TryBranch, While, None] = None, lineno: int | None[int, None] = None, error: str | None[str, None] = None)[source]¶ Bases:
robot.model.control.Try
,robot.running.model.WithSource
-
lineno
¶
-
error
¶
-
to_dict
() → Dict[str, Any][source]¶ Serialize this object into a dictionary.
The object can be later restored by using the
from_dict()
method.
-
BREAK
= 'BREAK'¶
-
CONTINUE
= 'CONTINUE'¶
-
ELSE
= 'ELSE'¶
-
ELSE_IF
= 'ELSE IF'¶
-
ERROR
= 'ERROR'¶
-
EXCEPT
= 'EXCEPT'¶
-
FINALLY
= 'FINALLY'¶
-
FOR
= 'FOR'¶
-
IF
= 'IF'¶
-
IF_ELSE_ROOT
= 'IF/ELSE ROOT'¶
-
ITERATION
= 'ITERATION'¶
-
KEYWORD
= 'KEYWORD'¶
-
MESSAGE
= 'MESSAGE'¶
-
RETURN
= 'RETURN'¶
-
SETUP
= 'SETUP'¶
-
TEARDOWN
= 'TEARDOWN'¶
-
TRY
= 'TRY'¶
-
TRY_EXCEPT_ROOT
= 'TRY/EXCEPT ROOT'¶
-
WHILE
= 'WHILE'¶
-
body
¶
-
branches_class
= robot.model.control.Branches[robot.model.control.TryBranch]¶
-
config
(**attributes) → T¶ 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) → T¶ Return a shallow copy of this object.
Parameters: attributes – Attributes to be set to the returned copy. For example, obj.copy(name='New name')
.See also
deepcopy()
. The difference betweencopy
anddeepcopy
is the same as with the methods having same names in the copy module.
-
deepcopy
(**attributes) → T¶ Return a deep copy of this object.
Parameters: attributes – Attributes to be set to the returned copy. For example, obj.deepcopy(name='New name')
.See also
copy()
. The difference betweendeepcopy
andcopy
is the same as with the methods having same names in the copy module.
-
else_branch
¶
-
except_branches
¶
-
finally_branch
¶
-
classmethod
from_dict
(data: Dict[str, Any]) → T¶ Create this object based on data in a dictionary.
Data can be got from the
to_dict()
method or created externally.
-
classmethod
from_json
(source: str | bytes | typing.TextIO | pathlib.Path[str, bytes, TextIO, pathlib.Path]) → T¶ 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, 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 apathlib.Path
instance.
-
id
¶ Root TRY/EXCEPT id is always
None
.
-
parent
¶
-
repr_args
= ()¶
-
source
¶
-
to_json
(file: None | typing.TextIO | pathlib.Path | str[None, TextIO, pathlib.Path, str] = None, *, ensure_ascii: bool = False, indent: int = 0, separators: tuple = (', ', ':')) → None | str[None, str]¶ 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, 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.
-
try_branch
¶
-
type
= 'TRY/EXCEPT ROOT'¶
-
-
class
robot.running.model.
Return
(values: Sequence[str] = (), parent: Union[TestSuite, TestCase, UserKeyword, For, If, IfBranch, Try, TryBranch, While, None] = None, lineno: int | None[int, None] = None, error: str | None[str, None] = None)[source]¶ Bases:
robot.model.control.Return
,robot.running.model.WithSource
-
lineno
¶
-
error
¶
-
to_dict
() → Dict[str, Any][source]¶ Serialize this object into a dictionary.
The object can be later restored by using the
from_dict()
method.
-
BREAK
= 'BREAK'¶
-
CONTINUE
= 'CONTINUE'¶
-
ELSE
= 'ELSE'¶
-
ELSE_IF
= 'ELSE IF'¶
-
ERROR
= 'ERROR'¶
-
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) → T¶ 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) → T¶ Return a shallow copy of this object.
Parameters: attributes – Attributes to be set to the returned copy. For example, obj.copy(name='New name')
.See also
deepcopy()
. The difference betweencopy
anddeepcopy
is the same as with the methods having same names in the copy module.
-
deepcopy
(**attributes) → T¶ Return a deep copy of this object.
Parameters: attributes – Attributes to be set to the returned copy. For example, obj.deepcopy(name='New name')
.See also
copy()
. The difference betweendeepcopy
andcopy
is the same as with the methods having same names in the copy module.
-
classmethod
from_dict
(data: Dict[str, Any]) → T¶ Create this object based on data in a dictionary.
Data can be got from the
to_dict()
method or created externally.
-
classmethod
from_json
(source: str | bytes | typing.TextIO | pathlib.Path[str, bytes, TextIO, pathlib.Path]) → T¶ 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, 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 apathlib.Path
instance.
-
id
¶ Item id in format like
s1-t3-k1
.See
TestSuite.id
for more information.id
isNone
only in these special cases:
-
parent
¶
-
repr_args
= ('values',)¶
-
source
¶
-
to_json
(file: None | typing.TextIO | pathlib.Path | str[None, TextIO, pathlib.Path, str] = None, *, ensure_ascii: bool = False, indent: int = 0, separators: tuple = (', ', ':')) → None | str[None, str]¶ 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, 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.
-
type
= 'RETURN'¶
-
values
¶
-
-
class
robot.running.model.
Continue
(parent: Union[TestSuite, TestCase, UserKeyword, For, If, IfBranch, Try, TryBranch, While, None] = None, lineno: int | None[int, None] = None, error: str | None[str, None] = None)[source]¶ Bases:
robot.model.control.Continue
,robot.running.model.WithSource
-
lineno
¶
-
error
¶
-
to_dict
() → Dict[str, Any][source]¶ Serialize this object into a dictionary.
The object can be later restored by using the
from_dict()
method.
-
BREAK
= 'BREAK'¶
-
CONTINUE
= 'CONTINUE'¶
-
ELSE
= 'ELSE'¶
-
ELSE_IF
= 'ELSE IF'¶
-
ERROR
= 'ERROR'¶
-
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) → T¶ 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) → T¶ Return a shallow copy of this object.
Parameters: attributes – Attributes to be set to the returned copy. For example, obj.copy(name='New name')
.See also
deepcopy()
. The difference betweencopy
anddeepcopy
is the same as with the methods having same names in the copy module.
-
deepcopy
(**attributes) → T¶ Return a deep copy of this object.
Parameters: attributes – Attributes to be set to the returned copy. For example, obj.deepcopy(name='New name')
.See also
copy()
. The difference betweendeepcopy
andcopy
is the same as with the methods having same names in the copy module.
-
classmethod
from_dict
(data: Dict[str, Any]) → T¶ Create this object based on data in a dictionary.
Data can be got from the
to_dict()
method or created externally.
-
classmethod
from_json
(source: str | bytes | typing.TextIO | pathlib.Path[str, bytes, TextIO, pathlib.Path]) → T¶ 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, 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 apathlib.Path
instance.
-
id
¶ Item id in format like
s1-t3-k1
.See
TestSuite.id
for more information.id
isNone
only in these special cases:
-
parent
¶
-
repr_args
= ()¶
-
source
¶
-
to_json
(file: None | typing.TextIO | pathlib.Path | str[None, TextIO, pathlib.Path, str] = None, *, ensure_ascii: bool = False, indent: int = 0, separators: tuple = (', ', ':')) → None | str[None, str]¶ 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, 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.
-
type
= 'CONTINUE'¶
-
-
class
robot.running.model.
Break
(parent: Union[TestSuite, TestCase, UserKeyword, For, If, IfBranch, Try, TryBranch, While, None] = None, lineno: int | None[int, None] = None, error: str | None[str, None] = None)[source]¶ Bases:
robot.model.control.Break
,robot.running.model.WithSource
-
lineno
¶
-
error
¶
-
to_dict
() → Dict[str, Any][source]¶ Serialize this object into a dictionary.
The object can be later restored by using the
from_dict()
method.
-
BREAK
= 'BREAK'¶
-
CONTINUE
= 'CONTINUE'¶
-
ELSE
= 'ELSE'¶
-
ELSE_IF
= 'ELSE IF'¶
-
ERROR
= 'ERROR'¶
-
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) → T¶ 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) → T¶ Return a shallow copy of this object.
Parameters: attributes – Attributes to be set to the returned copy. For example, obj.copy(name='New name')
.See also
deepcopy()
. The difference betweencopy
anddeepcopy
is the same as with the methods having same names in the copy module.
-
deepcopy
(**attributes) → T¶ Return a deep copy of this object.
Parameters: attributes – Attributes to be set to the returned copy. For example, obj.deepcopy(name='New name')
.See also
copy()
. The difference betweendeepcopy
andcopy
is the same as with the methods having same names in the copy module.
-
classmethod
from_dict
(data: Dict[str, Any]) → T¶ Create this object based on data in a dictionary.
Data can be got from the
to_dict()
method or created externally.
-
classmethod
from_json
(source: str | bytes | typing.TextIO | pathlib.Path[str, bytes, TextIO, pathlib.Path]) → T¶ 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, 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 apathlib.Path
instance.
-
id
¶ Item id in format like
s1-t3-k1
.See
TestSuite.id
for more information.id
isNone
only in these special cases:
-
parent
¶
-
repr_args
= ()¶
-
source
¶
-
to_json
(file: None | typing.TextIO | pathlib.Path | str[None, TextIO, pathlib.Path, str] = None, *, ensure_ascii: bool = False, indent: int = 0, separators: tuple = (', ', ':')) → None | str[None, str]¶ 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, 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.
-
type
= 'BREAK'¶
-
-
class
robot.running.model.
Error
(values: Sequence[str] = (), parent: Union[TestSuite, TestCase, UserKeyword, For, If, IfBranch, Try, TryBranch, While, None] = None, lineno: int | None[int, None] = None, error: str = '')[source]¶ Bases:
robot.model.control.Error
,robot.running.model.WithSource
-
lineno
¶
-
error
¶
-
to_dict
() → Dict[str, Any][source]¶ Serialize this object into a dictionary.
The object can be later restored by using the
from_dict()
method.
-
BREAK
= 'BREAK'¶
-
CONTINUE
= 'CONTINUE'¶
-
ELSE
= 'ELSE'¶
-
ELSE_IF
= 'ELSE IF'¶
-
ERROR
= 'ERROR'¶
-
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) → T¶ 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) → T¶ Return a shallow copy of this object.
Parameters: attributes – Attributes to be set to the returned copy. For example, obj.copy(name='New name')
.See also
deepcopy()
. The difference betweencopy
anddeepcopy
is the same as with the methods having same names in the copy module.
-
deepcopy
(**attributes) → T¶ Return a deep copy of this object.
Parameters: attributes – Attributes to be set to the returned copy. For example, obj.deepcopy(name='New name')
.See also
copy()
. The difference betweendeepcopy
andcopy
is the same as with the methods having same names in the copy module.
-
classmethod
from_dict
(data: Dict[str, Any]) → T¶ Create this object based on data in a dictionary.
Data can be got from the
to_dict()
method or created externally.
-
classmethod
from_json
(source: str | bytes | typing.TextIO | pathlib.Path[str, bytes, TextIO, pathlib.Path]) → T¶ 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, 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 apathlib.Path
instance.
-
id
¶ Item id in format like
s1-t3-k1
.See
TestSuite.id
for more information.id
isNone
only in these special cases:
-
parent
¶
-
repr_args
= ('values',)¶
-
source
¶
-
to_json
(file: None | typing.TextIO | pathlib.Path | str[None, TextIO, pathlib.Path, str] = None, *, ensure_ascii: bool = False, indent: int = 0, separators: tuple = (', ', ':')) → None | str[None, str]¶ 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, 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.
-
type
= 'ERROR'¶
-
values
¶
-
-
class
robot.running.model.
TestCase
(name: str = '', doc: str = '', tags: Sequence[str] = (), timeout: str | None[str, None] = None, lineno: int | None[int, None] = None, parent: robot.running.model.TestSuite | None[robot.running.model.TestSuite, None] = None, template: str | None[str, None] = None, error: str | None[str, None] = None)[source]¶ Bases:
robot.model.testcase.TestCase
Represents a single executable test case.
See the base class for documentation of attributes not documented here.
-
template
¶
-
error
¶
-
to_dict
() → Dict[str, Any][source]¶ Serialize this object into a dictionary.
The object can be later restored by using the
from_dict()
method.
-
body
¶ Test body as a
Body
object.
-
config
(**attributes) → T¶ 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) → T¶ Return a shallow copy of this object.
Parameters: attributes – Attributes to be set to the returned copy. For example, obj.copy(name='New name')
.See also
deepcopy()
. The difference betweencopy
anddeepcopy
is the same as with the methods having same names in the copy module.
-
deepcopy
(**attributes) → T¶ Return a deep copy of this object.
Parameters: attributes – Attributes to be set to the returned copy. For example, obj.deepcopy(name='New name')
.See also
copy()
. The difference betweendeepcopy
andcopy
is the same as with the methods having same names in the copy module.
-
doc
¶
-
classmethod
from_dict
(data: Dict[str, Any]) → T¶ Create this object based on data in a dictionary.
Data can be got from the
to_dict()
method or created externally.
-
classmethod
from_json
(source: str | bytes | typing.TextIO | pathlib.Path[str, bytes, TextIO, pathlib.Path]) → T¶ 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, 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 apathlib.Path
instance.
-
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.
-
lineno
¶
-
longname
¶ Test name prefixed with the long name of the parent suite.
-
name
¶
-
parent
¶
-
repr_args
= ('name',)¶
-
setup
¶ Test setup as a
Keyword
object.This attribute is a
Keyword
object also when a test has no setup but in that case its truth value 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
.
-
source
¶
Test tags as a
Tags
object.
-
timeout
¶
-
to_json
(file: None | typing.TextIO | pathlib.Path | str[None, TextIO, pathlib.Path, str] = None, *, ensure_ascii: bool = False, indent: int = 0, separators: tuple = (', ', ':')) → None | str[None, str]¶ 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, 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.
-
visit
(visitor: SuiteVisitor)[source]¶ Visitor interface
entry-point.
-
-
class
robot.running.model.
TestSuite
(name: str = '', doc: str = '', metadata: Optional[Mapping[str, str], None] = None, source: pathlib.Path | str | None[pathlib.Path, str, None] = None, rpa: bool | None[bool, None] = None, parent: robot.running.model.TestSuite | None[robot.running.model.TestSuite, None] = None)[source]¶ Bases:
robot.model.testsuite.TestSuite
Represents a single executable test suite.
See the base class for documentation of attributes not documented here.
-
resource
¶ ResourceFile
instance containing imports, variables and keywords the suite owns. When data is parsed from the file system, this data comes from the same test case file that creates the suite.
-
classmethod
from_file_system
(*paths, **config) → robot.running.model.TestSuite[source]¶ Create a
TestSuite
object based on the givenpaths
.Parameters: - paths – File or directory paths where to read the data from.
- config – Configuration parameters for
TestSuiteBuilder
class that is used internally for building the suite.
See also
from_model()
andfrom_string()
.
-
classmethod
from_model
(model: File, name: str|None = None, *, defaults: TestDefaults|None = None) → TestSuite[source]¶ Create a
TestSuite
object based on the givenmodel
.Parameters: - model – Model to create the suite from.
- name – Deprecated since Robot Framework 6.1.
- defaults – Possible test specific defaults from suite initialization files. New in Robot Framework 6.1.
The model can be created by using the
get_model()
function and possibly modified by other tooling in therobot.parsing
module.Giving suite name is deprecated and users should set it and possible other attributes to the returned suite separately. One easy way is using the
config()
method like this:suite = TestSuite.from_model(model).config(name='X', doc='Example')
See also
from_file_system()
andfrom_string()
.
-
classmethod
from_string
(string: str, *, defaults: TestDefaults|None = None, **config) → TestSuite[source]¶ Create a
TestSuite
object based on the givenstring
.Parameters: - string – String to create the suite from.
- defaults – Possible test specific defaults from suite initialization files.
- config – Configuration parameters for
get_model()
used internally.
If suite name or other attributes need to be set, an easy way is using the
config()
method like this:suite = TestSuite.from_string(string).config(name='X', doc='Example')
New in Robot Framework 6.1. See also
from_model()
andfrom_file_system()
.
-
configure
(randomize_suites: bool = False, randomize_tests: bool = False, randomize_seed: int | None[int, None] = None, **options)[source]¶ A shortcut to configure a suite using one method call.
Can only be used with the root test suite.
Parameters: - randomize_xxx – Passed to
randomize()
. - options – Passed to
SuiteConfigurer
that will then set suite attributes, callfilter()
, etc. as needed.
Example:
suite.configure(included_tags=['smoke'], doc='Smoke test results.')
Not to be confused with
config()
method that suites, tests, and keywords have to make it possible to set multiple attributes in one call.- randomize_xxx – Passed to
-
randomize
(suites: bool = True, tests: bool = True, seed: int | None[int, None] = None)[source]¶ Randomizes the order of suites and/or tests, recursively.
Parameters: - suites – Boolean controlling should suites be randomized.
- tests – Boolean controlling should tests be randomized.
- seed – Random seed. Can be given if previous random order needs to be re-created. Seed value is always shown in logs and reports.
-
suites
¶
-
run
(settings=None, **options)[source]¶ Executes the suite based on the given
settings
oroptions
.Parameters: - settings –
RobotSettings
object to configure test execution. - options – Used to construct new
RobotSettings
object ifsettings
are not given.
Returns: Result
object with information about executed suites and tests.If
options
are used, their names are the same as long command line options except without hyphens. Some options are ignored (see below), but otherwise they have the same semantics as on the command line. Options that can be given on the command line multiple times can be passed as lists likevariable=['VAR1:value1', 'VAR2:value2']
. If such an option is used only once, it can be given also as a single string likevariable='VAR:value'
.Additionally listener option allows passing object directly instead of listener name, e.g.
run('tests.robot', listener=Listener())
.To capture stdout and/or stderr streams, pass open file objects in as special keyword arguments
stdout
andstderr
, respectively.Only options related to the actual test execution have an effect. For example, options related to selecting or modifying test cases or suites (e.g.
--include
,--name
,--prerunmodifier
) or creating logs and reports are silently ignored. The output XML generated as part of the execution can be configured, though. This includes disabling it withoutput=None
.Example:
stdout = StringIO() result = suite.run(variable='EXAMPLE:value', output='example.xml', exitonfailure=True, stdout=stdout) print(result.return_code)
To save memory, the returned
Result
object does not have any information about the executed keywords. If that information is needed, the created output XML file needs to be read using theExecutionResult
factory method.See the
package level
documentation for more examples, including how to construct executable test suites and how to create logs and reports based on the execution results.See the
robot.run
function for a higher-level API for executing tests in files or directories.- settings –
-
to_dict
() → Dict[str, Any][source]¶ Serialize this object into a dictionary.
The object can be later restored by using the
from_dict()
method.
-
adjust_source
(relative_to: pathlib.Path | str | None[pathlib.Path, str, None] = None, root: pathlib.Path | str | None[pathlib.Path, str, None] = None)[source]¶ Adjust suite source and child suite sources, recursively.
Parameters: - 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.running 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.json') # Recreate suite elsewhere and adjust source accordingly. suite = TestSuite.from_json('data.json') suite.adjust_source(root='/new/path/to')
New in Robot Framework 6.1.
- relative_to – Make suite source relative to the given path. Calls
pathlib.Path.relative_to() internally. Raises
-
all_tests
¶ Yields all tests this suite and its child suites contain.
New in Robot Framework 6.1.
-
config
(**attributes) → T¶ 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) → T¶ Return a shallow copy of this object.
Parameters: attributes – Attributes to be set to the returned copy. For example, obj.copy(name='New name')
.See also
deepcopy()
. The difference betweencopy
anddeepcopy
is the same as with the methods having same names in the copy module.
-
deepcopy
(**attributes) → T¶ Return a deep copy of this object.
Parameters: attributes – Attributes to be set to the returned copy. For example, obj.deepcopy(name='New name')
.See also
copy()
. The difference betweendeepcopy
andcopy
is the same as with the methods having same names in the copy module.
-
doc
¶
-
filter
(included_suites: Optional[Sequence[str], None] = None, included_tests: Optional[Sequence[str], None] = None, included_tags: Optional[Sequence[str], None] = None, excluded_tags: Optional[Sequence[str], None] = 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')
-
classmethod
from_dict
(data: Dict[str, Any]) → T¶ Create this object based on data in a dictionary.
Data can be got from the
to_dict()
method or created externally.
-
classmethod
from_json
(source: str | bytes | typing.TextIO | pathlib.Path[str, bytes, TextIO, pathlib.Path]) → T¶ 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, 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 apathlib.Path
instance.
-
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 it can have some effect on memory usage.New in Robot Framework 5.0.
-
has_teardown
¶ Check does a suite have a teardown without creating a teardown object.
See
has_setup
for more information.New in Robot Framework 5.0.
-
has_tests
¶
-
id
¶ An automatically generated unique id.
The root suite has id
s1
, its child suites have 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
.
-
longname
¶ Suite name prefixed with the long name of the parent suite.
-
name
¶ 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.
-
static
name_from_source
(source: pathlib.Path | str | None[pathlib.Path, str, None], extension: Sequence[str] = ()) → str[source]¶ 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 optionalextension
argument.Examples:
TestSuite.name_from_source(source) TestSuite.name_from_source(source, extension='.robot.zip') TestSuite.name_from_source(source, ('.robot', '.robot.zip'))
- If the source is
-
parent
¶
-
remove_empty_suites
(preserve_direct_children: bool = False)[source]¶ Removes all child suites not containing any tests, recursively.
-
repr_args
= ('name',)¶
-
rpa
¶
Add and/or remove specified tags to the tests in this suite.
Parameters: - add – Tags to add as a list or, if adding only one, as a single string.
- remove – Tags to remove as a list or as a single string.
Can be given as patterns where
*
and?
work as wildcards. - persist – Add/remove specified tags also to new tests added to this suite in the future.
-
setup
¶ Suite setup.
This attribute is a
Keyword
object also when a suite has no setup but in that case its truth value isFalse
. The preferred way to check does a suite have a setup is usinghas_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 underlyingKeyword
object:suite.setup = None
New in Robot Framework 4.0. Earlier setup was accessed like
suite.keywords.setup
.
-
source
¶
-
test_count
¶ Total number of the tests in this suite and in its child suites.
-
tests
¶
-
to_json
(file: None | typing.TextIO | pathlib.Path | str[None, TextIO, pathlib.Path, str] = None, *, ensure_ascii: bool = False, indent: int = 0, separators: tuple = (', ', ':')) → None | str[None, str]¶ 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, 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.
-
visit
(visitor: robot.model.visitor.SuiteVisitor)[source]¶ Visitor interface
entry-point.
-
-
class
robot.running.model.
Variable
(name: str = '', value: Sequence[str] = (), parent: robot.running.model.ResourceFile | None[robot.running.model.ResourceFile, None] = None, lineno: int | None[int, None] = None, error: str | None[str, None] = None)[source]¶ Bases:
robot.model.modelobject.ModelObject
-
repr_args
= ('name', 'value')¶
-
source
¶
-
to_dict
() → Dict[str, Any][source]¶ Serialize this object into a dictionary.
The object can be later restored by using the
from_dict()
method.
-
config
(**attributes) → T¶ 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) → T¶ Return a shallow copy of this object.
Parameters: attributes – Attributes to be set to the returned copy. For example, obj.copy(name='New name')
.See also
deepcopy()
. The difference betweencopy
anddeepcopy
is the same as with the methods having same names in the copy module.
-
deepcopy
(**attributes) → T¶ Return a deep copy of this object.
Parameters: attributes – Attributes to be set to the returned copy. For example, obj.deepcopy(name='New name')
.See also
copy()
. The difference betweendeepcopy
andcopy
is the same as with the methods having same names in the copy module.
-
classmethod
from_dict
(data: Dict[str, Any]) → T¶ Create this object based on data in a dictionary.
Data can be got from the
to_dict()
method or created externally.
-
classmethod
from_json
(source: str | bytes | typing.TextIO | pathlib.Path[str, bytes, TextIO, pathlib.Path]) → T¶ 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, 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 apathlib.Path
instance.
-
to_json
(file: None | typing.TextIO | pathlib.Path | str[None, TextIO, pathlib.Path, str] = None, *, ensure_ascii: bool = False, indent: int = 0, separators: tuple = (', ', ':')) → None | str[None, str]¶ 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, 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.
-
-
class
robot.running.model.
ResourceFile
(source: pathlib.Path | str | None[pathlib.Path, str, None] = None, parent: robot.running.model.TestSuite | None[robot.running.model.TestSuite, None] = None, doc: str = '')[source]¶ Bases:
robot.model.modelobject.ModelObject
-
repr_args
= ('source',)¶
-
parent
¶
-
doc
¶
-
source
¶
-
imports
¶
-
variables
¶
-
keywords
¶
-
to_dict
() → Dict[str, Any][source]¶ Serialize this object into a dictionary.
The object can be later restored by using the
from_dict()
method.
-
config
(**attributes) → T¶ 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) → T¶ Return a shallow copy of this object.
Parameters: attributes – Attributes to be set to the returned copy. For example, obj.copy(name='New name')
.See also
deepcopy()
. The difference betweencopy
anddeepcopy
is the same as with the methods having same names in the copy module.
-
deepcopy
(**attributes) → T¶ Return a deep copy of this object.
Parameters: attributes – Attributes to be set to the returned copy. For example, obj.deepcopy(name='New name')
.See also
copy()
. The difference betweendeepcopy
andcopy
is the same as with the methods having same names in the copy module.
-
classmethod
from_dict
(data: Dict[str, Any]) → T¶ Create this object based on data in a dictionary.
Data can be got from the
to_dict()
method or created externally.
-
classmethod
from_json
(source: str | bytes | typing.TextIO | pathlib.Path[str, bytes, TextIO, pathlib.Path]) → T¶ 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, 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 apathlib.Path
instance.
-
to_json
(file: None | typing.TextIO | pathlib.Path | str[None, TextIO, pathlib.Path, str] = None, *, ensure_ascii: bool = False, indent: int = 0, separators: tuple = (', ', ':')) → None | str[None, str]¶ 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, 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.
-
-
class
robot.running.model.
UserKeyword
(name: str = '', args: Sequence[str] = (), doc: str = '', tags: Sequence[str] = (), return_: Sequence[str] = (), timeout: str | None[str, None] = None, lineno: int | None[int, None] = None, parent: robot.running.model.ResourceFile | None[robot.running.model.ResourceFile, None] = None, error: str | None[str, None] = None)[source]¶ Bases:
robot.model.modelobject.ModelObject
-
repr_args
= ('name', 'args')¶
-
name
¶
-
args
¶
-
doc
¶
-
return_
¶
-
timeout
¶
-
lineno
¶
-
parent
¶
-
error
¶
-
body
¶
-
teardown
¶
-
has_teardown
¶ Check does a keyword have a teardown without creating a teardown object.
A difference between using
if uk.has_teardown:
andif uk.teardown:
is that accessing theteardown
attribute creates aKeyword
object representing the teardown even when the user keyword actually does not have one. This can have an effect on memory usage.New in Robot Framework 6.1.
-
source
¶
-
to_dict
() → Dict[str, Any][source]¶ Serialize this object into a dictionary.
The object can be later restored by using the
from_dict()
method.
-
config
(**attributes) → T¶ 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) → T¶ Return a shallow copy of this object.
Parameters: attributes – Attributes to be set to the returned copy. For example, obj.copy(name='New name')
.See also
deepcopy()
. The difference betweencopy
anddeepcopy
is the same as with the methods having same names in the copy module.
-
deepcopy
(**attributes) → T¶ Return a deep copy of this object.
Parameters: attributes – Attributes to be set to the returned copy. For example, obj.deepcopy(name='New name')
.See also
copy()
. The difference betweendeepcopy
andcopy
is the same as with the methods having same names in the copy module.
-
classmethod
from_dict
(data: Dict[str, Any]) → T¶ Create this object based on data in a dictionary.
Data can be got from the
to_dict()
method or created externally.
-
classmethod
from_json
(source: str | bytes | typing.TextIO | pathlib.Path[str, bytes, TextIO, pathlib.Path]) → T¶ 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, 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 apathlib.Path
instance.
-
to_json
(file: None | typing.TextIO | pathlib.Path | str[None, TextIO, pathlib.Path, str] = None, *, ensure_ascii: bool = False, indent: int = 0, separators: tuple = (', ', ':')) → None | str[None, str]¶ 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, 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.
-
-
class
robot.running.model.
Import
(type: Literal[LIBRARY, RESOURCE, VARIABLES], name: str, args: Sequence[str] = (), alias: str | None[str, None] = None, parent: robot.running.model.ResourceFile | None[robot.running.model.ResourceFile, None] = None, lineno: int | None[int, None] = None)[source]¶ Bases:
robot.model.modelobject.ModelObject
-
repr_args
= ('type', 'name', 'args', 'alias')¶
-
LIBRARY
= 'LIBRARY'¶
-
RESOURCE
= 'RESOURCE'¶
-
VARIABLES
= 'VARIABLES'¶
-
source
¶
-
directory
¶
-
setting_name
¶
-
classmethod
from_dict
(data) → robot.running.model.Import[source]¶ Create this object based on data in a dictionary.
Data can be got from the
to_dict()
method or created externally.
-
to_dict
() → Dict[str, Any][source]¶ Serialize this object into a dictionary.
The object can be later restored by using the
from_dict()
method.
-
config
(**attributes) → T¶ 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) → T¶ Return a shallow copy of this object.
Parameters: attributes – Attributes to be set to the returned copy. For example, obj.copy(name='New name')
.See also
deepcopy()
. The difference betweencopy
anddeepcopy
is the same as with the methods having same names in the copy module.
-
deepcopy
(**attributes) → T¶ Return a deep copy of this object.
Parameters: attributes – Attributes to be set to the returned copy. For example, obj.deepcopy(name='New name')
.See also
copy()
. The difference betweendeepcopy
andcopy
is the same as with the methods having same names in the copy module.
-
classmethod
from_json
(source: str | bytes | typing.TextIO | pathlib.Path[str, bytes, TextIO, pathlib.Path]) → T¶ 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, 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 apathlib.Path
instance.
-
to_json
(file: None | typing.TextIO | pathlib.Path | str[None, TextIO, pathlib.Path, str] = None, *, ensure_ascii: bool = False, indent: int = 0, separators: tuple = (', ', ':')) → None | str[None, str]¶ 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, 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.
-
-
class
robot.running.model.
Imports
(parent: robot.running.model.ResourceFile, imports: Sequence[robot.running.model.Import] = ())[source]¶ Bases:
robot.model.itemlist.ItemList
-
append
(item: Union[T, Dict[str, Any]]) → T¶ 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: Iterable[Union[T, Dict[str, Any]]])¶ 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: int, item: Union[T, Dict[str, Any]])¶ S.insert(index, value) – insert value before index
-
item_type
¶ alias of
builtins.type
-
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
(**config)¶
-
to_dicts
() → list¶ Return list of items converted to dictionaries.
Items are converted to dictionaries using the
to_dict
method, if they have it, or the built-invars()
.New in Robot Framework 6.1.
-
visit
(visitor: SuiteVisitor)¶
-
library
(name: str, args: Sequence[str] = (), alias: str | None[str, None] = None, lineno: int | None[int, None] = None) → robot.running.model.Import[source]¶ Create library import.
-
resource
(name: str, lineno: int | None[int, None] = None) → robot.running.model.Import[source]¶ Create resource import.
-
variables
(name: str, args: Sequence[str] = (), lineno: int | None[int, None] = None) → robot.running.model.Import[source]¶ Create variables import.
-
create
(*args, **kwargs) → robot.running.model.Import[source]¶ Generic method for creating imports.
Import type specific methods
library()
,resource()
andvariables()
are recommended over this method.
-
-
class
robot.running.model.
Variables
(parent: robot.running.model.ResourceFile, variables: Sequence[robot.running.model.Variable] = ())[source]¶ Bases:
robot.model.itemlist.ItemList
-
append
(item: Union[T, Dict[str, Any]]) → T¶ 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) → T¶ Create a new item using the provided arguments.
-
extend
(items: Iterable[Union[T, Dict[str, Any]]])¶ 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: int, item: Union[T, Dict[str, Any]])¶ S.insert(index, value) – insert value before index
-
item_type
¶ alias of
builtins.type
-
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
(**config)¶
-
to_dicts
() → list¶ Return list of items converted to dictionaries.
Items are converted to dictionaries using the
to_dict
method, if they have it, or the built-invars()
.New in Robot Framework 6.1.
-
visit
(visitor: SuiteVisitor)¶
-
-
class
robot.running.model.
UserKeywords
(parent: robot.running.model.ResourceFile, keywords: Sequence[robot.running.model.UserKeyword] = ())[source]¶ Bases:
robot.model.itemlist.ItemList
-
append
(item: Union[T, Dict[str, Any]]) → T¶ 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) → T¶ Create a new item using the provided arguments.
-
extend
(items: Iterable[Union[T, Dict[str, Any]]])¶ 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: int, item: Union[T, Dict[str, Any]])¶ S.insert(index, value) – insert value before index
-
item_type
¶ alias of
builtins.type
-
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
(**config)¶
-
to_dicts
() → list¶ Return list of items converted to dictionaries.
Items are converted to dictionaries using the
to_dict
method, if they have it, or the built-invars()
.New in Robot Framework 6.1.
-
visit
(visitor: SuiteVisitor)¶
-
robot.running.modelcombiner module¶
robot.running.namespace module¶
-
class
robot.running.namespace.
Namespace
(variables, suite, resource, languages)[source]¶ Bases:
object
-
libraries
¶
-
robot.running.outputcapture module¶
robot.running.randomizer module¶
-
class
robot.running.randomizer.
Randomizer
(randomize_suites=True, randomize_tests=True, seed=None)[source]¶ Bases:
robot.model.visitor.SuiteVisitor
-
start_suite
(suite)[source]¶ Called when a suite starts. Default implementation does nothing.
Can return explicit
False
to stop visiting.
-
visit_test
(test)[source]¶ Implements traversing through tests.
Can be overridden to allow modifying the passed in
test
without 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: BodyItem)¶ 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_: Break)¶ Called when a BREAK element ends.
By default, calls
end_body_item()
which, by default, does nothing.
-
end_continue
(continue_: Continue)¶ Called when a CONTINUE element ends.
By default, calls
end_body_item()
which, by default, does nothing.
-
end_error
(error: Error)¶ Called when a ERROR element ends.
By default, calls
end_body_item()
which, by default, does nothing.
-
end_for
(for_: For)¶ Called when a FOR loop ends.
By default, calls
end_body_item()
which, by default, does nothing.
-
end_for_iteration
(iteration: ForIteration)¶ Called when a FOR loop iteration ends.
By default, calls
end_body_item()
which, by default, does nothing.
-
end_if
(if_: If)¶ Called when an IF/ELSE structure ends.
By default, calls
end_body_item()
which, by default, does nothing.
-
end_if_branch
(branch: IfBranch)¶ Called when an IF/ELSE branch ends.
By default, calls
end_body_item()
which, by default, does nothing.
-
end_keyword
(keyword: Keyword)¶ Called when a keyword ends.
By default, calls
end_body_item()
which, by default, does nothing.
-
end_message
(message: Message)¶ Called when a message ends.
By default, calls
end_body_item()
which, by default, does nothing.
-
end_return
(return_: Return)¶ Called when a RETURN element ends.
By default, calls
end_body_item()
which, by default, does nothing.
-
end_suite
(suite: TestSuite)¶ Called when a suite ends. Default implementation does nothing.
-
end_test
(test: TestCase)¶ Called when a test ends. Default implementation does nothing.
-
end_try
(try_: Try)¶ Called when a TRY/EXCEPT structure ends.
By default, calls
end_body_item()
which, by default, does nothing.
-
end_try_branch
(branch: TryBranch)¶ Called when TRY, EXCEPT, ELSE and FINALLY branches end.
By default, calls
end_body_item()
which, by default, does nothing.
-
end_while
(while_: While)¶ Called when a WHILE loop ends.
By default, calls
end_body_item()
which, by default, does nothing.
-
end_while_iteration
(iteration: WhileIteration)¶ Called when a WHILE loop iteration ends.
By default, calls
end_body_item()
which, by default, does nothing.
-
start_body_item
(item: BodyItem) → bool|None¶ 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_: Break) → bool|None¶ 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_: Continue) → bool|None¶ 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_error
(error: Error) → bool|None¶ Called when a ERROR element starts.
By default, calls
start_body_item()
which, by default, does nothing.Can return explicit
False
to stop visiting.
-
start_for
(for_: For) → bool|None¶ 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: ForIteration) → bool|None¶ 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_: If) → bool|None¶ 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: IfBranch) → bool|None¶ 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: Keyword) → bool|None¶ 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
(message: Message) → bool|None¶ 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_: Return) → bool|None¶ 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: TestCase) → bool|None¶ Called when a test starts. Default implementation does nothing.
Can return explicit
False
to stop visiting.
-
start_try
(try_: Try) → bool|None¶ 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: TryBranch) → bool|None¶ 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_: While) → bool|None¶ 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: WhileIteration) → bool|None¶ 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_: Break)¶ Visits BREAK elements.
-
visit_continue
(continue_: Continue)¶ Visits CONTINUE elements.
-
visit_error
(error: Error)¶ Visits body items resulting from invalid syntax.
Examples include syntax like
END
orELSE
in wrong place and invalid setting like[Invalid]
.
-
visit_for
(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: ForIteration)¶ 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_: If)¶ Implements traversing through IF/ELSE structures.
Notice that
if_
does not have any data directly. Actual IF/ELSE branches are in itsbody
and they are visited separately 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: IfBranch)¶ 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
(message: Message)¶ Implements visiting messages.
Can be overridden to allow modifying the passed in
msg
without callingstart_message()
orend_message()
.
-
visit_return
(return_: Return)¶ Visits a RETURN elements.
-
visit_suite
(suite: TestSuite)¶ 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_: 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: TryBranch)¶ Visits individual TRY, EXCEPT, ELSE and FINALLY branches.
-
visit_while
(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: WhileIteration)¶ 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.running.runkwregister module¶
robot.running.signalhandler module¶
robot.running.status module¶
-
class
robot.running.status.
Exit
(failure_mode=False, error_mode=False, skip_teardown_mode=False)[source]¶ Bases:
object
-
teardown_allowed
¶
-
-
class
robot.running.status.
SuiteStatus
(parent=None, exit_on_failure=False, exit_on_error=False, skip_teardown_on_exit=False)[source]¶ Bases:
robot.running.status._ExecutionStatus
-
error_occurred
()¶
-
failed
¶
-
failure_occurred
()¶
-
message
¶
-
passed
¶
-
setup_executed
(error=None)¶
-
status
¶
-
teardown_allowed
¶
-
teardown_executed
(error=None)¶
-
-
class
robot.running.status.
TestStatus
(parent, test, skip_on_failure=None, rpa=False)[source]¶ Bases:
robot.running.status._ExecutionStatus
-
skip_on_failure_after_tag_changes
¶
-
error_occurred
()¶
-
failed
¶
-
failure_occurred
()¶
-
message
¶
-
passed
¶
-
setup_executed
(error=None)¶
-
status
¶
-
teardown_allowed
¶
-
teardown_executed
(error=None)¶
-
-
class
robot.running.status.
TestMessage
(status)[source]¶ Bases:
robot.running.status._Message
-
setup_message
= 'Setup failed:\n%s'¶
-
teardown_message
= 'Teardown failed:\n%s'¶
-
setup_skipped_message
= '%s'¶
-
teardown_skipped_message
= '%s'¶
-
also_teardown_message
= '%s\n\nAlso teardown failed:\n%s'¶
-
also_teardown_skip_message
= 'Skipped in teardown:\n%s\n\nEarlier message:\n%s'¶
-
exit_on_fatal_message
= 'Test execution stopped due to a fatal error.'¶
-
exit_on_failure_message
= 'Failure occurred and exit-on-failure mode is in use.'¶
-
exit_on_error_message
= 'Error occurred and exit-on-error mode is in use.'¶
-
message
¶
-
-
class
robot.running.status.
SuiteMessage
(status)[source]¶ Bases:
robot.running.status._Message
-
setup_message
= 'Suite setup failed:\n%s'¶
-
setup_skipped_message
= 'Skipped in suite setup:\n%s'¶
-
teardown_skipped_message
= 'Skipped in suite teardown:\n%s'¶
-
teardown_message
= 'Suite teardown failed:\n%s'¶
-
also_teardown_message
= '%s\n\nAlso suite teardown failed:\n%s'¶
-
also_teardown_skip_message
= 'Skipped in suite teardown:\n%s\n\nEarlier message:\n%s'¶
-
message
¶
-
-
class
robot.running.status.
ParentMessage
(status)[source]¶ Bases:
robot.running.status.SuiteMessage
-
setup_message
= 'Parent suite setup failed:\n%s'¶
-
setup_skipped_message
= 'Skipped in parent suite setup:\n%s'¶
-
teardown_skipped_message
= 'Skipped in parent suite teardown:\n%s'¶
-
teardown_message
= 'Parent suite teardown failed:\n%s'¶
-
also_teardown_message
= '%s\n\nAlso parent suite teardown failed:\n%s'¶
-
also_teardown_skip_message
= 'Skipped in suite teardown:\n%s\n\nEarlier message:\n%s'¶
-
message
¶
-
robot.running.statusreporter module¶
robot.running.suiterunner module¶
-
class
robot.running.suiterunner.
SuiteRunner
(output, settings)[source]¶ Bases:
robot.model.visitor.SuiteVisitor
-
start_suite
(suite)[source]¶ Called when a suite starts. Default implementation does nothing.
Can return explicit
False
to stop visiting.
-
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.
-
end_body_item
(item: BodyItem)¶ 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_: Break)¶ Called when a BREAK element ends.
By default, calls
end_body_item()
which, by default, does nothing.
-
end_continue
(continue_: Continue)¶ Called when a CONTINUE element ends.
By default, calls
end_body_item()
which, by default, does nothing.
-
end_error
(error: Error)¶ Called when a ERROR element ends.
By default, calls
end_body_item()
which, by default, does nothing.
-
end_for
(for_: For)¶ Called when a FOR loop ends.
By default, calls
end_body_item()
which, by default, does nothing.
-
end_for_iteration
(iteration: ForIteration)¶ Called when a FOR loop iteration ends.
By default, calls
end_body_item()
which, by default, does nothing.
-
end_if
(if_: If)¶ Called when an IF/ELSE structure ends.
By default, calls
end_body_item()
which, by default, does nothing.
-
end_if_branch
(branch: IfBranch)¶ Called when an IF/ELSE branch ends.
By default, calls
end_body_item()
which, by default, does nothing.
-
end_keyword
(keyword: Keyword)¶ Called when a keyword ends.
By default, calls
end_body_item()
which, by default, does nothing.
-
end_message
(message: Message)¶ Called when a message ends.
By default, calls
end_body_item()
which, by default, does nothing.
-
end_return
(return_: Return)¶ Called when a RETURN element ends.
By default, calls
end_body_item()
which, by default, does nothing.
-
end_test
(test: TestCase)¶ Called when a test ends. Default implementation does nothing.
-
end_try
(try_: Try)¶ Called when a TRY/EXCEPT structure ends.
By default, calls
end_body_item()
which, by default, does nothing.
-
end_try_branch
(branch: TryBranch)¶ Called when TRY, EXCEPT, ELSE and FINALLY branches end.
By default, calls
end_body_item()
which, by default, does nothing.
-
end_while
(while_: While)¶ Called when a WHILE loop ends.
By default, calls
end_body_item()
which, by default, does nothing.
-
end_while_iteration
(iteration: WhileIteration)¶ Called when a WHILE loop iteration ends.
By default, calls
end_body_item()
which, by default, does nothing.
-
start_body_item
(item: BodyItem) → bool|None¶ 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_: Break) → bool|None¶ 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_: Continue) → bool|None¶ 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_error
(error: Error) → bool|None¶ Called when a ERROR element starts.
By default, calls
start_body_item()
which, by default, does nothing.Can return explicit
False
to stop visiting.
-
start_for
(for_: For) → bool|None¶ 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: ForIteration) → bool|None¶ 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_: If) → bool|None¶ 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: IfBranch) → bool|None¶ 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: Keyword) → bool|None¶ 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
(message: Message) → bool|None¶ 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_: Return) → bool|None¶ 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: TestCase) → bool|None¶ Called when a test starts. Default implementation does nothing.
Can return explicit
False
to stop visiting.
-
start_try
(try_: Try) → bool|None¶ 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: TryBranch) → bool|None¶ 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_: While) → bool|None¶ 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: WhileIteration) → bool|None¶ 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_: Break)¶ Visits BREAK elements.
-
visit_continue
(continue_: Continue)¶ Visits CONTINUE elements.
-
visit_error
(error: Error)¶ Visits body items resulting from invalid syntax.
Examples include syntax like
END
orELSE
in wrong place and invalid setting like[Invalid]
.
-
visit_for
(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: ForIteration)¶ 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_: If)¶ Implements traversing through IF/ELSE structures.
Notice that
if_
does not have any data directly. Actual IF/ELSE branches are in itsbody
and they are visited separately 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: IfBranch)¶ 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
(keyword: Keyword)¶ 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
(message: Message)¶ Implements visiting messages.
Can be overridden to allow modifying the passed in
msg
without callingstart_message()
orend_message()
.
-
visit_return
(return_: Return)¶ Visits a RETURN elements.
-
visit_suite
(suite: TestSuite)¶ 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_: 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: TryBranch)¶ Visits individual TRY, EXCEPT, ELSE and FINALLY branches.
-
visit_while
(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: WhileIteration)¶ 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.running.testlibraries module¶
robot.running.usererrorhandler module¶
-
class
robot.running.usererrorhandler.
UserErrorHandler
(error, name, libname=None, source=None, lineno=None)[source]¶ Bases:
object
Created if creating handlers fail. Running it raises DataError.
The idea is not to raise DataError at processing time and prevent all tests in affected test case file from executing. Instead, UserErrorHandler is created and if it is ever run DataError is raised then.
Parameters: - error (robot.errors.DataError) – Occurred error.
- name (str) – Name of the affected keyword.
- libname (str) – Name of the affected library or resource.
- source (str) – Path to the source file.
- lineno (int) – Line number of the failing keyword.
-
supports_embedded_arguments
= False¶
-
longname
¶
-
doc
¶
-
shortdoc
¶
-
dry_run
(kw, context, run=True)¶