Robot Framework
robot.running.model.TestSuite Class Reference

Represents a single executable test suite. More...

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

Public Member Functions

def __init__ (self, name='', doc='', metadata=None, source=None, rpa=None)
 
def configure (self, randomize_suites=False, randomize_tests=False, randomize_seed=None, **options)
 A shortcut to configure a suite using one method call. More...
 
def from_file_system (cls, *paths, **config)
 Create a :class:TestSuite object based on the given paths. More...
 
def from_model (cls, model, name=None)
 Create a :class:TestSuite object based on the given model. More...
 
def randomize (self, suites=True, tests=True, seed=None)
 Randomizes the order of suites and/or tests, recursively. More...
 
def run (self, settings=None, **options)
 Executes the suite based based the given settings or options. More...
 
- Public Member Functions inherited from robot.model.testsuite.TestSuite
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

 resource
 
- Public Attributes inherited from robot.model.testsuite.TestSuite
 doc
 
 metadata
 
 parent
 
 rpa
 
 source
 
 suites
 
 tests
 

Static Public Attributes

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

Static Private Attributes

list __slots__ = ['resource']
 

Additional Inherited Members

- Properties inherited from robot.model.testsuite.TestSuite
 _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...
 

Detailed Description

Represents a single executable test suite.

See the base class for documentation of attributes not documented here.

Definition at line 292 of file model.py.

Constructor & Destructor Documentation

◆ __init__()

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

Definition at line 297 of file model.py.

Member Function Documentation

◆ configure()

def robot.running.model.TestSuite.configure (   self,
  randomize_suites = False,
  randomize_tests = False,
  randomize_seed = None,
**  options 
)

A shortcut to configure a suite using one method call.

    Can only be used with the root test suite.

    :param randomize_xxx: Passed to :meth:`randomize`.
    :param options: Passed to
        :class:`~robot.model.configurer.SuiteConfigurer` that will then
        set suite attributes, call :meth:`filter`, etc. as needed.

    Example::

        suite.configure(included_tags=['smoke'],
                        doc='Smoke test results.')

    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.

Definition at line 349 of file model.py.

◆ from_file_system()

def robot.running.model.TestSuite.from_file_system (   cls,
paths,
**  config 
)

Create a :class:TestSuite object based on the given paths.

    ``paths`` are file or directory paths where to read the data from.

    Internally utilizes the :class:`~.builders.TestSuiteBuilder` class
    and ``config`` can be used to configure how it is initialized.

    New in Robot Framework 3.2.

Definition at line 314 of file model.py.

◆ from_model()

def robot.running.model.TestSuite.from_model (   cls,
  model,
  name = None 
)

Create a :class:TestSuite object based on the given model.

    The model can be created by using the
    :func:`~robot.parsing.parser.parser.get_model` function and possibly
    modified by other tooling in the :mod:`robot.parsing` module.

    New in Robot Framework 3.2.

Definition at line 327 of file model.py.

◆ randomize()

def robot.running.model.TestSuite.randomize (   self,
  suites = True,
  tests = True,
  seed = None 
)

Randomizes the order of suites and/or tests, recursively.

    :param suites: Boolean controlling should suites be randomized.
    :param tests: Boolean controlling should tests be randomized.
    :param seed: Random seed. Can be given if previous random order needs
        to be re-created. Seed value is always shown in logs and reports.

Definition at line 361 of file model.py.

◆ run()

def robot.running.model.TestSuite.run (   self,
  settings = None,
**  options 
)

Executes the suite based based the given settings or options.

    :param settings: :class:`~robot.conf.settings.RobotSettings` object
        to configure test execution.
    :param options: Used to construct new
        :class:`~robot.conf.settings.RobotSettings` object if ``settings``
        are not given.
    :return: :class:`~robot.result.executionresult.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 like ``variable=['VAR1:value1', 'VAR2:value2']``.
    If such an option is used only once, it can be given also as a single
    string like ``variable='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`` and ``stderr``, 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 with ``output=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
    :class:`~robot.result.executionresult.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 the
    :class:`~robot.result.resultbuilder.ExecutionResult` factory method.

    See the :mod:`package level <robot.running>` 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 :func:`robot.run <robot.run.run>` function for a higher-level
    API for executing tests in files or directories.

Definition at line 417 of file model.py.

Member Data Documentation

◆ __slots__

list robot.running.model.TestSuite.__slots__ = ['resource']
staticprivate

Definition at line 293 of file model.py.

◆ fixture_class

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

Definition at line 295 of file model.py.

◆ resource

robot.running.model.TestSuite.resource

Definition at line 302 of file model.py.

◆ test_class

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

Definition at line 294 of file model.py.


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