Skip to content

Commit bb0fba8

Browse files
Merge pull request #572 from mahbd/new_var_zeuztclog
added new shared variable zeuz_tc_logs
2 parents 44ca129 + 932b9ed commit bb0fba8

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

Framework/MainDriverApi.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -969,6 +969,7 @@ def run_test_case(
969969
shared.Set_Shared_Variables("zeuz_prettify_limit", 500)
970970
CommonUtil.prettify_limit = 500
971971

972+
shared.Set_Shared_Variables("zeuz_tc_logs", {"errors": []}, pretty=False, print_variable=False)
972973
shared.Set_Shared_Variables("zeuz_attachments_dir", (Path(temp_ini_file).parent/"attachments").__str__())
973974
if not shared.Test_Shared_Variables("element_wait"):
974975
shared.Set_Shared_Variables("element_wait", 10)

Framework/Utilities/CommonUtil.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -702,6 +702,27 @@ def ExecLog(
702702
# Except the browser logs
703703
global all_logs, all_logs_count, all_logs_list
704704

705+
# Append the errors in the zeuz_tc_logs
706+
if iLogLevel == 3:
707+
try:
708+
from Framework.Built_In_Automation.Shared_Resources import BuiltInFunctionSharedResources as shared
709+
zeuz_tc_logs = shared.Get_Shared_Variables("zeuz_tc_logs")
710+
if zeuz_tc_logs and isinstance(zeuz_tc_logs, dict):
711+
now = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
712+
error_entry = {
713+
"step": int(current_step_no),
714+
"action": int(current_action_no),
715+
"module": sModuleInfo,
716+
"message": sDetails,
717+
"test_case_id": current_tc_no,
718+
"timestamp": now
719+
}
720+
zeuz_tc_logs["errors"].append(error_entry)
721+
shared.Set_Shared_Variables("zeuz_tc_logs", zeuz_tc_logs, print_variable=False, pretty=False)
722+
except:
723+
pass
724+
725+
705726
log_id = ConfigModule.get_config_value(
706727
"sectionOne", "sTestStepExecLogId", temp_config
707728
)

0 commit comments

Comments
 (0)