Index: shared/scripts/configuration/config.py =================================================================== diff -u -r57644f8662735736c07ea303b6f5c17cfc929ce7 -r6a9444c4619a3fcd3fbfad05763e89e439baf345 --- shared/scripts/configuration/config.py (.../config.py) (revision 57644f8662735736c07ea303b6f5c17cfc929ce7) +++ shared/scripts/configuration/config.py (.../config.py) (revision 6a9444c4619a3fcd3fbfad05763e89e439baf345) @@ -12,29 +12,18 @@ # @date (last) 18-Jan-2022 # ############################################################################ - import os +from configuration.strings import * AUT_NAME = "denaliSquish" COMMON_PATH = os.environ['HOME']+"/Projects" -COLOR_CODES = {"Aqua": "#81ffff", "Blue": "#017dea", "Blue 2": "#1090d5", "Green": "#29fd2d", "Grey": "#d3d3d3", - "Lavender": "#db98f5", "Light Blue": "#acd7f1", "Light Teal": "#29f1da","Lime": "#b7fc36", - "Magenta":"#fd28fd", "Orange": "#f2721c", "Peach":"#f1979a", "Red": "#c53b33", "Rose":"#fc178d", - "Slate blue":"#7f7ffa", "Violet": "#6435c9", "White": "#ffffff", "Yellow": "#fcfc4d"} - #standby mode GOODMORNING_START_TIME_SEC = 0 GOODEVENING_START_TIME_SEC = 43200 -BLOOD_PRIMING_TEXT = "Blood Priming" -SALINE_UNIT = "mL" -BLOOD_PRIMING_DEFAULT_VALUE = "0 mL" - - -RESET_BINARY = "0" -SET_BINARY = "1" #Message binaries appending with for easy identification ACK_REQ_STATUS = 'Ack Req' -ACK_BAK_STATUS = 'Ack Bak' \ No newline at end of file +ACK_BAK_STATUS = 'Ack Bak' + Index: shared/scripts/configuration/strings.py =================================================================== diff -u -r433c0e7b21dd0f7df645e8a25c12b41abe004802 -r6a9444c4619a3fcd3fbfad05763e89e439baf345 --- shared/scripts/configuration/strings.py (.../strings.py) (revision 433c0e7b21dd0f7df645e8a25c12b41abe004802) +++ shared/scripts/configuration/strings.py (.../strings.py) (revision 6a9444c4619a3fcd3fbfad05763e89e439baf345) @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- ########################################################################### # @@ -7,15 +6,18 @@ # THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN # WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. # -# @file strings.py +# @file utils.py # -# @author (last) LTTS - -# @author (last) LTTS -# @date (last) 14-June-2022 +# @author (last) Joseph varghese +# @date (last) 18-Jan-2022 # ############################################################################ -#StandBy Mode + BLOOD_PRIMING_TEXT = "Blood Priming" -SALINE_UNIT = "mL" \ No newline at end of file +SALINE_UNIT = "mL" +BLOOD_PRIMING_UNIT = "mL" +BLOOD_PRIMING_VALUE_0 = "0" +BLOOD_PRIMING_DEFAULT_VALUE = BLOOD_PRIMING_VALUE_0 + " " + BLOOD_PRIMING_UNIT + + Index: shared/scripts/configuration/utility.py =================================================================== diff -u -r517be87a624e12b2529479481a5cc2825e0827ec -r6a9444c4619a3fcd3fbfad05763e89e439baf345 --- shared/scripts/configuration/utility.py (.../utility.py) (revision 517be87a624e12b2529479481a5cc2825e0827ec) +++ shared/scripts/configuration/utility.py (.../utility.py) (revision 6a9444c4619a3fcd3fbfad05763e89e439baf345) @@ -12,56 +12,14 @@ # ############################################################################ - -import sys import test import squish import csv from builtins import format from datetime import datetime -from configuration import config from builtins import int as pyInt - -def start_application(app_name): - """ - Function to start application and verify application status [running] - If application does not start or running status is false, test stops - Argument: - @param app_name : (str) - Name of the application - @param app_executable : (str) - Actual application - @return: handle for the application if the application is in running state, - or error (exist the application) - """ - counter = 0 - while True: - try: - counter += 1 - test.log("Starting {}".format(app_name)) - squish.startApplication(app_name) - if counter == 1: - test.log("Application launched at the "+str(counter)+" st try.") - elif counter == 2: - test.log("Application launched at the "+str(counter)+" nd try.") - elif counter == 3: - test.log("Application launched at the "+str(counter)+" rd try.") - else: - test.log("Application launched at the "+str(counter)+" th try.") - break - except RuntimeError: - if counter == 1: - test.log("Application failed to launch after "+str(counter)+" try - Please refer logs") - elif counter == 20: - test.log("Exiting after "+str(counter)+ " tries..") - sys.exit(1) - else: - test.log("Application failed to launch after "+str(counter)+ " tries - Please refer logs") - except: - logErrorDetails("Failed to start the application") - sys.exit(1) - - def check_if_object_is_within_the_container(obj=None, container=None): """ check if an object is inside a container Index: shared/scripts/names.py =================================================================== diff -u -rc5452bef60ff6c8703bec2675bf726132a79e5dd -r6a9444c4619a3fcd3fbfad05763e89e439baf345 --- shared/scripts/names.py (.../names.py) (revision c5452bef60ff6c8703bec2675bf726132a79e5dd) +++ shared/scripts/names.py (.../names.py) (revision 6a9444c4619a3fcd3fbfad05763e89e439baf345) @@ -1,9 +1,5 @@ # encoding: UTF-8 - -from objectmaphelper import * - - # Top Parents o_QQuickView = { "type": "QQuickView"} o_Overlay = {"container": o_QQuickView, "type": "Overlay"} Index: tst_unhandled_message_log/test.py =================================================================== diff -u -r9a6da8481fcb326cf31365772bedcc411100028a -r6a9444c4619a3fcd3fbfad05763e89e439baf345 --- tst_unhandled_message_log/test.py (.../test.py) (revision 9a6da8481fcb326cf31365772bedcc411100028a) +++ tst_unhandled_message_log/test.py (.../test.py) (revision 6a9444c4619a3fcd3fbfad05763e89e439baf345) @@ -8,10 +8,10 @@ # # file tst_inhandled_message_log # date 2022/04/09 -# author sai chaithyna ela, +# author sai chaithyna ela # joseph varghese # - +# # NOTE: # This test verifies the unhandled logs for the messages provided. # Scenarios are covered based on equivalence partitioning method of testing. @@ -44,6 +44,7 @@ } + def verify_log(api_content): """ This function is capable to verify the log data from sd-card @@ -55,11 +56,11 @@ utils.waitForGUI(5) test.log(str(api_content)) message_extracted = utility.get_current_log_details(message_ack = True, message_text = '~'+api_content) - test.log(str(message_extracted)) + parameter_index = 0 #loop to remove default arguments present in API, here it is '?' - while('?' in message_extracted[0]): - message_extracted[0].remove('?') + while('?' in message_extracted[parameter_index]): + message_extracted[parameter_index].remove('?') return message_extracted @@ -161,6 +162,7 @@ startApplication(config.AUT_NAME) #checking if the message is not in the unhandled (err) + test.startSection("verify the message is not in unhandled (err)") hd_simulator.cmd_send_hd_general_response(message_id = 275, accepted = 1, reason = 1) unhandled_status = get_error_message_from_log() test.verify(unhandled_status == True, "message is not in unhandled.conf file. verified error message from .err file") @@ -169,9 +171,11 @@ hd_simulator.cmd_send_hd_general_response(message_id = 276, accepted = 1, reason = 1) unhandled_status = get_error_message_from_log() test.verify(unhandled_status == True, "message is not in unhandled.conf file. verified error message from .err file") + test.endSection() #checking the id exists and parameters passed is not correct regarding the definition in the conf. (err) + test.startSection("verify the id exists and parameters passed is not correct regarding the definition in the conf. (err)") #0x1300 hd_simulator.cmd_send_hd_general_response(message_id = 19, accepted = 1, reason = 1) error_message = get_error_message_from_log() @@ -182,9 +186,11 @@ hd_simulator.cmd_send_hd_general_response(message_id = 9, accepted = 0, reason = 0) error_message = get_error_message_from_log() test.compare(error_message, ERROR_MESSAGE["0x0900"], "error code should be verified in log file") + test.endSection() #checking the number of parameters are correct but the type is not correct. (err) + test.startSection("verify the number of parameters are correct but the type is not correct. (err)") #0x0A00 payload = float_to_bytearray(DUMMY_FLOAT_VALUE_1) #expected negative scenario verification hd_simulator.cmd_send_hd_general_response(message_id = 10, accepted = 1, reason = 1, is_pure_data = False, has_parameters = True, parameters_payload = payload) @@ -202,20 +208,25 @@ log_data = verify_log("HD_Alarm_Information") test.verify([DUMMY_INT_VALUE_1, DUMMY_FLOAT_VALUE_1, DUMMY_FLOAT_VALUE_2, DUMMY_FLOAT_VALUE_1, DUMMY_INT_VALUE_1] not in log_data, "parameters type should show deviation in negative scenario.") + test.endSection() #checking everything is passed correctly. (log) + test.startSection("verify the log is passed correctly.") #0xBB00 + messageID_index = 1 + message_index = 2 payload = integer_to_bytearray(DUMMY_INT_VALUE_1) payload += integer_to_bytearray(DUMMY_INT_VALUE_2) hd_simulator.cmd_send_hd_general_response(message_id = 187, accepted = 1, reason = 1, is_pure_data = False, has_parameters = True, parameters_payload = payload) + unhandled_message = UNHANDLED_MESSAGE['MESSAGE_1'].split('\n') - #unhandled_message[2] is the expected message in unhandled.conf after API call - #unhandled_message[1] is the expected message id in unhandled.conf after API call - log_data = verify_log(unhandled_message[2]) - message_id = convert_message_id_from_unhandled_file_format_to_standared_format(unhandled_message[1]) - test.verify(message_id.lower() in log_data, "message id should be "+str(unhandled_message[1])) + #unhandled_message[message_index] is the expected message in unhandled.conf after API call + #unhandled_message[messageID_index] is the expected message id in unhandled.conf after API call + log_data = verify_log(unhandled_message[message_index]) + message_id = convert_message_id_from_unhandled_file_format_to_standared_format(unhandled_message[messageID_index]) + test.verify(message_id.lower() in log_data, "message id should be "+str(unhandled_message[messageID_index])) test.verify([DUMMY_INT_VALUE_1, DUMMY_INT_VALUE_2] in log_data, "API arguments should be "+str([DUMMY_INT_VALUE_1, DUMMY_INT_VALUE_2])) test.verify(config.ACK_REQ_STATUS in log_data, "ack request is verified") test.verify(config.ACK_BAK_STATUS in log_data, "ack back is verified") @@ -229,15 +240,16 @@ unhandled_message =UNHANDLED_MESSAGE['MESSAGE_2'].split('\n') #unhandled_message[2] is the expected message in unhandled.conf after API call - #unhandled_message[1] is the expected message id in unhandled.conf after API call - log_data = verify_log(unhandled_message[2]) - message_id = convert_message_id_from_unhandled_file_format_to_standared_format(unhandled_message[1]) - test.verify(message_id.lower() in log_data, "message id should be "+str(unhandled_message[1])) + #unhandled_message[messageID_index] is the expected message id in unhandled.conf after API call + + log_data = verify_log(unhandled_message[message_index]) + message_id = convert_message_id_from_unhandled_file_format_to_standared_format(unhandled_message[messageID_index]) + test.verify(message_id.lower() in log_data, "message id should be "+str(unhandled_message[messageID_index])) test.verify([DUMMY_FLOAT_VALUE_1, DUMMY_UNSIGNED_INT_VALUE] in log_data, "API arguments should be "+str([DUMMY_FLOAT_VALUE_1, DUMMY_UNSIGNED_INT_VALUE, 0])) test.verify(config.ACK_REQ_STATUS in log_data, "ack request is verified") test.verify(config.ACK_BAK_STATUS in log_data, "ack back is verified") - - + test.endSection() + remove_unhandled_configuration_file() utils.tstDone()