Index: tst_cloud_sync_device_registration/test.py =================================================================== diff -u -reb60fc7fabd81e5d61e9526dea36ceeecd29f1ea -r9d149eb43cc0dc58b5b3d52f64ccc6180abb7161 --- tst_cloud_sync_device_registration/test.py (.../test.py) (revision eb60fc7fabd81e5d61e9526dea36ceeecd29f1ea) +++ tst_cloud_sync_device_registration/test.py (.../test.py) (revision 9d149eb43cc0dc58b5b3d52f64ccc6180abb7161) @@ -39,12 +39,45 @@ NUMBER_OF_OPMODE = 9 NUMBER_OF_TREATMENTMODES = 3 CONDITIONS = [0,1] -SW_VERSION = 06300216 +SW_VERSION = 6292356 ZERO = 0 THREE = 3 +epoch = 0 +def retrive_log_data(): + file_name = utility.get_extracted_file_inp_buf() + contain = [] + try: + with open(file_name) as f: + contents = f.read() + test.log(str(contents)) + try: + for reader in reversed(list(contents)): + test.log(str(reader)) + return (row[0],row[1],row[2],row[3],row[4],row[5],row[6],row[7],row[8]) + except: + test.fail("application log data is corrupted") + except: + test.fail("Log file is not created or log file is not created based on standard log naming format.") -def verify_log(epoch, ZERO, registration_request, THREE, HD_VERSION_SERIAL, DG_VERSION_SERIAL = None, SW_VERSION): +# try: +# log_location = str(utility.get_extracted_file()) +# with open(log_location, 'r') as csv_file: +# +# try: +# for row in csv_file: +# reader = csv.reader(csv_file) +# for row in reader: +# row_length = sum(1 for values in row) +# for row1 in row: +# # if row[0]!= None and row[0] == msg_text and row_length == 3: +# return (row[1],row[2],row[3],row[4],row[5],row[6],row[7],row[8]) +# except: +# test.fail("Treatment log data is corrupted") +# except: +# test.fail("Log file is not created or log file is not created based on standard log naming format.") + +def verify_log(epoch, ZERO, registration_request, THREE, HD_VERSION_SERIAL, DG_VERSION_SERIAL, SW_VERSION): """ This function verifies the UI log's. @param msg_id - (string) expected message_id's. @@ -53,18 +86,19 @@ """ test.startSection("Verification of UI log based on message ID : " + str(msg_id)) utils.waitForGUI(2) - ack = False - if not msg_id in msg_defs.ACK_NOT_REQUIRED: - ack = True - message_extracted = utility.get_current_log_details_from_inp_buf(epoch, ZERO, registration_request, THREE, HD_VERSION_SERIAL, DG_VERSION_SERIAL = None, SW_VERSION) - if ack == True: - test.verify(config.ACK_REQ_STATUS in message_extracted, "ack request is verified") - test.verify(config.ACK_BAK_STATUS in message_extracted, "ack back is verified") - message_id_hex = builtins.hex(builtins.int(msg_id)) - message_id_str = builtins.str(message_id_hex) - test.verify(message_id_str in message_extracted, "message ID is verified") - if param != None: - test.verify(param in message_extracted, "parameters are verified") + message_extracted = utility.get_current_log_details_from_inp_buf(epoch, ZERO, registration_request, THREE, HD_VERSION_SERIAL, DG_VERSION_SERIAL, SW_VERSION) + test.verify(epoch in message_extracted, "EPOCH value is verified") + test.verify(registration_request in message_extracted, "Registration request number is verified") + test.verify(THREE in message_extracted, "THREE is verified") + test.verify(HD_VERSION_SERIAL in message_extracted, "HD Version Serial is verified") + test.verify(DG_VERSION_SERIAL in message_extracted, "DG Version Serial is verified") + test.verify(SW_VERSION in message_extracted, "Software Version is verified") + +# message_id_hex = builtins.hex(builtins.int(msg_id)) +# message_id_str = builtins.str(message_id_hex) +# test.verify(message_id_str in message_extracted, "message ID is verified") +# if param != None: +# test.verify(param in message_extracted, "parameters are verified") test.endSection() @@ -77,8 +111,10 @@ utils.waitForGUI(5) #0x9900 hd_simulator.cmd_send_serial_hd_data(serial = config.CLOUD_SYNC["HD_VERSION_SERIAL"][index]) - verify_log(epoch, ZERO, registration_request, THREE, HD_VERSION_SERIAL, DG_VERSION_SERIAL = None, SW_VERSION) - +# verify_log(epoch, ZERO, registration_request, THREE, HD_VERSION_SERIAL, DG_VERSION_SERIAL = None, SW_VERSION) + epoch, ZERO, registration_request, THREE, HD_VERSION_SERIAL, DG_VERSION_SERIAL, SW_VERSION = retrive_log_data() + test.log(str(epoch, ZERO, registration_request, THREE, HD_VERSION_SERIAL, DG_VERSION_SERIAL, SW_VERSION)) + # utils.waitForGUI(5) # #0x8800 # dg_simulator.cmd_send_serial_dg_data(serial = 'DG1234567890123')