diff --git a/TestEnvironment/env/leo_grifo_pdf2report.py b/TestEnvironment/env/leo_grifo_pdf2report.py
index 60c6c66..694bb36 100644
--- a/TestEnvironment/env/leo_grifo_pdf2report.py
+++ b/TestEnvironment/env/leo_grifo_pdf2report.py
@@ -153,9 +153,12 @@ class PDFClass:
"""
logging.info("Setting PDF name")
+ # Use test ID as base name (falls back to file_name) and include seconds
now = datetime.now()
- date_name = now.strftime("%Y%m%d_%H%M")
- file_name_only = f"{json_test['file_name']}_{date_name}"
+ date_name = now.strftime("%Y%m%d_%H%M%S")
+ base = json_test.get('ID') or json_test.get('file_name') or 'testReport'
+ # PDF will use suffix '_report' so final file is __report.pdf
+ file_name_only = f"{base}_{date_name}_report"
file_name = os.path.join(new_path, file_name_only)
logging.info(f"Test: {file_name}")
@@ -401,20 +404,21 @@ class PDFClass:
target_text = '-'
target_result_text = '-'
else:
- # Target test was performed - show results
- t_info = run.get('target_simulated')
- if t_info:
- try:
- target_text = f"{t_info.get('distance')}m @ cycle {t_info.get('appeared_after_cycles', t_info.get('found_at_iter','?'))}"
- except Exception:
- target_text = str(t_info)
- else:
- target_text = '-'
-
- # Target test result
+ # Target test was performed - show results based on detection
if target_detected:
+ # PASS: target was detected - show details (distance @ cycle)
+ t_info = run.get('target_simulated')
+ if t_info:
+ try:
+ target_text = f"{t_info.get('distance')}m @ cycle {t_info.get('appeared_after_cycles', t_info.get('found_at_iter','?'))}"
+ except Exception:
+ target_text = "Detected"
+ else:
+ target_text = "Detected"
target_result_text = "PASS"
else:
+ # FAIL: target was NOT detected - no details to show
+ target_text = '-'
target_result_text = "FAIL"
for cell_text in (str(run['repetition']), status_text, pbit_time,
diff --git a/TestEnvironment/scripts/GRIFO_M_PBIT.py b/TestEnvironment/scripts/GRIFO_M_PBIT.py
index 46f3ded..3b1930a 100644
--- a/TestEnvironment/scripts/GRIFO_M_PBIT.py
+++ b/TestEnvironment/scripts/GRIFO_M_PBIT.py
@@ -34,7 +34,7 @@ Power Cycling Timing (aligned with target2):
- Power OFF: wait_before=1s (stabilization before action), wait_after=4s (settle time)
- Power ON: wait_after=100ms (initialization delay)
-Author: Test Automation Team
+Author: Luca Vallongo
Date: 2026-01-29
Last Updated: 2026-02-02 (aligned with target2 timing and behavior)
"""
@@ -415,7 +415,8 @@ def export_statistics_to_csv(custom_statistics, test_name, output_folder):
logging.info(f"Created output folder: {output_folder}")
# Create CSV filename with absolute path
- csv_filename = f"{test_name}_statistics.csv"
+ # Use singular suffix '_statistic' to align with PDF naming ordering
+ csv_filename = f"{test_name}_statistic.csv"
csv_path = os.path.join(output_folder, csv_filename)
logging.info(f"Exporting statistics to CSV: {csv_path}")
@@ -2210,6 +2211,19 @@ def test_proc():
run_stats['target_iterations'] = tgt_result['iterations']
run_stats['target_detected'] = target_found
run_stats['target_test_time'] = target_test_time
+
+ # Update target_simulated with actual test results (for PDF table)
+ # This replaces the pre-test mock data with real post-test data
+ if target_found and tgt_result.get('range'):
+ run_stats['target_simulated'] = {
+ 'distance': int(tgt_result['range']),
+ 'appeared_after_cycles': tgt_result.get('iterations', 0),
+ 'found_at_iter': tgt_result.get('iterations', 0),
+ 'hits': tgt_result['hits']
+ }
+ else:
+ # Target not detected - clear any pre-test mock data
+ run_stats['target_simulated'] = None
# Restore STANDBY after target test ( simple command)
logging.info('[Target Test] Restoring STANDBY mode')
@@ -2367,7 +2381,8 @@ def test_proc():
# Also write JSON statistics file alongside CSV for structured consumption
try:
if csv_path and os.path.isdir(pdf_folder):
- json_filename = f"{csv_base_name}_statistics.json"
+ # JSON statistics file - singular 'statistic' to match CSV
+ json_filename = f"{csv_base_name}_statistic.json"
json_path = os.path.join(pdf_folder, json_filename)
with open(json_path, 'w', encoding='utf-8') as jf:
json.dump(custom_statistics, jf, ensure_ascii=False, indent=2)
diff --git a/run_target.bat b/run_target.bat
index 80373a1..c014a90 100644
--- a/run_target.bat
+++ b/run_target.bat
@@ -205,8 +205,8 @@ IF !EXIT_CODE! EQU 0 (
ECHO.
ECHO Results available in:
ECHO - Log: %TEST_ENV%\LOG\GRIFO_M_PBIT.log
- ECHO - PDF: %TEST_ENV%\pdf_reports\GRIFO_M_PBIT\GRIFO_M_PBIT_*.pdf
- ECHO - CSV: %TEST_ENV%\pdf_reports\GRIFO_M_PBIT\GRIFO_M_PBIT_*_statistics.csv
+ ECHO - PDF: %TEST_ENV%\pdf_reports\GRIFO_M_PBIT\GRIFO_M_PBIT_*_report.pdf
+ ECHO - CSV: %TEST_ENV%\pdf_reports\GRIFO_M_PBIT\GRIFO_M_PBIT_*_statistic.csv
ECHO.
ECHO Check PDF report for detailed test results and statistics.
ECHO.