Index: shared/scripts/configuration/config.py =================================================================== diff -u -r8a0969432960a8fe5773d3c25304cb6a400c299b -r29c20da01a9b6e69b3cc28efa76ddfe24192145e --- shared/scripts/configuration/config.py (.../config.py) (revision 8a0969432960a8fe5773d3c25304cb6a400c299b) +++ shared/scripts/configuration/config.py (.../config.py) (revision 29c20da01a9b6e69b3cc28efa76ddfe24192145e) @@ -85,4 +85,24 @@ } +TREATMENT_DATA_PARAMETER = { + "Blood flow rate" : [1, 2], + "Dialysate flow rate" : [3, 5], + "Uf rate" : [1.234, 3.452], + "Arterial pressure" : [10.123, 10.567], + "Venous pressure" : [10.323, 10.634], + + } +TREATMENT_ALARM_PARAMETER = { + "Alarm Id" : [2, 4], + "Parameter1" : [2.3, 3.7], + "Parameter2" : [3.4, 4.5], + + } +TREATMENT_EVENT_PARAMETER = { + "Event id" : [2, 3], + "Old Value" : [1.523, 1.945], + "New Value" : [2.523, 3.567], + + } Index: shared/scripts/configuration/utility.py =================================================================== diff -u -r8a0969432960a8fe5773d3c25304cb6a400c299b -r29c20da01a9b6e69b3cc28efa76ddfe24192145e --- shared/scripts/configuration/utility.py (.../utility.py) (revision 8a0969432960a8fe5773d3c25304cb6a400c299b) +++ shared/scripts/configuration/utility.py (.../utility.py) (revision 29c20da01a9b6e69b3cc28efa76ddfe24192145e) @@ -229,6 +229,5 @@ test.compare(bullet_border_color, config.INCOMPLETE_COLOR) test.endSection() - Index: tst_post_treatment/test.py =================================================================== diff -u -r4cf849e3fb0d7f454325a217602e91bf9c1b03d1 -r29c20da01a9b6e69b3cc28efa76ddfe24192145e --- tst_post_treatment/test.py (.../test.py) (revision 4cf849e3fb0d7f454325a217602e91bf9c1b03d1) +++ tst_post_treatment/test.py (.../test.py) (revision 29c20da01a9b6e69b3cc28efa76ddfe24192145e) @@ -20,9 +20,9 @@ import names import csv import os -from pathlib import Path import test import builtins +from pathlib import Path from dialin.ui import utils from datetime import * from configuration import config @@ -32,7 +32,6 @@ hd_simulator = HDSimulator() - SCREEN_OBJ1 = names.o_PostTreatmentStack_patientDisconnectionConfirm_TreatmentFlowBase SCREEN_OBJ3 = names.o_PostTreatmentStack_disposablesRemovalConfirm_TreatmentFlowBase num_of_instructionss = 0 @@ -42,9 +41,7 @@ pth = Path(os.getcwd()) - - def get_rightarrow_obj(screen_obj): """ To obtain object for right arrow based on container @@ -329,6 +326,17 @@ average_venous_pressure = config.POST_TREATMENT_REVIEW_PARAMETER_RANGE["Average Venous Pressure"][index] ) utils.waitForGUI(1) + hd_simulator.cmd_send_treatment_log_data(blood_flow_rate = config.TREATMENT_DATA_PARAMETER["Blood flow rate"][index], + dialysate_flow_rate = config.TREATMENT_DATA_PARAMETER["Dialysate flow rate"][index], + uf_rate = config.TREATMENT_DATA_PARAMETER["Uf rate"][index], + arterial_pressure = config.TREATMENT_DATA_PARAMETER["Arterial pressure"][index], + venous_pressure = config.TREATMENT_DATA_PARAMETER["Venous pressure"][index]) + hd_simulator.cmd_send_treatment_log_alarm(alarm_id = config.TREATMENT_ALARM_PARAMETER["Alarm Id"][index], + parameter1 = config.TREATMENT_ALARM_PARAMETER["Parameter1"][index], + parameter2 = config.TREATMENT_ALARM_PARAMETER["Parameter2"][index]) + hd_simulator.cmd_send_treatment_log_event(event_id = config.TREATMENT_EVENT_PARAMETER["Event id"][index], + old_value = config.TREATMENT_EVENT_PARAMETER["Old Value"][index], + new_value = config.TREATMENT_EVENT_PARAMETER["New Value"][index]) test.compare(str(waitForObjectExists(names.o_code_text_after_passing_log_values).text), config.CODE_TEXT_AFTER_LOGGING, "Code text must be {}".format(config.CODE_TEXT_AFTER_LOGGING)) test.startSection("verification of post treatment review values for iteration -> "+str(index+1)) @@ -438,7 +446,79 @@ test.endSection() test.endSection() + +def verify_treatment_log_data(): + """ + Method to verify treatment log data + """ + test.startSection("Verification of treatment data") + log_data = get_message_from_log("[Treatment Data]",parameter_count=9) + for index in range (1): + test.compare(log_data[1], str(config.TREATMENT_DATA_PARAMETER["Blood flow rate"][index]), "parameters value should be ->" + str(config.TREATMENT_DATA_PARAMETER["Blood flow rate"][index])) + test.compare(log_data[2], str(config.TREATMENT_DATA_PARAMETER["Dialysate flow rate"][index]), "parameters value should be ->" + str(config.TREATMENT_DATA_PARAMETER["Dialysate flow rate"][index])) + test.compare(log_data[3], str(config.TREATMENT_DATA_PARAMETER["Uf rate"][index]), "parameters value should be ->" + str(config.TREATMENT_DATA_PARAMETER["Uf rate"][index])) + test.compare(log_data[4], str(config.TREATMENT_DATA_PARAMETER["Arterial pressure"][index]), "parameters value should be ->" + str(config.TREATMENT_DATA_PARAMETER["Arterial pressure"][index])) + test.compare(log_data[5], str(config.TREATMENT_DATA_PARAMETER["Venous pressure"][index]), "parameters value should be ->" + str(config.TREATMENT_DATA_PARAMETER["Venous pressure"][index])) + + test.endSection() +def verify_treatment_alarm_data(): + """ + Method to verify treatment alarm data + """ + test.startSection("Verification of treatment alarm data") + log_data = get_message_from_log("[Treatment Alarms]",parameter_count=4) + for index in range (1): + test.compare(log_data[1], str(config.TREATMENT_ALARM_PARAMETER["Alarm Id"][index]), "parameters value should be ->" + str(config.TREATMENT_ALARM_PARAMETER["Alarm Id"][index])) + test.compare(log_data[2], str(config.TREATMENT_ALARM_PARAMETER["Parameter1"][index]), "parameters value should be ->" + str(config.TREATMENT_ALARM_PARAMETER["Parameter1"][index])) + test.compare(log_data[3], str(config.TREATMENT_ALARM_PARAMETER["Parameter2"][index]), "parameters value should be ->" + str(config.TREATMENT_ALARM_PARAMETER["Parameter2"][index])) + + test.endSection() + +def verify_treatment_event_data(): + """ + Method to verify treatment event data + """ + test.startSection("Verification of treatment event data") + log_data = get_message_from_log("[Treatment Events]",parameter_count=4) + for index in range (1): + test.compare(log_data[1], str(config.TREATMENT_EVENT_PARAMETER["Event id"][index]), "parameters value should be ->" + str(config.TREATMENT_EVENT_PARAMETER["Event id"][index])) + test.compare(log_data[2], str(config.TREATMENT_EVENT_PARAMETER["Old Value"][index]), "parameters value should be ->" + str(config.TREATMENT_EVENT_PARAMETER["Old Value"][index])) + test.compare(log_data[3], str(config.TREATMENT_EVENT_PARAMETER["New Value"][index]), "parameters value should be ->" + str(config.TREATMENT_EVENT_PARAMETER["New Value"][index])) + + test.endSection() + +def get_message_from_log(parameter_text, parameter_count): + + """ + This method intended to extract the message from treatment log. + For row[index], index represent column to be extracted. + + @param parameter_text - (string) message text to be identified. + @param parameter_count - number of arguments displayed. + @return row - (list) API arguments displayed in log. + """ + count = 0 + try: + log_location = str(utility.get_extracted_file()) + with open(log_location, 'r') as csv_file: + try: + for row in list(csv.reader(csv_file)): + if row[0].isalpha(): + pass + else: + row_length = sum(1 for values in row) + if row[0]!= None and row[0] == parameter_text: + count = 1 + if count == 1 and row_length == parameter_count: + return row + else: + pass + except: + test.fail("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_parameter_from_post_treatment_log(msg_text): """ To obtain the details of parameter from post treatment log file. @@ -471,11 +551,13 @@ utils.tstStart(__file__) startApplication(config.AUT_NAME) hd_simulator.cmd_send_hd_operation_mode(op_mode=HDOpModes.MODE_POST.value, sub_mode=PostTreatmentStates.HD_POST_TREATMENT_PATIENT_DISCONNECTION_STATE.value) - hd_simulator.cmd_send_treatment_log_data(blood_flow_rate=1, dialysate_flow_rate=1, uf_rate=1.23, arterial_pressure=2.12, venous_pressure=3.21) verify_patient_disconnection_screens() verify_treatment_review_screen() verify_disposables_screen() - + verify_treatment_log_data() + verify_treatment_alarm_data() + verify_treatment_event_data() + utils.tstDone()