Robot Framework
robot.model.testsuite.TestSuite Class Reference

Base model for single suite. More...

Inheritance diagram for robot.model.testsuite.TestSuite:
robot.model.modelobject.ModelObject metaclass robot.result.model.TestSuite robot.running.model.TestSuite

Public Member Functions

def __init__ (self, name='', doc='', metadata=None, source=None, rpa=False, parent=None)
 
def __str__ (self)
 
def configure (self, **options)
 A shortcut to configure a suite using one method call. More...
 
def filter (self, included_suites=None, included_tests=None, included_tags=None, excluded_tags=None)
 Select test cases and remove others from this suite. More...
 
def metadata (self, metadata)
 Free test suite metadata as a dictionary. More...
 
def remove_empty_suites (self, preserve_direct_children=False)
 Removes all child suites not containing any tests, recursively. More...
 
def set_tags (self, add=None, remove=None, persist=False)
 Add and/or remove specified tags to the tests in this suite. More...
 
def suites (self, suites)
 Child suites as a :class:~.TestSuites object. More...
 
def tests (self, tests)
 Tests as a :class:~.TestCases object. More...
 
def visit (self, visitor)
 :mod:Visitor interface <robot.model.visitor> entry-point. More...
 
- Public Member Functions inherited from robot.model.modelobject.ModelObject
def __repr__ (self)
 
def config (self, **attributes)
 Configure model object with given attributes. More...
 
def copy (self, **attributes)
 Return shallow copy of this object. More...
 
def deepcopy (self, **attributes)
 Return deep copy of this object. More...
 

Public Attributes

 doc
 
 metadata
 
 parent
 
 rpa
 
 source
 
 suites
 
 tests
 

Static Public Attributes

 fixture_class = Keyword
 
tuple repr_args = ('name',)
 
 test_class = TestCase
 
- Static Public Attributes inherited from robot.model.modelobject.ModelObject
tuple repr_args = ()
 

Properties

 _visitors = property
 
 has_setup = property
 Check does a suite have a setup without creating a setup object. More...
 
 has_teardown = property
 Check does a suite have a teardown without creating a teardown object. More...
 
 has_tests = property
 
 id = property
 An automatically generated unique id. More...
 
 keywords = property
 Deprecated since Robot Framework 4.0. More...
 
 longname = property
 Suite name prefixed with the long name of the parent suite. More...
 
 name = property
 Test suite name. More...
 
 setup = property
 Suite setup as a :class:~.model.keyword.Keyword object. More...
 
 teardown = property
 Suite teardown as a :class:~.model.keyword.Keyword object. More...
 
 test_count = property
 Number of the tests in this suite, recursively. More...
 

Private Member Functions

def _visitors (self)
 
def has_setup (self)
 
def has_teardown (self)
 
def has_tests (self)
 
def id (self)
 
def keywords (self)
 
def keywords (self, keywords)
 
def longname (self)
 
def name (self)
 
def name (self, name)
 
def setup (self)
 
def setup (self, setup)
 
def teardown (self)
 
def teardown (self, teardown)
 
def test_count (self)
 

Private Attributes

 _my_visitors
 
 _name
 
 _setup
 
 _teardown
 

Static Private Attributes

list __slots__
 

Detailed Description

Base model for single suite.

Extended by :class:`robot.running.model.TestSuite` and
:class:`robot.result.model.TestSuite`.

Definition at line 34 of file testsuite.py.

Constructor & Destructor Documentation

◆ __init__()

def robot.model.testsuite.TestSuite.__init__ (   self,
  name = '',
  doc = '',
  metadata = None,
  source = None,
  rpa = False,
  parent = None 
)

Definition at line 41 of file testsuite.py.

Member Function Documentation

◆ __str__()

def robot.model.testsuite.TestSuite.__str__ (   self)

Definition at line 291 of file testsuite.py.

◆ _visitors()

def robot.model.testsuite.TestSuite._visitors (   self)
private

Definition at line 58 of file testsuite.py.

◆ configure()

def robot.model.testsuite.TestSuite.configure (   self,
**  options 
)

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.

Reimplemented in robot.result.model.TestSuite.

Definition at line 276 of file testsuite.py.

◆ filter()

def robot.model.testsuite.TestSuite.filter (   self,
  included_suites = None,
  included_tests = None,
  included_tags = None,
  excluded_tags = None 
)

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')

Definition at line 259 of file testsuite.py.

◆ has_setup()

def robot.model.testsuite.TestSuite.has_setup (   self)
private

Definition at line 147 of file testsuite.py.

◆ has_teardown()

def robot.model.testsuite.TestSuite.has_teardown (   self)
private

Definition at line 177 of file testsuite.py.

◆ has_tests()

def robot.model.testsuite.TestSuite.has_tests (   self)
private

Definition at line 224 of file testsuite.py.

◆ id()

def robot.model.testsuite.TestSuite.id (   self)
private

Definition at line 209 of file testsuite.py.

◆ keywords() [1/2]

def robot.model.testsuite.TestSuite.keywords (   self)
private

Definition at line 187 of file testsuite.py.

◆ keywords() [2/2]

def robot.model.testsuite.TestSuite.keywords (   self,
  keywords 
)
private

Definition at line 193 of file testsuite.py.

◆ longname()

def robot.model.testsuite.TestSuite.longname (   self)
private

Definition at line 78 of file testsuite.py.

◆ metadata()

def robot.model.testsuite.TestSuite.metadata (   self,
  metadata 
)

Free test suite metadata as a dictionary.

Definition at line 85 of file testsuite.py.

◆ name() [1/2]

def robot.model.testsuite.TestSuite.name (   self)
private

Definition at line 66 of file testsuite.py.

◆ name() [2/2]

def robot.model.testsuite.TestSuite.name (   self,
  name 
)
private

Definition at line 71 of file testsuite.py.

◆ remove_empty_suites()

def robot.model.testsuite.TestSuite.remove_empty_suites (   self,
  preserve_direct_children = False 
)

Removes all child suites not containing any tests, recursively.

Definition at line 284 of file testsuite.py.

◆ set_tags()

def robot.model.testsuite.TestSuite.set_tags (   self,
  add = None,
  remove = None,
  persist = False 
)

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.

Definition at line 238 of file testsuite.py.

◆ setup() [1/2]

def robot.model.testsuite.TestSuite.setup (   self)
private

Definition at line 124 of file testsuite.py.

◆ setup() [2/2]

def robot.model.testsuite.TestSuite.setup (   self,
  setup 
)
private

Definition at line 131 of file testsuite.py.

◆ suites()

def robot.model.testsuite.TestSuite.suites (   self,
  suites 
)

Child suites as a :class:~.TestSuites object.

Definition at line 90 of file testsuite.py.

◆ teardown() [1/2]

def robot.model.testsuite.TestSuite.teardown (   self)
private

Definition at line 158 of file testsuite.py.

◆ teardown() [2/2]

def robot.model.testsuite.TestSuite.teardown (   self,
  teardown 
)
private

Definition at line 165 of file testsuite.py.

◆ test_count()

def robot.model.testsuite.TestSuite.test_count (   self)
private

Definition at line 218 of file testsuite.py.

◆ tests()

def robot.model.testsuite.TestSuite.tests (   self,
  tests 
)

Tests as a :class:~.TestCases object.

Definition at line 95 of file testsuite.py.

◆ visit()

def robot.model.testsuite.TestSuite.visit (   self,
  visitor 
)

:mod:Visitor interface <robot.model.visitor> entry-point.

Definition at line 288 of file testsuite.py.

Member Data Documentation

◆ __slots__

list robot.model.testsuite.TestSuite.__slots__
staticprivate
Initial value:
= ['parent', 'source', '_name', 'doc', '_setup', '_teardown', 'rpa',
'_my_visitors']

Definition at line 38 of file testsuite.py.

◆ _my_visitors

robot.model.testsuite.TestSuite._my_visitors
private

Definition at line 53 of file testsuite.py.

◆ _name

robot.model.testsuite.TestSuite._name
private

Definition at line 43 of file testsuite.py.

◆ _setup

robot.model.testsuite.TestSuite._setup
private

Definition at line 51 of file testsuite.py.

◆ _teardown

robot.model.testsuite.TestSuite._teardown
private

Definition at line 52 of file testsuite.py.

◆ doc

robot.model.testsuite.TestSuite.doc

Definition at line 44 of file testsuite.py.

◆ fixture_class

robot.model.testsuite.TestSuite.fixture_class = Keyword
static

Definition at line 36 of file testsuite.py.

◆ metadata

robot.model.testsuite.TestSuite.metadata

Definition at line 45 of file testsuite.py.

◆ parent

robot.model.testsuite.TestSuite.parent

Definition at line 47 of file testsuite.py.

◆ repr_args

tuple robot.model.testsuite.TestSuite.repr_args = ('name',)
static

Definition at line 37 of file testsuite.py.

◆ rpa

robot.model.testsuite.TestSuite.rpa

Definition at line 48 of file testsuite.py.

◆ source

robot.model.testsuite.TestSuite.source

Definition at line 46 of file testsuite.py.

◆ suites

robot.model.testsuite.TestSuite.suites

Definition at line 49 of file testsuite.py.

◆ test_class

robot.model.testsuite.TestSuite.test_class = TestCase
static

Definition at line 35 of file testsuite.py.

◆ tests

robot.model.testsuite.TestSuite.tests

Definition at line 50 of file testsuite.py.

Property Documentation

◆ _visitors

robot.model.testsuite.TestSuite._visitors = property
staticprivate

Definition at line 56 of file testsuite.py.

◆ has_setup

robot.model.testsuite.TestSuite.has_setup = property
static

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
    containing a huge about of suites it can have some effect on memory usage.

    New in Robot Framework 5.0.

Definition at line 145 of file testsuite.py.

◆ has_teardown

robot.model.testsuite.TestSuite.has_teardown = property
static

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.

Definition at line 175 of file testsuite.py.

◆ has_tests

robot.model.testsuite.TestSuite.has_tests = property
static

Definition at line 222 of file testsuite.py.

◆ id

robot.model.testsuite.TestSuite.id = property
static

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``.

Definition at line 207 of file testsuite.py.

◆ keywords

robot.model.testsuite.TestSuite.keywords = property
static

Deprecated since Robot Framework 4.0.

    Use :attr:`setup` or :attr:`teardown` instead.

Definition at line 185 of file testsuite.py.

◆ longname

robot.model.testsuite.TestSuite.longname = property
static

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

Definition at line 76 of file testsuite.py.

◆ name

robot.model.testsuite.TestSuite.name = property
static

Test suite name.

If not set, constructed from child suite names.

Definition at line 64 of file testsuite.py.

◆ setup

robot.model.testsuite.TestSuite.setup = property
static

Suite setup as a :class:~.model.keyword.Keyword object.

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

    Setup can be modified by setting attributes directly::

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

    Alternatively the :meth:`config` method can be used to set multiple
    attributes in one call::

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

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

        suite.setup = None

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

Definition at line 122 of file testsuite.py.

◆ teardown

robot.model.testsuite.TestSuite.teardown = property
static

Suite teardown as a :class:~.model.keyword.Keyword object.

    See :attr:`setup` for more information.

Definition at line 156 of file testsuite.py.

◆ test_count

robot.model.testsuite.TestSuite.test_count = property
static

Number of the tests in this suite, recursively.

Definition at line 216 of file testsuite.py.


The documentation for this class was generated from the following file: