From 4bbbd9d2ab6b59a6aea6a695ba4a37060d234f6c Mon Sep 17 00:00:00 2001 From: Benoit Orihuela Date: Mon, 7 Dec 2020 08:37:11 +0100 Subject: [PATCH 1/9] refactor: use EXECDIR variable to avoid long and complexe relative references --- .../BatchEntities/CreateBatchOfEntities/failure.robot | 5 ++--- .../BatchEntities/CreateBatchOfEntities/fullSuccess.robot | 8 ++++---- .../CreateBatchOfEntities/partialSuccess.robot | 8 ++++---- .../BatchEntities/DeleteBatchOfEntities/failure.robot | 6 +++--- .../BatchEntities/DeleteBatchOfEntities/fullSuccess.robot | 8 ++++---- .../DeleteBatchOfEntities/partialSuccess.robot | 8 ++++---- .../BatchEntities/UpdateBatchOfEntities/failure.robot | 8 ++++---- .../BatchEntities/UpdateBatchOfEntities/fullSuccess.robot | 8 ++++---- .../fullSuccessNoOverwriteMode.robot | 8 ++++---- .../UpdateBatchOfEntities/partialSuccess.robot | 8 ++++---- .../BatchEntities/UpsertBatchOfEntities/failure.robot | 7 +++---- .../UpsertBatchOfEntities/fullSuccessReplaceMode.robot | 8 ++++---- .../fullSuccessReplaceModeAllUpdated.robot | 8 ++++---- .../UpsertBatchOfEntities/fullSuccessUpdateMode.robot | 8 ++++---- .../UpsertBatchOfEntities/partialSucess.robot | 8 ++++---- 15 files changed, 56 insertions(+), 58 deletions(-) diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/failure.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/failure.robot index 18e6cec8..40ed19bd 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/failure.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/failure.robot @@ -1,8 +1,7 @@ *** Settings *** Documentation Check that you cannot create a batch of entities with an invalid request -Variables ../../../../../../resources/variables.py -Resource ../../../../../../resources/ApiUtils.resource -Resource ../../../../../../resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/ApiUtils.resource +Resource ${EXECDIR}/resources//AssertionUtils.resource Library RequestsLibrary Library JSONLibrary Library OperatingSystem diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/fullSuccess.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/fullSuccess.robot index 56bda491..c0f5a64e 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/fullSuccess.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/fullSuccess.robot @@ -1,9 +1,9 @@ *** Settings *** Documentation Check that you can create a batch of entities -Variables ../../../../../../resources/variables.py -Resource ../../../../../../resources/ApiUtils.resource -Resource ../../../../../../resources/AssertionUtils.resource -Resource ../../../../../../resources/JsonUtils.resource +Variables ${EXECDIR}/resources/variables.py +Resource ${EXECDIR}/resources/ApiUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource Library REST ${url} Library JSONLibrary Library String diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/partialSuccess.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/partialSuccess.robot index 6440376b..86696e9c 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/partialSuccess.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/partialSuccess.robot @@ -1,9 +1,9 @@ *** Settings *** Documentation Check that you can create a batch of entities where some will succeed and others will fail -Variables ../../../../../../resources/variables.py -Resource ../../../../../../resources/ApiUtils.resource -Resource ../../../../../../resources/AssertionUtils.resource -Resource ../../../../../../resources/JsonUtils.resource +Variables ${EXECDIR}/resources/variables.py +Resource ${EXECDIR}/resources/ApiUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource Library REST ${url} Library JSONLibrary Library String diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/DeleteBatchOfEntities/failure.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/DeleteBatchOfEntities/failure.robot index 6ded9d01..3568893d 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/DeleteBatchOfEntities/failure.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/DeleteBatchOfEntities/failure.robot @@ -1,8 +1,8 @@ *** Settings *** Documentation Check that you cannot delete a batch of entities with an invalid request -Variables ../../../../../../resources/variables.py -Resource ../../../../../../resources/ApiUtils.resource -Resource ../../../../../../resources/AssertionUtils.resource +Variables ${EXECDIR}/resources/variables.py +Resource ${EXECDIR}/resources/ApiUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource Library RequestsLibrary Library JSONLibrary Library OperatingSystem diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/DeleteBatchOfEntities/fullSuccess.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/DeleteBatchOfEntities/fullSuccess.robot index 09049cb3..9b9026e1 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/DeleteBatchOfEntities/fullSuccess.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/DeleteBatchOfEntities/fullSuccess.robot @@ -1,9 +1,9 @@ *** Settings *** Documentation Check that you can delete a batch of entities -Variables ../../../../../../resources/variables.py -Resource ../../../../../../resources/ApiUtils.resource -Resource ../../../../../../resources/AssertionUtils.resource -Resource ../../../../../../resources/JsonUtils.resource +Variables ${EXECDIR}/resources/variables.py +Resource ${EXECDIR}/resources/ApiUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource Library REST ${url} Library JSONLibrary Library String diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/DeleteBatchOfEntities/partialSuccess.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/DeleteBatchOfEntities/partialSuccess.robot index ea7152e9..05b571e1 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/DeleteBatchOfEntities/partialSuccess.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/DeleteBatchOfEntities/partialSuccess.robot @@ -1,9 +1,9 @@ *** Settings *** Documentation Check that you can delete a batch of entities where some will succeed and others will fail -Variables ../../../../../../resources/variables.py -Resource ../../../../../../resources/ApiUtils.resource -Resource ../../../../../../resources/AssertionUtils.resource -Resource ../../../../../../resources/JsonUtils.resource +Variables ${EXECDIR}/resources/variables.py +Resource ${EXECDIR}/resources/ApiUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource Library REST ${url} Library JSONLibrary Library String diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/failure.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/failure.robot index 1698dda2..a73faf73 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/failure.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/failure.robot @@ -1,9 +1,9 @@ *** Settings *** Documentation Check that you cannot update a batch of entities with an invalid request -Variables ../../../../../../resources/variables.py -Resource ../../../../../../resources/ApiUtils.resource -Resource ../../../../../../resources/AssertionUtils.resource -Resource ../../../../../../resources/JsonUtils.resource +Variables ${EXECDIR}/resources/variables.py +Resource ${EXECDIR}/resources/ApiUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource Library RequestsLibrary Library JSONLibrary Library OperatingSystem diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/fullSuccess.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/fullSuccess.robot index 88425216..6e6ab28e 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/fullSuccess.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/fullSuccess.robot @@ -1,9 +1,9 @@ *** Settings *** Documentation Check that you can update a batch of entities -Variables ../../../../../../resources/variables.py -Resource ../../../../../../resources/ApiUtils.resource -Resource ../../../../../../resources/AssertionUtils.resource -Resource ../../../../../../resources/JsonUtils.resource +Variables ${EXECDIR}/resources/variables.py +Resource ${EXECDIR}/resources/ApiUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource Library REST ${url} Library JSONLibrary Library String diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/fullSuccessNoOverwriteMode.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/fullSuccessNoOverwriteMode.robot index e6c44a31..25148783 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/fullSuccessNoOverwriteMode.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/fullSuccessNoOverwriteMode.robot @@ -1,9 +1,9 @@ *** Settings *** Documentation Check that you can update a batch of entities with noOverwrite option -Variables ../../../../../../resources/variables.py -Resource ../../../../../../resources/ApiUtils.resource -Resource ../../../../../../resources/AssertionUtils.resource -Resource ../../../../../../resources/JsonUtils.resource +Variables ${EXECDIR}/resources/variables.py +Resource ${EXECDIR}/resources/ApiUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource Library REST ${url} Library JSONLibrary Library String diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/partialSuccess.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/partialSuccess.robot index 79c8a17b..f7dfc1a0 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/partialSuccess.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/partialSuccess.robot @@ -1,9 +1,9 @@ *** Settings *** Documentation Check that you can update a batch of entities where some will succeed and others will fail -Variables ../../../../../../resources/variables.py -Resource ../../../../../../resources/ApiUtils.resource -Resource ../../../../../../resources/AssertionUtils.resource -Resource ../../../../../../resources/JsonUtils.resource +Variables ${EXECDIR}/resources/variables.py +Resource ${EXECDIR}/resources/ApiUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource Library REST ${url} Library JSONLibrary Library String diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/failure.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/failure.robot index 8eeaff7b..0ee36225 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/failure.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/failure.robot @@ -1,9 +1,8 @@ *** Settings *** Documentation Check that you cannot upsert a batch of entities with an invalid request -Variables ../../../../../../resources/variables.py -Resource ../../../../../../resources/ApiUtils.resource -Resource ../../../../../../resources/AssertionUtils.resource -Resource ../../../../../../resources/JsonUtils.resource +Resource ${EXECDIR}/resources/ApiUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource Library RequestsLibrary Library JSONLibrary Library OperatingSystem diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/fullSuccessReplaceMode.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/fullSuccessReplaceMode.robot index e33ce605..182ba5b6 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/fullSuccessReplaceMode.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/fullSuccessReplaceMode.robot @@ -1,9 +1,9 @@ *** Settings *** Documentation Check that you can upsert a batch of entities -Variables ../../../../../../resources/variables.py -Resource ../../../../../../resources/ApiUtils.resource -Resource ../../../../../../resources/AssertionUtils.resource -Resource ../../../../../../resources/JsonUtils.resource +Variables ${EXECDIR}/resources/variables.py +Resource ${EXECDIR}/resources/ApiUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource Library REST ${url} Library JSONLibrary Library String diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/fullSuccessReplaceModeAllUpdated.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/fullSuccessReplaceModeAllUpdated.robot index aa3d57ba..d82f3fdf 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/fullSuccessReplaceModeAllUpdated.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/fullSuccessReplaceModeAllUpdated.robot @@ -1,9 +1,9 @@ *** Settings *** Documentation Check that you can upsert a batch of existing entities and they will be replaced -Variables ../../../../../../resources/variables.py -Resource ../../../../../../resources/ApiUtils.resource -Resource ../../../../../../resources/AssertionUtils.resource -Resource ../../../../../../resources/JsonUtils.resource +Variables ${EXECDIR}/resources/variables.py +Resource ${EXECDIR}/resources/ApiUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource Library REST ${url} Library JSONLibrary Library String diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/fullSuccessUpdateMode.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/fullSuccessUpdateMode.robot index 12a3b8e5..3fcf71fb 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/fullSuccessUpdateMode.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/fullSuccessUpdateMode.robot @@ -1,9 +1,9 @@ *** Settings *** Documentation Check that you can upsert a batch of entities with update option -Variables ../../../../../../resources/variables.py -Resource ../../../../../../resources/ApiUtils.resource -Resource ../../../../../../resources/AssertionUtils.resource -Resource ../../../../../../resources/JsonUtils.resource +Variables ${EXECDIR}/resources/variables.py +Resource ${EXECDIR}/resources/ApiUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource Library REST ${url} Library JSONLibrary Library String diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/partialSucess.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/partialSucess.robot index c507e7c8..91ed6534 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/partialSucess.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/partialSucess.robot @@ -1,9 +1,9 @@ *** Settings *** Documentation Check that you can upsert a batch of entities where some will succeed and others will fail -Variables ../../../../../../resources/variables.py -Resource ../../../../../../resources/ApiUtils.resource -Resource ../../../../../../resources/AssertionUtils.resource -Resource ../../../../../../resources/JsonUtils.resource +Variables ${EXECDIR}/resources/variables.py +Resource ${EXECDIR}/resources/ApiUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource Library REST ${url} Library JSONLibrary Library String -- GitLab From 5668eaa8095a84dc0894499171aa939e91eddb46 Mon Sep 17 00:00:00 2001 From: Benoit Orihuela Date: Mon, 7 Dec 2020 15:34:27 +0100 Subject: [PATCH 2/9] feat: better use of global variables & fixes for RequestLibrary uses --- .../CreateBatchOfEntities/failure.robot | 15 +++++---------- .../CreateBatchOfEntities/fullSuccess.robot | 5 ----- .../CreateBatchOfEntities/partialSuccess.robot | 5 ----- resources/ApiUtils.resource | 16 ++++++++++------ resources/AssertionUtils.resource | 9 +++++++++ 5 files changed, 24 insertions(+), 26 deletions(-) diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/failure.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/failure.robot index 40ed19bd..cddb0959 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/failure.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/failure.robot @@ -1,16 +1,11 @@ *** Settings *** Documentation Check that you cannot create a batch of entities with an invalid request Resource ${EXECDIR}/resources/ApiUtils.resource -Resource ${EXECDIR}/resources//AssertionUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource Library RequestsLibrary Library JSONLibrary Library OperatingSystem - -*** Variable *** -${batch_endpoint}= entityOperations/create -${endpoint}= entities - *** Test Case *** With invalid json document [Documentation] Check that you cannot create a batch of entities with an invalid json document @@ -18,8 +13,8 @@ With invalid json document Batch Request Entities From File batch/invalid-json-sample.jsonld - Check Response Status Code Set To 400 - Check Response Body Containing Problem Details Element Containing Detail Element ${response} + Check RL Response Status Code Set To 400 + Check RL Response Body Containing Problem Details Element Containing Detail Element ${response} With empty json document [Documentation] Check that you cannot create a batch of entities with an empty json document @@ -27,5 +22,5 @@ With empty json document Batch Request Entities From File batch/empty-sample.jsonld - Check Response Status Code Set To 400 - Check Response Body Containing Problem Details Element Containing Detail Element ${response} + Check RL Response Status Code Set To 400 + Check RL Response Body Containing Problem Details Element Containing Detail Element ${response} diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/fullSuccess.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/fullSuccess.robot index c0f5a64e..b20cad9c 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/fullSuccess.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/fullSuccess.robot @@ -1,18 +1,13 @@ *** Settings *** Documentation Check that you can create a batch of entities -Variables ${EXECDIR}/resources/variables.py Resource ${EXECDIR}/resources/ApiUtils.resource Resource ${EXECDIR}/resources/AssertionUtils.resource Resource ${EXECDIR}/resources/JsonUtils.resource -Library REST ${url} Library JSONLibrary Library String Library Collections *** Variable *** -${batch_endpoint}= entityOperations/create -${batch_delete_endpoint}= entityOperations/delete -${endpoint}= entities ${building_id_prefix}= urn:ngsi-ld:Building: *** Test Case *** diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/partialSuccess.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/partialSuccess.robot index 86696e9c..324f8211 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/partialSuccess.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/partialSuccess.robot @@ -1,10 +1,8 @@ *** Settings *** Documentation Check that you can create a batch of entities where some will succeed and others will fail -Variables ${EXECDIR}/resources/variables.py Resource ${EXECDIR}/resources/ApiUtils.resource Resource ${EXECDIR}/resources/AssertionUtils.resource Resource ${EXECDIR}/resources/JsonUtils.resource -Library REST ${url} Library JSONLibrary Library String Library Collections @@ -12,9 +10,6 @@ Library Collections Suite Setup Setup Initial Entities *** Variable *** -${batch_endpoint}= entityOperations/create -${batch_delete_endpoint}= entityOperations/delete -${endpoint}= entities ${building_id_prefix}= urn:ngsi-ld:Building: *** Test Case *** diff --git a/resources/ApiUtils.resource b/resources/ApiUtils.resource index 3a4d99d1..cdaaf785 100644 --- a/resources/ApiUtils.resource +++ b/resources/ApiUtils.resource @@ -2,8 +2,12 @@ Variables ./variables.py Library REST ${url} +Library RequestsLibrary *** Variables *** +${BATCH_CREATE_ENDPOINT_PATH} entityOperations/create +${BATCH_DELETE_ENDPOINT_PATH} entityOperations/delete +${ENTITIES_ENDPOINT_PATH} entities ${response} *** Keywords *** @@ -33,7 +37,7 @@ Api DEL request Delete Entity by Id [Arguments] ${id} - ${response}= DELETE ${endpoint}/${id} + ${response}= DELETE ${ENTITIES_ENDPOINT_PATH}/${id} Output request Output response @@ -43,14 +47,14 @@ Create Entity ${entity}= Update Value To Json ${entity_payload} $..id ${entity_id} &{headers}= Create Dictionary Content-Type=application/ld+json - ${response}= POST ${endpoint} body=${entity} headers=${headers} + ${response}= POST ${ENTITIES_ENDPOINT_PATH} body=${entity} headers=${headers} Output request Output response Batch Create Entities [Arguments] @{entities_to_be_created} &{headers}= Create Dictionary Content-Type=application/ld+json - ${response}= POST ${batch_endpoint} body=@{entities_to_be_created} headers=${headers} + ${response}= POST ${BATCH_CREATE_ENDPOINT_PATH} body=@{entities_to_be_created} headers=${headers} Output request Output response Set Test Variable ${response} @@ -74,7 +78,7 @@ Batch Update Entities Batch Delete Entities [Arguments] @{entities_ids_to_be_deleted} &{headers}= Create Dictionary Content-Type=application/ld+json - ${response}= POST ${batch_delete_endpoint} body=@{entities_ids_to_be_deleted} headers=${headers} + ${response}= POST ${BATCH_DELETE_ENDPOINT_PATH} body=@{entities_ids_to_be_deleted} headers=${headers} Output request Output response Set Test Variable ${response} @@ -84,5 +88,5 @@ Batch Request Entities From File ${file_content}= Get File ${EXECDIR}/data/entities/${filename} Create Session BatchRequest ${url} &{headers}= Create Dictionary Content-Type=application/ld+json - ${response}= POST Request BatchRequest ${batch_endpoint} data=${file_content} headers=${headers} - Set Test Variable ${response} ${response.json()} + ${response}= POST Request BatchRequest ${BATCH_CREATE_ENDPOINT_PATH} data=${file_content} headers=${headers} + Set Test Variable ${response} diff --git a/resources/AssertionUtils.resource b/resources/AssertionUtils.resource index ab8faf99..324d8182 100644 --- a/resources/AssertionUtils.resource +++ b/resources/AssertionUtils.resource @@ -4,6 +4,10 @@ Check Response Status Code Set To ${response_status}= convert to string ${response['status']} Should Be Equal ${response_status} ${expected_status} +Check RL Response Status Code Set To + [Arguments] ${expected_status} + Status Should Be ${expected_status} ${response} + Check Response Body Containing Array Of URIs set to [Arguments] @{expected_entities_ids} Lists Should Be Equal ${expected_entities_ids} ${response['body']} ignore_order=True @@ -28,6 +32,11 @@ Check Response Body Containing Problem Details Element Containing Detail Element [Arguments] ${response_body} Should Not Be Empty ${response_body['detail']} +Check RL Response Body Containing Problem Details Element Containing Detail Element + [Arguments] ${response_body} + ${json_response_body}= To Json ${response_body.content} + Should Not Be Empty ${json_response_body['detail']} + Assert response status code [Arguments] ${code} Should Be Equal ${response}[status] ${code} -- GitLab From e45da752ccb649c069b22f9660d79550184e3d18 Mon Sep 17 00:00:00 2001 From: Benoit Orihuela Date: Mon, 7 Dec 2020 15:35:55 +0100 Subject: [PATCH 3/9] chore: update sample scripts to run the tests --- scripts/run_tests.sh | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/scripts/run_tests.sh b/scripts/run_tests.sh index 7a678f86..7f4c513b 100755 --- a/scripts/run_tests.sh +++ b/scripts/run_tests.sh @@ -1,27 +1,28 @@ #!/bin/bash -#run all tests -robot --outputdir ./results . +# run all tests +robot --outputdir ./results ./TP/NGSI-LD -#run all tests with base url overriden -#robot --variable url:"URL_HERE" --outputdir ./results . +# run all tests with base url overriden +robot --variable url:"URL_HERE" --outputdir ./results . -#specify which tests are critical -#robot --critical critical --outputdir ./results . +# specify which tests are critical +robot --critical critical --outputdir ./results . -#run by specific tag(s) -#robot --include critical --outputdir ./results . +# run by specific tag(s) +robot --include critical --outputdir ./results . -#run specific test suite -#robot --outputdir ./results ./TP/NGSI-LD/ContextInformation -#robot --outputdir ./results ./TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/SuccessCases.robot +# run specific test suite +robot --outputdir ./results ./TP/NGSI-LD/ContextInformation +robot --outputdir ./results ./TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/SuccessCases.robot +robot --outputdir ./results ./TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/failure.robot -#run specific test case -#robot --outputdir ./results -t "SuccessCases_MinimalEntity" -#robot --outputdir ./results -t "SuccessCases_MinimalEntity" ./TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/SuccessCases.robot +# run specific test case +robot --outputdir ./results -t "SuccessCases_MinimalEntity" +robot --outputdir ./results -t "SuccessCases_MinimalEntity" ./TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/SuccessCases.robot -#rerun failed tests -#robot --rerunfailedsuites ./results/output.xml --outputdir ./results . +# rerun failed tests +robot --rerunfailedsuites ./results/output.xml --outputdir ./results . -#stop the suite after a failed test +# stop the suite after a failed test robot --exitonfailure --outputdir ./results . -- GitLab From 4d95afe4a3ec037ccc9784d649dd153917f2ab8a Mon Sep 17 00:00:00 2001 From: Benoit Orihuela Date: Mon, 7 Dec 2020 16:05:53 +0100 Subject: [PATCH 4/9] feat(temp): use the temp checkers for batch entities tests --- .../BatchEntities/DeleteBatchOfEntities/failure.robot | 8 ++++---- .../BatchEntities/UpdateBatchOfEntities/failure.robot | 8 ++++---- .../BatchEntities/UpsertBatchOfEntities/failure.robot | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/DeleteBatchOfEntities/failure.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/DeleteBatchOfEntities/failure.robot index 3568893d..da655d04 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/DeleteBatchOfEntities/failure.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/DeleteBatchOfEntities/failure.robot @@ -19,8 +19,8 @@ With invalid json document Batch Request Entities From File batch/invalid-json-sample.jsonld - Check Response Status Code Set To 400 - Check Response Body Containing Problem Details Element Containing Detail Element ${response} + Check RL Response Status Code Set To 400 + Check RL Response Body Containing Problem Details Element Containing Detail Element ${response} With empty json document [Documentation] Check that you cannot delete a batch of entities with an empty json document @@ -28,5 +28,5 @@ With empty json document Batch Request Entities From File batch/empty-sample.jsonld - Check Response Status Code Set To 400 - Check Response Body Containing Problem Details Element Containing Detail Element ${response} + Check RL Response Status Code Set To 400 + Check RL Response Body Containing Problem Details Element Containing Detail Element ${response} diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/failure.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/failure.robot index a73faf73..410faae5 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/failure.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/failure.robot @@ -19,8 +19,8 @@ With invalid json document Batch Request Entities From File batch/invalid-json-sample.jsonld - Check Response Status Code Set To 400 - Check Response Body Containing Problem Details Element Containing Detail Element ${response} + Check RL Response Status Code Set To 400 + Check RL Response Body Containing Problem Details Element Containing Detail Element ${response} With json-ld document not syntactically correct according to the @context [Documentation] Check that you cannot update a batch of entities with a json-ld document not syntactically correct according to the @context @@ -29,5 +29,5 @@ With json-ld document not syntactically correct according to the @context #TODO: Use a json-ld document not syntactically correct according to the @context Batch Request Entities From File batch/invalid-json-ld-sample.jsonld - Check Response Status Code Set To 400 - Check Response Body Containing Problem Details Element Containing Detail Element ${response} + Check RL Response Status Code Set To 400 + Check RL Response Body Containing Problem Details Element Containing Detail Element ${response} diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/failure.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/failure.robot index 0ee36225..d7479127 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/failure.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/failure.robot @@ -18,8 +18,8 @@ With invalid json document Batch Request Entities From File batch/invalid-json-sample.jsonld - Check Response Status Code Set To 400 - Check Response Body Containing Problem Details Element Containing Detail Element ${response} + Check RL Response Status Code Set To 400 + Check RL Response Body Containing Problem Details Element Containing Detail Element ${response} With json-ld document containing a null value in any of its items [Documentation] Check that you cannot upsert a batch of entities with a json-ld document containing a null value in any of its items @@ -27,5 +27,5 @@ With json-ld document containing a null value in any of its items Batch Request Entities From File batch/invalid-json-ld-sample.jsonld - Check Response Status Code Set To 400 - Check Response Body Containing Problem Details Element Containing Detail Element ${response} + Check RL Response Status Code Set To 400 + Check RL Response Body Containing Problem Details Element Containing Detail Element ${response} -- GitLab From 306a0006983d00b4d285d3a9c3620750921500c7 Mon Sep 17 00:00:00 2001 From: Benoit Orihuela Date: Mon, 7 Dec 2020 16:16:33 +0100 Subject: [PATCH 5/9] feat: replace critical tag by mandatory --- .../BatchEntities/CreateBatchOfEntities/failure.robot | 4 ++-- .../BatchEntities/CreateBatchOfEntities/fullSuccess.robot | 6 +++--- .../CreateBatchOfEntities/partialSuccess.robot | 2 +- .../BatchEntities/DeleteBatchOfEntities/failure.robot | 4 ++-- .../BatchEntities/DeleteBatchOfEntities/fullSuccess.robot | 2 +- .../DeleteBatchOfEntities/partialSuccess.robot | 2 +- .../BatchEntities/UpdateBatchOfEntities/failure.robot | 4 ++-- .../BatchEntities/UpdateBatchOfEntities/fullSuccess.robot | 2 +- .../UpdateBatchOfEntities/fullSuccessNoOverwriteMode.robot | 2 +- .../UpdateBatchOfEntities/partialSuccess.robot | 2 +- .../BatchEntities/UpsertBatchOfEntities/failure.robot | 4 ++-- .../UpsertBatchOfEntities/fullSuccessReplaceMode.robot | 4 ++-- .../fullSuccessReplaceModeAllUpdated.robot | 2 +- .../UpsertBatchOfEntities/fullSuccessUpdateMode.robot | 2 +- .../BatchEntities/UpsertBatchOfEntities/partialSucess.robot | 2 +- .../Provision/Entities/CreateEntity/AlreadyExists.robot | 2 +- .../Provision/Entities/CreateEntity/SuccessCases.robot | 2 +- scripts/run_tests.sh | 6 +++--- 18 files changed, 27 insertions(+), 27 deletions(-) diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/failure.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/failure.robot index cddb0959..80e16d1a 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/failure.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/failure.robot @@ -9,7 +9,7 @@ Library OperatingSystem *** Test Case *** With invalid json document [Documentation] Check that you cannot create a batch of entities with an invalid json document - [Tags] critical + [Tags] mandatory Batch Request Entities From File batch/invalid-json-sample.jsonld @@ -18,7 +18,7 @@ With invalid json document With empty json document [Documentation] Check that you cannot create a batch of entities with an empty json document - [Tags] critical + [Tags] mandatory Batch Request Entities From File batch/empty-sample.jsonld diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/fullSuccess.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/fullSuccess.robot index b20cad9c..4b9c09d1 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/fullSuccess.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/fullSuccess.robot @@ -13,7 +13,7 @@ ${building_id_prefix}= urn:ngsi-ld:Building: *** Test Case *** Create a batch of minimal entities [Documentation] Check that you can create a batch of minimal entities - [Tags] critical + [Tags] mandatory ${first_entity_id}= Generate Random Entity Id ${building_id_prefix} ${second_entity_id}= Generate Random Entity Id ${building_id_prefix} @@ -31,7 +31,7 @@ Create a batch of minimal entities Create a batch of entities having only simple properties [Documentation] Check that you can create a batch of entities having only simple properties - [Tags] critical + [Tags] mandatory ${first_entity_id}= Generate Random Entity Id ${building_id_prefix} ${second_entity_id}= Generate Random Entity Id ${building_id_prefix} @@ -49,7 +49,7 @@ Create a batch of entities having only simple properties Create a batch of entities having multiple attributes [Documentation] Check that you can create a batch of entities having multiple attributes - [Tags] critical + [Tags] mandatory ${first_entity_id}= Generate Random Entity Id ${building_id_prefix} ${second_entity_id}= Generate Random Entity Id ${building_id_prefix} diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/partialSuccess.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/partialSuccess.robot index 324f8211..5555eef1 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/partialSuccess.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/partialSuccess.robot @@ -15,7 +15,7 @@ ${building_id_prefix}= urn:ngsi-ld:Building: *** Test Case *** Create a batch of two valid entities and one invalid entity [Documentation] Check that you can create a batch of two valid entities and one invalid entity - [Tags] critical + [Tags] mandatory ${first_entity_id}= Generate Random Entity Id ${building_id_prefix} ${second_entity_id}= Generate Random Entity Id ${building_id_prefix} diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/DeleteBatchOfEntities/failure.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/DeleteBatchOfEntities/failure.robot index da655d04..004a7d00 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/DeleteBatchOfEntities/failure.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/DeleteBatchOfEntities/failure.robot @@ -15,7 +15,7 @@ ${endpoint}= entities *** Test Case *** With invalid json document [Documentation] Check that you cannot delete a batch of entities with an invalid json document - [Tags] critical + [Tags] mandatory Batch Request Entities From File batch/invalid-json-sample.jsonld @@ -24,7 +24,7 @@ With invalid json document With empty json document [Documentation] Check that you cannot delete a batch of entities with an empty json document - [Tags] critical + [Tags] mandatory Batch Request Entities From File batch/empty-sample.jsonld diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/DeleteBatchOfEntities/fullSuccess.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/DeleteBatchOfEntities/fullSuccess.robot index 9b9026e1..421b44cd 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/DeleteBatchOfEntities/fullSuccess.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/DeleteBatchOfEntities/fullSuccess.robot @@ -19,7 +19,7 @@ ${building_id_prefix}= urn:ngsi-ld:Building: *** Test Case *** Delete a batch of entities [Documentation] Check that you can delete a batch of entities - [Tags] critical + [Tags] mandatory @{entities_ids_to_be_deleted}= Create List ${first_entity_id} ${second_entity_id} diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/DeleteBatchOfEntities/partialSuccess.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/DeleteBatchOfEntities/partialSuccess.robot index 05b571e1..924565b6 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/DeleteBatchOfEntities/partialSuccess.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/DeleteBatchOfEntities/partialSuccess.robot @@ -19,7 +19,7 @@ ${building_id_prefix}= urn:ngsi-ld:Building: *** Test Case *** Delete a batch of non existing and existing entities [Documentation] Check that you can delete a batch of non existing and existing entities - [Tags] critical + [Tags] mandatory ${new_entity_id}= Generate Random Entity Id ${building_id_prefix} @{entities_ids_to_be_deleted}= Create List ${existing_entity_id} ${new_entity_id} diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/failure.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/failure.robot index 410faae5..45badbf3 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/failure.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/failure.robot @@ -15,7 +15,7 @@ ${endpoint}= entities *** Test Case *** With invalid json document [Documentation] Check that you cannot update a batch of entities with an invalid json document - [Tags] critical + [Tags] mandatory Batch Request Entities From File batch/invalid-json-sample.jsonld @@ -24,7 +24,7 @@ With invalid json document With json-ld document not syntactically correct according to the @context [Documentation] Check that you cannot update a batch of entities with a json-ld document not syntactically correct according to the @context - [Tags] critical + [Tags] mandatory #TODO: Use a json-ld document not syntactically correct according to the @context Batch Request Entities From File batch/invalid-json-ld-sample.jsonld diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/fullSuccess.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/fullSuccess.robot index 6e6ab28e..6df3d35c 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/fullSuccess.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/fullSuccess.robot @@ -20,7 +20,7 @@ ${building_id_prefix}= urn:ngsi-ld:Building: *** Test Case *** Update a batch of entities [Documentation] Check that you can update a batch of entities - [Tags] critical + [Tags] mandatory ${first_entity}= Load Entity building-relationship-of-property-sample.jsonld ${first_entity_id} ${second_entity}= Load Entity building-relationship-of-property-sample.jsonld ${second_entity_id} diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/fullSuccessNoOverwriteMode.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/fullSuccessNoOverwriteMode.robot index 25148783..7a29ba0c 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/fullSuccessNoOverwriteMode.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/fullSuccessNoOverwriteMode.robot @@ -20,7 +20,7 @@ ${building_id_prefix}= urn:ngsi-ld:Building: *** Test Case *** Update a batch of entities with noOverwrite option [Documentation] Check that you can update a batch of entities with noOverwrite option - [Tags] critical + [Tags] mandatory ${first_entity}= Load Entity building-relationship-of-property-sample.jsonld ${first_entity_id} ${second_entity}= Load Entity building-relationship-of-property-sample.jsonld ${second_entity_id} diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/partialSuccess.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/partialSuccess.robot index f7dfc1a0..3fcb46c5 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/partialSuccess.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/partialSuccess.robot @@ -20,7 +20,7 @@ ${building_id_prefix}= urn:ngsi-ld:Building: *** Test Case *** Update a batch of non existing and existing entities [Documentation] Check that you can update a batch of non existing and existing entities - [Tags] critical + [Tags] mandatory ${first_existing_entity}= Load Entity building-relationship-of-property-sample.jsonld ${first_existing_entity_id} ${second_existing_entity}= Load Entity building-relationship-of-property-sample.jsonld ${second_existing_entity_id} diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/failure.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/failure.robot index d7479127..76b94b23 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/failure.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/failure.robot @@ -14,7 +14,7 @@ ${endpoint}= entities *** Test Case *** With invalid json document [Documentation] Check that you cannot upsert a batch of entities with an invalid json document - [Tags] critical + [Tags] mandatory Batch Request Entities From File batch/invalid-json-sample.jsonld @@ -23,7 +23,7 @@ With invalid json document With json-ld document containing a null value in any of its items [Documentation] Check that you cannot upsert a batch of entities with a json-ld document containing a null value in any of its items - [Tags] critical + [Tags] mandatory Batch Request Entities From File batch/invalid-json-ld-sample.jsonld diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/fullSuccessReplaceMode.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/fullSuccessReplaceMode.robot index 182ba5b6..499cf835 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/fullSuccessReplaceMode.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/fullSuccessReplaceMode.robot @@ -20,7 +20,7 @@ ${building_id_prefix}= urn:ngsi-ld:Building: *** Test Case *** Upsert a batch of non existing entities [Documentation] Check that you can upsert a batch of non existing entities - [Tags] critical + [Tags] mandatory ${first_entity_id}= Generate Random Entity Id ${building_id_prefix} ${second_entity_id}= Generate Random Entity Id ${building_id_prefix} @@ -38,7 +38,7 @@ Upsert a batch of non existing entities Upsert a batch of non existing and existing entities [Documentation] Check that you can upsert a batch of non existing and existing entities - [Tags] critical + [Tags] mandatory ${new_entity_id}= Generate Random Entity Id ${building_id_prefix} ${new_entity}= Load Entity building-minimal-sample.jsonld ${new_entity_id} diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/fullSuccessReplaceModeAllUpdated.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/fullSuccessReplaceModeAllUpdated.robot index d82f3fdf..1e33acd7 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/fullSuccessReplaceModeAllUpdated.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/fullSuccessReplaceModeAllUpdated.robot @@ -20,7 +20,7 @@ ${building_id_prefix}= urn:ngsi-ld:Building: *** Test Case *** Upsert a batch of existing entities [Documentation] Check that you can upsert a batch of existing entities - [Tags] critical + [Tags] mandatory ${first_existing_entity}= Load Entity building-minimal-sample.jsonld ${first_existing_entity_id} ${second_existing_entity}= Load Entity building-minimal-sample.jsonld ${second_existing_entity_id} diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/fullSuccessUpdateMode.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/fullSuccessUpdateMode.robot index 3fcf71fb..73bdff7b 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/fullSuccessUpdateMode.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/fullSuccessUpdateMode.robot @@ -20,7 +20,7 @@ ${building_id_prefix}= urn:ngsi-ld:Building: *** Test Case *** Upsert a batch of entities with update option [Documentation] Check that you can upsert a batch of entities with update option - [Tags] critical + [Tags] mandatory ${new_entity_id}= Generate Random Entity Id ${building_id_prefix} ${new_entity}= Load Entity building-minimal-sample.jsonld ${new_entity_id} diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/partialSucess.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/partialSucess.robot index 91ed6534..1dd2ed22 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/partialSucess.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/partialSucess.robot @@ -18,7 +18,7 @@ ${building_id_prefix}= urn:ngsi-ld:Building: *** Test Case *** Upsert a batch of two valid entities and one invalid entity [Documentation] Check that you can upsert a batch of two valid entities and one invalid entity - [Tags] critical + [Tags] mandatory ${first_entity_id}= Generate Random Entity Id ${building_id_prefix} ${second_entity_id}= Generate Random Entity Id ${building_id_prefix} diff --git a/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/AlreadyExists.robot b/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/AlreadyExists.robot index 85413577..ef8a8050 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/AlreadyExists.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/AlreadyExists.robot @@ -15,7 +15,7 @@ ${endpoint}= entities *** Test Case *** AlreadyExists [Documentation] Check that the IUT refuses to create an entity if one exists with the same identifier - [Tags] critical + [Tags] mandatory Create Entity building-minimal.jsonld Create Entity building-minimal.jsonld Check HTTP Status Code Is 409 diff --git a/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/SuccessCases.robot b/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/SuccessCases.robot index 35b647ab..47474e20 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/SuccessCases.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/SuccessCases.robot @@ -11,7 +11,7 @@ ${id}= urn:ngsi-ld:Building:3009ef20-9f62-41f5-bd66-92f041b428b9 *** Test Case *** SuccessCases_MinimalEntity [Documentation] Create an entity with a JSON-LD payload containing the minimal information - [Tags] critical + [Tags] mandatory Create Entity building-minimal.jsonld Check HTTP Status Code Is 201 Delete Entity by Id ${id} diff --git a/scripts/run_tests.sh b/scripts/run_tests.sh index 7f4c513b..d403cf62 100755 --- a/scripts/run_tests.sh +++ b/scripts/run_tests.sh @@ -6,11 +6,11 @@ robot --outputdir ./results ./TP/NGSI-LD # run all tests with base url overriden robot --variable url:"URL_HERE" --outputdir ./results . -# specify which tests are critical -robot --critical critical --outputdir ./results . +# specify which tests are mandatory +robot --critical mandatory --outputdir ./results . # run by specific tag(s) -robot --include critical --outputdir ./results . +robot --include mandatory --outputdir ./results . # run specific test suite robot --outputdir ./results ./TP/NGSI-LD/ContextInformation -- GitLab From 302d09ee075fd7b81cd6032b72bb5c92df0413f8 Mon Sep 17 00:00:00 2001 From: Benoit Orihuela Date: Tue, 8 Dec 2020 07:57:02 +0100 Subject: [PATCH 6/9] feat: use data-driven features to test batch creation of entities --- .../CreateBatchOfEntities/fullSuccess.robot | 56 +++++-------------- 1 file changed, 14 insertions(+), 42 deletions(-) diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/fullSuccess.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/fullSuccess.robot index 4b9c09d1..975d4c3d 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/fullSuccess.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/fullSuccess.robot @@ -7,60 +7,32 @@ Library JSONLibrary Library String Library Collections +Test Template Create Batch Entity Scenarios + *** Variable *** ${building_id_prefix}= urn:ngsi-ld:Building: -*** Test Case *** -Create a batch of minimal entities - [Documentation] Check that you can create a batch of minimal entities - [Tags] mandatory - - ${first_entity_id}= Generate Random Entity Id ${building_id_prefix} - ${second_entity_id}= Generate Random Entity Id ${building_id_prefix} - ${first_entity}= Load Entity building-minimal-sample.jsonld ${first_entity_id} - ${second_entity}= Load Entity building-minimal-sample.jsonld ${second_entity_id} - @{entities_to_be_created}= Create List ${first_entity} ${second_entity} - - Batch Create Entities @{entities_to_be_created} - - @{expected_entities_ids}= Create List ${first_entity_id} ${second_entity_id} - Check Response Status Code Set To 201 - Check Response Body Containing Array Of URIs set to @{expected_entities_ids} - - Batch Delete Entities @{expected_entities_ids} - -Create a batch of entities having only simple properties - [Documentation] Check that you can create a batch of entities having only simple properties - [Tags] mandatory +*** Test Cases *** FILENAME +MinimalEntity building-minimal-sample.jsonld +EntityWithSimpleProperties building-simple-attributes-sample.jsonld +EntityWithRelationshipsProperties building-relationship-of-property-sample.jsonld - ${first_entity_id}= Generate Random Entity Id ${building_id_prefix} - ${second_entity_id}= Generate Random Entity Id ${building_id_prefix} - ${first_entity}= Load Entity building-simple-attributes-sample.jsonld ${first_entity_id} - ${second_entity}= Load Entity building-simple-attributes-sample.jsonld ${second_entity_id} - @{entities_to_be_created}= Create List ${first_entity} ${second_entity} - - Batch Create Entities @{entities_to_be_created} - - @{expected_entities_ids}= Create List ${first_entity_id} ${second_entity_id} - Check Response Status Code Set To 201 - Check Response Body Containing Array Of URIs set to @{expected_entities_ids} - - Batch Delete Entities @{expected_entities_ids} - -Create a batch of entities having multiple attributes - [Documentation] Check that you can create a batch of entities having multiple attributes - [Tags] mandatory +*** Keywords *** +Create Batch Entity Scenarios + [Arguments] ${filename} + [Documentation] Check that you can create a batch of entities + [Tags] mandatory entityOperations ${first_entity_id}= Generate Random Entity Id ${building_id_prefix} ${second_entity_id}= Generate Random Entity Id ${building_id_prefix} - ${first_entity}= Load Entity building-relationship-of-property-sample.jsonld ${first_entity_id} - ${second_entity}= Load Entity building-relationship-of-property-sample.jsonld ${second_entity_id} + ${first_entity}= Load Entity ${filename} ${first_entity_id} + ${second_entity}= Load Entity ${filename} ${second_entity_id} @{entities_to_be_created}= Create List ${first_entity} ${second_entity} Batch Create Entities @{entities_to_be_created} @{expected_entities_ids}= Create List ${first_entity_id} ${second_entity_id} Check Response Status Code Set To 201 - Check Response Body Containing Array Of URIs set to @{expected_entities_ids} + Check Response Body Containing Array Of URIs set to @{expected_entities_ids} Batch Delete Entities @{expected_entities_ids} -- GitLab From c5bdeebe1d4393536de1fef5d9f7c64e0d0827b6 Mon Sep 17 00:00:00 2001 From: Houcem Kacem Date: Tue, 8 Dec 2020 20:06:23 +0100 Subject: [PATCH 7/9] refactor: remove unused variables and libraries in test cases + refactor Batch Request Entities From File keyword --- .../CreateBatchOfEntities/failure.robot | 7 ++----- .../CreateBatchOfEntities/fullSuccess.robot | 3 --- .../CreateBatchOfEntities/partialSuccess.robot | 3 --- .../DeleteBatchOfEntities/failure.robot | 13 ++----------- .../DeleteBatchOfEntities/fullSuccess.robot | 7 ------- .../DeleteBatchOfEntities/partialSuccess.robot | 7 ------- .../UpdateBatchOfEntities/failure.robot | 13 ++----------- .../UpdateBatchOfEntities/fullSuccess.robot | 8 -------- .../fullSuccessNoOverwriteMode.robot | 8 -------- .../UpdateBatchOfEntities/partialSuccess.robot | 8 -------- .../UpsertBatchOfEntities/failure.robot | 12 ++---------- .../fullSuccessReplaceMode.robot | 8 -------- .../fullSuccessReplaceModeAllUpdated.robot | 8 -------- .../fullSuccessUpdateMode.robot | 8 -------- .../UpsertBatchOfEntities/partialSucess.robot | 8 -------- resources/ApiUtils.resource | 14 ++++++++++---- resources/JsonUtils.resource | 4 ++++ resources/variables.py | 2 +- 18 files changed, 23 insertions(+), 118 deletions(-) diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/failure.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/failure.robot index 80e16d1a..eae07366 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/failure.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/failure.robot @@ -2,16 +2,13 @@ Documentation Check that you cannot create a batch of entities with an invalid request Resource ${EXECDIR}/resources/ApiUtils.resource Resource ${EXECDIR}/resources/AssertionUtils.resource -Library RequestsLibrary -Library JSONLibrary -Library OperatingSystem *** Test Case *** With invalid json document [Documentation] Check that you cannot create a batch of entities with an invalid json document [Tags] mandatory - Batch Request Entities From File batch/invalid-json-sample.jsonld + Batch Request Entities From File create filename=batch/invalid-json-sample.jsonld Check RL Response Status Code Set To 400 Check RL Response Body Containing Problem Details Element Containing Detail Element ${response} @@ -20,7 +17,7 @@ With empty json document [Documentation] Check that you cannot create a batch of entities with an empty json document [Tags] mandatory - Batch Request Entities From File batch/empty-sample.jsonld + Batch Request Entities From File create filename=batch/empty-sample.jsonld Check RL Response Status Code Set To 400 Check RL Response Body Containing Problem Details Element Containing Detail Element ${response} diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/fullSuccess.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/fullSuccess.robot index 975d4c3d..b31491a7 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/fullSuccess.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/fullSuccess.robot @@ -3,9 +3,6 @@ Documentation Check that you can create a batch of entities Resource ${EXECDIR}/resources/ApiUtils.resource Resource ${EXECDIR}/resources/AssertionUtils.resource Resource ${EXECDIR}/resources/JsonUtils.resource -Library JSONLibrary -Library String -Library Collections Test Template Create Batch Entity Scenarios diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/partialSuccess.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/partialSuccess.robot index 5555eef1..83533186 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/partialSuccess.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/partialSuccess.robot @@ -3,9 +3,6 @@ Documentation Check that you can create a batch of entities where some will su Resource ${EXECDIR}/resources/ApiUtils.resource Resource ${EXECDIR}/resources/AssertionUtils.resource Resource ${EXECDIR}/resources/JsonUtils.resource -Library JSONLibrary -Library String -Library Collections Suite Setup Setup Initial Entities diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/DeleteBatchOfEntities/failure.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/DeleteBatchOfEntities/failure.robot index 004a7d00..cfdace33 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/DeleteBatchOfEntities/failure.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/DeleteBatchOfEntities/failure.robot @@ -1,23 +1,14 @@ *** Settings *** Documentation Check that you cannot delete a batch of entities with an invalid request -Variables ${EXECDIR}/resources/variables.py Resource ${EXECDIR}/resources/ApiUtils.resource Resource ${EXECDIR}/resources/AssertionUtils.resource -Library RequestsLibrary -Library JSONLibrary -Library OperatingSystem - - -*** Variable *** -${batch_endpoint}= entityOperations/delete -${endpoint}= entities *** Test Case *** With invalid json document [Documentation] Check that you cannot delete a batch of entities with an invalid json document [Tags] mandatory - Batch Request Entities From File batch/invalid-json-sample.jsonld + Batch Request Entities From File delete filename=batch/invalid-json-sample.jsonld Check RL Response Status Code Set To 400 Check RL Response Body Containing Problem Details Element Containing Detail Element ${response} @@ -26,7 +17,7 @@ With empty json document [Documentation] Check that you cannot delete a batch of entities with an empty json document [Tags] mandatory - Batch Request Entities From File batch/empty-sample.jsonld + Batch Request Entities From File delete filename=batch/empty-sample.jsonld Check RL Response Status Code Set To 400 Check RL Response Body Containing Problem Details Element Containing Detail Element ${response} diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/DeleteBatchOfEntities/fullSuccess.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/DeleteBatchOfEntities/fullSuccess.robot index 421b44cd..13652a23 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/DeleteBatchOfEntities/fullSuccess.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/DeleteBatchOfEntities/fullSuccess.robot @@ -1,19 +1,12 @@ *** Settings *** Documentation Check that you can delete a batch of entities -Variables ${EXECDIR}/resources/variables.py Resource ${EXECDIR}/resources/ApiUtils.resource Resource ${EXECDIR}/resources/AssertionUtils.resource Resource ${EXECDIR}/resources/JsonUtils.resource -Library REST ${url} -Library JSONLibrary -Library String -Library Collections Suite Setup Setup Initial Entities *** Variable *** -${batch_delete_endpoint}= entityOperations/delete -${endpoint}= entities ${building_id_prefix}= urn:ngsi-ld:Building: *** Test Case *** diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/DeleteBatchOfEntities/partialSuccess.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/DeleteBatchOfEntities/partialSuccess.robot index 924565b6..49246ae0 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/DeleteBatchOfEntities/partialSuccess.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/DeleteBatchOfEntities/partialSuccess.robot @@ -1,19 +1,12 @@ *** Settings *** Documentation Check that you can delete a batch of entities where some will succeed and others will fail -Variables ${EXECDIR}/resources/variables.py Resource ${EXECDIR}/resources/ApiUtils.resource Resource ${EXECDIR}/resources/AssertionUtils.resource Resource ${EXECDIR}/resources/JsonUtils.resource -Library REST ${url} -Library JSONLibrary -Library String -Library Collections Suite Setup Setup Initial Entities *** Variable *** -${batch_delete_endpoint}= entityOperations/delete -${endpoint}= entities ${building_id_prefix}= urn:ngsi-ld:Building: *** Test Case *** diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/failure.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/failure.robot index 45badbf3..8f094b86 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/failure.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/failure.robot @@ -1,23 +1,14 @@ *** Settings *** Documentation Check that you cannot update a batch of entities with an invalid request -Variables ${EXECDIR}/resources/variables.py Resource ${EXECDIR}/resources/ApiUtils.resource Resource ${EXECDIR}/resources/AssertionUtils.resource -Resource ${EXECDIR}/resources/JsonUtils.resource -Library RequestsLibrary -Library JSONLibrary -Library OperatingSystem - -*** Variable *** -${batch_endpoint}= entityOperations/update -${endpoint}= entities *** Test Case *** With invalid json document [Documentation] Check that you cannot update a batch of entities with an invalid json document [Tags] mandatory - Batch Request Entities From File batch/invalid-json-sample.jsonld + Batch Request Entities From File update filename=batch/invalid-json-sample.jsonld Check RL Response Status Code Set To 400 Check RL Response Body Containing Problem Details Element Containing Detail Element ${response} @@ -27,7 +18,7 @@ With json-ld document not syntactically correct according to the @context [Tags] mandatory #TODO: Use a json-ld document not syntactically correct according to the @context - Batch Request Entities From File batch/invalid-json-ld-sample.jsonld + Batch Request Entities From File update filename=batch/invalid-json-ld-sample.jsonld Check RL Response Status Code Set To 400 Check RL Response Body Containing Problem Details Element Containing Detail Element ${response} diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/fullSuccess.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/fullSuccess.robot index 6df3d35c..2233b53e 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/fullSuccess.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/fullSuccess.robot @@ -1,20 +1,12 @@ *** Settings *** Documentation Check that you can update a batch of entities -Variables ${EXECDIR}/resources/variables.py Resource ${EXECDIR}/resources/ApiUtils.resource Resource ${EXECDIR}/resources/AssertionUtils.resource Resource ${EXECDIR}/resources/JsonUtils.resource -Library REST ${url} -Library JSONLibrary -Library String -Library Collections Suite Setup Setup Initial Entities *** Variable *** -${batch_endpoint}= entityOperations/update -${batch_delete_endpoint}= entityOperations/delete -${endpoint}= entities ${building_id_prefix}= urn:ngsi-ld:Building: *** Test Case *** diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/fullSuccessNoOverwriteMode.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/fullSuccessNoOverwriteMode.robot index 7a29ba0c..56ddec05 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/fullSuccessNoOverwriteMode.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/fullSuccessNoOverwriteMode.robot @@ -1,20 +1,12 @@ *** Settings *** Documentation Check that you can update a batch of entities with noOverwrite option -Variables ${EXECDIR}/resources/variables.py Resource ${EXECDIR}/resources/ApiUtils.resource Resource ${EXECDIR}/resources/AssertionUtils.resource Resource ${EXECDIR}/resources/JsonUtils.resource -Library REST ${url} -Library JSONLibrary -Library String -Library Collections Suite Setup Setup Initial Entities *** Variable *** -${batch_endpoint}= entityOperations/update -${batch_delete_endpoint}= entityOperations/delete -${endpoint}= entities ${building_id_prefix}= urn:ngsi-ld:Building: *** Test Case *** diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/partialSuccess.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/partialSuccess.robot index 3fcb46c5..6ea6ff51 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/partialSuccess.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/partialSuccess.robot @@ -1,20 +1,12 @@ *** Settings *** Documentation Check that you can update a batch of entities where some will succeed and others will fail -Variables ${EXECDIR}/resources/variables.py Resource ${EXECDIR}/resources/ApiUtils.resource Resource ${EXECDIR}/resources/AssertionUtils.resource Resource ${EXECDIR}/resources/JsonUtils.resource -Library REST ${url} -Library JSONLibrary -Library String -Library Collections Suite Setup Setup Initial Entities *** Variable *** -${batch_endpoint}= entityOperations/update -${batch_delete_endpoint}= entityOperations/delete -${endpoint}= entities ${building_id_prefix}= urn:ngsi-ld:Building: *** Test Case *** diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/failure.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/failure.robot index 76b94b23..212bbf3e 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/failure.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/failure.robot @@ -2,21 +2,13 @@ Documentation Check that you cannot upsert a batch of entities with an invalid request Resource ${EXECDIR}/resources/ApiUtils.resource Resource ${EXECDIR}/resources/AssertionUtils.resource -Resource ${EXECDIR}/resources/JsonUtils.resource -Library RequestsLibrary -Library JSONLibrary -Library OperatingSystem - -*** Variable *** -${batch_endpoint}= entityOperations/upsert -${endpoint}= entities *** Test Case *** With invalid json document [Documentation] Check that you cannot upsert a batch of entities with an invalid json document [Tags] mandatory - Batch Request Entities From File batch/invalid-json-sample.jsonld + Batch Request Entities From File upsert filename=batch/invalid-json-sample.jsonld Check RL Response Status Code Set To 400 Check RL Response Body Containing Problem Details Element Containing Detail Element ${response} @@ -25,7 +17,7 @@ With json-ld document containing a null value in any of its items [Documentation] Check that you cannot upsert a batch of entities with a json-ld document containing a null value in any of its items [Tags] mandatory - Batch Request Entities From File batch/invalid-json-ld-sample.jsonld + Batch Request Entities From File upsert filename=batch/invalid-json-ld-sample.jsonld Check RL Response Status Code Set To 400 Check RL Response Body Containing Problem Details Element Containing Detail Element ${response} diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/fullSuccessReplaceMode.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/fullSuccessReplaceMode.robot index 499cf835..d8b20dfb 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/fullSuccessReplaceMode.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/fullSuccessReplaceMode.robot @@ -1,20 +1,12 @@ *** Settings *** Documentation Check that you can upsert a batch of entities -Variables ${EXECDIR}/resources/variables.py Resource ${EXECDIR}/resources/ApiUtils.resource Resource ${EXECDIR}/resources/AssertionUtils.resource Resource ${EXECDIR}/resources/JsonUtils.resource -Library REST ${url} -Library JSONLibrary -Library String -Library Collections Suite Setup Setup Initial Entities *** Variable *** -${batch_endpoint}= entityOperations/upsert -${batch_delete_endpoint}= entityOperations/delete -${endpoint}= entities ${building_id_prefix}= urn:ngsi-ld:Building: *** Test Case *** diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/fullSuccessReplaceModeAllUpdated.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/fullSuccessReplaceModeAllUpdated.robot index 1e33acd7..694de2af 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/fullSuccessReplaceModeAllUpdated.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/fullSuccessReplaceModeAllUpdated.robot @@ -1,20 +1,12 @@ *** Settings *** Documentation Check that you can upsert a batch of existing entities and they will be replaced -Variables ${EXECDIR}/resources/variables.py Resource ${EXECDIR}/resources/ApiUtils.resource Resource ${EXECDIR}/resources/AssertionUtils.resource Resource ${EXECDIR}/resources/JsonUtils.resource -Library REST ${url} -Library JSONLibrary -Library String -Library Collections Suite Setup Setup Initial Entities *** Variable *** -${batch_endpoint}= entityOperations/upsert -${batch_delete_endpoint}= entityOperations/delete -${endpoint}= entities ${building_id_prefix}= urn:ngsi-ld:Building: *** Test Case *** diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/fullSuccessUpdateMode.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/fullSuccessUpdateMode.robot index 73bdff7b..8ee93d2d 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/fullSuccessUpdateMode.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/fullSuccessUpdateMode.robot @@ -1,20 +1,12 @@ *** Settings *** Documentation Check that you can upsert a batch of entities with update option -Variables ${EXECDIR}/resources/variables.py Resource ${EXECDIR}/resources/ApiUtils.resource Resource ${EXECDIR}/resources/AssertionUtils.resource Resource ${EXECDIR}/resources/JsonUtils.resource -Library REST ${url} -Library JSONLibrary -Library String -Library Collections Suite Setup Setup Initial Entities *** Variable *** -${batch_endpoint}= entityOperations/upsert -${batch_delete_endpoint}= entityOperations/delete -${endpoint}= entities ${building_id_prefix}= urn:ngsi-ld:Building: *** Test Case *** diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/partialSucess.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/partialSucess.robot index 1dd2ed22..5bb07723 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/partialSucess.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/partialSucess.robot @@ -1,18 +1,10 @@ *** Settings *** Documentation Check that you can upsert a batch of entities where some will succeed and others will fail -Variables ${EXECDIR}/resources/variables.py Resource ${EXECDIR}/resources/ApiUtils.resource Resource ${EXECDIR}/resources/AssertionUtils.resource Resource ${EXECDIR}/resources/JsonUtils.resource -Library REST ${url} -Library JSONLibrary -Library String -Library Collections *** Variable *** -${batch_endpoint}= entityOperations/upsert -${batch_delete_endpoint}= entityOperations/delete -${endpoint}= entities ${building_id_prefix}= urn:ngsi-ld:Building: *** Test Case *** diff --git a/resources/ApiUtils.resource b/resources/ApiUtils.resource index cdaaf785..16ef8732 100644 --- a/resources/ApiUtils.resource +++ b/resources/ApiUtils.resource @@ -3,12 +3,17 @@ Variables ./variables.py Library REST ${url} Library RequestsLibrary +Library OperatingSystem +Library Collections *** Variables *** ${BATCH_CREATE_ENDPOINT_PATH} entityOperations/create +${BATCH_UPSERT_ENDPOINT_PATH} entityOperations/upsert +${BATCH_UPDATE_ENDPOINT_PATH} entityOperations/update ${BATCH_DELETE_ENDPOINT_PATH} entityOperations/delete ${ENTITIES_ENDPOINT_PATH} entities ${response} +&{BATCH_OPERATION_ENDPOINT_MAPPING} create=${BATCH_CREATE_ENDPOINT_PATH} upsert=${BATCH_UPSERT_ENDPOINT_PATH} update=${BATCH_UPDATE_ENDPOINT_PATH} delete=${BATCH_DELETE_ENDPOINT_PATH} *** Keywords *** Api POST request @@ -62,7 +67,7 @@ Batch Create Entities Batch Upsert Entities [Arguments] @{entities_to_be_upserted} ${update_option}=replace &{headers}= Create Dictionary Content-Type=application/ld+json - ${response}= POST ${batch_endpoint}?options=${update_option} body=@{entities_to_be_upserted} headers=${headers} + ${response}= POST ${BATCH_UPSERT_ENDPOINT_PATH}?options=${update_option} body=@{entities_to_be_upserted} headers=${headers} Output request Output response Set Test Variable ${response} @@ -70,7 +75,7 @@ Batch Upsert Entities Batch Update Entities [Arguments] @{entities_to_be_updated} ${overwrite_option}=overwrite &{headers}= Create Dictionary Content-Type=application/ld+json - ${response}= POST ${batch_endpoint}?options=${overwrite_option} body=@{entities_to_be_updated} headers=${headers} + ${response}= POST ${BATCH_UPDATE_ENDPOINT_PATH}?options=${overwrite_option} body=@{entities_to_be_updated} headers=${headers} Output request Output response Set Test Variable ${response} @@ -84,9 +89,10 @@ Batch Delete Entities Set Test Variable ${response} Batch Request Entities From File - [Arguments] ${filename} + [Arguments] ${batchOperation} ${filename} ${file_content}= Get File ${EXECDIR}/data/entities/${filename} + ${endpoint_url}= Get From Dictionary ${BATCH_OPERATION_ENDPOINT_MAPPING} ${batchOperation} Create Session BatchRequest ${url} &{headers}= Create Dictionary Content-Type=application/ld+json - ${response}= POST Request BatchRequest ${BATCH_CREATE_ENDPOINT_PATH} data=${file_content} headers=${headers} + ${response}= POST Request BatchRequest ${endpoint_url} data=${file_content} headers=${headers} Set Test Variable ${response} diff --git a/resources/JsonUtils.resource b/resources/JsonUtils.resource index cda79d17..8ae198c2 100644 --- a/resources/JsonUtils.resource +++ b/resources/JsonUtils.resource @@ -1,3 +1,7 @@ +*** Settings *** +Library String +Library JSONLibrary + *** Keywords *** Load Entity [Arguments] ${entity_file_name} ${entity_id} diff --git a/resources/variables.py b/resources/variables.py index b2ae5498..7136ce1f 100644 --- a/resources/variables.py +++ b/resources/variables.py @@ -1,5 +1,5 @@ def get_variables(arg=None): variables = { - 'url': 'http://10.5.1.214:9090/ngsi-ld/v1' + 'url': 'http://127.0.0.1:8082/ngsi-ld/v1' } return variables -- GitLab From 1b1311beb48fbb06d98e3fb94d9c8cdd48a0c615 Mon Sep 17 00:00:00 2001 From: Houcem Kacem Date: Wed, 9 Dec 2020 09:33:56 +0100 Subject: [PATCH 8/9] refactor: rename test cases files to match sequence numbers --- .../{fullSuccess.robot => 003_01.robot} | 0 .../{partialSuccess.robot => 003_02.robot} | 0 .../{failure.robot => 003_03.robot} | 0 .../{fullSuccess.robot => 006_01.robot} | 0 .../{partialSuccess.robot => 006_02.robot} | 0 .../{failure.robot => 006_03.robot} | 0 .../{fullSuccess.robot => 005_01.robot} | 0 ...cessNoOverwriteMode.robot => 005_02.robot} | 0 .../{partialSuccess.robot => 005_03.robot} | 0 .../{failure.robot => 005_04.robot} | 0 .../UpsertBatchOfEntities/004_01.robot | 27 +++++++++++++++++++ ...lSuccessReplaceMode.robot => 004_02.robot} | 20 +------------- ...placeModeAllUpdated.robot => 004_03.robot} | 0 ...llSuccessUpdateMode.robot => 004_04.robot} | 0 .../{partialSucess.robot => 004_05.robot} | 0 .../{failure.robot => 004_06.robot} | 0 16 files changed, 28 insertions(+), 19 deletions(-) rename TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/{fullSuccess.robot => 003_01.robot} (100%) rename TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/{partialSuccess.robot => 003_02.robot} (100%) rename TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/{failure.robot => 003_03.robot} (100%) rename TP/NGSI-LD/ContextInformation/Provision/BatchEntities/DeleteBatchOfEntities/{fullSuccess.robot => 006_01.robot} (100%) rename TP/NGSI-LD/ContextInformation/Provision/BatchEntities/DeleteBatchOfEntities/{partialSuccess.robot => 006_02.robot} (100%) rename TP/NGSI-LD/ContextInformation/Provision/BatchEntities/DeleteBatchOfEntities/{failure.robot => 006_03.robot} (100%) rename TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/{fullSuccess.robot => 005_01.robot} (100%) rename TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/{fullSuccessNoOverwriteMode.robot => 005_02.robot} (100%) rename TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/{partialSuccess.robot => 005_03.robot} (100%) rename TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/{failure.robot => 005_04.robot} (100%) create mode 100644 TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/004_01.robot rename TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/{fullSuccessReplaceMode.robot => 004_02.robot} (66%) rename TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/{fullSuccessReplaceModeAllUpdated.robot => 004_03.robot} (100%) rename TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/{fullSuccessUpdateMode.robot => 004_04.robot} (100%) rename TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/{partialSucess.robot => 004_05.robot} (100%) rename TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/{failure.robot => 004_06.robot} (100%) diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/fullSuccess.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_01.robot similarity index 100% rename from TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/fullSuccess.robot rename to TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_01.robot diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/partialSuccess.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_02.robot similarity index 100% rename from TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/partialSuccess.robot rename to TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_02.robot diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/failure.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_03.robot similarity index 100% rename from TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/failure.robot rename to TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_03.robot diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/DeleteBatchOfEntities/fullSuccess.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/DeleteBatchOfEntities/006_01.robot similarity index 100% rename from TP/NGSI-LD/ContextInformation/Provision/BatchEntities/DeleteBatchOfEntities/fullSuccess.robot rename to TP/NGSI-LD/ContextInformation/Provision/BatchEntities/DeleteBatchOfEntities/006_01.robot diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/DeleteBatchOfEntities/partialSuccess.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/DeleteBatchOfEntities/006_02.robot similarity index 100% rename from TP/NGSI-LD/ContextInformation/Provision/BatchEntities/DeleteBatchOfEntities/partialSuccess.robot rename to TP/NGSI-LD/ContextInformation/Provision/BatchEntities/DeleteBatchOfEntities/006_02.robot diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/DeleteBatchOfEntities/failure.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/DeleteBatchOfEntities/006_03.robot similarity index 100% rename from TP/NGSI-LD/ContextInformation/Provision/BatchEntities/DeleteBatchOfEntities/failure.robot rename to TP/NGSI-LD/ContextInformation/Provision/BatchEntities/DeleteBatchOfEntities/006_03.robot diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/fullSuccess.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/005_01.robot similarity index 100% rename from TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/fullSuccess.robot rename to TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/005_01.robot diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/fullSuccessNoOverwriteMode.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/005_02.robot similarity index 100% rename from TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/fullSuccessNoOverwriteMode.robot rename to TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/005_02.robot diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/partialSuccess.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/005_03.robot similarity index 100% rename from TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/partialSuccess.robot rename to TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/005_03.robot diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/failure.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/005_04.robot similarity index 100% rename from TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/failure.robot rename to TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/005_04.robot diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/004_01.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/004_01.robot new file mode 100644 index 00000000..d6c3a548 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/004_01.robot @@ -0,0 +1,27 @@ +*** Settings *** +Documentation Check that you can upsert a batch of non-existing entities and they will be created +Resource ${EXECDIR}/resources/ApiUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +*** Variable *** +${building_id_prefix}= urn:ngsi-ld:Building: + +*** Test Case *** +Upsert a batch of non existing entities + [Documentation] Check that you can upsert a batch of non existing entities + [Tags] mandatory + + ${first_entity_id}= Generate Random Entity Id ${building_id_prefix} + ${second_entity_id}= Generate Random Entity Id ${building_id_prefix} + ${first_entity}= Load Entity building-minimal-sample.jsonld ${first_entity_id} + ${second_entity}= Load Entity building-minimal-sample.jsonld ${second_entity_id} + @{entities_to_be_upserted}= Create List ${first_entity} ${second_entity} + + Batch Upsert Entities @{entities_to_be_upserted} + + @{expected_entities_ids}= Create List ${first_entity_id} ${second_entity_id} + Check Response Status Code Set To 201 + Check Response Body Containing Array Of URIs set to @{expected_entities_ids} + + Batch Delete Entities @{expected_entities_ids} diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/fullSuccessReplaceMode.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/004_02.robot similarity index 66% rename from TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/fullSuccessReplaceMode.robot rename to TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/004_02.robot index d8b20dfb..aa0f6238 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/fullSuccessReplaceMode.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/004_02.robot @@ -1,5 +1,5 @@ *** Settings *** -Documentation Check that you can upsert a batch of entities +Documentation Check that you can upsert a batch of non-existing and existing entities where non-existing will be created and existing will be replaced Resource ${EXECDIR}/resources/ApiUtils.resource Resource ${EXECDIR}/resources/AssertionUtils.resource Resource ${EXECDIR}/resources/JsonUtils.resource @@ -10,24 +10,6 @@ Suite Setup Setup Initial Entities ${building_id_prefix}= urn:ngsi-ld:Building: *** Test Case *** -Upsert a batch of non existing entities - [Documentation] Check that you can upsert a batch of non existing entities - [Tags] mandatory - - ${first_entity_id}= Generate Random Entity Id ${building_id_prefix} - ${second_entity_id}= Generate Random Entity Id ${building_id_prefix} - ${first_entity}= Load Entity building-minimal-sample.jsonld ${first_entity_id} - ${second_entity}= Load Entity building-minimal-sample.jsonld ${second_entity_id} - @{entities_to_be_upserted}= Create List ${first_entity} ${second_entity} - - Batch Upsert Entities @{entities_to_be_upserted} - - @{expected_entities_ids}= Create List ${first_entity_id} ${second_entity_id} - Check Response Status Code Set To 201 - Check Response Body Containing Array Of URIs set to @{expected_entities_ids} - - Batch Delete Entities @{expected_entities_ids} - Upsert a batch of non existing and existing entities [Documentation] Check that you can upsert a batch of non existing and existing entities [Tags] mandatory diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/fullSuccessReplaceModeAllUpdated.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/004_03.robot similarity index 100% rename from TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/fullSuccessReplaceModeAllUpdated.robot rename to TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/004_03.robot diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/fullSuccessUpdateMode.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/004_04.robot similarity index 100% rename from TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/fullSuccessUpdateMode.robot rename to TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/004_04.robot diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/partialSucess.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/004_05.robot similarity index 100% rename from TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/partialSucess.robot rename to TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/004_05.robot diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/failure.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/004_06.robot similarity index 100% rename from TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/failure.robot rename to TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/004_06.robot -- GitLab From af4e8db9cb52b02e42010704e41a2988238e70e3 Mon Sep 17 00:00:00 2001 From: Houcem Kacem Date: Wed, 9 Dec 2020 10:42:33 +0100 Subject: [PATCH 9/9] feat: use data driven features where applicable --- .../CreateBatchOfEntities/003_01.robot | 5 ++-- .../CreateBatchOfEntities/003_03.robot | 20 +++++++-------- .../DeleteBatchOfEntities/006_03.robot | 20 +++++++-------- .../UpdateBatchOfEntities/005_01.robot | 24 ++++++++++++------ .../UpdateBatchOfEntities/005_02.robot | 24 ++++++++++++------ .../UpdateBatchOfEntities/005_04.robot | 21 +++++++--------- .../UpsertBatchOfEntities/004_01.robot | 16 +++++++++--- .../UpsertBatchOfEntities/004_02.robot | 25 +++++++++++++------ .../UpsertBatchOfEntities/004_03.robot | 24 ++++++++++++------ .../UpsertBatchOfEntities/004_04.robot | 23 ++++++++++++----- .../UpsertBatchOfEntities/004_06.robot | 20 +++++++-------- resources/ApiUtils.resource | 4 +-- 12 files changed, 136 insertions(+), 90 deletions(-) diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_01.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_01.robot index b31491a7..725fd77b 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_01.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_01.robot @@ -4,7 +4,7 @@ Resource ${EXECDIR}/resources/ApiUtils.resource Resource ${EXECDIR}/resources/AssertionUtils.resource Resource ${EXECDIR}/resources/JsonUtils.resource -Test Template Create Batch Entity Scenarios +Test Template Batch Create Entity Scenarios *** Variable *** ${building_id_prefix}= urn:ngsi-ld:Building: @@ -12,10 +12,11 @@ ${building_id_prefix}= urn:ngsi-ld:Building: *** Test Cases *** FILENAME MinimalEntity building-minimal-sample.jsonld EntityWithSimpleProperties building-simple-attributes-sample.jsonld +EntityWithSimpleRelationships building-relationship-sample.jsonld EntityWithRelationshipsProperties building-relationship-of-property-sample.jsonld *** Keywords *** -Create Batch Entity Scenarios +Batch Create Entity Scenarios [Arguments] ${filename} [Documentation] Check that you can create a batch of entities [Tags] mandatory entityOperations diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_03.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_03.robot index eae07366..916fcd5c 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_03.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_03.robot @@ -3,21 +3,19 @@ Documentation Check that you cannot create a batch of entities with an invalid Resource ${EXECDIR}/resources/ApiUtils.resource Resource ${EXECDIR}/resources/AssertionUtils.resource -*** Test Case *** -With invalid json document - [Documentation] Check that you cannot create a batch of entities with an invalid json document - [Tags] mandatory - - Batch Request Entities From File create filename=batch/invalid-json-sample.jsonld +Test Template Create Batch Entity With Invalid Request Scenarios - Check RL Response Status Code Set To 400 - Check RL Response Body Containing Problem Details Element Containing Detail Element ${response} +*** Test Cases *** FILENAME +InvalidJson batch/invalid-json-sample.jsonld +EmptyJson batch/empty-sample.jsonld -With empty json document - [Documentation] Check that you cannot create a batch of entities with an empty json document +*** Keywords *** +Create Batch Entity With Invalid Request Scenarios + [Arguments] ${filename} + [Documentation] Check that you cannot create a batch of entities with an invalid request [Tags] mandatory - Batch Request Entities From File create filename=batch/empty-sample.jsonld + Batch Request Entities From File create filename=${filename} Check RL Response Status Code Set To 400 Check RL Response Body Containing Problem Details Element Containing Detail Element ${response} diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/DeleteBatchOfEntities/006_03.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/DeleteBatchOfEntities/006_03.robot index cfdace33..ae664944 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/DeleteBatchOfEntities/006_03.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/DeleteBatchOfEntities/006_03.robot @@ -3,21 +3,19 @@ Documentation Check that you cannot delete a batch of entities with an invalid Resource ${EXECDIR}/resources/ApiUtils.resource Resource ${EXECDIR}/resources/AssertionUtils.resource -*** Test Case *** -With invalid json document - [Documentation] Check that you cannot delete a batch of entities with an invalid json document - [Tags] mandatory - - Batch Request Entities From File delete filename=batch/invalid-json-sample.jsonld +Test Template Batch Delete Entity With Invalid Request Scenarios - Check RL Response Status Code Set To 400 - Check RL Response Body Containing Problem Details Element Containing Detail Element ${response} +*** Test Cases *** FILENAME +InvalidJson batch/invalid-json-sample.jsonld +EmptyJson batch/empty-sample.jsonld -With empty json document - [Documentation] Check that you cannot delete a batch of entities with an empty json document +*** Keywords *** +Batch Delete Entity With Invalid Request Scenarios + [Arguments] ${filename} + [Documentation] Check that you cannot delete a batch of entities with an invalid request [Tags] mandatory - Batch Request Entities From File delete filename=batch/empty-sample.jsonld + Batch Request Entities From File delete filename=${filename} Check RL Response Status Code Set To 400 Check RL Response Body Containing Problem Details Element Containing Detail Element ${response} diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/005_01.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/005_01.robot index 2233b53e..4ecd8679 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/005_01.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/005_01.robot @@ -5,27 +5,31 @@ Resource ${EXECDIR}/resources/AssertionUtils.resource Resource ${EXECDIR}/resources/JsonUtils.resource Suite Setup Setup Initial Entities +Test Template Batch Update Entity Scenarios +Suite Teardown Delete Initial Entities *** Variable *** ${building_id_prefix}= urn:ngsi-ld:Building: -*** Test Case *** -Update a batch of entities +*** Test Cases *** FILENAME +EntityWithSimpleProperties building-simple-attributes-sample.jsonld +EntityWithSimpleRelationships building-relationship-sample.jsonld +EntityWithRelationshipsProperties building-relationship-of-property-sample.jsonld + +*** Keywords *** +Batch Update Entity Scenarios + [Arguments] ${filename} [Documentation] Check that you can update a batch of entities [Tags] mandatory - ${first_entity}= Load Entity building-relationship-of-property-sample.jsonld ${first_entity_id} - ${second_entity}= Load Entity building-relationship-of-property-sample.jsonld ${second_entity_id} + ${first_entity}= Load Entity ${filename} ${first_entity_id} + ${second_entity}= Load Entity ${filename} ${second_entity_id} @{entities_to_be_updated}= Create List ${first_entity} ${second_entity} Batch Update Entities @{entities_to_be_updated} Check Response Status Code Set To 204 - @{entities_ids_to_be_deleted}= Create List ${first_entity_id} ${second_entity_id} - Batch Delete Entities @{entities_ids_to_be_deleted} - -*** Keywords *** Setup Initial Entities ${first_entity_id}= Generate Random Entity Id ${building_id_prefix} ${second_entity_id}= Generate Random Entity Id ${building_id_prefix} @@ -34,3 +38,7 @@ Setup Initial Entities Set Suite Variable ${first_entity_id} Set Suite Variable ${second_entity_id} + +Delete Initial Entities + @{entities_ids_to_be_deleted}= Create List ${first_entity_id} ${second_entity_id} + Batch Delete Entities @{entities_ids_to_be_deleted} teardown=True diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/005_02.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/005_02.robot index 56ddec05..45485a7d 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/005_02.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/005_02.robot @@ -5,27 +5,31 @@ Resource ${EXECDIR}/resources/AssertionUtils.resource Resource ${EXECDIR}/resources/JsonUtils.resource Suite Setup Setup Initial Entities +Test Template Batch Update Entity With NoOverwrite Option Scenarios +Suite Teardown Delete Initial Entities *** Variable *** ${building_id_prefix}= urn:ngsi-ld:Building: -*** Test Case *** -Update a batch of entities with noOverwrite option +*** Test Cases *** FILENAME +EntityWithSimpleProperties building-simple-attributes-sample.jsonld +EntityWithSimpleRelationships building-relationship-sample.jsonld +EntityWithRelationshipsProperties building-relationship-of-property-sample.jsonld + +*** Keywords *** +Batch Update Entity With NoOverwrite Option Scenarios + [Arguments] ${filename} [Documentation] Check that you can update a batch of entities with noOverwrite option [Tags] mandatory - ${first_entity}= Load Entity building-relationship-of-property-sample.jsonld ${first_entity_id} - ${second_entity}= Load Entity building-relationship-of-property-sample.jsonld ${second_entity_id} + ${first_entity}= Load Entity ${filename} ${first_entity_id} + ${second_entity}= Load Entity ${filename} ${second_entity_id} @{entities_to_be_updated}= Create List ${first_entity} ${second_entity} Batch Update Entities @{entities_to_be_updated} overwrite_option=noOverwrite Check Response Status Code Set To 204 - @{entities_ids_to_be_deleted}= Create List ${first_entity_id} ${second_entity_id} - Batch Delete Entities @{entities_ids_to_be_deleted} - -*** Keywords *** Setup Initial Entities ${first_entity_id}= Generate Random Entity Id ${building_id_prefix} ${second_entity_id}= Generate Random Entity Id ${building_id_prefix} @@ -34,3 +38,7 @@ Setup Initial Entities Set Suite Variable ${first_entity_id} Set Suite Variable ${second_entity_id} + +Delete Initial Entities + @{entities_ids_to_be_deleted}= Create List ${first_entity_id} ${second_entity_id} + Batch Delete Entities @{entities_ids_to_be_deleted} teardown=True diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/005_04.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/005_04.robot index 8f094b86..2c7b8fd1 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/005_04.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/005_04.robot @@ -3,22 +3,19 @@ Documentation Check that you cannot update a batch of entities with an invalid Resource ${EXECDIR}/resources/ApiUtils.resource Resource ${EXECDIR}/resources/AssertionUtils.resource -*** Test Case *** -With invalid json document - [Documentation] Check that you cannot update a batch of entities with an invalid json document - [Tags] mandatory - - Batch Request Entities From File update filename=batch/invalid-json-sample.jsonld +Test Template Batch Update Entity With Invalid Request Scenarios - Check RL Response Status Code Set To 400 - Check RL Response Body Containing Problem Details Element Containing Detail Element ${response} +*** Test Cases *** FILENAME +InvalidJson batch/invalid-json-sample.jsonld +InvalidJsonLd batch/invalid-json-ld-sample.jsonld -With json-ld document not syntactically correct according to the @context - [Documentation] Check that you cannot update a batch of entities with a json-ld document not syntactically correct according to the @context +*** Keywords *** +Batch Update Entity With Invalid Request Scenarios + [Arguments] ${filename} + [Documentation] Check that you cannot update a batch of entities with an invalid request [Tags] mandatory - #TODO: Use a json-ld document not syntactically correct according to the @context - Batch Request Entities From File update filename=batch/invalid-json-ld-sample.jsonld + Batch Request Entities From File update filename=${filename} Check RL Response Status Code Set To 400 Check RL Response Body Containing Problem Details Element Containing Detail Element ${response} diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/004_01.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/004_01.robot index d6c3a548..d3f74612 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/004_01.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/004_01.robot @@ -4,18 +4,26 @@ Resource ${EXECDIR}/resources/ApiUtils.resource Resource ${EXECDIR}/resources/AssertionUtils.resource Resource ${EXECDIR}/resources/JsonUtils.resource +Test Template Batch Upsert Entity Scenarios + *** Variable *** ${building_id_prefix}= urn:ngsi-ld:Building: -*** Test Case *** -Upsert a batch of non existing entities +*** Test Cases *** FILENAME +EntityWithSimpleProperties building-simple-attributes-sample.jsonld +EntityWithSimpleRelationships building-relationship-sample.jsonld +EntityWithRelationshipsProperties building-relationship-of-property-sample.jsonld + +*** Keywords *** +Batch Upsert Entity Scenarios + [Arguments] ${filename} [Documentation] Check that you can upsert a batch of non existing entities [Tags] mandatory ${first_entity_id}= Generate Random Entity Id ${building_id_prefix} ${second_entity_id}= Generate Random Entity Id ${building_id_prefix} - ${first_entity}= Load Entity building-minimal-sample.jsonld ${first_entity_id} - ${second_entity}= Load Entity building-minimal-sample.jsonld ${second_entity_id} + ${first_entity}= Load Entity ${filename} ${first_entity_id} + ${second_entity}= Load Entity ${filename} ${second_entity_id} @{entities_to_be_upserted}= Create List ${first_entity} ${second_entity} Batch Upsert Entities @{entities_to_be_upserted} diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/004_02.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/004_02.robot index aa0f6238..6ec7f570 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/004_02.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/004_02.robot @@ -5,19 +5,27 @@ Resource ${EXECDIR}/resources/AssertionUtils.resource Resource ${EXECDIR}/resources/JsonUtils.resource Suite Setup Setup Initial Entities +Test Template Batch Upsert Non-existing And Existing Entities Scenarios +Suite Teardown Delete Initial Entities *** Variable *** ${building_id_prefix}= urn:ngsi-ld:Building: -*** Test Case *** -Upsert a batch of non existing and existing entities +*** Test Cases *** FILENAME +EntityWithSimpleProperties building-simple-attributes-sample.jsonld +EntityWithSimpleRelationships building-relationship-sample.jsonld +EntityWithRelationshipsProperties building-relationship-of-property-sample.jsonld + +*** Keywords *** +Batch Upsert Non-existing And Existing Entities Scenarios + [Arguments] ${filename} [Documentation] Check that you can upsert a batch of non existing and existing entities [Tags] mandatory ${new_entity_id}= Generate Random Entity Id ${building_id_prefix} - ${new_entity}= Load Entity building-minimal-sample.jsonld ${new_entity_id} - ${first_existing_entity}= Load Entity building-minimal-sample.jsonld ${first_existing_entity_id} - ${second_existing_entity}= Load Entity building-minimal-sample.jsonld ${second_existing_entity_id} + ${new_entity}= Load Entity ${filename} ${new_entity_id} + ${first_existing_entity}= Load Entity ${filename} ${first_existing_entity_id} + ${second_existing_entity}= Load Entity ${filename} ${second_existing_entity_id} @{entities_to_be_upserted}= Create List ${new_entity} ${first_existing_entity} ${second_existing_entity} Batch Upsert Entities @{entities_to_be_upserted} @@ -26,10 +34,9 @@ Upsert a batch of non existing and existing entities Check Response Status Code Set To 201 Check Response Body Containing Array Of URIs set to @{expected_entities_ids} - @{entities_ids_to_be_deleted}= Create List ${new_entity_id} ${first_existing_entity_id} ${second_existing_entity_id} + @{entities_ids_to_be_deleted}= Create List ${new_entity_id} Batch Delete Entities @{entities_ids_to_be_deleted} -*** Keywords *** Setup Initial Entities ${first_existing_entity_id}= Generate Random Entity Id ${building_id_prefix} ${second_existing_entity_id}= Generate Random Entity Id ${building_id_prefix} @@ -38,3 +45,7 @@ Setup Initial Entities Set Suite Variable ${first_existing_entity_id} Set Suite Variable ${second_existing_entity_id} + +Delete Initial Entities + @{entities_ids_to_be_deleted}= Create List ${first_existing_entity_id} ${second_existing_entity_id} + Batch Delete Entities @{entities_ids_to_be_deleted} teardown=True diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/004_03.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/004_03.robot index 694de2af..24fe2194 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/004_03.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/004_03.robot @@ -5,27 +5,31 @@ Resource ${EXECDIR}/resources/AssertionUtils.resource Resource ${EXECDIR}/resources/JsonUtils.resource Suite Setup Setup Initial Entities +Test Template Batch Upsert Existing Entities Scenarios +Suite Teardown Delete Initial Entities *** Variable *** ${building_id_prefix}= urn:ngsi-ld:Building: -*** Test Case *** -Upsert a batch of existing entities +*** Test Cases *** FILENAME +EntityWithSimpleProperties building-simple-attributes-sample.jsonld +EntityWithSimpleRelationships building-relationship-sample.jsonld +EntityWithRelationshipsProperties building-relationship-of-property-sample.jsonld + +*** Keywords *** +Batch Upsert Existing Entities Scenarios + [Arguments] ${filename} [Documentation] Check that you can upsert a batch of existing entities [Tags] mandatory - ${first_existing_entity}= Load Entity building-minimal-sample.jsonld ${first_existing_entity_id} - ${second_existing_entity}= Load Entity building-minimal-sample.jsonld ${second_existing_entity_id} + ${first_existing_entity}= Load Entity ${filename} ${first_existing_entity_id} + ${second_existing_entity}= Load Entity ${filename} ${second_existing_entity_id} @{entities_to_be_upserted}= Create List ${first_existing_entity} ${second_existing_entity} Batch Upsert Entities @{entities_to_be_upserted} Check Response Status Code Set To 204 - @{entities_ids_to_be_deleted}= Create List ${first_existing_entity_id} ${second_existing_entity_id} - Batch Delete Entities @{entities_ids_to_be_deleted} - -*** Keywords *** Setup Initial Entities ${first_existing_entity_id}= Generate Random Entity Id ${building_id_prefix} ${second_existing_entity_id}= Generate Random Entity Id ${building_id_prefix} @@ -34,3 +38,7 @@ Setup Initial Entities Set Suite Variable ${first_existing_entity_id} Set Suite Variable ${second_existing_entity_id} + +Delete Initial Entities + @{entities_ids_to_be_deleted}= Create List ${first_existing_entity_id} ${second_existing_entity_id} + Batch Delete Entities @{entities_ids_to_be_deleted} teardown=True diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/004_04.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/004_04.robot index 8ee93d2d..e9baf486 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/004_04.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/004_04.robot @@ -5,18 +5,26 @@ Resource ${EXECDIR}/resources/AssertionUtils.resource Resource ${EXECDIR}/resources/JsonUtils.resource Suite Setup Setup Initial Entities +Test Template Batch Upsert Entities With Update Option Scenarios +Suite Teardown Delete Initial Entities *** Variable *** ${building_id_prefix}= urn:ngsi-ld:Building: -*** Test Case *** -Upsert a batch of entities with update option +*** Test Cases *** FILENAME +EntityWithSimpleProperties building-simple-attributes-sample.jsonld +EntityWithSimpleRelationships building-relationship-sample.jsonld +EntityWithRelationshipsProperties building-relationship-of-property-sample.jsonld + +*** Keywords *** +Batch Upsert Entities With Update Option Scenarios + [Arguments] ${filename} [Documentation] Check that you can upsert a batch of entities with update option [Tags] mandatory ${new_entity_id}= Generate Random Entity Id ${building_id_prefix} - ${new_entity}= Load Entity building-minimal-sample.jsonld ${new_entity_id} - ${existing_entity}= Load Entity building-minimal-sample.jsonld ${existing_entity_id} + ${new_entity}= Load Entity ${filename} ${new_entity_id} + ${existing_entity}= Load Entity ${filename} ${existing_entity_id} @{entities_to_be_upserted}= Create List ${new_entity} ${existing_entity} Batch Upsert Entities @{entities_to_be_upserted} update_option=update @@ -25,12 +33,15 @@ Upsert a batch of entities with update option Check Response Status Code Set To 201 Check Response Body Containing Array Of URIs set to @{expected_entities_ids} - @{entities_ids_to_be_deleted}= Create List ${new_entity_id} ${existing_entity_id} + @{entities_ids_to_be_deleted}= Create List ${new_entity_id} Batch Delete Entities @{entities_ids_to_be_deleted} -*** Keywords *** Setup Initial Entities ${existing_entity_id}= Generate Random Entity Id ${building_id_prefix} Create Entity building-minimal-sample.jsonld ${existing_entity_id} Set Suite Variable ${existing_entity_id} + +Delete Initial Entities + @{entities_ids_to_be_deleted}= Create List ${existing_entity_id} + Batch Delete Entities @{entities_ids_to_be_deleted} teardown=True diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/004_06.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/004_06.robot index 212bbf3e..aae23c28 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/004_06.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/004_06.robot @@ -3,21 +3,19 @@ Documentation Check that you cannot upsert a batch of entities with an invalid Resource ${EXECDIR}/resources/ApiUtils.resource Resource ${EXECDIR}/resources/AssertionUtils.resource -*** Test Case *** -With invalid json document - [Documentation] Check that you cannot upsert a batch of entities with an invalid json document - [Tags] mandatory - - Batch Request Entities From File upsert filename=batch/invalid-json-sample.jsonld +Test Template Batch Upsert Entity With Invalid Request Scenarios - Check RL Response Status Code Set To 400 - Check RL Response Body Containing Problem Details Element Containing Detail Element ${response} +*** Test Cases *** FILENAME +InvalidJson batch/invalid-json-sample.jsonld +InvalidJsonLd batch/invalid-json-ld-sample.jsonld -With json-ld document containing a null value in any of its items - [Documentation] Check that you cannot upsert a batch of entities with a json-ld document containing a null value in any of its items +*** Keywords *** +Batch Upsert Entity With Invalid Request Scenarios + [Arguments] ${filename} + [Documentation] Check that you cannot upsert a batch of entities with an invalid request [Tags] mandatory - Batch Request Entities From File upsert filename=batch/invalid-json-ld-sample.jsonld + Batch Request Entities From File upsert filename=${filename} Check RL Response Status Code Set To 400 Check RL Response Body Containing Problem Details Element Containing Detail Element ${response} diff --git a/resources/ApiUtils.resource b/resources/ApiUtils.resource index 16ef8732..934ca4a4 100644 --- a/resources/ApiUtils.resource +++ b/resources/ApiUtils.resource @@ -81,12 +81,12 @@ Batch Update Entities Set Test Variable ${response} Batch Delete Entities - [Arguments] @{entities_ids_to_be_deleted} + [Arguments] @{entities_ids_to_be_deleted} ${teardown}=False &{headers}= Create Dictionary Content-Type=application/ld+json ${response}= POST ${BATCH_DELETE_ENDPOINT_PATH} body=@{entities_ids_to_be_deleted} headers=${headers} Output request Output response - Set Test Variable ${response} + Run Keyword If not ${teardown} Set Test Variable ${response} Batch Request Entities From File [Arguments] ${batchOperation} ${filename} -- GitLab