mlx.robot2rst

Python script for converting a Robot Framework file to a reStructuredText (.rst) file


Keywords
robot, robotframework, sphinx, traceability
License
Apache-2.0
Install
pip install mlx.robot2rst==3.4.0

Documentation

Build status Documentation Contributions welcome

Documentation robot2rst

This script can convert your .robot files from Robot Framework to reStructuredText (.rst) files with traceable items.

Goal

This script allows you to connect your requirements to test cases via the mlx.traceability Sphinx extension. Test cases get converted to traceable items. The documentation of each test gets used to generate the body of the item. Test case names get converted to item IDs with a configurable prefix. Tags can be used to link to other traceable items.

Usage

robot2rst -i example.robot -o test_plan.rst --prefix ITEST_MY_LIB- \
    --tags SWRQT- SYSRQT- --relationships validates ext_toolname --coverage 100 66.66

$ robot2rst --help

usage: robot2rst [-h] -i ROBOT_FILE -o RST_FILE [--only EXPRESSION] [-p PREFIX]
                 [-r [RELATIONSHIPS ...]] [-t [TAGS ...]] [--include [INCLUDE ...]]
                 [-c [COVERAGE ...]] [--type TYPE] [--trim-suffix]

Convert robot test cases to reStructuredText with traceable items.

options:
  -h, --help            show this help message and exit
  -i ROBOT_FILE, --robot ROBOT_FILE
                        Input robot file
  -o RST_FILE, --rst RST_FILE
                        Output RST file, e.g. my_component_qtp.rst
  --only EXPRESSION     Expression of tags for Sphinx' `only` directive that surrounds all
                        RST content. By default, no `only` directive is generated.
  -p PREFIX, --prefix PREFIX
                        Overrides the default 'QTEST-' prefix.
  -r [RELATIONSHIPS ...], --relationships [RELATIONSHIPS ...]
                        Name(s) of the relationship(s) used to link to items in Tags section.
                        The default value is 'validates'.
  -t [TAGS ...], --tags [TAGS ...]
                        Zero or more Python regexes for matching tags to treat them as
                        traceable targets via a relationship. All tags get matched by
                        default.
  --include [INCLUDE ...]
                        Zero or more Python regexes for matching tags to filter test cases.
                        If every regex matches at least one of a test case's tags, the test
                        case is included.
  -c [COVERAGE ...], --coverage [COVERAGE ...]
                        Minimum coverage percentages for the item-matrix(es); 1 value per tag
                        in -t, --tags.
  --type TYPE           Give value that starts with 'q' or 'i' (case-insensitive) to
                        explicitly define the type of test: qualification/integration test.
                        The default is 'qualification'.
  --trim-suffix         If the suffix of any prefix or --tags argument ends with '_-' it gets
                        trimmed to '-'.

Configuration

To include the script's output in your documentation you want to add the aforementioned extension to your extensions list in your conf.py like so:

extensions = [
    'mlx.traceability',
]

Please read the documentation of mlx.traceability for additional configuration steps.

If you use the --only input argument, you should also add 'sphinx_selective_exclude.eager_only' to the extensions list to prevent mlx.traceability from parsing the content and ignoring the effect of the only directive.