From bd1b7d9f271c95a0dfd565f60781a7fd34762822 Mon Sep 17 00:00:00 2001 From: Elian Kraja Date: Fri, 2 Aug 2019 16:20:49 +0200 Subject: [PATCH] Refactoring folders. Updates on SRV/PlatUeIdentity file adding high level test cases and moved low level code to specific keywords --- SRV/UETAG/PlatUeIdentity.robot | 171 ++++++++++-------- SRV/UETAG/environment/pics.txt | 4 + .../UETAG/environment}/variables.txt | 1 + .../UETAG/resources}/GenericKeywords.robot | 5 + .../UETAG/resources}/LocationAPI.robot | 0 .../UETAG/resources}/UEidentityAPI.robot | 8 +- 6 files changed, 114 insertions(+), 75 deletions(-) create mode 100644 SRV/UETAG/environment/pics.txt rename {environment => SRV/UETAG/environment}/variables.txt (88%) rename {resources => SRV/UETAG/resources}/GenericKeywords.robot (89%) rename {resources => SRV/UETAG/resources}/LocationAPI.robot (100%) rename {resources => SRV/UETAG/resources}/UEidentityAPI.robot (84%) diff --git a/SRV/UETAG/PlatUeIdentity.robot b/SRV/UETAG/PlatUeIdentity.robot index 404cffd..ae5b0e6 100644 --- a/SRV/UETAG/PlatUeIdentity.robot +++ b/SRV/UETAG/PlatUeIdentity.robot @@ -2,125 +2,150 @@ ... Test Suite to validate UE Identity Tag (UETAG) operations. *** Settings *** -Resource ../../environment/variables.txt -Resource ../../resources/GenericKeywords.robot -Resource ../../resources/UEidentityAPI.robot +Resource environment/variables.txt +Resource environment/pics.txt +Resource resources/GenericKeywords.robot +Resource resources/UEidentityAPI.robot Library REST ${MEC-APP_SCHEMA}://${MEC-APP_HOST}:${MEC-APP_PORT} ssl_verify=false -Default Tags TC_MEC_SRV_UETAG - -*** Variables *** *** Test Cases *** -Get UE Identity Tag information +Request UE Identity Tag information [Documentation] TC_MEC_SRV_UETAG_001_OK ... Check that the IUT responds with the information on a UE Identity tag when queried by a MEC Application ... Reference ETSI GS MEC 014 V1.1.1, clause 7.3.3.1 - ... Reference https://forge.etsi.org/gitlab/mec/gs014-ue-identity-api/blob/master/UEidentityAPI.yaml#/definitions/UeIdentityTagInfo - - [Tags] TP_MEC_SRV_UETAG_001_OK TP_MEC_SRV_UETAG - - Set Headers {"Accept":"application/json"} - Set Headers {"Content-Type":"application/json"} - Set Headers {"Authorization":"Basic YWxhZGRpbjpvcGVuc2VzYW1l"} - Set Headers {"Content-Length":"0"} - Get /exampleAPI/ui/v1/${APP_INSTANCE_ID}/ue_identity_tag_info?ueIdentityTag=${UE_IDENTITY_TAG} - ${output}= Output response - Set Suite Variable ${response} ${output} + ... Reference https://forge.etsi.org/gitlab/mec/gs014-ue-identity-api/blob/master/UEidentityAPI.yaml#/definitions/UeIdentityTagInfo + Get UE Identity Tag information Check HTTP Response Status Code Is 200 Check HTTP Response Body Json Schema Is ueIdentityTagInfo - #Log Check ueIdentityTagsList for ${UE_IDENTITY_TAG} element - Should Be Present In Json List ${response['body']['ueIdentityTagInfo']['ueIdentityTags']} ueIdentityTag ${UE_IDENTITY_TAG} + Check Result Contains ${response['body']['ueIdentityTagInfo']['ueIdentityTags']} ueIdentityTag ${UE_IDENTITY_TAG} + -Bad Request error on UE Identity Tag registration -# FIXME Which IE protocol should be invalid? +Request UE Identity Tag information using bad parameters [Documentation] TC_MEC_SRV_UETAG_001_BR ... Check that the IUT responds with an error when a request with incorrect parameters is sent by a MEC Application ... Reference ETSI GS MEC 014 V1.1.1, clause 7.3.3.1 ... Reference https://forge.etsi.org/gitlab/mec/gs014-ue-identity-api/blob/master/UEidentityAPI.yaml#/definitions/UeIdentityTagInfo - - [Tags] TP_MEC_SRV_UETAG_001_BR TP_MEC_SRV_UETAG - - Set Headers {"Accept":"application/json"} - Set Headers {"Content-Type":"application/json"} - Set Headers {"Authorization":"Basic YWxhZGRpbjpvcGVuc2VzYW1l"} - Set Headers {"Content-Length":"0"} - Get /exampleAPI/ui/v1/${APP_INSTANCE_ID}/invalid/ue_identity_tag_info?ueIdentityTag=${UE_IDENTITY_TAG} - ${output}= Output response - Set Suite Variable ${response} ${output} + Get UE Identity Tag information using bad parameters Check HTTP Response Status Code Is 400 -Not Found error on UE Identity Tag registration + +Request UE Identity Tag information using non-existent application instance [Documentation] TC_MEC_SRV_UETAG_001_NF ... Check that the IUT responds with an error when a request for an URI that cannot be mapped to a valid resource URI is sent by a MEC Application ... Reference ETSI GS MEC 014 V1.1.1, clause 7.3.3.1 ... Reference https://forge.etsi.org/gitlab/mec/gs014-ue-identity-api/blob/master/UEidentityAPI.yaml#/definitions/UeIdentityTagInfo + Get UE Identity Tag information using non-existent application instance + Check HTTP Response Status Code Is 404 - [Tags] TP_MEC_SRV_UETAG_001_NF TP_MEC_SRV_UETAG +Register an UE Identity Tag + [Documentation] TP_MEC_SRV_UETAG_002_OK + ... Check that the IUT registers a tag (representing a UE) or a list of tags when commanded by a MEC Application + ... Reference ETSI GS MEC 014 V1.1.1, clause 7.3.3.2 + ... Reference https://forge.etsi.org/gitlab/mec/gs014-ue-identity-api/blob/master/UEidentityAPI.yaml#/definitions/UeIdentityTagInfo + Update an UE Identity Tag {"ueIdentityTags":[{"ueIdentityTag":"${UE_IDENTITY_TAG}","state":"REGISTERED"}]} + Check HTTP Response Status Code Is 200 + Check HTTP Response Body Json Schema Is UeIdentityTagInfo + Log Checking Postcondition + Check User Identity Tag state ${UE_IDENTITY_TAG} REGISTERED + + +Register an UE Identity Tag using invalid state + [Documentation] TP_MEC_SRV_UETAG_002_BR + ... Check that the IUT responds with an error when an unauthorised request is sent by a MEC Application + ... Reference ETSI GS MEC 014 V1.1.1, clause 7.3.3.2 + ... Reference https://forge.etsi.org/gitlab/mec/gs014-ue-identity-api/blob/master/UEidentityAPI.yaml#/definitions/UeIdentityTagInfo + Update an UE Identity Tag using invalid state {"ueIdentityTags":[{"ueIdentityTag":"${UE_IDENTITY_TAG}","state":"INVALID_STATE"}]} + Check HTTP Response Status Code Is 400 + + +Unregister an UE Identity Tag already in unregistered state + [Documentation] TP_MEC_SRV_UETAG_002_PF + ... Check that the IUT responds with ProblemDetails on information an invalid URI + ... Reference ETSI GS MEC 014 V1.1.1, clause 7.3.3.2 + ... Reference https://forge.etsi.org/gitlab/mec/gs014-ue-identity-api/blob/master/UEidentityAPI.yaml#/definitions/UeIdentityTagInfo + Update an UE Identity Tag using a not applicable valid state {"ueIdentityTags":[{"ueIdentityTag":"${UE_IDENTITY_TAG_INVALID_STATE}","state":"UNREGISTERED"}]} + Check HTTP Response Status Code Is 412 + + +*** Keywords *** +Get UE Identity Tag information + Should Be True ${PIC_MEC_PLAT} == '1' + Should Be True ${PIC_SERVICES} == '1' Set Headers {"Accept":"application/json"} Set Headers {"Content-Type":"application/json"} - Set Headers {"Authorization":"Basic YWxhZGRpbjpvcGVuc2VzYW1l"} + Set Headers {"Authorization":"${TOKEN}"} Set Headers {"Content-Length":"0"} - Get /exampleAPI/ui/v1/${NON_EXISTENT_APP_INSTANCE_ID}/ue_identity_tag_info?ueIdentityTag=${UE_IDENTITY_TAG} + Get /exampleAPI/ui/v1/${APP_INSTANCE_ID}/ue_identity_tag_info?ueIdentityTag=${UE_IDENTITY_TAG} + ${output}= Output response + + +Get UE Identity Tag information using bad parameters +# FIXME Which IE protocol should be invalid? + Should Be True ${PIC_MEC_PLAT} == '1' + Should Be True ${PIC_SERVICES} == '1' + Set Headers {"Accept":"application/json"} + Set Headers {"Content-Type":"application/json"} + Set Headers {"Authorization":"${TOKEN}"} + Set Headers {"Content-Length":"0"} + Get /exampleAPI/ui/v1/${APP_INSTANCE_ID}/ue_identity_tag_info?ueIdentityTagERROR=${UE_IDENTITY_TAG} ${output}= Output response Set Suite Variable ${response} ${output} - Check HTTP Response Status Code Is 404 -Register a UE Identity Tag - [Documentation] TC_MEC_PLAT_UETAG_002_OK - ... Check that the IUT registers a tag (representing a UE) or a list of tags when commanded by a MEC Application - ... Reference ETSI GS MEC 014 V1.1.1, clause 7.3.3.2 - ... Reference https://forge.etsi.org/gitlab/mec/gs014-ue-identity-api/blob/master/UEidentityAPI.yaml#/definitions/UeIdentityTagInfo - - [Tags] TP_MEC_SRV_UETAG_002_OK TP_MEC_SRV_UETAG +Get UE Identity Tag information using non-existent application instance + Should Be True ${PIC_MEC_PLAT} == '1' + Should Be True ${PIC_SERVICES} == '1' Set Headers {"Accept":"application/json"} Set Headers {"Content-Type":"application/json"} + Set Headers {"Authorization":"${TOKEN}"} + Set Headers {"Content-Length":"0"} + Get /exampleAPI/ui/v1/${NON_EXISTENT_APP_INSTANCE_ID}/ue_identity_tag_info?ueIdentityTag=${UE_IDENTITY_TAG} + ${output}= Output response + Set Suite Variable ${response} ${output} + + +Update an UE Identity Tag + [Arguments] ${content} + Should Be True ${PIC_MEC_PLAT} == '1' + Should Be True ${PIC_SERVICES} == '1' + Set Headers {"Accept":"application/json"} Set Headers {"Content-Type":"application/json"} - Set Headers {"Authorization":"Basic YWxhZGRpbjpvcGVuc2VzYW1l"} + Set Headers {"Authorization":"${TOKEN}"} + ## As far as I understood, we are not checking preconditions. # Preamble: Check that the user tag is not registered - Check User Identity Tag state ${UE_IDENTITY_TAG} UNREGISTERED - # Test Body: Register the tag user and check that the IUT has registered the tag user - Post /exampleAPI/ui/v1/${APP_INSTANCE_ID}/ue_identity_tag_info {"ueIdentityTags":[{"ueIdentityTag":"${UE_IDENTITY_TAG}","state":"REGISTERED"}]} + ## Check User Identity Tag state ${UE_IDENTITY_TAG} UNREGISTERED + Put /exampleAPI/ui/v1/${APP_INSTANCE_ID}/ue_identity_tag_info ${content} ${output}= Output response Set Suite Variable ${response} ${output} - Check User Identity Tag state ${UE_IDENTITY_TAG} REGISTERED - -Bad Request error on invalid state - [Documentation] TC_MEC_PLAT_UETAG_002_BR - ... Check that the IUT responds with an error when an unauthorised request is sent by a MEC Application - ... Reference ETSI GS MEC 014 V1.1.1, clause 7.3.3.2 - ... Reference https://forge.etsi.org/gitlab/mec/gs014-ue-identity-api/blob/master/UEidentityAPI.yaml#/definitions/UeIdentityTagInfo - - [Tags] TP_MEC_SRV_UETAG_002_BR TP_MEC_SRV_UETAG + +Update an UE Identity Tag using invalid state + [Arguments] ${content} + Should Be True ${PIC_MEC_PLAT} == '1' + Should Be True ${PIC_SERVICES} == '1' Set Headers {"Accept":"application/json"} Set Headers {"Content-Type":"application/json"} - Set Headers {"Content-Type":"application/json"} - Set Headers {"Authorization":"Basic YWxhZGRpbjpvcGVuc2VzYW1l"} + Set Headers {"Authorization":"${TOKEN}"} # Test Body: Register the tag user and check that the IUT has registered the tag user - Post /exampleAPI/ui/v1/${APP_INSTANCE_ID}/ue_identity_tag_info {"ueIdentityTags":[{"ueIdentityTag":"${UE_IDENTITY_TAG}","state":"INVALID_STATE"}]} + Put /exampleAPI/ui/v1/${APP_INSTANCE_ID}/ue_identity_tag_info ${content} ${output}= Output response Set Suite Variable ${response} ${output} - Check HTTP Response Status Code Is 400 - -Precondition Failed error on invalid state - [Documentation] TC_MEC_PLAT_UETAG_002_PF - ... Check that the IUT responds with ProblemDetails on information an invalid URI - ... Reference ETSI GS MEC 014 V1.1.1, clause 7.3.3.2 - ... Reference https://forge.etsi.org/gitlab/mec/gs014-ue-identity-api/blob/master/UEidentityAPI.yaml#/definitions/UeIdentityTagInfo - - [Tags] TP_MEC_SRV_UETAG_002_PF TP_MEC_SRV_UETAG + +Update an UE Identity Tag using a not applicable valid state + [Arguments] ${content} + Should Be True ${PIC_MEC_PLAT} == '1' + Should Be True ${PIC_SERVICES} == '1' Set Headers {"Accept":"application/json"} Set Headers {"Content-Type":"application/json"} - Set Headers {"Content-Type":"application/json"} - Set Headers {"Authorization":"Basic YWxhZGRpbjpvcGVuc2VzYW1l"} + Set Headers {"Authorization":"${TOKEN}"} # Test Body: Register the tag user and check that the IUT has registered the tag user - Post /exampleAPI/ui/v1/${APP_INSTANCE_ID}/ue_identity_tag_info {"ueIdentityTags":[{"ueIdentityTag":"${UE_IDENTITY_TAG_INVALID_STATE}","state":"UNREGISTERED"}]} + Put /exampleAPI/ui/v1/${APP_INSTANCE_ID}/ue_identity_tag_info ${content} ${output}= Output response Set Suite Variable ${response} ${output} - Check HTTP Response Status Code Is 412 + # TODO Check ProblemDetails + \ No newline at end of file diff --git a/SRV/UETAG/environment/pics.txt b/SRV/UETAG/environment/pics.txt new file mode 100644 index 0000000..9a354cc --- /dev/null +++ b/SRV/UETAG/environment/pics.txt @@ -0,0 +1,4 @@ +*** Variables *** + +${PIC_MEC_PLAT} 1 +${PIC_SERVICES} 1 \ No newline at end of file diff --git a/environment/variables.txt b/SRV/UETAG/environment/variables.txt similarity index 88% rename from environment/variables.txt rename to SRV/UETAG/environment/variables.txt index 08921ed..d211c76 100644 --- a/environment/variables.txt +++ b/SRV/UETAG/environment/variables.txt @@ -10,3 +10,4 @@ ${NON_EXISTENT_APP_INSTANCE_ID} appInst99 ${UE_IDENTITY_TAG} UeTagA ${UE_IDENTITY_TAG_INVALID_STATE} UeTagC ${response} {} +${TOKEN} Basic YWxhZGRpbjpvcGVuc2VzYW1l diff --git a/resources/GenericKeywords.robot b/SRV/UETAG/resources/GenericKeywords.robot similarity index 89% rename from resources/GenericKeywords.robot rename to SRV/UETAG/resources/GenericKeywords.robot index 2cabd01..f19dfc0 100644 --- a/resources/GenericKeywords.robot +++ b/SRV/UETAG/resources/GenericKeywords.robot @@ -32,3 +32,8 @@ Should Be Present In Json List \ Exit For Loop If "${item['${json_field}']}" == "${json_value}" Log Item found ${item} [return] ${item} + + +Check Result Contains + [Arguments] ${source} ${parameter} ${value} + Should Be Present In Json List ${source} ${parameter} ${value} \ No newline at end of file diff --git a/resources/LocationAPI.robot b/SRV/UETAG/resources/LocationAPI.robot similarity index 100% rename from resources/LocationAPI.robot rename to SRV/UETAG/resources/LocationAPI.robot diff --git a/resources/UEidentityAPI.robot b/SRV/UETAG/resources/UEidentityAPI.robot similarity index 84% rename from resources/UEidentityAPI.robot rename to SRV/UETAG/resources/UEidentityAPI.robot index 5e9e248..a3f3a8f 100644 --- a/resources/UEidentityAPI.robot +++ b/SRV/UETAG/resources/UEidentityAPI.robot @@ -1,16 +1,20 @@ *** Settings *** Resource ../environment/variables.txt -Resource UEidentityAPI.robot +Resource ../environment/pics.txt +Resource GenericKeywords.robot Library REST ${MEC-APP_SCHEMA}://${MEC-APP_HOST}:${MEC-APP_PORT} ssl_verify=false Library JSONSchemaLibrary schemas/ + *** Keywords *** Check User Identity Tag state [Arguments] ${ue_identity_tag} ${state} + Should Be True ${PIC_MEC_PLAT} == '1' + Should Be True ${PIC_SERVICES} == '1' Log Check ueIdentityTag state ${state} Set Headers {"Accept":"application/json"} Set Headers {"Content-Type":"application/json"} - Set Headers {"Authorization":"Basic YWxhZGRpbjpvcGVuc2VzYW1l"} + Set Headers {"Authorization":"${TOKEN}"} Set Headers {"Content-Length":"0"} Get /exampleAPI/ui/v1/${APP_INSTANCE_ID}/ue_identity_tag_info?ueIdentityTag=${ue_identity_tag} ${output}= Output response -- GitLab