Skip to main content

ReportPortal integration client lib

Project description


This library is Report Portal connector that allows you to integrate Report Portal with your Python Behave BDD testing framework

Your automation framework will run just as it does now unless you choose to run with Report Portal Integration

The library was updated to work with Report Portal API v5+ and the reportportal-client lib v5



  1. Clone the repository
  2. Enter the folder and run pip install .

Using pip and

pip install reportportal-behave-client

NOTE: Use version >= 1.0.3 for ReportPortal v5

Sending reports to Report Portal

In order to enable the Report Portal Integration add the -D rp_enable=True:

behave -D rp_enable=True

For step based reporting you need to also add the step based flag -D step_based=True:

behave -D rp_enable=True -D step_based=True

Integrating the lib in your framework

In your file add the service in each method. For e.g.:

def before_all(context):
    tags = ', '.join([tag for tags in context.config.tags.ands for tag in tags])
    attributes = {
        # Used to label launches in Report Portal
        "environment": context.config.userdata.get('environment', "staging"),
        "version": context.config.userdata.get('version', "unknown"),
    rp_enable = context.config.userdata.getbool('rp_enable', False)
    step_based = context.config.userdata.getbool('step_based', True)
    context.requested_browser = context.config.userdata.get('browser', "chrome")
    rp_token = os.environ.get("RP_TOKEN")
    add_screenshot = context.config.userdata.getbool('add_screenshot', False)
    launch_name = f"Execution using tags: {tags}"
    launch_description = f"BDD Tests for: {tags}"
    context.behave_integration_service = BehaveIntegrationService(rp_endpoint=rp_endpoint,
    context.launch_id = context.behave_integration_service.launch_service(attributes=attributes, tags=tags)

def before_feature(context, feature):
    context.feature_id = context.behave_integration_service.before_feature(feature)

def before_scenario(context, scenario):
    context.scenario_id = context.behave_integration_service.before_scenario(scenario,

def before_step(context, step):
    context.step_id = context.behave_integration_service.before_step(step, scenario_id=context.scenario_id)

def after_step(context, step):
    context.behave_integration_service.after_step(step, context.step_id)

def after_scenario(context, scenario):
    context.behave_integration_service.after_scenario(scenario, context.scenario_id)

def after_feature(context, feature):
    context.behave_integration_service.after_feature(feature, context.feature_id)

def after_all(context):

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

reportportal-behave-client-1.1.1.tar.gz (7.3 kB view hashes)

Uploaded Source

Built Distribution

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page