diff --git a/TAF/testCaseModules/keywords/app-service/AppServiceAPI.robot b/TAF/testCaseModules/keywords/app-service/AppServiceAPI.robot index a4f36b14..6bab3a1a 100644 --- a/TAF/testCaseModules/keywords/app-service/AppServiceAPI.robot +++ b/TAF/testCaseModules/keywords/app-service/AppServiceAPI.robot @@ -24,22 +24,18 @@ Suite Teardown for App Service Set Functions ${functions} ${path}= Set variable /v1/kv/edgex/appservices/${CONSUL_CONFIG_VERSION}/app-functional-tests/Writable/Pipeline/ExecutionOrder Update Service Configuration On Consul ${path} ${functions} - sleep 1 Set Transform Type ${type} ${path}= Set variable /v1/kv/edgex/appservices/${CONSUL_CONFIG_VERSION}/app-functional-tests/Writable/Pipeline/Functions/Transform/Parameters/Type Update Service Configuration On Consul ${path} ${type} - sleep 1 Set Compress Algorithm ${algorithm} ${path}= Set variable /v1/kv/edgex/appservices/${CONSUL_CONFIG_VERSION}/app-functional-tests/Writable/Pipeline/Functions/Compress/Parameters/Algorithm Update Service Configuration On Consul ${path} ${algorithm} - sleep 1 Set Encrypt Algorithm ${algorithm} ${path}= Set variable /v1/kv/edgex/appservices/${CONSUL_CONFIG_VERSION}/app-functional-tests/Writable/Pipeline/Functions/Encrypt/Parameters/Algorithm Update Service Configuration On Consul ${path} ${algorithm} - sleep 1 Trigger Function Pipeline With ${data} ${trigger_data}= Run keyword if '${data}' != 'Invalid Data' set variable Valid Data diff --git a/TAF/testCaseModules/keywords/common/commonKeywords.robot b/TAF/testCaseModules/keywords/common/commonKeywords.robot index cd050d49..fea04983 100644 --- a/TAF/testCaseModules/keywords/common/commonKeywords.robot +++ b/TAF/testCaseModules/keywords/common/commonKeywords.robot @@ -249,6 +249,7 @@ Update Service Configuration On Consul ${url} Set Variable http://${BASE_URL}:${REGISTRY_PORT} Create Session Consul url=${url} disable_warnings=true ${resp}= PUT On Session Consul ${path} data=${value} headers=${headers} expected_status=200 + Sleep 1s # Waiting for the configuration updating Get Consul Token ${command} Set Variable cat /tmp/edgex/secrets/consul-acl-token/bootstrap_token.json @@ -263,7 +264,6 @@ Set Telemetry ${config}=${value} For ${service_name} On Consul ${telemetry_path} Set Variable /v1/kv/edgex/${service_layer}/${CONSUL_CONFIG_VERSION}/${service_name}/Writable/Telemetry ${path} Set Variable ${telemetry_path}/${config} Update Service Configuration On Consul ${path} ${value} - Sleep 500ms # Waiting for the configuration available Run Redis Subscriber Progress And Output [Arguments] ${topic} ${keyword} diff --git a/TAF/testCaseModules/keywords/core-metadata/coreMetadataAPI.robot b/TAF/testCaseModules/keywords/core-metadata/coreMetadataAPI.robot index 7265af66..4331abe5 100644 --- a/TAF/testCaseModules/keywords/core-metadata/coreMetadataAPI.robot +++ b/TAF/testCaseModules/keywords/core-metadata/coreMetadataAPI.robot @@ -18,6 +18,7 @@ ${deviceResourceUri} /api/${API_VERSION}/deviceresource ${deviceUri} /api/${API_VERSION}/device ${provisionWatcherUri} /api/${API_VERSION}/provisionwatcher ${LOG_FILE_PATH} ${WORK_DIR}/TAF/testArtifacts/logs/coreMetadataAPI.log +${uomValidationPath} /v1/kv/edgex/core/${CONSUL_CONFIG_VERSION}/core-metadata/Writable/UoM/Validation *** Keywords *** # Device Profile @@ -510,28 +511,25 @@ Delete Profile Files Remove File ${WORK_DIR}/TAF/testData/core-metadata/deviceprofile/${file} # Device profile > resource -Generate a device profile and Add multiple Resources on device profile +Create A Device Profile And Generate Multiple Resources Entity Set Test Variable ${test_profile} Test-Profile-1 Generate a device profile sample ${test_profile} Create Device Profile ${deviceProfile} - ${resource_data}= Get File ${WORK_DIR}/TAF/testData/core-metadata/resource_profile.json encoding=UTF-8 - ${json_string}= Evaluate json.loads(r'''${resource_data}''') json - Generate resource ${json_string} + Generate multiple deviceResources Add multiple Resources on multiple device profile - ${resource_data}= Get File ${WORK_DIR}/TAF/testData/core-metadata/resource_profile.json encoding=UTF-8 - ${json_string}= Evaluate json.loads(r'''${resource_data}''') json - Generate resource ${json_string} + Generate multiple deviceResources Set To Dictionary ${resourceProfile}[1] profileName=Test-Profile-2 Set To Dictionary ${resourceProfile}[2] profileName=Test-Profile-3 -Generate resource - [Arguments] ${data_list} - ${len} Get Length ${data_list} +Generate multiple deviceResources + ${resource_data}= Get File ${WORK_DIR}/TAF/testData/core-metadata/resource_profile.json encoding=UTF-8 + ${json_string}= Evaluate json.loads(r'''${resource_data}''') json + ${len} Get Length ${json_string} FOR ${INDEX} IN RANGE ${len} - Set To Dictionary ${data_list}[${INDEX}] apiVersion=${API_VERSION} + Set To Dictionary ${json_string}[${INDEX}] apiVersion=${API_VERSION} END - Set Test Variable ${resourceProfile} ${data_list} + Set Test Variable ${resourceProfile} ${json_string} Create New resource ${entity} Create Session Core Metadata url=${coreMetadataUrl} disable_warnings=true @@ -755,4 +753,63 @@ Create A Provision Watcher Sample With Associated Test-Device-Service And ${devi Set ProfileChange.${config}=${value} For Core-Metadata On Consul ${path}= Set Variable /v1/kv/edgex/core/${CONSUL_CONFIG_VERSION}/core-metadata/Writable/ProfileChange/${config} Update Service Configuration On Consul ${path} ${value} - Sleep 1s # Waiting for the configuration updating + +## UoM +Query UoM + ${headers}= Create Dictionary Authorization=Bearer ${jwt_token} + Create Session Metrics url=${coreMetadataUrl} disable_warnings=true + ${resp}= GET On Session Metrics api/${API_VERSION}/uom headers=${headers} expected_status=200 + Set Response to Test Variables ${resp} + +Retrieve Valid Units Value + Query UoM + ${units} Create List + ${units_key} Get Dictionary Keys ${content}[uom][units] + FOR ${ITEM} IN @{units_key} + FOR ${INDEX} IN RANGE len(${content}[uom][units][${ITEM}][values]) + Append To List ${units} ${content}[uom][units][${ITEM}][values][${INDEX}] + END + END + Set Test Variable ${uom_units} ${units} + +Set Profile Units Value To ${valid} + Run Keyword If "${valid}" == "valid" Retrieve Valid Units Value + FOR ${INDEX} IN RANGE len(${deviceProfile}[0][profile][deviceResources]) + ${unit} Run Keyword If "${valid}" == "valid" Evaluate random.choice(@{uom_units}) random + ... ELSE Set Variable invalid + Set To Dictionary ${deviceProfile}[0][profile][deviceResources][${INDEX}][properties] units=${unit} + END + Set Test Variable ${deviceProfile} ${deviceProfile} + +Create A Profile ${file} With ${valid} Units Value + Generate a device profile sample ${file} + Set Profile Units Value To ${valid} + Create Device Profile ${deviceProfile} + +Update Units Value In Profile ${file} To ${valid} + Run Keyword If "${valid}" == "valid" Retrieve Valid Units Value + ${content} Get File ${WORK_DIR}/TAF/testData/core-metadata/deviceprofile/${file}.yaml + ${matches} Get Regexp Matches ${content} units: \"(.*?)\" + FOR ${ITEM} IN @{matches} + ${variables}= Get variables + ${existed} Run Keyword And Return Status Should be true "\${replaced}" in $variables + ${data} Run Keyword If ${existed} == True Set Variable ${replaced} + ... ELSE Set Variable ${content} + ${unit} Run Keyword If "${valid}" == "valid" Evaluate random.choice(@{uom_units}) random + ... ELSE Set Variable invalid + ${replaced} Replace String ${data} ${ITEM} units: "${unit}" count=1 + END + Create File ${WORK_DIR}/TAF/testData/core-metadata/deviceprofile/NEW-${file}.yaml ${replaced} + +Modify Device Profile ${file} With ${valid} Units Value + Update Units Value In Profile ${file} To ${valid} + Upload device profile NEW-${file}.yaml + +Create Device Resources Contain ${valid} Units Value + Run Keyword If "${valid}" == "valid" Retrieve Valid Units Value + FOR ${INDEX} IN RANGE len(${resourceProfile}) + ${unit} Run Keyword If "${valid}" == "valid" Evaluate random.choice(@{uom_units}) random + ... ELSE Set Variable invalid + Set To Dictionary ${resourceProfile}[${INDEX}][resource][properties] units=${unit} + END + Create New resource ${resourceProfile} diff --git a/TAF/testScenarios/functionalTest/V2-API/app-service/trigger/POST-negative.robot b/TAF/testScenarios/functionalTest/V2-API/app-service/trigger/POST-negative.robot index a624de1f..6f560e6f 100644 --- a/TAF/testScenarios/functionalTest/V2-API/app-service/trigger/POST-negative.robot +++ b/TAF/testScenarios/functionalTest/V2-API/app-service/trigger/POST-negative.robot @@ -30,5 +30,4 @@ Accept raw data [Arguments] ${bool} ${path}= Set variable /v1/kv/edgex/appservices/${CONSUL_CONFIG_VERSION}/app-functional-tests/Writable/Pipeline/UseTargetTypeOfByteArray Update Service Configuration On Consul ${path} ${bool} - sleep 1 diff --git a/TAF/testScenarios/functionalTest/V2-API/core-data/event/GET-negative.robot b/TAF/testScenarios/functionalTest/V2-API/core-data/event/GET-negative.robot index afabab18..bb12d84c 100644 --- a/TAF/testScenarios/functionalTest/V2-API/core-data/event/GET-negative.robot +++ b/TAF/testScenarios/functionalTest/V2-API/core-data/event/GET-negative.robot @@ -50,7 +50,6 @@ ErrEventGET005 - Query events by start/end time fails (Start>End) ErrEventGET006 - Query event fails when persistData is false ${path}= Set Variable /v1/kv/edgex/core/${CONSUL_CONFIG_VERSION}/core-data/Writable/PersistData Given Update Service Configuration On Consul ${path} false - And Sleep 1s # Waiting for the configuration updating And Generate Event Sample Event Device-Test-001 Profile-Test-001 Command-Test-001 Simple Reading And Create Event With Device-Test-001 And Profile-Test-001 And Command-Test-001 When Query Event By Event Id "${id}" @@ -59,4 +58,3 @@ ErrEventGET006 - Query event fails when persistData is false And Response Time Should Be Less Than "${default_response_time_threshold}"ms [Teardown] Run Keywords Delete All Events By Age ... AND Update Service Configuration On Consul ${path} true - ... AND Sleep 1s # Waiting for the configuration updating diff --git a/TAF/testScenarios/functionalTest/V2-API/core-metadata/deviceprofile/PATCH-Negative-Deviceresource.robot b/TAF/testScenarios/functionalTest/V2-API/core-metadata/deviceprofile/PATCH-Negative-Deviceresource.robot index 8be958a5..4a560bbf 100644 --- a/TAF/testScenarios/functionalTest/V2-API/core-metadata/deviceprofile/PATCH-Negative-Deviceresource.robot +++ b/TAF/testScenarios/functionalTest/V2-API/core-metadata/deviceprofile/PATCH-Negative-Deviceresource.robot @@ -44,16 +44,3 @@ ErrProfileResourcePATCH003 - Update deviceResource with isHidden validation erro And Should Return Content-Type "application/json" And Response Time Should Be Less Than "${default_response_time_threshold}"ms [Teardown] Delete Device Profile By Name ${test_profile} - -ErrProfileResourcePATCH004 - Update resources which contain invalid Units value - [Tags] Skipped - Given Set UoM Validation to True - And Generate Device Profile - When Update Resource with Invalid Units Value - Then Should Return Status Code "207" - And Should Return Content-Type "application/json" - And Item Index All Should Contain Status Code "500" - And Response Time Should Be Less Than "${default_response_time_threshold}"ms - And Resource Should Not Be Updated - [Teardown] Run Keywords Set UoM Validation to False - ... AND Delete Device Profile diff --git a/TAF/testScenarios/functionalTest/V2-API/core-metadata/deviceprofile/PATCH-Positive-Deviceresource.robot b/TAF/testScenarios/functionalTest/V2-API/core-metadata/deviceprofile/PATCH-Positive-Deviceresource.robot index e6812565..1b67dec2 100644 --- a/TAF/testScenarios/functionalTest/V2-API/core-metadata/deviceprofile/PATCH-Positive-Deviceresource.robot +++ b/TAF/testScenarios/functionalTest/V2-API/core-metadata/deviceprofile/PATCH-Positive-Deviceresource.robot @@ -37,19 +37,6 @@ ProfileResourcePATCH002 - Update multiple resources on multiple device profiles And Resource DeviceValue_FLOAT32_R in Profile Test-Profile-3 Should Be Updated [Teardown] Delete Multiple Device Profiles By Names Test-Profile-1 Test-Profile-2 Test-Profile-3 -ProfileResourcePATCH003 - Update resources which contain valid Units value - [Tags] Skipped - Given Create Device Profile - And Set UoM Validation to True - When Update Resource with Valid Units Value - Then Should Return Status Code "207" - And Should Return Content-Type "application/json" - And Item Index All Should Contain Status Code "200" - And Response Time Should Be Less Than "${default_response_time_threshold}"ms - And Resource Should Be Updated - [Teardown] Run Keywords Set UoM Validation to False - ... AND Delete Device Profile - *** Keywords *** Generate multiple resource sample for updating ${resource_1}= Create Dictionary name=DeviceValue_Boolean_RW description=Dcp_ABC isHidden=${false} diff --git a/TAF/testScenarios/functionalTest/V2-API/core-metadata/deviceprofile/POST-Negative-Deviceresource.robot b/TAF/testScenarios/functionalTest/V2-API/core-metadata/deviceprofile/POST-Negative-Deviceresource.robot index ec4ebdb0..c5037888 100644 --- a/TAF/testScenarios/functionalTest/V2-API/core-metadata/deviceprofile/POST-Negative-Deviceresource.robot +++ b/TAF/testScenarios/functionalTest/V2-API/core-metadata/deviceprofile/POST-Negative-Deviceresource.robot @@ -11,7 +11,7 @@ ${SUITE} Core Metadata Device Profile POST Deviceresource Negative Test *** Test Cases *** ErrProfileResourcePOST001 - Add deviceResource with Non-existent device profile name # non-existent profile name - Given Generate deviceResource + Given Generate multiple deviceResources And Set To Dictionary ${resourceProfile}[0] profileName=non-existent When Create New resource ${resourceProfile} Then Should Return Status Code "207" @@ -21,7 +21,7 @@ ErrProfileResourcePOST001 - Add deviceResource with Non-existent device profile ErrProfileResourcePOST002 - Add deviceResource with Empty profile name # empty profile name - Given Generate deviceResource + Given Generate multiple deviceResources And Set To Dictionary ${resourceProfile}[0] profileName=${EMPTY} When Create New resource ${resourceProfile} Then Should Return Status Code "400" @@ -30,7 +30,7 @@ ErrProfileResourcePOST002 - Add deviceResource with Empty profile name ErrProfileResourcePOST003 - Add deviceResource with duplicate Resource name # 2 deviceResource with same resource name - Given Generate a device profile and Add multiple Resources on device profile + Given Create A Device Profile And Generate Multiple Resources Entity And Create New resource ${resourceProfile} When Create New resource ${resourceProfile} Then Should Return Status Code "207" @@ -42,7 +42,7 @@ ErrProfileResourcePOST003 - Add deviceResource with duplicate Resource name ErrProfileResourcePOST004 - Add deviceResource with Empty Resource Name # deviceResources > deviceResource without name # Contains valid profile body - Given Generate a device profile and Add multiple Resources on device profile + Given Create A Device Profile And Generate Multiple Resources Entity And Set To Dictionary ${resourceProfile}[0][resource] name=${EMPTY} When Create New resource ${resourceProfile} Then Should Return Status Code "400" @@ -53,7 +53,7 @@ ErrProfileResourcePOST004 - Add deviceResource with Empty Resource Name ErrProfileResourcePOST005 - Add deviceResource with Empty valueType # deviceResources > ResourceProperties without valueType # Contains valid profile body - Given Generate a device profile and Add multiple Resources on device profile + Given Create A Device Profile And Generate Multiple Resources Entity And Set To Dictionary ${resourceProfile}[0][resource][properties] valueType=${Empty} When Create New resource ${resourceProfile} Then Should Return Status Code "400" @@ -64,7 +64,7 @@ ErrProfileResourcePOST005 - Add deviceResource with Empty valueType ErrProfileResourcePOST006 - Add deviceResource with valueType validation error # deviceResources > deviceResource invalid valueType # Contains valid profile body - Given Generate a device profile and Add multiple Resources on device profile + Given Create A Device Profile And Generate Multiple Resources Entity And Set To Dictionary ${resourceProfile}[0][resource][properties] valueType=invalid When Create New resource ${resourceProfile} Then Should Return Status Code "400" @@ -75,7 +75,7 @@ ErrProfileResourcePOST006 - Add deviceResource with valueType validation error ErrProfileResourcePOST007 - Add deviceResource with Empty readWrite # deviceResources > ResourceProperties without readWrite # Contains valid profile body - Given Generate a device profile and Add multiple Resources on device profile + Given Create A Device Profile And Generate Multiple Resources Entity And Set To Dictionary ${resourceProfile}[0][resource][properties] readWrite=${Empty} When Create New resource ${resourceProfile} Then Should Return Status Code "400" @@ -86,7 +86,7 @@ ErrProfileResourcePOST007 - Add deviceResource with Empty readWrite ErrProfileResourcePOST008 - Add deviceResource with readWrite validation error # deviceResources > ResourceProperties invalid readWrite # Contains valid profile body - Given Generate a device profile and Add multiple Resources on device profile + Given Create A Device Profile And Generate Multiple Resources Entity And Set To Dictionary ${resourceProfile}[0][resource][properties] readWrite=invalid When Create New resource ${resourceProfile} Then Should Return Status Code "400" @@ -94,20 +94,26 @@ ErrProfileResourcePOST008 - Add deviceResource with readWrite validation error And Response Time Should Be Less Than "${default_response_time_threshold}"ms [Teardown] Delete device profile by name ${test_profile} -ErrProfileResourcePOST008 - Add deviceResource with invalid units value - [Tags] Skipped - Given Set UoM Validation to True - And Create A Device Profile - When Create Device Resource with Invalid Units Value - Then Should Return Status Code "500" +ErrProfileResourcePOST009 - Add deviceResource with invalid units value + Given Create A Device Profile And Generate Multiple Resources Entity + And Update Service Configuration On Consul ${uomValidationPath} true + When Create Device Resources Contain invalid Units Value + Then Should Return Status Code "207" And Should Return Content-Type "application/json" + And Item Index All Should Contain Status Code "500" And Response Time Should Be Less Than "${default_response_time_threshold}"ms - And The Resource Should Not Be Added - [Teardown] Run Keywords Set UoM Validation to False - ... AND Delete Device Profile + And Resources Should Not Be Added in ${test_profile} + [Teardown] Run Keywords Update Service Configuration On Consul ${uomValidationPath} false + ... AND Delete Device Profile By Name ${test_profile} *** Keywords *** -Generate deviceResource - ${resource_data}= Get File ${WORK_DIR}/TAF/testData/core-metadata/resource_profile.json encoding=UTF-8 - ${json_string}= Evaluate json.loads(r'''${resource_data}''') json - Generate resource ${json_string} +Resources Should Not Be Added in ${profile_name} + Query device profile by name ${profile_name} + ${resource_name_list} Create List + FOR ${resource} IN @{content}[profile][deviceResources] + Append To List ${resource_name_list} ${resource}[name] + END + # Validate + FOR ${INDEX} IN RANGE len(${resourceProfile}) + List Should Not Contain Value ${resource_name_list} ${resourceProfile}[${INDEX}][resource][name] + END diff --git a/TAF/testScenarios/functionalTest/V2-API/core-metadata/deviceprofile/POST-Negative-Uploadfile.robot b/TAF/testScenarios/functionalTest/V2-API/core-metadata/deviceprofile/POST-Negative-Uploadfile.robot index 507b9659..d268eddb 100644 --- a/TAF/testScenarios/functionalTest/V2-API/core-metadata/deviceprofile/POST-Negative-Uploadfile.robot +++ b/TAF/testScenarios/functionalTest/V2-API/core-metadata/deviceprofile/POST-Negative-Uploadfile.robot @@ -84,10 +84,9 @@ ErrProfilePOSTUpload008 - Create device profile by upload file with deviceComman [Teardown] Delete Profile Files NEW-Test-Profile-2.yaml ErrProfilePOSTUpload009 - Create device profile by upload file with invalid units property - [Tags] Skipped - Given Set UoM Validation to True - When Upload Device Prfoile and the File Contains Invalid Units Value + Given Update Service Configuration On Consul ${uomValidationPath} true + When Modify Device Profile Test-Profile-4 With invalid Units Value Then Should Return Status Code "500" And Should Return Content-Type "application/json" And Response Time Should Be Less Than "${default_response_time_threshold}"ms - [Teardown] Run Keywords Set UoM Validation to False + [Teardown] Update Service Configuration On Consul ${uomValidationPath} false diff --git a/TAF/testScenarios/functionalTest/V2-API/core-metadata/deviceprofile/POST-Negative.robot b/TAF/testScenarios/functionalTest/V2-API/core-metadata/deviceprofile/POST-Negative.robot index 727bbeb3..d9f9d73e 100644 --- a/TAF/testScenarios/functionalTest/V2-API/core-metadata/deviceprofile/POST-Negative.robot +++ b/TAF/testScenarios/functionalTest/V2-API/core-metadata/deviceprofile/POST-Negative.robot @@ -89,11 +89,10 @@ ErrProfilePOST008 - Create device profile with deviceCommands deviceResources va And Response Time Should Be Less Than "${default_response_time_threshold}"ms ErrProfilePOST009 - Create device profile with invalid units value - [Tags] Skipped - Given Set UoM Validation to True - When Create Device Profile Which Contains Invalid Units Value + Given Update Service Configuration On Consul ${uomValidationPath} true + When Create A Profile Test-Profile-1 With invalid Units Value Then Should Return Status Code "207" And Should Return Content-Type "application/json" And Item Index All Should Contain Status Code "500" And Response Time Should Be Less Than "${default_response_time_threshold}"ms - [Teardown] Set UoM Validation to False + [Teardown] Update Service Configuration On Consul ${uomValidationPath} false diff --git a/TAF/testScenarios/functionalTest/V2-API/core-metadata/deviceprofile/POST-Positive-Deviceresource.robot b/TAF/testScenarios/functionalTest/V2-API/core-metadata/deviceprofile/POST-Positive-Deviceresource.robot index d330afdf..1b3381d1 100644 --- a/TAF/testScenarios/functionalTest/V2-API/core-metadata/deviceprofile/POST-Positive-Deviceresource.robot +++ b/TAF/testScenarios/functionalTest/V2-API/core-metadata/deviceprofile/POST-Positive-Deviceresource.robot @@ -13,13 +13,13 @@ ${LOG_FILE_PATH} ${WORK_DIR}/TAF/testArtifacts/logs/core-metadata-deviceprofile *** Test Cases *** ProfileResourcePOST001 - Add multiple Resources on device profile # multiple resources > one profile - Given Generate a device profile and Add multiple Resources on device profile + Given Create A Device Profile And Generate Multiple Resources Entity When Create New resource ${resourceProfile} Then Should Return Status Code "207" And Should Return Content-Type "application/json" And Item Index All Should Contain Status Code "201" And Response Time Should Be Less Than "${default_response_time_threshold}"ms - And New Resource SwitchButton in Test-Profile-1 Should Be Added + And Resources Should Be Added in ${test_profile} [Teardown] Delete Device Profile By Name ${test_profile} ProfileResourcePOST002 - Add multiple Resources on multiple device profiles @@ -32,29 +32,37 @@ ProfileResourcePOST002 - Add multiple Resources on multiple device profiles And Should Return Content-Type "application/json" And Item Index All Should Contain Status Code "201" And Response Time Should Be Less Than "${default_response_time_threshold}"ms - And New Resource SwitchButton in Test-Profile-1 Should Be Added - And New Resource Temperature in Test-Profile-2 Should Be Added - And New Resource BinaryInput1 in Test-Profile-3 Should Be Added + And Resources Should Be Created in Profiles [Teardown] Delete Multiple Device Profiles By Names Test-Profile-1 Test-Profile-2 Test-Profile-3 ProfileResourcePOST003 - Add multiple Resources on device profile with valid units property - [Tags] Skipped - Given Set UoM Validation to True - And Create A Device Profile - When Create Device Resources Contain Valid Units Property + Given Create A Device Profile And Generate Multiple Resources Entity + And Update Service Configuration On Consul ${uomValidationPath} true + When Create Device Resources Contain valid Units Value Then Should Return Status Code "207" And Should Return Content-Type "application/json" And Item Index All Should Contain Status Code "201" And Response Time Should Be Less Than "${default_response_time_threshold}"ms - And New Resources Should Be Added - [Teardown] Run Keywords Set UoM Validation to False - ... AND Delete Device Profile + And Resources Should Be Added in ${test_profile} + [Teardown] Run Keywords Update Service Configuration On Consul ${uomValidationPath} false + ... AND Delete Device Profile By Name ${test_profile} *** Keywords *** -New Resource ${resource_name} in ${profile_name} Should Be Added +Resources Should Be Added in ${profile_name} Query device profile by name ${profile_name} ${resource_name_list} Create List FOR ${resource} IN @{content}[profile][deviceResources] Append To List ${resource_name_list} ${resource}[name] END - List Should Contain Value ${resource_name_list} ${resource_name} + # Validate + FOR ${INDEX} IN RANGE len(${resourceProfile}) + Run Keyword If "${resourceProfile}[${INDEX}][profileName]" == "${content}[profile][name]" + ... List Should Contain Value ${resource_name_list} ${resourceProfile}[${INDEX}][resource][name] + END + +Resources Should Be Created in Profiles + ${profiles} Create List Test-Profile-1 Test-Profile-2 Test-Profile-3 + FOR ${profile} IN @{profiles} + Resources Should Be Added in ${profile} + END + diff --git a/TAF/testScenarios/functionalTest/V2-API/core-metadata/deviceprofile/POST-Positive.robot b/TAF/testScenarios/functionalTest/V2-API/core-metadata/deviceprofile/POST-Positive.robot index 59419caf..99b5e6f7 100644 --- a/TAF/testScenarios/functionalTest/V2-API/core-metadata/deviceprofile/POST-Positive.robot +++ b/TAF/testScenarios/functionalTest/V2-API/core-metadata/deviceprofile/POST-Positive.robot @@ -45,7 +45,6 @@ ProfilePOST003 - Create device profile by upload file with empty deviceResources ProfilePOST004 - Create device profile by upload file without deviceResources and deviceCommands When Upload Device Profile Without DeviceResources And DeviceCommands - log to console ${content} Then Should Return Status Code "201" And Should Return Content-Type "application/json" And Should Contain "id" @@ -54,26 +53,25 @@ ProfilePOST004 - Create device profile by upload file without deviceResources an ... AND Delete Profile Files ${upload_profile} ProfilePOST005 - Create device profile with json body and contains valid unit value - [Tags] Skipped - Given Set UoM Validation to True - When Create Device Profile Which Contains Valid Units Value + Given Update Service Configuration On Consul ${uomValidationPath} true + When Create A Profile Test-Profile-1 With valid Units Value Then Should Return Status Code "207" And Should Return Content-Type "application/json" And Item Index All Should Contain Status Code "201" And id And Response Time Should Be Less Than "${default_response_time_threshold}"ms - [Teardown] Run Keywords Set UoM Validation to False - ... AND Delete Device Profile + [Teardown] Run Keywords Update Service Configuration On Consul ${uomValidationPath} false + ... AND Delete Device Profile By Name Test-Profile-1 ProfilePOST006 - Create device profile by upload file and the update file contains valid unit value - [Tags] Skipped - Given Set UoM Validation to True - When Upload Device Prfoile and the File Contains Valid Units Value + Given Update Service Configuration On Consul ${uomValidationPath} true + When Modify Device Profile Test-Profile-1 With valid Units Value Then Should Return Status Code "201" And Should Return Content-Type "application/json" And Should Contain "id" And Response Time Should Be Less Than "${default_response_time_threshold}"ms - [Teardown] Run Keywords Set UoM Validation to False - ... AND Delete Device Profile + [Teardown] Run Keywords Update Service Configuration On Consul ${uomValidationPath} false + ... AND Delete Device Profile By Name Test-Profile-1 + ... AND Delete Profile Files NEW-Test-Profile-1.yaml *** Keywords *** Upload Device Profile With Empty DeviceResources And DeviceCommands diff --git a/TAF/testScenarios/functionalTest/V2-API/core-metadata/deviceprofile/PUT-Negative-UploadFile.robot b/TAF/testScenarios/functionalTest/V2-API/core-metadata/deviceprofile/PUT-Negative-UploadFile.robot index 19e14373..fd94fbae 100644 --- a/TAF/testScenarios/functionalTest/V2-API/core-metadata/deviceprofile/PUT-Negative-UploadFile.robot +++ b/TAF/testScenarios/functionalTest/V2-API/core-metadata/deviceprofile/PUT-Negative-UploadFile.robot @@ -109,13 +109,24 @@ ErrProfilePUTUpload008 - Update device profile by upload file when StrictDeviceP ... AND Delete Profile Files NEW-Test-Profile-3.yaml ErrProfilePUTUpload009 - Update device profile by upload file and the update file contains invalid unit value - [Tags] Skipped - Given Upload Device Profile - And Set UoM Validation to True - When Update Device Profile with Upload File Contains Invalid Unit Value + Given Upload Device Profile Test-Profile-3.yaml + And Update Service Configuration On Consul ${uomValidationPath} true + And Update Units Value In Profile Test-Profile-3 To invalid + When Upload File NEW-Test-Profile-3.yaml To Update Device Profile Then Should Return Status Code "500" And Should Return Content-Type "application/json" And Response Time Should Be Less Than "${default_response_time_threshold}"ms - And Profile Should Not Be Updated - [Teardown] Run Keywords Set UoM Validation to False - ... AND Delete Device Profile + And Resource Units Should Not Be Updated in Test-Profile-3 + [Teardown] Run Keywords Update Service Configuration On Consul ${uomValidationPath} false + ... AND Delete Device Profile By Name Test-Profile-3 + ... AND Delete Profile Files NEW-Test-Profile-3.yaml + +*** Keywords *** +Resource Units Should Not Be Updated in ${profile_name} + Retrieve Valid Units Value + Query device profile by name ${profile_name} + # Validate + FOR ${INDEX} IN RANGE len(${content}[profile][deviceResources]) + Run Keyword If "${content}[profile][deviceResources][${INDEX}][properties][units]" != "${EMPTY}" + ... List Should Not Contain Value ${uom_units} ${content}[profile][deviceResources][${INDEX}][properties][units] + END diff --git a/TAF/testScenarios/functionalTest/V2-API/core-metadata/deviceprofile/PUT-Negative.robot b/TAF/testScenarios/functionalTest/V2-API/core-metadata/deviceprofile/PUT-Negative.robot index c05f9e82..f333708a 100644 --- a/TAF/testScenarios/functionalTest/V2-API/core-metadata/deviceprofile/PUT-Negative.robot +++ b/TAF/testScenarios/functionalTest/V2-API/core-metadata/deviceprofile/PUT-Negative.robot @@ -111,13 +111,25 @@ ErrProfilePUT008 - Update device profile when StrictDeviceProfileChanges is true ... AND Delete Device Profile By Name Test-Profile-1 ErrProfilePUT009 - Update device profile with invalid units value - [Tags] Skipped - Given Create device profile - And Set UoM Validation to True + Given Generate A Device Profile Sample Test-Profile-1 + And Create Device Profile ${deviceProfile} + And Update Service Configuration On Consul ${uomValidationPath} true + And Set Profile Units Value To invalid When Update Device Profile ${deviceProfile} - Then Should Return Status Code "500" + Then Should Return Status Code "207" + And Item Index 0 Should Contain Status Code "500" And Should Return Content-Type "application/json" And Response Time Should Be Less Than "${default_response_time_threshold}"ms - And Profile Should Not Be Updated - [Teardown] Run Keywords Set UoM Validation to False - ... AND Delete Device Profile + And Resource Units Should Not Be Updated in Test-Profile-1 + [Teardown] Run Keywords Update Service Configuration On Consul ${uomValidationPath} false + ... AND Delete Device Profile By Name Test-Profile-1 + +*** Keywords *** +Resource Units Should Not Be Updated in ${profile_name} + Retrieve Valid Units Value + Query device profile by name ${profile_name} + # Validate + FOR ${INDEX} IN RANGE len(${content}[profile][deviceResources]) + Run Keyword If "${content}[profile][deviceResources][${INDEX}][properties][units]" != "${EMPTY}" + ... List Should Not Contain Value ${uom_units} ${content}[profile][deviceResources][${INDEX}][properties][units] + END diff --git a/TAF/testScenarios/functionalTest/V2-API/core-metadata/deviceprofile/PUT-Positive.robot b/TAF/testScenarios/functionalTest/V2-API/core-metadata/deviceprofile/PUT-Positive.robot index aca58651..64bc1d7b 100644 --- a/TAF/testScenarios/functionalTest/V2-API/core-metadata/deviceprofile/PUT-Positive.robot +++ b/TAF/testScenarios/functionalTest/V2-API/core-metadata/deviceprofile/PUT-Positive.robot @@ -53,29 +53,31 @@ ProfilePUT003 - Update device profiles by upload file ... AND Delete Profile Files NEW-Test-Profile-2.yaml ProfilePUT004 - Update a device profile with valid unit value - [Tags] Skipped - Given Create Device Profile - And Set UoM Validation to True - When Update Device Profile Contains Valid Unit Value + Given Generate A Device Profile Sample Test-Profile-1 + And Create Device Profile ${deviceProfile} + And Update Service Configuration On Consul ${uomValidationPath} true + And Set Profile Units Value To valid + When Update Device Profile ${deviceProfile} Then Should Return Status Code "207" And Should Return Content-Type "application/json" And Item Index 0 Should Contain Status Code "200" And Response Time Should Be Less Than "${default_response_time_threshold}"ms - And Profile Should Be Updated - [Teardown] Run Keywords Set UoM Validation to False - ... AND Delete Device Profile + And Resource Units Should Be Updated in Test-Profile-1 + [Teardown] Run Keywords Update Service Configuration On Consul ${uomValidationPath} false + ... AND Delete Device Profile By Name Test-Profile-1 ProfilePUT005 - Update device profiles by upload file and the update file contains valid unit value - [Tags] Skipped - Given Upload Device Profile - And Set UoM Validation to True - When Upload File Contains Valid Unit Value To Update Device Profile + Given Upload Device Profile Test-Profile-2.yaml + And Update Service Configuration On Consul ${uomValidationPath} true + And Update Units Value In Profile Test-Profile-2 To valid + When Upload File NEW-Test-Profile-2.yaml To Update Device Profile Then Should Return Status Code "200" And Should Return Content-Type "application/json" And Response Time Should Be Less Than "${default_response_time_threshold}"ms - And Profile Should Be Updated - [Teardown] Run Keywords Set UoM Validation to False - ... AND Delete Device Profile + And Resource Units Should Be Updated in Test-Profile-2 + [Teardown] Run Keywords Update Service Configuration On Consul ${uomValidationPath} false + ... AND Delete Device Profile By Name Test-Profile-2 + ... AND Delete Profile Files NEW-Test-Profile-2.yaml *** Keywords *** Profile ${device_profile_name} Data "${property}" Should Be Updated @@ -86,3 +88,11 @@ Profile ${device_profile_name} Data "${property}" Should Be Updated ... Should Be Equal ${content}[profile][deviceResources][1][properties][valueType] Float64 ... ELSE IF "${property}" == "deviceCommands" Should Be Equal ${content}[profile][deviceCommands][0][isHidden] ${true} +Resource Units Should Be Updated in ${profile_name} + Retrieve Valid Units Value + Query device profile by name ${profile_name} + # Validate + FOR ${INDEX} IN RANGE len(${content}[profile][deviceResources]) + Run Keyword If "${content}[profile][deviceResources][${INDEX}][properties][units]" != "${EMPTY}" + ... List Should Contain Value ${uom_units} ${content}[profile][deviceResources][${INDEX}][properties][units] + END diff --git a/TAF/testScenarios/functionalTest/V2-API/core-metadata/info/GET.robot b/TAF/testScenarios/functionalTest/V2-API/core-metadata/info/GET.robot index db5f34f9..605da6aa 100644 --- a/TAF/testScenarios/functionalTest/V2-API/core-metadata/info/GET.robot +++ b/TAF/testScenarios/functionalTest/V2-API/core-metadata/info/GET.robot @@ -41,10 +41,3 @@ InfoGET005 - Query UoM Then Should Return Status Code "200" And uom And apiVersion Should be ${API_VERSION} And Response Time Should Be Less Than "${default_response_time_threshold}"ms - -*** Keywords *** -Query UoM - ${headers}= Create Dictionary Authorization=Bearer ${jwt_token} - Create Session Metrics url=${url} disable_warnings=true - ${resp}= GET On Session Metrics api/${API_VERSION}/uom headers=${headers} expected_status=200 - Set Response to Test Variables ${resp} diff --git a/TAF/testScenarios/functionalTest/V2-API/support-notifications/transmission/GET-Positive-II.robot b/TAF/testScenarios/functionalTest/V2-API/support-notifications/transmission/GET-Positive-II.robot index 6b40e840..ab9db6af 100644 --- a/TAF/testScenarios/functionalTest/V2-API/support-notifications/transmission/GET-Positive-II.robot +++ b/TAF/testScenarios/functionalTest/V2-API/support-notifications/transmission/GET-Positive-II.robot @@ -111,7 +111,6 @@ Set Writable configs: resendInterval=${resendInterval} and resendLimit=${resendL ${path}= Set variable /v1/kv/edgex/core/${CONSUL_CONFIG_VERSION}/support-notifications/Writable Update Service Configuration On Consul ${path}/ResendInterval ${resendInterval} Update Service Configuration On Consul ${path}/ResendLimit ${resendLimit} - Sleep 1s # Waiting for the configuration updating Get Transmission Id Query All Transmissions diff --git a/TAF/testScenarios/integrationTest/UC_device_service/device_configuration.robot b/TAF/testScenarios/integrationTest/UC_device_service/device_configuration.robot index cd76d588..afa76d74 100644 --- a/TAF/testScenarios/integrationTest/UC_device_service/device_configuration.robot +++ b/TAF/testScenarios/integrationTest/UC_device_service/device_configuration.robot @@ -87,13 +87,11 @@ Config006 - Verfiy reading contains units when ReadingUnits is false Set Device ${config} to ${value} For ${service_name} On Consul ${path}= Set Variable /v1/kv/edgex/devices/${CONSUL_CONFIG_VERSION}/${service_name}/Device/${config} Update Service Configuration On Consul ${path} ${value} - Sleep 500ms Restart Services device-virtual Set Writable.Reading.ReadingUnits to ${value} For ${service_name} On Consul ${path}= Set Variable /v1/kv/edgex/devices/${CONSUL_CONFIG_VERSION}/${service_name}/Writable/Reading/ReadingUnits Update Service Configuration On Consul ${path} ${value} - Sleep 500ms Retrive device data by device ${device_name} and command ${command} ${timestamp} Get current milliseconds epoch time diff --git a/TAF/testScenarios/integrationTest/UC_end_to_end/export_store_forward.robot b/TAF/testScenarios/integrationTest/UC_end_to_end/export_store_forward.robot index 32365633..cb007cc6 100644 --- a/TAF/testScenarios/integrationTest/UC_end_to_end/export_store_forward.robot +++ b/TAF/testScenarios/integrationTest/UC_end_to_end/export_store_forward.robot @@ -88,7 +88,6 @@ Set ${configurations} For ${service_name} On Consul FOR ${key} ${value} IN ZIP ${config_key} ${config_value} ${path}= Set Variable /v1/kv/edgex/appservices/${CONSUL_CONFIG_VERSION}/${service_name}/Writable/StoreAndForward/${key} Update Service Configuration On Consul ${path} ${value} - Sleep 500ms END Start HTTP Server And Received Exported Data Contains ${keyword} diff --git a/TAF/testScenarios/integrationTest/UC_mqtt_message_bus/core_data_config.robot b/TAF/testScenarios/integrationTest/UC_mqtt_message_bus/core_data_config.robot index 1f3c1f99..0281f4a1 100644 --- a/TAF/testScenarios/integrationTest/UC_mqtt_message_bus/core_data_config.robot +++ b/TAF/testScenarios/integrationTest/UC_mqtt_message_bus/core_data_config.robot @@ -73,7 +73,6 @@ CoreConfig004 - Set core-data MessageQueue.Optional.Qos (SUBSCRIBE) Set MessageQueue ${key}=${value} For core-data On Consul ${path}= Set Variable ${DATA_CONSOL_PATH}/MessageQueue/${key} Update Service Configuration On Consul ${path} ${value} - Sleep 500ms Restart Services data ${timestamp} get current epoch time Set Test Variable ${log_timestamp} ${timestamp} diff --git a/TAF/testScenarios/integrationTest/UC_mqtt_message_bus/device_virtual_config.robot b/TAF/testScenarios/integrationTest/UC_mqtt_message_bus/device_virtual_config.robot index a734d852..cf362804 100644 --- a/TAF/testScenarios/integrationTest/UC_mqtt_message_bus/device_virtual_config.robot +++ b/TAF/testScenarios/integrationTest/UC_mqtt_message_bus/device_virtual_config.robot @@ -62,7 +62,6 @@ Set MessageQueue ${key}=${value} For ${service_name} On Consul ... ELSE IF "device" in "${service_name}" Set Variable devices ${path}= Set Variable /v1/kv/edgex/${service_layer}/${CONSUL_CONFIG_VERSION}/${service_name}/MessageQueue/${key} Update Service Configuration On Consul ${path} ${value} - Sleep 500ms ${service} Run Keyword If "data" in "${service_name}" Set Variable data ... ELSE Set Variable ${service_name} Restart Services ${service} @@ -70,7 +69,6 @@ Set MessageQueue ${key}=${value} For ${service_name} On Consul Set Writable LogLevel To Debug For ${service_name} On Consul ${path}= Set Variable /v1/kv/edgex/devices/${CONSUL_CONFIG_VERSION}/${service_name}/Writable/LogLevel Update Service Configuration On Consul ${path} DEBUG - Sleep 500ms Retrive device data by device ${device_name} and command ${command} ${timestamp} get current epoch time