Agent for Reproting results of tests to the Report Portal server
Project description
Important: this is draft version under development.
Pytest plugin for reporting test results of Pytest to the ‘Reportal Portal’.
Usage
Installation
To install pytest plugin execute next command in a terminal:
pip install pytest-reportportal
Configuration
Prepare the config file pytest.ini
in root directory of tests or specify
any one using pytest command line option:
py.test -c config.cfg
The pytest.ini
file should have next mandatory fields:
rp_uuid
- number could be found in the User profile sectionrp_project
- name of project in Report Potalrp_endpoint
- address of Report Portal Server
Example of pytest.ini
:
[pytest]
rp_uuid = fb586627-32be-47dd-93c1-678873458a5f
rp_endpoint = http://192.168.1.10:8080
rp_project = user_personal
rp_launch_tags = 'PyTest' 'Smoke'
Also launch tags could be added, but this parapmeter is not
mandatory rp_launch_tags = 'PyTest' 'Report_Portal'
.
Logging
For logging of the test item flow to Report Portal, please, use the python logging handler privided by plugin like bellow:
# Import Report Portal handler in the test module.
from pytest_reportportal import RPlogHandler
# Get logger.
logger = logging.getLogger()
# Create hanler, set log level add it to the logger.
rp_handler = RPlogHandler()
rp_handler.setLevel(logging.INFO)
logger.addHandler(rp_handler)
# In this case only INFO messages will be sent to the Report Portal.
def test_one(self):
logger.info("Case1. Step1")
x = "this"
logger.info("Case1. Step2")
assert 'h' in x
Launching
To run test with Report Portal you need to specify neme of launch
:
py.test ./tests --rp-launch AnyLaunchName
Copyright Notice
Licensed under the GPLv3 license (see the LICENSE file).