Programmatic entry point for running tests.
:param tests: Paths to test case files/directories to be executed similarly
as when running the ``robot`` command on the command line.
:param options: Options to configure and control execution. Accepted
options are mostly same as normal command line options to the ``robot``
command. Option names match command line option long names without
hyphens so that, for example, ``--name`` becomes ``name``.
Most options that can be given from the command line work. An exception
is that options ``--pythonpath``, ``--argumentfile``, ``--help`` and
``--version`` are not supported.
Options that can be given on the command line multiple times can be
passed as lists. For example, ``include=['tag1', 'tag2']`` is equivalent
to ``--include tag1 --include tag2``. If such options are used only once,
they can be given also as a single string like ``include='tag'``.
Options that accept no value can be given as Booleans. For example,
``dryrun=True`` is same as using the ``--dryrun`` option.
Options that accept string ``NONE`` as a special value can also be used
with Python ``None``. For example, using ``log=None`` is equivalent to
``--log NONE``.
``listener``, ``prerunmodifier`` and ``prerebotmodifier`` options allow
passing values as Python objects in addition to module names these command
line options support. For example, ``run('tests', listener=MyListener())``.
To capture the standard output and error streams, pass an open file or
file-like object as special keyword arguments ``stdout`` and ``stderr``,
respectively.
A return code is returned similarly as when running on the command line.
Zero means that tests were executed and no test failed, values up to 250
denote the number of failed tests, and values between 251-255 are for other
statuses documented in the Robot Framework User Guide.
Example::
from robot import run
run('path/to/tests.robot')
run('tests.robot', include=['tag1', 'tag2'], splitlog=True)
with open('stdout.txt', 'w') as stdout:
run('t1.robot', 't2.robot', name='Example', log=None, stdout=stdout)
Equivalent command line usage::
robot path/to/tests.robot
robot --include tag1 --include tag2 --splitlog tests.robot
robot --name Example --log NONE t1.robot t2.robot > stdout.txt
Definition at line 557 of file run.py.