Skip to main content

Pytest connector for Zebrunner reporting

Project description

Zebrunner PyTest agent

The official Zebrunner Pytest agent provides reporting functionality. It can automatically track selenium sessions and send info about session details to Zebrunner backend. It can be ease integrated in project just by installing library and adding configuration file.

Installation


pip install pytest-zebrunner

Configuration


Library don't ready for usage just after installation. It won't send data to zebrunner service without additional configuration. To configure app you need to specify environment variables. It can be done by specifying variables in .env file.

Environment variables

SERVICE_URL=<zebrunner url>
ACCESS_TOKEN=<access_token>
ZEBRUNNER_PROJECT=ProjectName
ZEBRUNNER_ENABLED=true
BUILD=1.25.16
ENV=stage

You can configure agent only with environment variables. Another formats would be added in future. Planed formats are yaml, ini and program arguments.

  • SERVICE_URL - [required] Base URL of Zebrunner service.

  • ACCESS_TOKEN - [required] Authorization token. You can find it in Account & profile section.

  • ZEBRUNNER_PROJECT - [required] Name of project.

  • REPORTING_ENABLED - You can disable agent if it makes side effects in you project or doesn't work.

  • BUILD - Version of product on which tests are running.

  • ENV - Testing environment name.

If required configurations not provided there is a warning in logs with problem description and names of options, which need to be specified. Parameter names are case insensitive and can be written in upper and lower registers.

Additional functionality


IMPORTANT: All attachments to tests can be done only while some test is running. All attachments to test-run can be done only while pytest test-session is active.

Attach screenshot

from pytest_zebrunner.attachments import attach_test_screenshot


def test_something():
    ...
    attach_test_screenshot("path_to_screenshot.png")
    ...

Attach artifact to test

from pytest_zebrunner.attachments import attach_test_artifact


def test_something():
    ...
    attach_test_artifact("path_to_artifact")
    ...

Attach artifact-reference to test

from pytest_zebrunner.attachments import attach_test_artifact_reference


def test_something():
    ...
    attach_test_artifact_reference("name", "reference")
    ...

Attach artifact to test-run

from pytest_zebrunner.attachments import attach_test_run_artifact


attach_test_run_artifact("path_to_artifact")

Attach artifact-reference to test-run

from pytest_zebrunner.attachments import attach_test_run_artifact_reference


attach_test_run_artifact_reference("name", "reference")

Attach labels to test

@pytest.mark.label("name", "value")
def test_something():
    ...

or

from pytest_zebrunner.attachments import attach_test_label


def test_something():
    ...
    attach_test_label("name", "value")
    ...

Note: These two methods can be combined.

Attach label to test run

from pytest_zebrunner.attachments import attach_test_run_label

attach_test_run_label("name", "value")

Add maintainer to test

@pytest.mark.maintainer("username_of_maintainer")
def test_something():
    ...

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

pytest-zebrunner-0.1.0.tar.gz (13.9 kB view hashes)

Uploaded Source

Built Distribution

pytest_zebrunner-0.1.0-py3-none-any.whl (15.7 kB view hashes)

Uploaded Python 3

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