Skip to main content

A Qase-Pytest plugin to extract test results and push metrics to Victoria Metrics

Project description

Qase-Pytest Metrics Exporter

This project leverages the qase-pytest plugin to extract test result data, convert it into metrics, and push it to Victoria Metrics.

Features

  • Collects test execution results using qase-pytest
  • Formats results into metrics
  • Pushes the metrics to Victoria Metrics for monitoring and visualization

Environment Variables

Before running the tests, set up the following environment variables:

Variable Name Description Required
VICTORIA_URL URL of the Victoria Metrics instance Yes
QASE_TESTOPS_RUN_ID Qase TestOps Run ID Yes
QASE_TESTOPS_PROJECT Qase project identifier Yes
PLATFORM Platform identifier (e.g., OS, environment) Yes
QASE_TESTOPS_API_TOKEN API token for Qase integration Yes
EXCLUDED_RUN_ID Run ID to exclude from metrics Yes
PUSH_TO_VICTORIA Option to Push or Not Push the Result Yes

Usage

On a testcase level, import this decators

from pytest_metrics.decorators import qase_id, qase_title, qase_suite, qase_tags

To apply the decorators , follow this example :

@qase_id(5189)
@qase_title("User success login, when input email, password, and gauth valid")
@qase_suite("PRO WEB.AUTH.LOGIN")
@qase_tags("ProSpot")
def test_1():
    var = False
    assert_that(var).is_true()

To exclude test case from being pushed to Excluded Run Id, follow this example :

@qase_ignore()

Modify your conftest.py file to integrate with the metrics reporting system:

from pytest_metrics.metrics import MetricsReport
import os

qase_report = MetricsReport()

@pytest.hookimpl(tryfirst=True, hookwrapper=True)
def pytest_runtest_makereport(item, call):
    outcome = yield
    rep = outcome.get_result()

    if call.when == "call":
        qase_report.collect_result(item, rep)
        item.test_result = rep

def pytest_sessionfinish(session, exitstatus):
    worker_id = os.environ.get("PYTEST_XDIST_WORKER")

    if worker_id:
        qase_report.save_to_temp_file(worker_id)
    else:
        qase_report.load_and_merge_results()
        qase_report.send_to_victoria_metrics()

Installation

  1. Install dependencies:
pip install qase-victoria-metrics
  1. Set up the required environment variables.

  2. Run your tests:

pytest /path/to/file

How It Works

  • During test execution, pytest_runtest_makereport collects test results.
  • After the test session, results are either saved (for distributed runs) or aggregated.
  • The final results are pushed to Victoria Metrics for monitoring.

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

qase_victoria_metrics-1.0.5b0.tar.gz (7.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

qase_victoria_metrics-1.0.5b0-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

File details

Details for the file qase_victoria_metrics-1.0.5b0.tar.gz.

File metadata

  • Download URL: qase_victoria_metrics-1.0.5b0.tar.gz
  • Upload date:
  • Size: 7.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for qase_victoria_metrics-1.0.5b0.tar.gz
Algorithm Hash digest
SHA256 f0932582baa139e31e736f25e3a3076fcdd172b734f7f0e63ebaa469ab00db03
MD5 6569a586788c0ee89624cb313b28ffa7
BLAKE2b-256 00d560dbedd1e3b300e9ceae528c29c2fd8bda2a1a729e4e25ccce26590aad50

See more details on using hashes here.

Provenance

The following attestation bundles were made for qase_victoria_metrics-1.0.5b0.tar.gz:

Publisher: release.yml on dsetiawan230294/qase-victoria-metrics

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file qase_victoria_metrics-1.0.5b0-py3-none-any.whl.

File metadata

File hashes

Hashes for qase_victoria_metrics-1.0.5b0-py3-none-any.whl
Algorithm Hash digest
SHA256 f5431461993c1dea2ef7d597a2462fe2a2d1d0986cc95fbf598e855f7d798792
MD5 b444978a4e9e29ac5c6d716b65687f66
BLAKE2b-256 b74b60daf4a66e7bda2ed9abbc40db469e0fc9eb8169d38bd70c494b180e8194

See more details on using hashes here.

Provenance

The following attestation bundles were made for qase_victoria_metrics-1.0.5b0-py3-none-any.whl:

Publisher: release.yml on dsetiawan230294/qase-victoria-metrics

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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