9797
9898all_logs = {}
9999all_logs_json , json_log_cond = [], False
100+ zeuz_tc_run_comment = []
100101tc_error_logs = []
101102all_logs_count = 0
102103all_logs_list = []
@@ -460,6 +461,23 @@ def node_manager_json(data):
460461)
461462report_json_time = 0.0
462463
464+ def construct_commment_string (original_log , operations ):
465+ result = []
466+ final_comment = ""
467+ for op_dict in operations :
468+ op = op_dict ['op' ]
469+ comment = op_dict ['comment' ]
470+
471+ if op == 'overwrite' :
472+ result = [comment ] # Clear the list and add the new comment
473+ elif op == 'append' :
474+ result .append (comment ) # Append the comment
475+ elif op == 'prepend' :
476+ result .insert (0 , comment ) # Prepend the comment
477+
478+ final_comment = '\n ' .join (result ) + '\n \n ' + original_log
479+ return final_comment .strip ()
480+
463481
464482def CreateJsonReport (logs = None , stepInfo = None , TCInfo = None , setInfo = None ):
465483 try :
@@ -469,7 +487,7 @@ def CreateJsonReport(logs=None, stepInfo=None, TCInfo=None, setInfo=None):
469487 return
470488 elif upload_on_fail and rerun_on_fail and not rerunning_on_fail and logs :
471489 return
472- global all_logs_json , report_json_time , tc_error_logs , passed_after_rerun
490+ global all_logs_json , report_json_time , tc_error_logs , passed_after_rerun , zeuz_tc_run_comment
473491 start = time .perf_counter ()
474492 if logs or stepInfo or TCInfo or setInfo :
475493 log_id = ConfigModule .get_config_value ("sectionOne" , "sTestStepExecLogId" , temp_config )
@@ -502,8 +520,12 @@ def CreateJsonReport(logs=None, stepInfo=None, TCInfo=None, setInfo=None):
502520 elif passed_after_rerun :
503521 fail_reason_str = "** Test case Failed on first run but Passed when Rerun **"
504522 passed_after_rerun = False
505- testcase_info ["execution_detail" ]["failreason" ] = fail_reason_str
523+
524+ # Add custom comment with fail_reason_str
525+ fail_reason_comment = construct_commment_string (fail_reason_str , zeuz_tc_run_comment )
526+ testcase_info ["execution_detail" ]["failreason" ] = fail_reason_comment
506527 tc_error_logs = []
528+ zeuz_tc_run_comment = []
507529 return
508530 if step_id == "none" :
509531 return
0 commit comments