From d647fcebddbe2ffceda3ad4525d591444541e2ed Mon Sep 17 00:00:00 2001 From: jacobkeeler Date: Mon, 24 Jun 2019 16:23:26 -0400 Subject: [PATCH 1/3] Add CloseApplication RPC tests --- .../API/CloseApplication/001_Success_flow.lua | 64 +++++++++++++++++++ .../002_HMI_error_response.lua | 62 ++++++++++++++++++ .../commonCloseApplication.lua | 14 ++++ test_sets/CloseApplication_RPC.txt | 2 + 4 files changed, 142 insertions(+) create mode 100644 test_scripts/API/CloseApplication/001_Success_flow.lua create mode 100644 test_scripts/API/CloseApplication/002_HMI_error_response.lua create mode 100644 test_scripts/API/CloseApplication/commonCloseApplication.lua create mode 100644 test_sets/CloseApplication_RPC.txt diff --git a/test_scripts/API/CloseApplication/001_Success_flow.lua b/test_scripts/API/CloseApplication/001_Success_flow.lua new file mode 100644 index 0000000000..5d32bc4c70 --- /dev/null +++ b/test_scripts/API/CloseApplication/001_Success_flow.lua @@ -0,0 +1,64 @@ +--------------------------------------------------------------------------------------------------- +-- Precondition: +-- 1) Application with is registered on SDL. +-- 2) Specific permissions are assigned for with CloseApplication +-- +-- Steps: +-- 1) Application sends a CloseApplication RPC request +-- +-- Expected: +-- 1) SDL sends BasicCommunication.CloseApplication to the HMI with the appropriate appID, +-- HMI responds with SUCCESS +-- 2) SDL responds to mobile app with "resultCode: SUCCESS, success: true" +--------------------------------------------------------------------------------------------------- + +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/API/CloseApplication/commonCloseApplication') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local Variables ]] + +local rpc = { + name = "CloseApplication", + hmiName = "BasicCommunication.CloseApplication", + params = {} +} + +local expectedResponse = { + success = true, + resultCode = "SUCCESS" +} + +--[[ Local Functions ]] +local function processRPCSuccess() + local mobileSession = common.getMobileSession(1) + local cid = mobileSession:SendRPC(rpc.name, rpc.params) + EXPECT_HMICALL(rpc.hmiName, { + appID = common.getHMIAppId(1) + }) + :Do(function(_, data) + common.getHMIConnection():SendResponse(data.id, data.method, "SUCCESS", {}) + end) + + mobileSession:ExpectNotification("OnHMIStatus", { + hmiLevel = "NONE", audioStreamingState = "NOT_AUDIBLE", videoStreamingState = "NOT_STREAMABLE" + }) + mobileSession:ExpectResponse(cid, expectedResponse) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI", common.registerApp) +runner.Step("PTU", common.policyTableUpdate) +runner.Step("Activate App", common.activateApp) + +runner.Title("Test") +runner.Step("RPC " .. rpc.name .. "_resultCode_SUCCESS", processRPCSuccess) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) \ No newline at end of file diff --git a/test_scripts/API/CloseApplication/002_HMI_error_response.lua b/test_scripts/API/CloseApplication/002_HMI_error_response.lua new file mode 100644 index 0000000000..3fe93c6e61 --- /dev/null +++ b/test_scripts/API/CloseApplication/002_HMI_error_response.lua @@ -0,0 +1,62 @@ +--------------------------------------------------------------------------------------------------- +-- Precondition: +-- 1) Application with is registered on SDL. +-- 2) Specific permissions are assigned for with CloseApplication +-- +-- Steps: +-- 1) Application sends a CloseApplication RPC request +-- +-- Expected: +-- 1) SDL sends BasicCommunication.CloseApplication to the HMI with the appropriate appID, +-- HMI responds with IGNORED +-- 2) SDL responds to mobile app with "resultCode: IGNORED, success: false" +--------------------------------------------------------------------------------------------------- + +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/API/CloseApplication/commonCloseApplication') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local Variables ]] + +local rpc = { + name = "CloseApplication", + hmiName = "BasicCommunication.CloseApplication", + params = {} +} + +local expectedResponse = { + success = false, + resultCode = "IGNORED" +} + +--[[ Local Functions ]] +local function processRPCIgnored() + local mobileSession = common.getMobileSession(1) + local cid = mobileSession:SendRPC(rpc.name, rpc.params) + EXPECT_HMICALL(rpc.hmiName, { + appID = common.getHMIAppId(1) + }) + :Do(function(_, data) + common.getHMIConnection():SendResponse(data.id, data.method, "IGNORED", {}) + end) + + mobileSession:ExpectNotification("OnHMIStatus", { hmiLevel = "NONE" }):Times(0) + mobileSession:ExpectResponse(cid, expectedResponse) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI", common.registerApp) +runner.Step("PTU", common.policyTableUpdate) +runner.Step("Activate App", common.activateApp) + +runner.Title("Test") +runner.Step("RPC " .. rpc.name .. "_resultCode_IGNORED", processRPCIgnored) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) \ No newline at end of file diff --git a/test_scripts/API/CloseApplication/commonCloseApplication.lua b/test_scripts/API/CloseApplication/commonCloseApplication.lua new file mode 100644 index 0000000000..5a4f2f7e37 --- /dev/null +++ b/test_scripts/API/CloseApplication/commonCloseApplication.lua @@ -0,0 +1,14 @@ + +--------------------------------------------------------------------------------------------------- +-- Common module +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local actions = require("user_modules/sequences/actions") + +--[[ General configuration parameters ]] +config.defaultProtocolVersion = 2 + +--[[ Variables ]] +local m = actions + +return m \ No newline at end of file diff --git a/test_sets/CloseApplication_RPC.txt b/test_sets/CloseApplication_RPC.txt new file mode 100644 index 0000000000..f54af08a6d --- /dev/null +++ b/test_sets/CloseApplication_RPC.txt @@ -0,0 +1,2 @@ +./test_scripts/API/CloseApplication/001_Success_flow.lua +./test_scripts/API/CloseApplication/002_HMI_error_response.lua From 26dbc1ac3be4323b9ec5e9e26204feaf440f766a Mon Sep 17 00:00:00 2001 From: jacobkeeler Date: Wed, 26 Jun 2019 11:26:58 -0400 Subject: [PATCH 2/3] Replace usage of ActivateApp(NONE) with CloseApplication --- ...76_ATF_OnAllowSDLFunctionality_allowed_false_with_device.lua | 2 +- .../043_ATF_HMI_Status_Appid_Gets_Null_In_Case_Of_PTU.lua | 2 +- .../044_ATF_HMI_Status_Value_Of_AppId_In_PT_Is_Null.lua | 2 +- .../207_ATF_HMILevel_before_data_consented.lua | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/test_scripts/Policies/Related_HMI_API/176_ATF_OnAllowSDLFunctionality_allowed_false_with_device.lua b/test_scripts/Policies/Related_HMI_API/176_ATF_OnAllowSDLFunctionality_allowed_false_with_device.lua index c690f9becc..cdd0f0b110 100644 --- a/test_scripts/Policies/Related_HMI_API/176_ATF_OnAllowSDLFunctionality_allowed_false_with_device.lua +++ b/test_scripts/Policies/Related_HMI_API/176_ATF_OnAllowSDLFunctionality_allowed_false_with_device.lua @@ -47,7 +47,7 @@ function Test:TestStep_RegisterApp_allowed_false_without_device() end) end) - EXPECT_HMICALL("BasicCommunication.ActivateApp", {appID = self.applications[config.application1.registerAppInterfaceParams.appName], level = "NONE"}) + EXPECT_HMICALL("BasicCommunication.CloseApplication", {appID = self.applications[config.application1.registerAppInterfaceParams.appName]}) :Do(function(_,data) self.hmiConnection:SendResponse(data.id,"BasicCommunication.ActivateApp", "SUCCESS", {}) end) diff --git a/test_scripts/Policies/appID_Management/043_ATF_HMI_Status_Appid_Gets_Null_In_Case_Of_PTU.lua b/test_scripts/Policies/appID_Management/043_ATF_HMI_Status_Appid_Gets_Null_In_Case_Of_PTU.lua index 6ed7757972..cec2c66afa 100644 --- a/test_scripts/Policies/appID_Management/043_ATF_HMI_Status_Appid_Gets_Null_In_Case_Of_PTU.lua +++ b/test_scripts/Policies/appID_Management/043_ATF_HMI_Status_Appid_Gets_Null_In_Case_Of_PTU.lua @@ -131,7 +131,7 @@ function Test:TestStep_UpdatePolicy() end) EXPECT_HMINOTIFICATION("SDL.OnAppPermissionChanged", { appID = HMIAppID, appRevoked = true}) - EXPECT_HMICALL("BasicCommunication.ActivateApp", { level = "NONE" }) + EXPECT_HMICALL("BasicCommunication.CloseApplication", {}) :Do(function(_, data) self.hmiConnection:SendResponse(data.id, data.method, "SUCCESS", {}) end) self.mobileSession2:ExpectNotification("OnHMIStatus", { hmiLevel ="NONE", systemContext = "MAIN", audioStreamingState = "NOT_AUDIBLE" }) end diff --git a/test_scripts/Policies/appID_Management/044_ATF_HMI_Status_Value_Of_AppId_In_PT_Is_Null.lua b/test_scripts/Policies/appID_Management/044_ATF_HMI_Status_Value_Of_AppId_In_PT_Is_Null.lua index 8a10767d7a..381578c128 100644 --- a/test_scripts/Policies/appID_Management/044_ATF_HMI_Status_Value_Of_AppId_In_PT_Is_Null.lua +++ b/test_scripts/Policies/appID_Management/044_ATF_HMI_Status_Value_Of_AppId_In_PT_Is_Null.lua @@ -123,7 +123,7 @@ function Test:Precondition_UpdatePolicy() end) EXPECT_HMINOTIFICATION("SDL.OnAppPermissionChanged", { appID = HMIAppID, appRevoked = true}) - EXPECT_HMICALL("BasicCommunication.ActivateApp", { level = "NONE" }) + EXPECT_HMICALL("BasicCommunication.CloseApplication", {}) :Do(function(_, data) self.hmiConnection:SendResponse(data.id, data.method, "SUCCESS", {}) self.mobileSession2:ExpectNotification("OnHMIStatus", { hmiLevel ="NONE", systemContext = "MAIN", audioStreamingState = "NOT_AUDIBLE" }) diff --git a/test_scripts/Policies/user_consent_of_Policies/207_ATF_HMILevel_before_data_consented.lua b/test_scripts/Policies/user_consent_of_Policies/207_ATF_HMILevel_before_data_consented.lua index 9231e81b30..102abc4889 100644 --- a/test_scripts/Policies/user_consent_of_Policies/207_ATF_HMILevel_before_data_consented.lua +++ b/test_scripts/Policies/user_consent_of_Policies/207_ATF_HMILevel_before_data_consented.lua @@ -68,7 +68,7 @@ function Test:ActivateApp_on_unconsented_device() end) end end) - EXPECT_HMICALL("BasicCommunication.ActivateApp",{ level = "NONE" }):Times(1) + EXPECT_HMICALL("BasicCommunication.CloseApplication",{}):Times(1) EXPECT_NOTIFICATION("OnHMIStatus", {}):Times(0) end From 341b4f116deb909bfe2673dbfb03acdde7589eb3 Mon Sep 17 00:00:00 2001 From: jacobkeeler Date: Thu, 27 Jun 2019 13:07:51 -0400 Subject: [PATCH 3/3] Update smoke test set --- test_sets/smoke_tests.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/test_sets/smoke_tests.txt b/test_sets/smoke_tests.txt index bb72d11c98..1df644661d 100644 --- a/test_sets/smoke_tests.txt +++ b/test_sets/smoke_tests.txt @@ -44,6 +44,7 @@ ./test_scripts/Smoke/API/044_AlertManeuver_Non_Media_PositiveCase_SUCCESS.lua ./test_scripts/Smoke/API/045_PerformAudioPassThru_Non_Media_PositiveCase_SUCCESS.lua ./test_scripts/Smoke/API/048_GetSystemCapabilityRequest_SUCCESS.lua +./test_scripts/API/CloseApplication/001_Success_flow.lua ./test_scripts/Smoke/HeartBeat/001_HeartBeat_App_does_not_send_HB_and_does_not_respond.lua ./test_scripts/Smoke/HeartBeat/002_HeartBeat_App_does_not_send_HB_but_respond.lua ./test_scripts/Smoke/HeartBeat/003_HeartBeat_App_send_HB.lua