From 89c760ed6d9da9eb506013931a7ee3cf21463756 Mon Sep 17 00:00:00 2001 From: IGetmanets Date: Wed, 26 Jan 2022 12:39:04 +0200 Subject: [PATCH 1/2] Scripts for issue 2451 --- ...ith_different_valid_values_in_ini_file.lua | 77 +++++++++++++++++ ...h_different_invalid_values_in_ini_file.lua | 83 +++++++++++++++++++ test_sets/Defects/Defects_release_8_1.txt | 2 + 3 files changed, 162 insertions(+) create mode 100644 test_scripts/Defects/8_1/2451_1_SupportedDiagModes_with_different_valid_values_in_ini_file.lua create mode 100644 test_scripts/Defects/8_1/2451_2_SupportedDiagModes_with_different_invalid_values_in_ini_file.lua diff --git a/test_scripts/Defects/8_1/2451_1_SupportedDiagModes_with_different_valid_values_in_ini_file.lua b/test_scripts/Defects/8_1/2451_1_SupportedDiagModes_with_different_valid_values_in_ini_file.lua new file mode 100644 index 0000000000..9931e47940 --- /dev/null +++ b/test_scripts/Defects/8_1/2451_1_SupportedDiagModes_with_different_valid_values_in_ini_file.lua @@ -0,0 +1,77 @@ +--------------------------------------------------------------------------------------------------- +-- Issue: https://github.com/smartdevicelink/sdl_core/issues/2451 +--------------------------------------------------------------------------------------------------- +-- Description: SDL provides valid values of supportedDiagModes parameter in RAI response from .ini file +-- +-- Steps: +-- 1. New valid value in hex is defined in .ini file for supportedDiagModes parameter +-- 2. SDL and HMI are started +-- 3. Mobile app requests RAI +-- SDL does: +-- - send successful RAI response with supportedDiagModes parameter that has the value from .ini file in decimal +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local common = require('user_modules/sequences/actions') +local runner = require('user_modules/script_runner') +local utils = require("user_modules/utils") + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local Variables ]] +local maxValue = "0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x21," .. + "0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x41,0x42,0x43,0x44,0x45," .. + "0x46,0x47,0x48,0x49,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69," .. + "0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x91,0x92,0x93,0x94," .. + "0x95,0x96,0x97,0x98,0x99,0x10,0x20,0x30,0x40,0x50,0x60,0x70,0x80,0x90,0x9A" + +local tcs = { + [01] = { name = "min value", value = "0x01, 0x00" }, + [02] = { name = "min size", value = "0x01" }, + [03] = { name = "max value", value = "0x01, 0xFF" }, + [04] = { name = "max size", value = maxValue } +} + +--[[ Local Functions ]] +local function getDecimalValues(pValue) + local out = utils.splitString(pValue, ",") + for i in pairs(out) do + out[i] = tonumber(out[i]) + end + return out +end + +local function appRegistration(pValue) + local session = common.mobile.createSession() + session:StartService(7) + :Do(function() + local corId = session:SendRPC("RegisterAppInterface", common.app.getParams()) + common.hmi.getConnection():ExpectNotification("BasicCommunication.OnAppRegistered", + { application = { appName = common.app.getParams().appName } }) + session:ExpectResponse(corId, { + success = true, + resultCode = "SUCCESS", + supportedDiagModes = getDecimalValues(pValue) + }) + :Do(function() + session:ExpectNotification("OnHMIStatus", + { hmiLevel = "NONE", audioStreamingState = "NOT_AUDIBLE", systemContext = "MAIN" }) + end) + end) +end + +--[[ Scenario ]] +for id, tc in utils.spairs(tcs) do + runner.Title("Test Case [" .. id .. "] check: " .. tc.name) + runner.Title("Preconditions") + runner.Step("Clean environment", common.preconditions) + runner.Step("Update ini file with new SupportedDiagModes value", common.sdl.setSDLIniParameter, + { "SupportedDiagModes", tc.value }) + runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) + + runner.Title("Test") + runner.Step("Register App", appRegistration, { tc.value }) + + runner.Title("Postconditions") + runner.Step("Stop SDL", common.postconditions) +end diff --git a/test_scripts/Defects/8_1/2451_2_SupportedDiagModes_with_different_invalid_values_in_ini_file.lua b/test_scripts/Defects/8_1/2451_2_SupportedDiagModes_with_different_invalid_values_in_ini_file.lua new file mode 100644 index 0000000000..90963ad2b1 --- /dev/null +++ b/test_scripts/Defects/8_1/2451_2_SupportedDiagModes_with_different_invalid_values_in_ini_file.lua @@ -0,0 +1,83 @@ +--------------------------------------------------------------------------------------------------- +-- Issue: https://github.com/smartdevicelink/sdl_core/issues/2451 +--------------------------------------------------------------------------------------------------- +-- Description: SDL does not provide the invalid values of supportedDiagModes parameter in RAI response from .ini file +-- +-- Steps: +-- 1. New value in hex with out of bound size is defined in .ini file for supportedDiagModes parameter +-- 2. SDL and HMI are started +-- 3. Mobile app requests RAI +-- SDL does: +-- - not send supportedDiagModes parameter in RAI response in case value is out of min size +-- - send supportedDiagModes value with cutted off elements number to allowed size in RAI response +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local common = require('user_modules/sequences/actions') +local runner = require('user_modules/script_runner') +local utils = require("user_modules/utils") + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local Variables ]] +local maxValue = "0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x21," .. + "0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x41,0x42,0x43,0x44,0x45," .. + "0x46,0x47,0x48,0x49,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69," .. + "0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x91,0x92,0x93,0x94," .. + "0x95,0x96,0x97,0x98,0x99,0x10,0x20,0x30,0x40,0x50,0x60,0x70,0x80,0x90,0x9A" + +local tcs = { + [01] = { name = "out of min size", value = "" }, + [02] = { name = "out of max size", value = maxValue .. ",0x9B", expected = maxValue } +} + +--[[ Local Functions ]] +local function getDecimalValues(pValue) + local out = utils.splitString(pValue, ",") + for i in pairs(out) do + out[i] = tonumber(out[i]) + end + return out +end + +local function appRegistration(pValue) + if pValue then pValue = getDecimalValues(pValue) end + local session = common.mobile.createSession() + session:StartService(7) + :Do(function() + local corId = session:SendRPC("RegisterAppInterface", common.app.getParams()) + common.hmi.getConnection():ExpectNotification("BasicCommunication.OnAppRegistered", + { application = { appName = common.app.getParams().appName } }) + session:ExpectResponse(corId, { + success = true, + resultCode = "SUCCESS", + supportedDiagModes = pValue + }) + :Do(function() + session:ExpectNotification("OnHMIStatus", + { hmiLevel = "NONE", audioStreamingState = "NOT_AUDIBLE", systemContext = "MAIN" }) + end) + :ValidIf(function(_, data) + if not pValue and data.payload.supportedDiagModes then + return false, "RAI response contains unexpected supportedDiagModes parameter" + end + return true + end) + end) +end + +--[[ Scenario ]] +for id, tc in utils.spairs(tcs) do + runner.Title("Test Case [" .. id .. "] check: " .. tc.name) + runner.Title("Preconditions") + runner.Step("Clean environment", common.preconditions) + runner.Step("Update ini file with new SupportedDiagModes value", common.sdl.setSDLIniParameter, + { "SupportedDiagModes", tc.value }) + runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) + + runner.Title("Test") + runner.Step("Register App", appRegistration, { tc.expected }) + + runner.Title("Postconditions") + runner.Step("Stop SDL", common.postconditions) +end diff --git a/test_sets/Defects/Defects_release_8_1.txt b/test_sets/Defects/Defects_release_8_1.txt index 99104e86ef..0e774e7229 100644 --- a/test_sets/Defects/Defects_release_8_1.txt +++ b/test_sets/Defects/Defects_release_8_1.txt @@ -26,3 +26,5 @@ ./test_scripts/Defects/8_1/3845/3845_6_PerformAudioPassThru_custom_success_codes_in_error_structure_to_tts_and_ui.lua ./test_scripts/Defects/8_1/3880_1_PTU_Empty_endpoint_properties.lua ./test_scripts/Defects/8_1/3880_2_PTU_Omitted_endpoint_properties.lua +./test_scripts/Defects/8_1/2451_1_SupportedDiagModes_with_different_valid_values_in_ini_file.lua +./test_scripts/Defects/8_1/2451_2_SupportedDiagModes_with_different_invalid_values_in_ini_file.lua From 4ee9222302507eef312468dce9d12d2b07ba2939 Mon Sep 17 00:00:00 2001 From: GetmanetsIrina Date: Fri, 1 Jul 2022 15:15:14 +0300 Subject: [PATCH 2/2] fixup! Scripts for issue 2451 --- ...tedDiagModes_with_different_valid_values_in_ini_file.lua | 4 +++- ...dDiagModes_with_different_invalid_values_in_ini_file.lua | 6 ++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/test_scripts/Defects/8_1/2451_1_SupportedDiagModes_with_different_valid_values_in_ini_file.lua b/test_scripts/Defects/8_1/2451_1_SupportedDiagModes_with_different_valid_values_in_ini_file.lua index 9931e47940..bd251a43d1 100644 --- a/test_scripts/Defects/8_1/2451_1_SupportedDiagModes_with_different_valid_values_in_ini_file.lua +++ b/test_scripts/Defects/8_1/2451_1_SupportedDiagModes_with_different_valid_values_in_ini_file.lua @@ -1,5 +1,7 @@ --------------------------------------------------------------------------------------------------- --- Issue: https://github.com/smartdevicelink/sdl_core/issues/2451 +-- Issues: +-- https://github.com/smartdevicelink/sdl_core/issues/2451 +-- https://github.com/smartdevicelink/sdl_core/issues/3935 --------------------------------------------------------------------------------------------------- -- Description: SDL provides valid values of supportedDiagModes parameter in RAI response from .ini file -- diff --git a/test_scripts/Defects/8_1/2451_2_SupportedDiagModes_with_different_invalid_values_in_ini_file.lua b/test_scripts/Defects/8_1/2451_2_SupportedDiagModes_with_different_invalid_values_in_ini_file.lua index 90963ad2b1..91262d242f 100644 --- a/test_scripts/Defects/8_1/2451_2_SupportedDiagModes_with_different_invalid_values_in_ini_file.lua +++ b/test_scripts/Defects/8_1/2451_2_SupportedDiagModes_with_different_invalid_values_in_ini_file.lua @@ -1,5 +1,7 @@ --------------------------------------------------------------------------------------------------- --- Issue: https://github.com/smartdevicelink/sdl_core/issues/2451 +-- Issues: +-- https://github.com/smartdevicelink/sdl_core/issues/2451 +-- https://github.com/smartdevicelink/sdl_core/issues/3934 --------------------------------------------------------------------------------------------------- -- Description: SDL does not provide the invalid values of supportedDiagModes parameter in RAI response from .ini file -- @@ -27,7 +29,7 @@ local maxValue = "0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x11,0x12,0x13,0x "0x95,0x96,0x97,0x98,0x99,0x10,0x20,0x30,0x40,0x50,0x60,0x70,0x80,0x90,0x9A" local tcs = { - [01] = { name = "out of min size", value = "" }, + [01] = { name = "out of min size", value = "", expected = nil }, [02] = { name = "out of max size", value = maxValue .. ",0x9B", expected = maxValue } }