Library for importing Robot Framework resource files from python libraries. See examples/ directory for an example of Python library with embedded Robot Framework resources and usage of this library.
There are three different ways to import resources with this library: inside the Python library that contains the resources, in Settings table with initialization parameters, or through a keyword.
from SharedResources import SharedResources
class EmbeddedResources(SharedResources):
def __init__(self):
super().__init__(
'EmbeddedResources.resources',
'a_keywords.resource',
'b_keywords.robot')
*** Settings ***
Library SharedResources EmbeddedResources
... a_keywords.resource b_keywords.robot
*** Settings ***
Library SharedResources
*** Keywords ***
Load resources
Import resource from package EmbeddedResources.resources
... a_keywords.resource b_keywords.robot
Check and automatically fix formatting with:
pycodestyle SharedResources
autopep8 -aaar --in-place SharedResources
Run static analysis with:
pylint -E --enable=invalid-name,unused-import,useless-object-inheritance SharedResources
Run acceptance tests:
# Run acceptance tests
robot -L TRACE:INFO -d out/ acceptance_tests/
# Run acceptance tests with coverage analysis
coverage run \
--branch \
--source SharedResources/ \
-m robot -L TRACE:INFO -d out/ acceptance_tests/
coverage report -m
Run acceptance tests in Docker container:
# Build image
docker build . -t atest
# Run acceptance tests
docker run --rm atest
# Run acceptance tests and get test output to ./out
docker run -v $(pwd)/out:/out --rm atest -d /out -L TRACE:INFO
Generate documentation with:
python3 -m robot.libdoc SharedResources docs/index.html