Qase Pytest Plugin

raw JSON →
8.1.0 verified Mon Apr 27 auth: no python

Qase Pytest Plugin integrates pytest with Qase TestOps and Qase Report, allowing you to publish test results, manage test cases, and track test runs. Version 8.1.0 requires Python >=3.9. The library is actively maintained with regular releases.

pip install qase-pytest
error pluggy._manager.PluginValidationError: Plugin 'qaseio.pytest' could not be loaded: (qaseio.pytest) cannot import name 'QaseConfig' from 'qaseio'
cause Importing QaseConfig from the top-level qaseio package instead of the subpackage.
fix
Use 'from qaseio.pytest import QaseConfig'.
error pytest.fixture.FixtureLookupError: The requested fixture has no fixture defined: qase_api
cause The fixture 'qase_api' is not automatically available; it must be declared in conftest.py or a plugin.
fix
Ensure any test file using 'qase_api' has it imported from qaseio.pytest in conftest.py.
error qaseio.exceptions.QaseApiError: Authentication error: Invalid API token
cause The QASE_API_TOKEN environment variable is missing or incorrect.
fix
Set QASE_API_TOKEN to a valid Qase API token in your environment or in a .env file.
breaking Version 8.0.0 replaced the old 'qase' marker with 'qase_id' marker for attaching test case IDs. Existing tests using '@pytest.mark.qase(1)' will not be recognized.
fix Replace '@pytest.mark.qase(id)' with '@pytest.mark.qase_id(id)'.
gotcha The 'qase_api' fixture must be imported from qaseio.pytest, not from qaseio. Importing from the wrong module will cause a FixtureLookupError.
fix Use 'from qaseio.pytest import qase_api' in your conftest.py.
deprecated In version 7.x, the 'QASE_MODE' environment variable was used to switch between report and testops modes. In 8.x, use '--qase-mode' CLI argument or 'mode' in config.
fix Use 'pytest --qase-mode testops' instead of setting QASE_MODE environment variable.

Set up Qase API token and project code via environment variables, then run 'pytest --qase' to publish results.

# conftest.py
import os
import pytest
from qaseio.pytest import qase_api

@pytest.fixture
def api_token(qase_api):
    qase_api.config.api_token = os.environ.get('QASE_API_TOKEN', '')
    qase_api.config.project_code = os.environ.get('QASE_PROJECT_CODE', 'PROJ')
    return qase_api

def test_example(api_token):
    assert 1 == 1