From fb24cd83077dc0658bdbc7395c6337373742471e Mon Sep 17 00:00:00 2001 From: Dmitrii Gridnev Date: Mon, 9 Feb 2026 18:29:36 +0300 Subject: [PATCH 1/2] fix: align report mode with spec schema - Rename output file from report.json to run.json - Replace 'broken' status with 'blocked' in RunStats - Add step data conversion to TEXT format for report serialization - Update test to use blocked instead of broken --- .../src/qase/commons/models/run.py | 6 +- .../src/qase/commons/reporters/report.py | 58 ++++++++++++++++++- .../tests_qase_commons/models/test_run.py | 3 +- 3 files changed, 62 insertions(+), 5 deletions(-) diff --git a/qase-python-commons/src/qase/commons/models/run.py b/qase-python-commons/src/qase/commons/models/run.py index e670999e..9b9e0f4c 100644 --- a/qase-python-commons/src/qase/commons/models/run.py +++ b/qase-python-commons/src/qase/commons/models/run.py @@ -23,7 +23,7 @@ def __init__(self) -> None: self.passed = 0 self.failed = 0 self.skipped = 0 - self.broken = 0 + self.blocked = 0 self.invalid = 0 self.muted = 0 self.total = 0 @@ -36,8 +36,8 @@ def track(self, result: dict): self.failed += 1 elif status == "skipped": self.skipped += 1 - elif status == "broken": - self.broken += 1 + elif status == "blocked": + self.blocked += 1 elif status == "invalid": self.invalid += 1 self.total += 1 diff --git a/qase-python-commons/src/qase/commons/reporters/report.py b/qase-python-commons/src/qase/commons/reporters/report.py index cb5d79e1..84126c29 100644 --- a/qase-python-commons/src/qase/commons/reporters/report.py +++ b/qase-python-commons/src/qase/commons/reporters/report.py @@ -4,11 +4,63 @@ import json import re from ..models import Result, Run, Attachment +from ..models.step import Step, StepType, StepTextData from .. import QaseUtils, Logger from ..models.config.connection import Format from ..models.config.qaseconfig import QaseConfig +def _convert_step_data_to_text(step: Step) -> None: + """Convert step data to TEXT format for report serialization.""" + if step.data is None: + return + + step_type = step.step_type + data = step.data + + if step_type == StepType.TEXT: + # Already in TEXT format, no conversion needed + pass + elif step_type == StepType.ASSERT: + step.data = StepTextData( + action=f"Assert: {data.message}", + expected_result=str(data.expected) + ) + step.data.input_data = str(data.actual) + elif step_type == StepType.GHERKIN: + step.data = StepTextData( + action=f"{data.keyword} {data.name}", + expected_result=None + ) + step.data.input_data = data.data + elif step_type == StepType.REQUEST: + step.data = StepTextData( + action=f"{data.request_method} {data.request_url}", + expected_result=f"Status: {data.status_code}" if data.status_code else None + ) + step.data.input_data = data.request_body + elif step_type == StepType.DB_QUERY: + step.data = StepTextData( + action=f"SQL: {data.query}", + expected_result=data.expected_result + ) + step.data.input_data = data.connection_info + elif step_type == StepType.SLEEP: + step.data = StepTextData( + action=f"Sleep {data.duration}ms", + expected_result=None + ) + step.data.input_data = None + + # Set step_type to TEXT after conversion + step.step_type = StepType.TEXT + + # Recursively convert nested steps + if step.steps: + for nested_step in step.steps: + _convert_step_data_to_text(nested_step) + + class QaseReport: def __init__( self, @@ -91,6 +143,10 @@ def _persist_attachments_in_steps(self, steps: list): # Method saves result to a file def _store_result(self, result: Result): + # Convert all step data to TEXT format for report + if result.steps: + for step in result.steps: + _convert_step_data_to_text(step) self._store_object(result, self.report_path + "/results/", result.id) def _check_report_path(self): @@ -121,7 +177,7 @@ def _compile_report(self): run.add_host_data(QaseUtils.get_host_data()) - self._store_object(run, self.report_path, "report") + self._store_object(run, self.report_path, "run") # Saves a model to a file def _store_object(self, object, path, filename): diff --git a/qase-python-commons/tests/tests_qase_commons/models/test_run.py b/qase-python-commons/tests/tests_qase_commons/models/test_run.py index 95800392..874814fe 100644 --- a/qase-python-commons/tests/tests_qase_commons/models/test_run.py +++ b/qase-python-commons/tests/tests_qase_commons/models/test_run.py @@ -23,7 +23,8 @@ def test_run_stats(): assert stats.passed == 0 assert stats.failed == 0 assert stats.skipped == 0 - assert stats.broken == 0 + assert stats.blocked == 0 + assert stats.invalid == 0 assert stats.muted == 0 assert stats.total == 0 From 41f76b2f81cbc8cdd42ec0397ecc88c1a87ab9e3 Mon Sep 17 00:00:00 2001 From: Dmitrii Gridnev Date: Mon, 9 Feb 2026 18:32:48 +0300 Subject: [PATCH 2/2] chore: bump version to 5.0.2 --- qase-python-commons/changelog.md | 9 +++++++++ qase-python-commons/pyproject.toml | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/qase-python-commons/changelog.md b/qase-python-commons/changelog.md index 19dc4ade..c0f923ab 100644 --- a/qase-python-commons/changelog.md +++ b/qase-python-commons/changelog.md @@ -1,3 +1,12 @@ +# qase-python-commons@5.0.2 + +## What's new + +- Aligned report mode with specification schema: + - Renamed output file from `report.json` to `run.json` + - Replaced `broken` status with `blocked` in run statistics + - Added automatic conversion of all step data types to TEXT format for report serialization + # qase-python-commons@5.0.1 ## What's new diff --git a/qase-python-commons/pyproject.toml b/qase-python-commons/pyproject.toml index a29db7eb..6b6d4cd4 100644 --- a/qase-python-commons/pyproject.toml +++ b/qase-python-commons/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "qase-python-commons" -version = "5.0.1" +version = "5.0.2" description = "A library for Qase TestOps and Qase Report" readme = "README.md" authors = [{name = "Qase Team", email = "support@qase.io"}]