Skip to content

Commit 325637e

Browse files
committed
Added test case id in the error logs
1 parent fa58cda commit 325637e

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

Framework/MainDriverApi.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -950,6 +950,9 @@ def run_test_case(
950950
browserDriver=None,
951951
):
952952
try:
953+
prev_zeuz_tc_logs = shared.Get_Shared_Variables("zeuz_tc_logs")
954+
prev_zeuz_tc_logs['current_test_case_id'] = TestCaseID
955+
shared.Set_Shared_Variables("zeuz_tc_logs", prev_zeuz_tc_logs, pretty=False, print_variable=False)
953956
TestCaseStartTime = time.time()
954957
test_case = str(TestCaseID).replace("#", "no")
955958
CommonUtil.current_tc_no = test_case
@@ -1802,6 +1805,8 @@ def download_or_copy(attachment):
18021805
# main function
18031806
def main(device_dict, all_run_id_info):
18041807
try:
1808+
# Set TC logs
1809+
shared.Set_Shared_Variables("zeuz_tc_logs", {"errors": []}, print_variable=False, pretty=False)
18051810
# get module info
18061811
sModuleInfo = inspect.currentframe().f_code.co_name + " : " + MODULE_NAME
18071812

Framework/Utilities/CommonUtil.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -710,11 +710,13 @@ def ExecLog(
710710
if not zeuz_tc_logs or not isinstance(zeuz_tc_logs, dict):
711711
zeuz_tc_logs = {"errors": []}
712712
now = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
713+
test_case_id = zeuz_tc_logs.get("current_test_case_id", 'unknown')
713714
error_entry = {
714-
"step": str(current_step_no),
715-
"action": str(current_action_no),
715+
"step": int(current_step_no),
716+
"action": int(current_action_no),
716717
"module": sModuleInfo,
717718
"message": sDetails,
719+
"test_case_id": test_case_id,
718720
"timestamp": now
719721
}
720722
zeuz_tc_logs["errors"].append(error_entry)

0 commit comments

Comments
 (0)