Skip to main content

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

Installation

Manual

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

Using pip and pypi.org

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 environments.py 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,
                                                                  rp_project=rp_project,
                                                                  rp_token=rp_token,
                                                                  rp_launch_name=launch_name,
                                                                  rp_launch_description=launch_description,
                                                                  rp_enable=rp_enable,
                                                                  step_based=step_based,
                                                                  add_screenshot=add_screenshot,
                                                                  verify_ssl=False)
    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,
                                                                             feature_id=context.feature_id)


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):
    context.behave_integration_service.after_all(context.launch_id)

Metadata

Release files for reportportal-behave-client 1.1.1

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

Source distribution (sdist)

Source distribution for reportportal-behave-client 1.1.1
File Size Uploaded
reportportal-behave-client-1.1.1.tar.gz 7.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for reportportal-behave-client 1.1.1
File Interpreter ABI Platform
reportportal_behave_client-1.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 15.9 kB

Release files / reportportal-behave-client-1.1.1.tar.gz

Download URL reportportal-behave-client-1.1.1.tar.gz
Size 7.3 kB
Tags Source
SHA-256 checksum
How to use checksums
48fe7370dd7b3cc7f5ac61461e59868c74d6e53375ed143fe0f9cacf0acd58fb
BLAKE2b-256 checksum
How to use checksums
2b942a06ccbe99324fccb488ff07f67e2e00d66c07ae9111829e73934be43c4a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.0

Release files / reportportal_behave_client-1.1.1-py3-none-any.whl

Download URL reportportal_behave_client-1.1.1-py3-none-any.whl
Size 8.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7ba7aaa9b20055ad70ccde9658cd543f5b6055cdac681c261760bda7e6769a02
BLAKE2b-256 checksum
How to use checksums
a0d3277c4968c615b174ff138c386b39d067a1bcb70be0fd12e047e386f0199b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.0

Release history Release notifications | RSS feed

This release

1.1.1 This release

2 release files

1.1.0

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

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