Pytest ReportPortal Agent

5.6.6 · active · verified Mon Apr 13

pytest-reportportal is a Pytest plugin that serves as an agent for reporting test results to the ReportPortal test automation dashboard. It enables real-time reporting, detailed logs, and execution data analysis for Python tests run with Pytest. The library, currently at version 5.6.6, receives frequent minor updates to improve functionality, fix bugs, and maintain compatibility with Python and the ReportPortal client.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to configure and run Pytest with `pytest-reportportal`. The core configuration involves setting `rp_endpoint`, `rp_project`, and `rp_api_key` (or OAuth credentials) either in a `pytest.ini` file or via environment variables. The `--reportportal` flag activates the plugin during test execution. A simple test file with passing, failing, and skipped tests is provided to show how results are reported.

import pytest
import os

# --- pytest.ini (simulated content for quickstart) ---
# [pytest]
# rp_endpoint = http://localhost:8080
# rp_project = default_personal
# rp_api_key = your_api_key_from_reportportal_profile
# rp_launch = MyPytestLaunch

# To run this example:
# 1. Ensure ReportPortal is running (e.g., via Docker).
# 2. Set environment variables or create a pytest.ini file:
#    export RP_ENDPOINT="http://localhost:8080"
#    export RP_PROJECT="default_personal"
#    export RP_API_KEY="your_api_key"
# 3. Save the test below as `test_example.py`.
# 4. Run from your terminal: `pytest --reportportal test_example.py`

def test_passing_example():
    assert True

def test_failing_example():
    assert False

@pytest.mark.skip(reason="demonstrating skip")
def test_skipped_example():
    pass

view raw JSON →