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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for pytest_zebrunner-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b31c8958139815f08b4d9850041cc05084c57a88aa577979d0f6501a4d0fba33 |
|
MD5 | 0626b4095292eccd42917a0e1dd57d9a |
|
BLAKE2b-256 | a9057ce2938daeebab56a0d3f92ae615f9fa769b0d5822ee90597d2b040e295a |