pytest-reportportal

Agent for Reporting results of tests to the Report Portal


Keywords
testing, reporting, reportportal, pytest, agent, python
License
Apache-2.0
Install
pip install pytest-reportportal==5.4.1

Documentation

agent-python-pytest

Latest Version

Supported python versions

Test status

Test coverage

Join Slack chat!

Pytest plugin for reporting test results of the Pytest to the ReportPortal.

Installation

To install pytest plugin execute next command in a terminal:

Look through the CONTRIBUTING.rst for contribution guidelines.

Configuration

Prepare the config file pytest.ini in root directory of tests or specify any one using pytest command line option:

The pytest.ini file should have next mandatory fields:

  • rp_api_key - value could be found in the User Profile section
  • rp_project - name of project in ReportPortal
  • rp_endpoint - address of ReportPortal Server

Example of pytest.ini:

[pytest]
rp_api_key = fb586627-32be-47dd-93c1-678873458a5f
rp_endpoint = http://192.168.1.10:8080
rp_project = user_personal
rp_launch = AnyLaunchName
rp_launch_attributes = 'PyTest' 'Smoke'
rp_launch_description = 'Smoke test'
rp_ignore_attributes = 'xfail' 'usefixture'
  • The rp_api_key can also be set with the environment variable RP_API_KEY. This will override the value set for rp_api_key in pytest.ini

There are also optional parameters: https://reportportal.io/docs/log-data-in-reportportal/test-framework-integration/Python/pytest/

Examples

For logging of the test item flow to ReportPortal, please, use the python logging handler provided by plugin like bellow:

in conftest.py:

in tests:

Launching

To run test with ReportPortal you must provide '--reportportal' flag:

Check the documentation to find more detailed information about how to integrate pytest with ReportPortal using an agent: https://reportportal.io/docs/log-data-in-reportportal/test-framework-integration/Python/pytest/

Licensed under the Apache 2.0 license (see the LICENSE file).