running
Implements the core test execution logic.
The public API of this module consists of the following objects:
-
:class:
~robot.running.model.TestSuitefor creating an executable test suite structure programmatically. -
:class:
~robot.running.builder.builders.TestSuiteBuilderfor creating executable test suites based on data on a file system. Instead of using this class directly, it is possible to use the :meth:TestSuite.from_file_system <robot.running.model.TestSuite.from_file_system>classmethod that uses it internally. -
Classes used by :class:
~robot.running.model.TestSuite, such as :class:~robot.running.model.TestCase, :class:~robot.running.model.Keywordand :class:~robot.running.model.Ifthat are defined in the :mod:robot.running.modelmodule. These classes are typically only needed in type hints. -
Keyword implementation related classes :class:
~robot.running.resourcemodel.UserKeyword, :class:~robot.running.librarykeyword.LibraryKeyword, :class:~robot.running.invalidkeyword.InvalidKeywordand their common base class :class:~robot.running.keywordimplementation.KeywordImplementation. Also these classes are mainly needed in type hints. -
:class:
~robot.running.builder.settings.TestDefaultsthat is part of theexternal parsing API__ and also typically needed only in type hints.
__ http://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#parser-interface
:class:~robot.running.model.TestSuite and
:class:~robot.running.builder.builders.TestSuiteBuilder can be imported also via
the :mod:robot.api package.
.. note:: Prior to Robot Framework 6.1, only some classes in
:mod:robot.running.model were exposed via :mod:robot.running.
Keyword implementation related classes are new in Robot Framework 7.0.
Examples¶
First, let's assume we have the following test suite in file
activate_skynet.robot::
1 2 3 4 5 6 7 8 | |
We can easily create an executable test suite based on the above file::
1 2 3 | |
That was easy. Let's next generate the same test suite from scratch::
1 2 3 4 5 6 7 | |
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 :meth:execute it
<robot.running.model.TestSuite.run> and verify that the returned
:class:~robot.result.executionresult.Result object contains correct
information::
1 2 3 4 5 6 7 8 9 | |
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
:class:~robot.reporting.resultwriter.ResultWriter class::
1 2 3 4 5 6 | |