Bases: ModelObject, Generic[KW, TC]
Base model for single suite.
Extended by :class:robot.running.model.TestSuite and
:class:robot.result.model.TestSuite.
Source code in src/robot/model/testsuite.py
                    
classmethod
  
¶
Create this object based on data in a dictionary.
Data can be got from the :meth:to_dict method or created externally.
With robot.running model objects new in Robot Framework 6.1,
with robot.result new in Robot Framework 7.0.
Source code in src/robot/model/modelobject.py
              
classmethod
  
¶
    Create this object based on JSON data.
The data is given as the source parameter. It can be:
- a string (or bytes) containing the data directly,
- an open file object where to read the data from, or
- a path (pathlib.Pathor 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 :meth:from_dict method.
Notice that the source is considered to be JSON data if it is
a string and contains {. If you need to use { in a file system
path, pass it in as a pathlib.Path instance.
With robot.running model objects new in Robot Framework 6.1,
with robot.result new in Robot Framework 7.0.
Source code in src/robot/model/modelobject.py
              
          Serialize this object into JSON.
The object is first converted to a Python dictionary using the
:meth:to_dict method and then the dictionary is converted to JSON.
The file parameter controls what to do with the resulting JSON data.
It can be:
- None(default) to return the data as a string,
- an open file object where to write the data to, or
- a path (pathlib.Pathor string) to a file where to write the data using UTF-8 encoding.
JSON formatting can be configured using optional parameters that
are passed directly to the underlying json__ module. Notice that
the defaults differ from what json uses.
With robot.running model objects new in Robot Framework 6.1,
with robot.result new in Robot Framework 7.0.
__ https://docs.python.org/3/library/json.html
Source code in src/robot/model/modelobject.py
              
Configure model object with given attributes.
obj.config(name='Example', doc='Something') is equivalent to setting
obj.name = 'Example' and obj.doc = 'Something'.
New in Robot Framework 4.0.
Source code in src/robot/model/modelobject.py
              
Return a shallow copy of this object.
:param attributes: Attributes to be set to the returned copy.
    For example, obj.copy(name='New name').
See also :meth:deepcopy. The difference between copy and
deepcopy is the same as with the methods having same names in
the copy__ module.
__ https://docs.python.org/3/library/copy.html
Source code in src/robot/model/modelobject.py
              
Return a deep copy of this object.
:param attributes: Attributes to be set to the returned copy.
    For example, obj.deepcopy(name='New name').
See also :meth:copy. The difference between deepcopy and
copy is the same as with the methods having same names in
the copy__ module.
__ https://docs.python.org/3/library/copy.html
Source code in src/robot/model/modelobject.py
              
staticmethod
  
¶
    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 :attr:name is not set and someone
accesses it.
The algorithm is as follows:
- If the source is Noneor empty, return an empty string.
- Get the base name of the source. Read more below.
- Remove possible prefix separated with __.
- Convert underscores to spaces.
- If the name is all lower case, title case it.
The base name of files is got by calling Path.stem__ that drops
the file extension. It typically works fine, but gives wrong result
if the extension has multiple parts like in tests.robot.zip.
That problem can be avoided by giving valid file extension or extensions
as the optional extension argument.
Examples::
| 1 2 3 |  | 
__ https://docs.python.org/3/library/pathlib.html#pathlib.PurePath.stem
Source code in src/robot/model/testsuite.py
              
property
      writable
  
¶
    Suite name.
If name is not set, it is constructed from source. If source is not set,
name is constructed from child suite names by concatenating them with
&. If there are no child suites, name is an empty string.
    Adjust suite source and child suite sources, recursively.
:param 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.
:param 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::
| 1 2 3 4 5 6 7 8 9 10 |  | 
New in Robot Framework 6.1.
__ https://docs.python.org/3/library/pathlib.html#pathlib.PurePath.relative_to
Source code in src/robot/model/testsuite.py
              
property
  
¶
    Suite name prefixed with the full name of the possible parent suite.
Just :attr:name of the suite if it has no :attr:parent.
property
  
¶
    Deprecated since Robot Framework 7.0. Use :attr:full_name instead.
    
    Validate that suite execution mode is set consistently.
Raise an exception if the execution mode is not set (i.e. the :attr:rpa
attribute is None) and child suites have conflicting execution modes.
The execution mode is returned. New in RF 6.1.1.
Source code in src/robot/model/testsuite.py
              
property
      writable
  
¶
Suite setup.
This attribute is a Keyword object also when a suite has no setup
but in that case its truth value is False. The preferred way to
check does a suite have a setup is using :attr:has_setup.
Setup can be modified by setting attributes directly::
| 1 2 |  | 
Alternatively the :meth:config method can be used to set multiple
attributes in one call::
| 1 |  | 
The easiest way to reset the whole setup is setting it to None.
It will automatically recreate the underlying Keyword object::
| 1 |  | 
New in Robot Framework 4.0. Earlier setup was accessed like
suite.keywords.setup.
property
  
¶
    Check does a suite have a setup without creating a setup object.
A difference between using if suite.has_setup: and if suite.setup:
is that accessing the :attr:setup attribute creates a :class:Keyword
object representing the setup even when the suite actually does not have
one. This typically does not matter, but with bigger suite structures
it can have some effect on memory usage.
New in Robot Framework 5.0.
property
  
¶
    Check does a suite have a teardown without creating a teardown object.
See :attr:has_setup for more information.
New in Robot Framework 5.0.
property
  
¶
    An automatically generated unique id.
The root suite has id s1, its child suites have ids s1-s1,
s1-s2, ..., their child suites get ids s1-s1-s1, s1-s1-s2,
..., s1-s2-s1, ..., and so on.
The first test in a suite has an id like s1-t1, the second has an
id s1-t2, and so on. Similarly, keywords in suites (setup/teardown)
and in tests get ids like s1-k1, s1-t1-k1, and s1-s4-t2-k5.
property
  
¶
    Yields all tests this suite and its child suites contain.
New in Robot Framework 6.1.
property
  
¶
    Total number of the tests in this suite and in its child suites.
    Add and/or remove specified tags to the tests in this suite.
:param add: Tags to add as a list or, if adding only one,
    as a single string.
:param remove: Tags to remove as a list or as a single string.
    Can be given as patterns where * and ? work as wildcards.
:param persist: Add/remove specified tags also to new tests added
    to this suite in the future.
Source code in src/robot/model/testsuite.py
              
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::
| 1 2 |  | 
Source code in src/robot/model/testsuite.py
              
A shortcut to configure a suite using one method call.
Can only be used with the root test suite.
:param options: Passed to
    :class:~robot.model.configurer.SuiteConfigurer that will then
    set suite attributes, call :meth:filter, etc. as needed.
Not to be confused with :meth:config method that suites, tests,
and keywords have to make it possible to set multiple attributes in
one call.
Source code in src/robot/model/testsuite.py
              
    Removes all child suites not containing any tests, recursively.