Index: tst_treatment_saline_data/test.py =================================================================== diff -u -r0bdfe99af7b51d00f774e621d4e04fe450f7531c -r7640c9264d7acaf3883ee4e02dcc0fe99e3314b6 --- tst_treatment_saline_data/test.py (.../test.py) (revision 0bdfe99af7b51d00f774e621d4e04fe450f7531c) +++ tst_treatment_saline_data/test.py (.../test.py) (revision 7640c9264d7acaf3883ee4e02dcc0fe99e3314b6) @@ -16,15 +16,13 @@ import names +from configuration import config, utility from dialin.ui import utils +from dialin.common.hd_defs import HDOpSubModes, TreatmentStates from dialin.ui.hd_simulator import HDSimulator from dialin.common.ui_defs import TXStates as txStates from dialin.common.msg_defs import RequestRejectReasons as rejectReason -from configuration import config, utility -#testing options for main treatment saline -SALINE_BOLUS_TARGET = [0, 1, 150, 155, 299, 300] #Boundary Value Analysis - hd_simulator = HDSimulator() @@ -35,7 +33,7 @@ return str(waitForObjectExists(names.o_treatmentStart_SalineSection).unit) -def verification_of_target_value(expected_target_value): +def verify_target_value(expected_target_value): """ Method to verify target value on saline section @param expected_target_value: (int) expected target value on saline section @@ -44,7 +42,7 @@ test.compare(waitForObjectExists(names.o_treatmentHome_mL_Text).text , get_unit(), "Target unit verified" ) -def verification_of_cumulative_value(expected_cumulative_value): +def verify_cumulative_value(expected_cumulative_value): """ Method to verify cumulative value on saline section @param expected_cumulative_value: (int) expected cumulative value on saline section @@ -53,7 +51,7 @@ test.compare(waitForObjectExists(names.o_treatmentHome_cumalative_unit).text , config.SALINE_UNIT, "cumulative unit verified" ) -def verification_of_delivered_value(expected_delivered_value): +def verify_delivered_value(expected_delivered_value): """ Method to verify delivered value on saline section @param expected_delivered_valuee: (int) expected delivered value on saline section @@ -81,8 +79,7 @@ @param : enabled_status: (bool) True/False -> based on visibility @return: none """ - test.compare(waitForObjectExists(names.o_treatmentHome_ultrafiltrationTouchArea_TreatmentUltrafiltration).isTouchable, enabled_status,\ - "uf touchable area is visible") + test.compare(waitForObjectExists(names.o_treatmentHome_ultrafiltrationTouchArea_TreatmentUltrafiltration).isTouchable, enabled_status,"uf touchable area is visible") def test_state(accept_status, button_text, target, saline_states): @@ -98,16 +95,15 @@ # when rejected reason set 16 -> saline bolus in progress if (not accept_status): rejection_reason = rejectReason.REQUEST_REJECT_REASON_SALINE_BOLUS_IN_PROGRESS.value hd_simulator.cmd_set_saline_bolus_response(accepted = accept_status, reason = rejection_reason, target = target) - if (not accept_status): test.compare(waitForObjectExists(utility.rejection_msg(config.REJECTION_REASON[rejection_reason])).text, config.REJECTION_REASON[rejection_reason], \ - "expected rejection {msg} displayed".format(msg=config.REJECTION_REASON[rejection_reason])) + if (not accept_status): test.compare(waitForObjectExists(utility.rejection_msg(config.REJECTION_REASON[rejection_reason])).text, config.REJECTION_REASON[rejection_reason], "expected rejection {msg} displayed".format(msg=config.REJECTION_REASON[rejection_reason])) #set saline transition state. - hd_simulator.cmd_set_treatment_states_data(sub_mode= 2, uf_state= 0, saline_state=saline_states, heparin_state= 0, - rinseback_state= 0, recirculate_state= 0, blood_prime_state= 0, - treatment_end_state=0, treatment_stop_state= 0, dialysis_state=0) + hd_simulator.cmd_set_treatment_states_data(sub_mode=HDOpSubModes.SUBMODE_WAIT_FOR_DISINFECT.value, uf_state=TreatmentStates.TREATMENT_START_STATE.value, saline_state=saline_states, heparin_state=TreatmentStates.TREATMENT_START_STATE.value, + rinseback_state=TreatmentStates.TREATMENT_START_STATE.value, recirculate_state=TreatmentStates.TREATMENT_START_STATE.value, blood_prime_state=TreatmentStates.TREATMENT_START_STATE.value, + treatment_end_state=TreatmentStates.TREATMENT_START_STATE.value, treatment_stop_state=TreatmentStates.TREATMENT_START_STATE.value, dialysis_state=TreatmentStates.TREATMENT_START_STATE.value) test.compare(str(waitForObjectExists(names.o_treatmentStart_SalineSection).buttonText), "{} BOLUS".format(button_text)) - verification_of_target_value(expected_target_value = target) + verify_target_value(expected_target_value = target) def test_rejection_message_on_saline_bolus(accept_status, target, saline_states): @@ -120,7 +116,7 @@ """ test.startSection("verification of rejection messages on saline bolus") for rejection in range(1, config.NUM_OF_REQUEST_REJECT_REASONS): - hd_simulator.cmd_set_saline_bolus_response(accepted = accept_status, reason = rejection, target = target) + hd_simulator.cmd_set_saline_bolus_response(accepted=accept_status, reason=rejection, target=target) rejection_message = waitForObjectExists(utility.rejection_msg(config.REJECTION_REASON[rejection])) test.compare(rejection_message.text, config.REJECTION_REASON[rejection], "expected rejection {msg} displayed".format(msg=config.REJECTION_REASON[rejection])) @@ -135,19 +131,18 @@ """ test.startSection("verification of saline parameter values on main treatment screen") #FIXME: execution time is more, so used specified saline target value for verification. - for target_value in SALINE_BOLUS_TARGET: + for target_value in config.SALINE_BOLUS_TARGET: for delivered_value, cumulative_value in config.SALINE_BOLUS_VALUES.items(): - hd_simulator.cmd_set_treatment_saline_bolus_data(target = target_value, - cumulative = cumulative_value, - delivered = delivered_value) + hd_simulator.cmd_set_treatment_saline_bolus_data(target=target_value, + cumulative=cumulative_value, + delivered=delivered_value) - test.log("verification of saline values from dialysis state for target value :" + str(target_value)+\ - " cumulative value :" +str(cumulative_value)+" and delivered value :"+ str(delivered_value)) + test.log("verification of saline values from dialysis state for target value :" + str(target_value)+ " cumulative value :" +str(cumulative_value)+" and delivered value :"+ str(delivered_value)) - verification_of_target_value(expected_target_value = format(target_value, '.1f')) - verification_of_delivered_value(expected_delivered_value = format(delivered_value, '.0f')) - verification_of_cumulative_value(expected_cumulative_value = format(cumulative_value, '.0f')) + verify_target_value(expected_target_value = format(target_value, '.1f')) + verify_delivered_value(expected_delivered_value = format(delivered_value, '.0f')) + verify_cumulative_value(expected_cumulative_value = format(cumulative_value, '.0f')) test.endSection() @@ -161,8 +156,8 @@ """ test.startSection("verification of saline stages on main treatment screen") - saline_bolus_target = len(SALINE_BOLUS_TARGET)-1 - saline_target_value = SALINE_BOLUS_TARGET[saline_bolus_target] + saline_bolus_target = len(config.SALINE_BOLUS_TARGET)-1 + saline_target_value = config.SALINE_BOLUS_TARGET[saline_bolus_target] #verification of total rejection message on saline bolus touch section. test_rejection_message_on_saline_bolus(True, saline_target_value, txStates.SALINE_BOLUS_STATE_IDLE) @@ -216,36 +211,37 @@ def test_saline_types(): test.startSection("verification of saline parameter states on main treatment screen") - hd_simulator.cmd_set_treatment_states_data(sub_mode= 2, uf_state= 0, saline_state= 0, heparin_state= 0, - rinseback_state= 0, recirculate_state= 0, blood_prime_state= 0, - treatment_end_state=0, treatment_stop_state= 0, dialysis_state=0 ) + + hd_simulator.cmd_set_treatment_states_data(sub_mode=HDOpSubModes.SUBMODE_WAIT_FOR_DISINFECT.value, uf_state=TreatmentStates.TREATMENT_START_STATE.value, saline_state=TreatmentStates.TREATMENT_START_STATE.value, heparin_state=TreatmentStates.TREATMENT_START_STATE.value, + rinseback_state=TreatmentStates.TREATMENT_START_STATE.value, recirculate_state=TreatmentStates.TREATMENT_START_STATE.value, blood_prime_state=TreatmentStates.TREATMENT_START_STATE.value, + treatment_end_state=TreatmentStates.TREATMENT_START_STATE.value, treatment_stop_state=TreatmentStates.TREATMENT_START_STATE.value, dialysis_state=TreatmentStates.TREATMENT_START_STATE.value) mouseClick(waitForObject(names.o_treatmentHome_startFluidButton_TouchRect)) test.compare((waitForObjectExists(names.o_treatmentHome_startFluidButton_TouchRect).enabled), True, "START BOLUS button is enable") test.compare((waitForObjectExists(names.o_treatmentHome_START_BOLUS_Text).enabled), True, "Start Bolus text is enable") - hd_simulator.cmd_set_treatment_states_data(sub_mode= 2, uf_state= 0, saline_state= 1, heparin_state= 0, - rinseback_state= 0, recirculate_state= 0, blood_prime_state= 0, - treatment_end_state=0, treatment_stop_state= 0, dialysis_state=0 ) + hd_simulator.cmd_set_treatment_states_data(sub_mode=HDOpSubModes.SUBMODE_WAIT_FOR_DISINFECT.value, uf_state=TreatmentStates.TREATMENT_START_STATE.value, saline_state=TreatmentStates.TREATMENT_BLOOD_PRIME_STATE.value, heparin_state=TreatmentStates.TREATMENT_START_STATE.value, + rinseback_state=TreatmentStates.TREATMENT_START_STATE.value, recirculate_state=TreatmentStates.TREATMENT_START_STATE.value, blood_prime_state=TreatmentStates.TREATMENT_START_STATE.value, + treatment_end_state=TreatmentStates.TREATMENT_START_STATE.value, treatment_stop_state=TreatmentStates.TREATMENT_START_STATE.value, dialysis_state=TreatmentStates.TREATMENT_START_STATE.value) test.compare((waitForObjectExists(names.o_treatmentHome_startFluidButton_TouchRect).enabled), False, "START BOLUS button is not enable") test.compare((waitForObjectExists(names.o_treatmentHome_START_BOLUS_Text).enabled), False, "Start Bolus text is not enable") test.compare((waitForObjectExists(names.o_treatmentHome_START_BOLUS_Text).enabled), False, "Start Bolus text is not enable") test.compare((waitForObjectExists(names.o_treatmentHome_image_Image).visible), True, "Pause Image is Visible") test.compare(str(waitForObjectExists(names.o_treatmentHome_Treatment_Paused_Text).text), "Treatment Paused", "Treatment Paused text is visible") - hd_simulator.cmd_set_treatment_states_data(sub_mode= 2, uf_state= 0, saline_state= 2, heparin_state= 0, - rinseback_state= 0, recirculate_state= 0, blood_prime_state= 0, - treatment_end_state=0, treatment_stop_state= 0, dialysis_state=0 ) + hd_simulator.cmd_set_treatment_states_data(sub_mode=HDOpSubModes.SUBMODE_WAIT_FOR_DISINFECT.value, uf_state=TreatmentStates.TREATMENT_START_STATE.value, saline_state=TreatmentStates.TREATMENT_DIALYSIS_STATE.value, heparin_state=TreatmentStates.TREATMENT_START_STATE.value, + rinseback_state=TreatmentStates.TREATMENT_START_STATE.value, recirculate_state=TreatmentStates.TREATMENT_START_STATE.value, blood_prime_state=TreatmentStates.TREATMENT_START_STATE.value, + treatment_end_state=TreatmentStates.TREATMENT_START_STATE.value, treatment_stop_state=TreatmentStates.TREATMENT_START_STATE.value, dialysis_state=TreatmentStates.TREATMENT_START_STATE.value) mouseClick(waitForObjectExists(names.o_treatmentHome_stop_bolus_Text)) mouseClick(waitForObject(names.o_treatmentHome_Treatment_Paused_Text)) test.compare((waitForObjectExists(names.o_treatmentHome_image_Image).visible), True, "Pause Image is Visible") test.compare(str(waitForObjectExists(names.o_treatmentHome_Treatment_Paused_Text).text), "Treatment Paused", "Treatment Paused text is visible") - hd_simulator.cmd_set_treatment_states_data(sub_mode= 2, uf_state= 0, saline_state= 3, heparin_state= 0, - rinseback_state= 0, recirculate_state= 0, blood_prime_state= 0, - treatment_end_state=0, treatment_stop_state= 0, dialysis_state=0 ) + hd_simulator.cmd_set_treatment_states_data(sub_mode=HDOpSubModes.SUBMODE_WAIT_FOR_DISINFECT.value, uf_state=TreatmentStates.TREATMENT_START_STATE.value, saline_state=TreatmentStates.TREATMENT_STOP_STATE.value, heparin_state=TreatmentStates.TREATMENT_START_STATE.value, + rinseback_state=TreatmentStates.TREATMENT_START_STATE.value, recirculate_state=TreatmentStates.TREATMENT_START_STATE.value, blood_prime_state=TreatmentStates.TREATMENT_START_STATE.value, + treatment_end_state=TreatmentStates.TREATMENT_START_STATE.value, treatment_stop_state=TreatmentStates.TREATMENT_START_STATE.value, dialysis_state=TreatmentStates.TREATMENT_START_STATE.value) test.compare((waitForObjectExists(names.o_treatmentHome_startFluidButton_TouchRect).enabled), False, "START BOLUS button is not enable") test.compare((waitForObjectExists(names.o_treatmentHome_START_BOLUS_Text).enabled), False, "Start Bolus text is not enable") @@ -260,9 +256,9 @@ utils.waitForGUI(1) #navigate to dialysis state - hd_simulator.cmd_set_treatment_states_data(sub_mode= 2, uf_state= 0, saline_state=0, heparin_state= 0, - rinseback_state= 0, recirculate_state= 0, blood_prime_state= 0, - treatment_end_state=0, treatment_stop_state=0, dialysis_state=0) + hd_simulator.cmd_set_treatment_states_data(sub_mode= HDOpSubModes.SUBMODE_WAIT_FOR_DISINFECT.value, uf_state=TreatmentStates.TREATMENT_START_STATE.value, saline_state=TreatmentStates.TREATMENT_START_STATE.value, heparin_state=TreatmentStates.TREATMENT_START_STATE.value, + rinseback_state=TreatmentStates.TREATMENT_START_STATE.value, recirculate_state=TreatmentStates.TREATMENT_START_STATE.value, blood_prime_state=TreatmentStates.TREATMENT_START_STATE.value, + treatment_end_state=TreatmentStates.TREATMENT_START_STATE.value, treatment_stop_state=TreatmentStates.TREATMENT_START_STATE.value, dialysis_state=TreatmentStates.TREATMENT_START_STATE.value) #verification of target, cumulative and delivered value test_saline_values()