diff --git a/TPF/scenario_execution.py b/TPF/scenario_execution.py index 8827dbf..d9218a7 100644 --- a/TPF/scenario_execution.py +++ b/TPF/scenario_execution.py @@ -72,7 +72,7 @@ def run_test_suite(tasks): shell_script = "/home/asf/testarena_backend/TPF/test_execution.sh" if os.name != 'nt': subprocess.run(["chmod", "+x", shell_script]) - + print("tasks:", tasks) for task in tasks: print(f"--- Starting Task: {task['id']} ---") @@ -109,6 +109,8 @@ def run_test_suite(tasks): if not json_found: aggregated_results[task['id']] = ["ERROR", "N/A"] + else: + print(f"--- Completed Task: {json_found} ---") return aggregated_results def generate_html_report(scenario_name, results, output_path): @@ -142,14 +144,14 @@ def generate_html_report(scenario_name, results, output_path): f.write(report_content) print(f"HTML Report generated at: {report_file}") -def save_summary(results, task_id_path): +def save_summary(results): json_path = os.path.join(task_id_path, "final_summary.json") with open(json_path, "w") as f: - results = results.replace("file:///home/asf/testarena/", "http://asf-server.duckdns.org:8080/results/") json.dump(results, f, indent=4) print(f"\nFinal results saved to {json_path}") if __name__ == "__main__": + exit_code = 0 if len(sys.argv) > 3: queue_id = sys.argv[1] #"1234" scenario_path = sys.argv[2] #"application_layer/business_stack/actuator_manager/test/actuator_manager_init_test.test_scenario.xml" @@ -175,9 +177,20 @@ if __name__ == "__main__": "cmd": exec_cmd, "path": task_id_path }) - - final_data = run_test_suite(my_tasks) - save_summary(final_data, task_id_path) + if not my_tasks: + print("No test cases found in the scenario.") + final_data= { + "INVALID_SCENARIO": [ + "FAIL", + "N/A" + ], + } + exit_code = 1 + else: + final_data = run_test_suite(my_tasks) + print("\n--- Final Aggregated Results ---", final_data) + save_summary(final_data) # Generate report INSIDE the task folder - generate_html_report(os.path.basename(scenario_path), final_data, task_id_path) \ No newline at end of file + generate_html_report(os.path.basename(scenario_path), final_data, task_id_path) + sys.exit(exit_code) \ No newline at end of file diff --git a/testarena_app/main.py b/testarena_app/main.py index 04aa3a5..3631fb9 100644 --- a/testarena_app/main.py +++ b/testarena_app/main.py @@ -15,6 +15,10 @@ static_dir = os.path.join(os.path.dirname(__file__), "static") os.makedirs(static_dir, exist_ok=True) app.mount("/static", StaticFiles(directory=static_dir), name="static") +@app.get("/favicon.ico", include_in_schema=False) +async def favicon(): + return FileResponse(os.path.join(static_dir, "favicon.png")) + # Base directory for data as requested BASE_DATA_DIR = "/home/asf/testarena" # For local development on Windows, we might need to adjust this, diff --git a/testarena_app/static/favicon.png b/testarena_app/static/favicon.png new file mode 100644 index 0000000..419cc8e Binary files /dev/null and b/testarena_app/static/favicon.png differ diff --git a/testarena_app/static/index.html b/testarena_app/static/index.html index 21e89c0..c300a27 100644 --- a/testarena_app/static/index.html +++ b/testarena_app/static/index.html @@ -5,6 +5,7 @@