Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions junit_reporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ class UIPerformanceJUnitReporter:
}

@staticmethod
def create_junit_report(all_thresholds, failed_thresholds, total_thresholds, failed_count, quality_gate_status,
degradation_rate=None, missed_thresholds_percent=None):
def create_junit_report(all_thresholds, failed_thresholds, total_thresholds, failed_count, quality_gate_status,
deviation=None, baseline_deviation=None, missed_thresholds_percent=None):
"""Create JUnit XML report for UI performance test results."""
test_name = environ.get("JOB_NAME", "UI_Performance_Test")
report_id = environ.get("REPORT_ID", "unknown")
Expand All @@ -46,9 +46,9 @@ def create_junit_report(all_thresholds, failed_thresholds, total_thresholds, fai

unit_suffix = f" {unit}" if unit else ""
system_out = f"Value: {display_value:.2f}{unit_suffix}. Threshold value: {threshold_value:.2f}{unit_suffix}"
if degradation_rate and degradation_rate > 0 and adjusted_threshold != threshold_value:
system_out += f". Degradation rate: {degradation_rate}% (adj. threshold: {adjusted_threshold:.2f}{unit_suffix})"

if deviation and deviation > 0 and adjusted_threshold != threshold_value:
system_out += f". Deviation: {deviation}% (adj. threshold: {adjusted_threshold:.2f}{unit_suffix})"

if scope == page:
testcase_name = f"Threshold for {scope}, target - {target}"
Expand Down
26 changes: 15 additions & 11 deletions post_processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@

try:
# Fetch test configuration for quality gate settings
degradation_rate = None
deviation = None
baseline_deviation = None
missed_thresholds_percent = None
try:
test_config_url = f"{URL}/api/v1/ui_performance/tests/{PROJECT_ID}"
Expand All @@ -53,11 +54,12 @@
integrations_config = test.get('integrations', {})
processing_config = integrations_config.get('processing', {})
quality_gate_config = processing_config.get('quality_gate', {})

degradation_rate = quality_gate_config.get('degradation_rate')

deviation = quality_gate_config.get('deviation')
baseline_deviation = quality_gate_config.get('baseline_deviation')
missed_thresholds_percent = quality_gate_config.get('missed_thresholds')

logger.info(f"Quality gate configuration - degradation_rate: {degradation_rate}, missed_thresholds: {missed_thresholds_percent}")
logger.info(f"Quality gate configuration - deviation: {deviation}, baseline_deviation: {baseline_deviation}, missed_thresholds: {missed_thresholds_percent}")
break
else:
logger.warning(f"Test '{TEST_NAME}' not found in configuration response")
Expand Down Expand Up @@ -216,10 +218,10 @@ def get_result_type(identifier):
threshold_value = threshold.get('value', 0)
comparison = threshold.get('comparison', 'lte')

# Apply degradation rate tolerance if configured
# Apply deviation tolerance if configured
adjusted_threshold = threshold_value
if degradation_rate is not None and degradation_rate > 0:
tolerance = threshold_value * (degradation_rate / 100.0)
if deviation is not None and deviation > 0:
tolerance = threshold_value * (deviation / 100.0)
if comparison in ['gte', 'gt']:
adjusted_threshold = threshold_value + tolerance
elif comparison in ['lte', 'lt']:
Expand All @@ -241,13 +243,13 @@ def get_result_type(identifier):
threshold_record['status'] = 'failed'
failed_thresholds.append(threshold_record)
all_evaluated_thresholds.append(threshold_record)
degradation_info = f" (tolerance: {adjusted_threshold:.3f})" if degradation_rate else ""
degradation_info = f" (tolerance: {adjusted_threshold:.3f})" if deviation else ""
logger.warning(f"{threshold['scope']} {threshold['target']} = {comparison_value:.3f} "
f"violates {comparison} {threshold_value}{degradation_info} [FAILED]")
else:
threshold_record['status'] = 'passed'
all_evaluated_thresholds.append(threshold_record)
degradation_info = f" (tolerance: {adjusted_threshold:.3f})" if degradation_rate else ""
degradation_info = f" (tolerance: {adjusted_threshold:.3f})" if deviation else ""
logger.debug(f"{threshold['scope']} {threshold['target']} = {comparison_value:.3f} "
f"complies {comparison} {threshold_value}{degradation_info} [PASSED]")

Expand Down Expand Up @@ -308,7 +310,8 @@ def get_result_type(identifier):
total_thresholds=total,
failed_count=failed,
quality_gate_status=status,
degradation_rate=degradation_rate,
deviation=deviation,
baseline_deviation=baseline_deviation,
missed_thresholds_percent=missed_thresholds_percent
)

Expand Down Expand Up @@ -361,7 +364,8 @@ def get_result_type(identifier):
quality_gate_config = integrations['processing']['quality_gate']
else:
quality_gate_config = {}
event["performance_degradation_rate"] = quality_gate_config.get('degradation_rate')
event["deviation"] = quality_gate_config.get('deviation')
event["baseline_deviation"] = quality_gate_config.get('baseline_deviation')
event["missed_thresholds"] = quality_gate_config.get('missed_thresholds')

res = requests.post(task_url, json=event, headers={'Authorization': f'bearer {TOKEN}',
Expand Down