Index: shared/scripts/configuration/utility.py =================================================================== diff -u -r30b3e1a07f940f488bc749e2d39438ce2a3f5168 -rb98a26754d9f171df91a444374c4eb9a6f15450f --- shared/scripts/configuration/utility.py (.../utility.py) (revision 30b3e1a07f940f488bc749e2d39438ce2a3f5168) +++ shared/scripts/configuration/utility.py (.../utility.py) (revision b98a26754d9f171df91a444374c4eb9a6f15450f) @@ -78,3 +78,12 @@ def expected_heparin_value(val): names.o_heparin_value["text"] = val return names.o_heparin_value + +def msg(string: str): + """ + added ### at the right side of the string to make sure that it is a message. + @param string: (str) the string to add trailing ### to + @return: (str) padded string + """ + pad_str = "###"+string + return pad_str Index: tst_main_treatment_heparin/test.py =================================================================== diff -u -r30b3e1a07f940f488bc749e2d39438ce2a3f5168 -rb98a26754d9f171df91a444374c4eb9a6f15450f --- tst_main_treatment_heparin/test.py (.../test.py) (revision 30b3e1a07f940f488bc749e2d39438ce2a3f5168) +++ tst_main_treatment_heparin/test.py (.../test.py) (revision b98a26754d9f171df91a444374c4eb9a6f15450f) @@ -27,7 +27,7 @@ """ expected_cumulative_value = str(expected_cumulative_value).replace(".0","") heparin_value = waitForObjectExists(utility.expected_heparin_value(expected_cumulative_value)) - test.compare(heparin_value.text, expected_cumulative_value, "Actual heparin cumulative value: {} should be equal to expected heparin cumulative value: {}".format(heparin_value.text, expected_cumulative_value)) + test.compare(heparin_value.text, expected_cumulative_value, utility.msg("Actual heparin cumulative value: {} should be equal to expected heparin cumulative value: {}".format(heparin_value.text, expected_cumulative_value))) def constants_for_cumulative_value(): """ @@ -37,10 +37,10 @@ hd_simulator.cmd_set_treatment_states_data(sub_mode= 2, uf_state= 0, saline_state= 0, heparin_state= 3, rinseback_state= 0, recirculate_state= 0, blood_prime_state= 0, treatment_end_state= 0, treatment_stop_state=0, dialysis_state= 0) - test.compare(str(waitForObjectExists(names.o_state0_heparin_delivery_text).text), config.HEPARIN_DELIVERY_TEXT, "Heparin Delivery Text should be {}".format(config.HEPARIN_DELIVERY_TEXT)) - test.compare((waitForObjectExists(names.o_state0_heparin_delivery_text)).enabled, False, "Heparin Delivery should be disabled") + test.compare(str(waitForObjectExists(names.o_state0_heparin_delivery_text).text), config.HEPARIN_DELIVERY_TEXT, utility.msg("Heparin Delivery Text should be {}".format(config.HEPARIN_DELIVERY_TEXT))) + test.compare((waitForObjectExists(names.o_state0_heparin_delivery_text)).enabled, False, utility.msg("Heparin Delivery should be disabled")) initial_bolus_text = waitForObjectExists(names.o_state3_heparin_state_initial_bolus_text).text - test.compare(str(initial_bolus_text), config.HEPARIN_BOLUS_ACTIVE_TEXT, "Notification Message should be {}".format(config.HEPARIN_BOLUS_ACTIVE_TEXT)) + test.compare(str(initial_bolus_text), config.HEPARIN_BOLUS_ACTIVE_TEXT, utility.msg("Notification Message should be {}".format(config.HEPARIN_BOLUS_ACTIVE_TEXT))) HIGHER_VALUE = HIGHER_RANGE * 10 #conversion of decaliter to liter for heparin_cumulative in range(LOWER_RANGE, HIGHER_VALUE+1, STEP_VALUE): @@ -64,20 +64,20 @@ 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) - test.compare(str(waitForObjectExists(names.o_state0_heparin_delivery_text).text), config.HEPARIN_DELIVERY_TEXT, "Heparin Delivery Text should be {}".format(config.HEPARIN_DELIVERY_TEXT)) - test.compare((waitForObjectExists(names.o_state0_heparin_delivery_text)).enabled, False, "Heparin Delivery should be disabled") + test.compare(str(waitForObjectExists(names.o_state0_heparin_delivery_text).text), config.HEPARIN_DELIVERY_TEXT, utility.msg("Heparin Delivery Text should be {}".format(config.HEPARIN_DELIVERY_TEXT))) + test.compare((waitForObjectExists(names.o_state0_heparin_delivery_text)).enabled, False, utility.msg("Heparin Delivery should be disabled")) test.log("Verifying Notification Message") - test.compare(str(findObject(names.o_state0_heparin_delivery_Off_text).text ), config.HEPARIN_DELIVERY_OFF_TEXT,"Notification Message should be {}".format(config.HEPARIN_DELIVERY_OFF_TEXT)) + test.compare(str(findObject(names.o_state0_heparin_delivery_Off_text).text ), config.HEPARIN_DELIVERY_OFF_TEXT, utility.msg("Notification Message should be {}".format(config.HEPARIN_DELIVERY_OFF_TEXT))) utils.waitForGUI(1) test.log("Verifying Heparin State 1 - HEPARIN_STATE_STOPPED") hd_simulator.cmd_set_treatment_states_data(sub_mode= 2, uf_state= 0, saline_state=0, heparin_state= 1, rinseback_state= 0, recirculate_state= 0, blood_prime_state= 0, treatment_end_state=0, treatment_stop_state= 0, dialysis_state= 0) - test.compare(str(waitForObjectExists(names.o_state0_heparin_delivery_text).text), config.HEPARIN_DELIVERY_TEXT, "Heparin Delivery Text should be {}".format(config.HEPARIN_DELIVERY_TEXT)) - test.compare((waitForObjectExists(names.o_state0_heparin_delivery_text)).enabled, False, "Heparin Delivery should be disabled") + test.compare(str(waitForObjectExists(names.o_state0_heparin_delivery_text).text), config.HEPARIN_DELIVERY_TEXT, utility.msg("Heparin Delivery Text should be {}".format(config.HEPARIN_DELIVERY_TEXT))) + test.compare((waitForObjectExists(names.o_state0_heparin_delivery_text)).enabled, False, utility.msg("Heparin Delivery should be disabled")) test.log("Verifying Notification Message") - test.compare(str(waitForObjectExists(names.o_state_one_text).text), config.HEPARIN_STOP_TEXT,"Notification Message should be {}".format(config.HEPARIN_STOP_TEXT)) + test.compare(str(waitForObjectExists(names.o_state_one_text).text), config.HEPARIN_STOP_TEXT, utility.msg("Notification Message should be {}".format(config.HEPARIN_STOP_TEXT))) utils.waitForGUI(1) constants_for_cumulative_value() @@ -88,21 +88,21 @@ rinseback_state= 0, recirculate_state= 0, blood_prime_state= 0, treatment_end_state=0, treatment_stop_state= 0, dialysis_state= 0) - test.compare(str(waitForObjectExists(names.o_state0_heparin_delivery_text).text), config.HEPARIN_DELIVERY_TEXT, "Heparin Delivery Text should be {}".format(config.HEPARIN_DELIVERY_TEXT)) - test.compare((waitForObjectExists(names.o_state0_heparin_delivery_text)).enabled, False, "Heparin Delivery should be disabled") + test.compare(str(waitForObjectExists(names.o_state0_heparin_delivery_text).text), config.HEPARIN_DELIVERY_TEXT, utility.msg("Heparin Delivery Text should be {}".format(config.HEPARIN_DELIVERY_TEXT))) + test.compare((waitForObjectExists(names.o_state0_heparin_delivery_text)).enabled, False, utility.msg("Heparin Delivery should be disabled")) test.log("Verifying Notification Message") - test.compare(str(waitForObjectExists(names.o_state5_heparin_state_completed_text).text), config.HEPARIN_MAXIMUM_VOLUME_DELIVERED_TEXT,"Notification Message should be {}".format(config.HEPARIN_MAXIMUM_VOLUME_DELIVERED_TEXT)) + test.compare(str(waitForObjectExists(names.o_state5_heparin_state_completed_text).text), config.HEPARIN_MAXIMUM_VOLUME_DELIVERED_TEXT, utility.msg("Notification Message should be {}".format(config.HEPARIN_MAXIMUM_VOLUME_DELIVERED_TEXT))) utils.waitForGUI(1) test.log("Verifying Heparin State 6 - HEPARIN_STATE_EMPTY") hd_simulator.cmd_set_treatment_states_data(sub_mode= 2, uf_state= 0, saline_state=0, heparin_state= 6, rinseback_state= 0, recirculate_state= 0, blood_prime_state= 0, treatment_end_state=0, treatment_stop_state= 0, dialysis_state= 0) - test.compare(str(waitForObjectExists(names.o_state0_heparin_delivery_text).text), config.HEPARIN_DELIVERY_TEXT, "Heparin Delivery Text should be {}".format(config.HEPARIN_DELIVERY_TEXT)) - test.compare((waitForObjectExists(names.o_state0_heparin_delivery_text)).enabled, False, "Heparin Delivery should be disabled") + test.compare(str(waitForObjectExists(names.o_state0_heparin_delivery_text).text), config.HEPARIN_DELIVERY_TEXT, utility.msg("Heparin Delivery Text should be {}".format(config.HEPARIN_DELIVERY_TEXT))) + test.compare((waitForObjectExists(names.o_state0_heparin_delivery_text)).enabled, False, utility.msg("Heparin Delivery should be disabled")) test.log("Verifying Notification Message") - test.compare(str(waitForObjectExists(names.o_state6_heparin_state_empty_text).text), config.HEPARIN_SYRINGE_EMPTY_TEXT,"Notification Message should be {}".format(config.HEPARIN_SYRINGE_EMPTY_TEXT)) + test.compare(str(waitForObjectExists(names.o_state6_heparin_state_empty_text).text), config.HEPARIN_SYRINGE_EMPTY_TEXT, utility.msg("Notification Message should be {}".format(config.HEPARIN_SYRINGE_EMPTY_TEXT))) utils.waitForGUI(1) def heparin_pause_resume_states(): @@ -116,17 +116,17 @@ hd_simulator.cmd_set_treatment_states_data(sub_mode= 2, uf_state= 0, saline_state=0, heparin_state= 2, rinseback_state= 0, recirculate_state= 0, blood_prime_state= 0, treatment_end_state=0, treatment_stop_state= 0, dialysis_state= 0) - test.compare(str(waitForObjectExists(names.o_state2_heparin_state_paused_text).text),config.HEPARIN_RESUME_DELIVERY_TEXT,"Heparin Resume Delivery Text should be {}".format(config.HEPARIN_RESUME_DELIVERY_TEXT)) - test.compare( waitForObjectExists(names.o_state2_heparin_state_paused_text).enabled, True, "Resume Delivery Button is enabled") + test.compare(str(waitForObjectExists(names.o_state2_heparin_state_paused_text).text),config.HEPARIN_RESUME_DELIVERY_TEXT, utility.msg("Heparin Resume Delivery Text should be {}".format(config.HEPARIN_RESUME_DELIVERY_TEXT))) + test.compare( waitForObjectExists(names.o_state2_heparin_state_paused_text).enabled, True, utility.msg("Resume Delivery Button is enabled")) test.log("Heparin delivery is paused, resume delivery to start") utils.waitForGUI(1) hd_simulator.cmd_set_treatment_heparin_data(cumulative = 10.1) hd_simulator.cmd_set_treatment_states_data(sub_mode= 2, uf_state= 0, saline_state=0, heparin_state= 4, rinseback_state= 0, recirculate_state= 0, blood_prime_state= 0, treatment_end_state=0, treatment_stop_state= 0, dialysis_state= 0) - test.compare(str(waitForObjectExists(names.o_state4_heparin_state_dispensing_text).text), config.HEPARIN_PAUSE_DELIVERY_TEXT,"Heparin Pause Delivery Text should be {}".format(config.HEPARIN_PAUSE_DELIVERY_TEXT)) - test.compare( waitForObjectExists(names.o_state4_heparin_state_dispensing_text).enabled , True, "Pause Delivery Button is enabled") + test.compare(str(waitForObjectExists(names.o_state4_heparin_state_dispensing_text).text), config.HEPARIN_PAUSE_DELIVERY_TEXT, utility.msg("Heparin Pause Delivery Text should be {}".format(config.HEPARIN_PAUSE_DELIVERY_TEXT))) + test.compare( waitForObjectExists(names.o_state4_heparin_state_dispensing_text).enabled , True, utility.msg("Pause Delivery Button is enabled")) test.log("Heparin delivery is in dispensing state") utils.waitForGUI(1) @@ -142,7 +142,7 @@ for reason_id in range(1, config.NUM_OF_REQUEST_REJECT_REASONS+1): hd_simulator.cmd_set_heparin_pause_resume_response(accepted=0, reason=reason_id) rejection_msg = waitForObjectExists(utility.rejection_msg(text=config.REJECTION_REASON[reason_id])) - test.compare(rejection_msg.text, config.REJECTION_REASON[reason_id], "The rejection message should be {}".format(config.REJECTION_REASON[reason_id])) + test.compare(rejection_msg.text, config.REJECTION_REASON[reason_id], utility.msg("The rejection message should be {}".format(config.REJECTION_REASON[reason_id]))) test.endSection() def main():