Skip to main content

ReportPortal integration for RobotFramework

A RobotFramework Listener to report test results to ReportPortal

DISCLAIMER: We use Google Analytics for sending anonymous usage information such as agent's and client's names, and their versions after a successful launch start. This information might help us to improve both ReportPortal backend and client sides. It is used by the ReportPortal team only and is not supposed for sharing with 3rd parties.

PyPI Python versions Build Status codecov.io Join Slack chat! stackoverflow Build with Love

Installation

First you need to install RobotFramework:

pip install robotframework

The latest stable version of library is available on PyPI:

pip install robotframework-reportportal

Usage

Properties

For reporting results to ReportPortal you need to pass some variables to robot run:

Required:

These variable should be specified in either case:

--listener robotframework_reportportal.listener
--variable RP_ENDPOINT:"your_reportportal_url"
--variable RP_LAUNCH:"launch_name"
--variable RP_PROJECT:"reportportal_project_name"

And also one type of authorization is required: API Key or OAuth 2.0 Password grant:

--variable RP_API_KEY:"your_user_api_key"
    - You can get it in the User Profile section on the UI.

Or:

--variable RP_OAUTH_URI:"https://reportportal.example.com/uat/sso/oauth/token"
    - OAuth 2.0 token endpoint URL for password grant authentication. **Required** if API key is not used.
--variable RP_OAUTH_USERNAME:"my_username"
    - OAuth 2.0 username for password grant authentication. **Required** if OAuth 2.0 is used.
--variable RP_OAUTH_PASSWORD:"my_password"
    - OAuth 2.0 password for password grant authentication. **Required** if OAuth 2.0 is used.
--variable RP_OAUTH_CLIENT_ID:"client_id"
    - OAuth 2.0 client identifier. **Required** if OAuth 2.0 is used.
--variable RP_OAUTH_CLIENT_SECRET:"client_id_secret"
    - OAuth 2.0 client secret. **Optional** for OAuth 2.0 authentication.
--variable RP_OAUTH_SCOPE:"offline_access"
    - OAuth 2.0 access token scope. **Optional** for OAuth 2.0 authentication.

Optional:

--variable RP_CLIENT_TYPE:"SYNC"
    - Type of the under-the-hood ReportPortal client implementation. Possible values: [SYNC, ASYNC_THREAD, ASYNC_BATCHED].
--variable RP_LAUNCH_UUID:"id_of_existing_rp_launch"
    - ID of existing ReportPortal launch
--variable RP_LAUNCH_DOC:"some_documentation_for_launch"
    - Description for the launch
--variable RP_LAUNCH_ATTRIBUTES:"RF tag_name:tag_value"
    - Space-separated list of tags/attributes for the launch
--variable RP_LAUNCH_UUID_PRINT:"True"
    - Default value is "False", enables printing Launch UUID on test run start.
--variable RP_LAUNCH_UUID_PRINT_OUTPUT:"stderr"
    - Default value is "stdout", Launch UUID print output. Possible values: [stderr, stdout].
--variable RP_TEST_ATTRIBUTES:"key1:value1 key1:value2 tag key2:value3"
    - Space-separated list of tags/attributes for the tests
--variable RP_CONNECT_TIMEOUT:"20"
    - Default value is "10.0", connection timeout to ReportPortal server.
--variable RP_READ_TIMEOUT:"20"
    - Default value is "10.0", response read timeout for ReportPortal connection.
--variable RP_LOG_BATCH_SIZE:"10"
    - Default value is "20", affects size of async batch log requests
--variable RP_LOG_BATCH_PAYLOAD_LIMIT:"10240000"
    - Default value is "65000000", maximum payload size of async batch log requests
--variable RP_RERUN:"True"
    - Default is "False". Enables rerun mode for the last launch.
--variable RP_RERUN_OF:"xxxxx-xxxx-xxxx-lauch-uuid"
    - Default is "None". Enables rerun mode for the launch with the specified
      UUID. Should be used in combination with the RP_RERUN option.
--variable RP_SKIPPED_ISSUE:"True"
    - Default value is "True", marks skipped test items with 'To Investigate'
--variable RP_ATTACH_LOG:"True"
    - Default value is "False", attaches Robot Framework HTML log file to
      the launch.
--variable RP_ATTACH_REPORT:"True"
    - Default value is "False", attaches Robot Framework HTML report file to
      the launch.
--variable RP_ATTACH_XUNIT:"True"
    - Default value is "False", attaches Robot Framework XUnit result file to
      the launch.
--variable RP_VERIFY_SSL:"True"
    - Default value is "True", disables SSL verification for HTTP requests.
      Also, you can specify a full path to your certificate as the value.
--variable RP_REMOVE_KEYWORDS:"True"
    - Default value is "False", remove  keywords from reporting, passed with '--remove-keywords' Robot's argument.
--variable RP_FLATTEN_KEYWORDS:"True"
    - Default value is "False", flatten keywords on reporting, passed with '--flatten-keywords' Robot's argument.

Logging

Custom logger which supports attachments can be used in Python keywords. Usage of this logger is similar to the standard robot.api.logger with addition of an extra kwarg "attachment":

import subprocess
from robotframework_reportportal import logger


def log_free_memory():
    logger.debug("Collecting free memory statistics!")
    logger.debug(
        "Memory consumption report",
        attachment={
            "name": "free_memory.txt",
            "data": subprocess.check_output("free -h".split()),
            "mime": "text/plain",
        },
    )

Test case ID

It's possible to tag tests the following way test_case_id:12345 using default Robot Framework tagging functionality. ID specified after : will be sent to ReportPortal.

Send attachment (screenshots)

https://github.com/reportportal/client-Python#send-attachement-screenshots

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

Metadata

Release files for robotframework-reportportal 5.7.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for robotframework-reportportal 5.7.2
File Size Uploaded
robotframework_reportportal-5.7.2.tar.gz 29.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for robotframework-reportportal 5.7.2
File Interpreter ABI Platform
robotframework_reportportal-5.7.2-py3-none-any.whl Python 3 none any Details

Total release size: 62.9 kB

Release files / robotframework_reportportal-5.7.2.tar.gz

Download URL robotframework_reportportal-5.7.2.tar.gz
Size 29.2 kB
Tags Source
SHA-256 checksum
How to use checksums
e4f2ab1fd848c9ecd27f45fe6f7f347b65462cdfff3a5e20dab976d8facc298c
BLAKE2b-256 checksum
How to use checksums
de8a3b09197e03d14ade3d970596943041e898efcb93f1658aa3ca4fe37062bf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / robotframework_reportportal-5.7.2-py3-none-any.whl

Download URL robotframework_reportportal-5.7.2-py3-none-any.whl
Size 33.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a14b13815bad4346f77a4dfcc9bde56bc009441aa5d6dc45f0e4d1cbae97025b
BLAKE2b-256 checksum
How to use checksums
affc913ac70f7e6e381d6809215601966bbdc14263ad1e746276bf28ad76fc22
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release history Release notifications | RSS feed

This release

5.7.2 This release

2 release files

5.7.1

2 release files

5.7.0

2 release files

5.6.5

2 release files

5.6.4

2 release files

5.6.3

2 release files

5.6.2

2 release files

5.6.1

2 release files

5.6.0

2 release files

5.5.8

2 release files

5.5.7

2 release files

5.5.6

2 release files

5.5.5

2 release files

5.5.4

2 release files

5.5.3

2 release files

5.5.2

2 release files

5.5.1

2 release files

5.5.0

2 release files

5.4.0

2 release files

5.3.3

2 release files

5.3.2

2 release files

5.3.1

2 release files

5.3.0

2 release files

5.2.2

2 release files

5.2.1

2 release files

5.2.0

2 release files

5.1.2

2 release files

5.1.1

2 release files

5.1.0

2 release files

5.0.4

2 release files

5.0.3

2 release files

5.0.2

2 release files

5.0.1

2 release files

5.0.0

2 release files

3.1.1

2 release files

3.1.0

2 release files

3.0.0

2 release files

2.5.4

1 release file

2.5.3

1 release file

2.5.2

1 release file

2.5.1.1

1 release file

2.5.1

1 release file

2.5.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page