From 45bfb62109eceb8e600cf2ada62b6ab6833d4805 Mon Sep 17 00:00:00 2001 From: Houcem Kacem Date: Fri, 11 Dec 2020 15:08:06 +0100 Subject: [PATCH 01/12] feat: add tp 020_05 --- .../020_05.robot | 35 ++++ ...epresentation-020-05-01-expectation.jsonld | 112 +++++++++++ ...epresentation-020-05-02-expectation.jsonld | 177 +++++++++++++++++ ...sentation-multiple-instances-sample.jsonld | 183 ++++++++++++++++++ resources/ApiUtils.resource | 3 +- 5 files changed, 509 insertions(+), 1 deletion(-) create mode 100644 TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_05.robot create mode 100644 data/temporalEntities/expectations/vehicle-temporal-representation-020-05-01-expectation.jsonld create mode 100644 data/temporalEntities/expectations/vehicle-temporal-representation-020-05-02-expectation.jsonld create mode 100644 data/temporalEntities/vehicule-temporal-representation-multiple-instances-sample.jsonld diff --git a/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_05.robot b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_05.robot new file mode 100644 index 00000000..4681d8cd --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_05.robot @@ -0,0 +1,35 @@ +*** Settings *** +Documentation Check that you can retrieve the temporal evolution of the last N instances of entity attributes +Resource ${EXECDIR}/resources/ApiUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Suite Setup Setup Initial Entities +Test Template Retrieve the temporal evolution of the last N instances of entity attributes + +*** Variable *** +${vehicule_id_prefix}= urn:ngsi-ld:Vehicle: +${vehicle_payload_file}= vehicule-temporal-representation-multiple-instances-sample.jsonld + +*** Test Cases *** LASTN VEHICLE_EXPECTATION_FILE +Retrieve Some Instances ${10} vehicle-temporal-representation-020-05-01-expectation.jsonld +Retrieve All Instances ${20} vehicle-temporal-representation-020-05-02-expectation.jsonld + +*** Keywords *** +Retrieve the temporal evolution of the last N instances of entity attributes + [Arguments] ${lastN} ${vehicle_expectation_file} + [Documentation] Check that you can retrieve the temporal evolution of the last N instances of entity attributes + [Tags] mandatory + + Retrieve Temporal Representation Of Entity ${temporal_entity_representation_id} lastN=${lastN} context=${ngsild_test_suite_context} + + Check Response Status Code Set To 200 + Check Response Body Containing EntityTemporal element ${vehicle_expectation_file} ${temporal_entity_representation_id} + + +Setup Initial Entities + ${temporal_entity_representation_id}= Generate Random Entity Id ${vehicule_id_prefix} + Create Temporal Representation Of Entity ${vehicle_payload_file} ${temporal_entity_representation_id} + Set Suite Variable ${temporal_entity_representation_id} + +#TODO Call Suite Teardown \ No newline at end of file diff --git a/data/temporalEntities/expectations/vehicle-temporal-representation-020-05-01-expectation.jsonld b/data/temporalEntities/expectations/vehicle-temporal-representation-020-05-01-expectation.jsonld new file mode 100644 index 00000000..34e35ca1 --- /dev/null +++ b/data/temporalEntities/expectations/vehicle-temporal-representation-020-05-01-expectation.jsonld @@ -0,0 +1,112 @@ +{ + "id":"urn:ngsi-ld:Vehicle:randomUUID", + "type":"Vehicle", + "brandName":{ + "type":"Property", + "value":"Volvo" + }, + "fuelLevel":[ + { + "type":"Property", + "value":76, + "observedAt":"2018-08-01T16:05:00Z" + }, + { + "type":"Property", + "value":70, + "observedAt":"2018-08-01T17:07:00Z" + }, + { + "type":"Property", + "value":50, + "observedAt":"2018-08-01T18:03:00Z" + }, + { + "type":"Property", + "value":48, + "observedAt":"2018-08-01T19:05:00Z" + }, + { + "type":"Property", + "value":40, + "observedAt":"2018-08-01T19:07:00Z" + }, + { + "type":"Property", + "value":35, + "observedAt":"2018-08-01T20:05:00Z" + }, + { + "type":"Property", + "value":31, + "observedAt":"2018-08-01T20:07:00Z" + }, + { + "type":"Property", + "value":28, + "observedAt":"2018-08-01T21:03:00Z" + }, + { + "type":"Property", + "value":24, + "observedAt":"2018-08-01T21:05:00Z" + }, + { + "type":"Property", + "value":19, + "observedAt":"2018-08-01T22:07:00Z" + } + ], + "speed":[ + { + "type":"Property", + "value":50, + "observedAt":"2018-08-01T12:15:00Z" + }, + { + "type":"Property", + "value":40, + "observedAt":"2018-08-01T12:17:00Z" + }, + { + "type":"Property", + "value":50, + "observedAt":"2018-08-01T12:19:00Z" + }, + { + "type":"Property", + "value":60, + "observedAt":"2018-08-01T12:21:00Z" + }, + { + "type":"Property", + "value":80, + "observedAt":"2018-08-01T12:23:00Z" + }, + { + "type":"Property", + "value":85, + "observedAt":"2018-08-01T12:25:00Z" + }, + { + "type":"Property", + "value":105, + "observedAt":"2018-08-01T12:27:00Z" + }, + { + "type":"Property", + "value":120, + "observedAt":"2018-08-01T12:29:00Z" + }, + { + "type":"Property", + "value":125, + "observedAt":"2018-08-01T12:31:00Z" + }, + { + "type":"Property", + "value":130, + "observedAt":"2018-08-01T12:35:00Z" + } + ] +} \ No newline at end of file diff --git a/data/temporalEntities/expectations/vehicle-temporal-representation-020-05-02-expectation.jsonld b/data/temporalEntities/expectations/vehicle-temporal-representation-020-05-02-expectation.jsonld new file mode 100644 index 00000000..6399ccd0 --- /dev/null +++ b/data/temporalEntities/expectations/vehicle-temporal-representation-020-05-02-expectation.jsonld @@ -0,0 +1,177 @@ +{ + "id":"urn:ngsi-ld:Vehicle:randomUUID", + "type":"Vehicle", + "brandName":{ + "type":"Property", + "value":"Volvo" + }, + "fuelLevel":[ + { + "type":"Property", + "value":67, + "observedAt":"2018-08-01T12:03:00Z" + }, + { + "type":"Property", + "value":53, + "observedAt":"2018-08-01T13:05:00Z" + }, + { + "type":"Property", + "value":40, + "observedAt":"2018-08-01T14:07:00Z" + }, + { + "type":"Property", + "value":35, + "observedAt":"2018-08-01T14:20:00Z" + }, + { + "type":"Property", + "value":30, + "observedAt":"2018-08-01T15:05:00Z" + }, + { + "type":"Property", + "value":85, + "observedAt":"2018-08-01T15:07:00Z" + }, + { + "type":"Property", + "value":80, + "observedAt":"2018-08-01T15:20:00Z" + }, + { + "type":"Property", + "value":76, + "observedAt":"2018-08-01T16:05:00Z" + }, + { + "type":"Property", + "value":70, + "observedAt":"2018-08-01T17:07:00Z" + }, + { + "type":"Property", + "value":50, + "observedAt":"2018-08-01T18:03:00Z" + }, + { + "type":"Property", + "value":48, + "observedAt":"2018-08-01T19:05:00Z" + }, + { + "type":"Property", + "value":40, + "observedAt":"2018-08-01T19:07:00Z" + }, + { + "type":"Property", + "value":35, + "observedAt":"2018-08-01T20:05:00Z" + }, + { + "type":"Property", + "value":31, + "observedAt":"2018-08-01T20:07:00Z" + }, + { + "type":"Property", + "value":28, + "observedAt":"2018-08-01T21:03:00Z" + }, + { + "type":"Property", + "value":24, + "observedAt":"2018-08-01T21:05:00Z" + }, + { + "type":"Property", + "value":19, + "observedAt":"2018-08-01T22:07:00Z" + } + ], + "speed":[ + { + "type":"Property", + "value":120, + "observedAt":"2018-08-01T12:03:00Z" + }, + { + "type":"Property", + "value":80, + "observedAt":"2018-08-01T12:05:00Z" + }, + { + "type":"Property", + "value":100, + "observedAt":"2018-08-01T12:07:00Z" + }, + { + "type":"Property", + "value":110, + "observedAt":"2018-08-01T12:09:00Z" + }, + { + "type":"Property", + "value":100, + "observedAt":"2018-08-01T12:11:00Z" + }, + { + "type":"Property", + "value":80, + "observedAt":"2018-08-01T12:13:00Z" + }, + { + "type":"Property", + "value":50, + "observedAt":"2018-08-01T12:15:00Z" + }, + { + "type":"Property", + "value":40, + "observedAt":"2018-08-01T12:17:00Z" + }, + { + "type":"Property", + "value":50, + "observedAt":"2018-08-01T12:19:00Z" + }, + { + "type":"Property", + "value":60, + "observedAt":"2018-08-01T12:21:00Z" + }, + { + "type":"Property", + "value":80, + "observedAt":"2018-08-01T12:23:00Z" + }, + { + "type":"Property", + "value":85, + "observedAt":"2018-08-01T12:25:00Z" + }, + { + "type":"Property", + "value":105, + "observedAt":"2018-08-01T12:27:00Z" + }, + { + "type":"Property", + "value":120, + "observedAt":"2018-08-01T12:29:00Z" + }, + { + "type":"Property", + "value":125, + "observedAt":"2018-08-01T12:31:00Z" + }, + { + "type":"Property", + "value":130, + "observedAt":"2018-08-01T12:35:00Z" + } + ] +} \ No newline at end of file diff --git a/data/temporalEntities/vehicule-temporal-representation-multiple-instances-sample.jsonld b/data/temporalEntities/vehicule-temporal-representation-multiple-instances-sample.jsonld new file mode 100644 index 00000000..605dd0e0 --- /dev/null +++ b/data/temporalEntities/vehicule-temporal-representation-multiple-instances-sample.jsonld @@ -0,0 +1,183 @@ +{ + "id":"urn:ngsi-ld:Vehicle:randomUUID", + "type":"Vehicle", + "brandName":[ + { + "type":"Property", + "value":"Volvo" + } + ], + "speed":[ + { + "type":"Property", + "value":120, + "observedAt":"2018-08-01T12:03:00Z" + }, + { + "type":"Property", + "value":80, + "observedAt":"2018-08-01T12:05:00Z" + }, + { + "type":"Property", + "value":100, + "observedAt":"2018-08-01T12:07:00Z" + }, + { + "type":"Property", + "value":110, + "observedAt":"2018-08-01T12:09:00Z" + }, + { + "type":"Property", + "value":100, + "observedAt":"2018-08-01T12:11:00Z" + }, + { + "type":"Property", + "value":80, + "observedAt":"2018-08-01T12:13:00Z" + }, + { + "type":"Property", + "value":50, + "observedAt":"2018-08-01T12:15:00Z" + }, + { + "type":"Property", + "value":40, + "observedAt":"2018-08-01T12:17:00Z" + }, + { + "type":"Property", + "value":50, + "observedAt":"2018-08-01T12:19:00Z" + }, + { + "type":"Property", + "value":60, + "observedAt":"2018-08-01T12:21:00Z" + }, + { + "type":"Property", + "value":80, + "observedAt":"2018-08-01T12:23:00Z" + }, + { + "type":"Property", + "value":85, + "observedAt":"2018-08-01T12:25:00Z" + }, + { + "type":"Property", + "value":105, + "observedAt":"2018-08-01T12:27:00Z" + }, + { + "type":"Property", + "value":120, + "observedAt":"2018-08-01T12:29:00Z" + }, + { + "type":"Property", + "value":125, + "observedAt":"2018-08-01T12:31:00Z" + }, + { + "type":"Property", + "value":130, + "observedAt":"2018-08-01T12:35:00Z" + } + ], + "fuelLevel":[ + { + "type":"Property", + "value":67, + "observedAt":"2018-08-01T12:03:00Z" + }, + { + "type":"Property", + "value":53, + "observedAt":"2018-08-01T13:05:00Z" + }, + { + "type":"Property", + "value":40, + "observedAt":"2018-08-01T14:07:00Z" + }, + { + "type":"Property", + "value":35, + "observedAt":"2018-08-01T14:20:00Z" + }, + { + "type":"Property", + "value":30, + "observedAt":"2018-08-01T15:05:00Z" + }, + { + "type":"Property", + "value":85, + "observedAt":"2018-08-01T15:07:00Z" + }, + { + "type":"Property", + "value":80, + "observedAt":"2018-08-01T15:20:00Z" + }, + { + "type":"Property", + "value":76, + "observedAt":"2018-08-01T16:05:00Z" + }, + { + "type":"Property", + "value":70, + "observedAt":"2018-08-01T17:07:00Z" + }, + { + "type":"Property", + "value":50, + "observedAt":"2018-08-01T18:03:00Z" + }, + { + "type":"Property", + "value":48, + "observedAt":"2018-08-01T19:05:00Z" + }, + { + "type":"Property", + "value":40, + "observedAt":"2018-08-01T19:07:00Z" + }, + { + "type":"Property", + "value":35, + "observedAt":"2018-08-01T20:05:00Z" + }, + { + "type":"Property", + "value":31, + "observedAt":"2018-08-01T20:07:00Z" + }, + { + "type":"Property", + "value":28, + "observedAt":"2018-08-01T21:03:00Z" + }, + { + "type":"Property", + "value":24, + "observedAt":"2018-08-01T21:05:00Z" + }, + { + "type":"Property", + "value":19, + "observedAt":"2018-08-01T22:07:00Z" + } + ], + "@context":[ + "https://raw.githubusercontent.com/easy-global-market/ngsild-api-data-models/feature/add-json-ld-context-for-ngsi-ld-test-suite/ngsi-ld-test-suite/ngsi-ld-test-suite-context.jsonld", + "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context.jsonld" + ] +} \ No newline at end of file diff --git a/resources/ApiUtils.resource b/resources/ApiUtils.resource index 547834a9..74348d6a 100644 --- a/resources/ApiUtils.resource +++ b/resources/ApiUtils.resource @@ -109,7 +109,7 @@ Create Temporal Representation Of Entity Output response Retrieve Temporal Representation Of Entity - [Arguments] ${temporal_entity_representation_id} ${attrs}=${EMPTY} ${options}=${EMPTY} ${context}=${EMPTY} ${timerel}=${EMPTY} ${time}=${EMPTY} ${endTime}=${EMPTY} + [Arguments] ${temporal_entity_representation_id} ${attrs}=${EMPTY} ${options}=${EMPTY} ${context}=${EMPTY} ${timerel}=${EMPTY} ${time}=${EMPTY} ${endTime}=${EMPTY} ${lastN}=${EMPTY} ${attrs_length} = Get Length ${attrs} ${options_length} = Get Length ${options} &{headers}= Create Dictionary @@ -121,6 +121,7 @@ Retrieve Temporal Representation Of Entity Run Keyword If '${timerel}'!='' Set To Dictionary ${params} timerel=${timerel} Run Keyword If '${time}'!='' Set To Dictionary ${params} time=${time} Run Keyword If '${endTime}'!='' Set To Dictionary ${params} endTime=${endTime} + Run Keyword If '${lastN}'!='' Set To Dictionary ${params} lastN=${lastN} ${response}= GET ${TEMPORAL_ENTITIES_ENDPOINT_PATH}/${temporal_entity_representation_id} headers=${headers} query=${params} Output request -- GitLab From 7771be9beb549c29d9eb9dfd5aca437d79c39f49 Mon Sep 17 00:00:00 2001 From: Houcem Kacem Date: Fri, 11 Dec 2020 17:27:08 +0100 Subject: [PATCH 02/12] feat: add tp 020_06 --- .../020_06.robot | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_06.robot diff --git a/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_06.robot b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_06.robot new file mode 100644 index 00000000..e555f04c --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_06.robot @@ -0,0 +1,18 @@ +*** Settings *** +Documentation Check that you cannot retrieve the temporal evolution of an entity with an invalid id (invalid URI) +Resource ${EXECDIR}/resources/ApiUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +*** Variable *** +${vehicule_id_prefix}= urn:ngsi-ld:Vehicle: + +*** Test Case *** +Retrieve the temporal evolution of an entity with an invalid id + [Documentation] Check that you cannot retrieve the temporal evolution of an entity with an invalid id (invalid URI) + [Tags] mandatory + + Retrieve Temporal Representation Of Entity invalidUri + + Check Response Status Code Set To 400 + Check Response Body Containing Problem Details Element Containing Detail Element ${response['body']} \ No newline at end of file -- GitLab From 64d1ce4189d110c70c4e5edb940a01a5f59cf553 Mon Sep 17 00:00:00 2001 From: Houcem Kacem Date: Fri, 11 Dec 2020 17:31:53 +0100 Subject: [PATCH 03/12] feat: add tp 020_06 --- .../020_07.robot | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_07.robot diff --git a/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_07.robot b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_07.robot new file mode 100644 index 00000000..e555f04c --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_07.robot @@ -0,0 +1,18 @@ +*** Settings *** +Documentation Check that you cannot retrieve the temporal evolution of an entity with an invalid id (invalid URI) +Resource ${EXECDIR}/resources/ApiUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +*** Variable *** +${vehicule_id_prefix}= urn:ngsi-ld:Vehicle: + +*** Test Case *** +Retrieve the temporal evolution of an entity with an invalid id + [Documentation] Check that you cannot retrieve the temporal evolution of an entity with an invalid id (invalid URI) + [Tags] mandatory + + Retrieve Temporal Representation Of Entity invalidUri + + Check Response Status Code Set To 400 + Check Response Body Containing Problem Details Element Containing Detail Element ${response['body']} \ No newline at end of file -- GitLab From 1fc88a17687b70193ec1fe737e0ab34b4fdb3f17 Mon Sep 17 00:00:00 2001 From: Houcem Kacem Date: Fri, 11 Dec 2020 17:33:51 +0100 Subject: [PATCH 04/12] feat: add tp 020_07 --- .../020_06.robot | 3 --- .../020_07.robot | 15 +++++++-------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_06.robot b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_06.robot index e555f04c..d9d1ac97 100644 --- a/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_06.robot +++ b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_06.robot @@ -4,9 +4,6 @@ Resource ${EXECDIR}/resources/ApiUtils.resource Resource ${EXECDIR}/resources/AssertionUtils.resource Resource ${EXECDIR}/resources/JsonUtils.resource -*** Variable *** -${vehicule_id_prefix}= urn:ngsi-ld:Vehicle: - *** Test Case *** Retrieve the temporal evolution of an entity with an invalid id [Documentation] Check that you cannot retrieve the temporal evolution of an entity with an invalid id (invalid URI) diff --git a/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_07.robot b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_07.robot index e555f04c..9ffca690 100644 --- a/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_07.robot +++ b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_07.robot @@ -1,18 +1,17 @@ *** Settings *** -Documentation Check that you cannot retrieve the temporal evolution of an entity with an invalid id (invalid URI) +Documentation Check that you cannot retrieve the temporal evolution of a non-existing entity Resource ${EXECDIR}/resources/ApiUtils.resource Resource ${EXECDIR}/resources/AssertionUtils.resource Resource ${EXECDIR}/resources/JsonUtils.resource -*** Variable *** -${vehicule_id_prefix}= urn:ngsi-ld:Vehicle: - *** Test Case *** -Retrieve the temporal evolution of an entity with an invalid id - [Documentation] Check that you cannot retrieve the temporal evolution of an entity with an invalid id (invalid URI) +Retrieve the temporal evolution of a non-existing entity + [Documentation] Check that you cannot retrieve the temporal evolution of a non-existing entity [Tags] mandatory - Retrieve Temporal Representation Of Entity invalidUri + Retrieve Temporal Representation Of Entity urn:ngsi-ld:Vehicle:unknowEntity + + Check Response Status Code Set To 404 - Check Response Status Code Set To 400 + #TODO: update check on ProblemDetails element Check Response Body Containing Problem Details Element Containing Detail Element ${response['body']} \ No newline at end of file -- GitLab From 248471332faf6c690799839ff4e7165822b20e86 Mon Sep 17 00:00:00 2001 From: Houcem Kacem Date: Mon, 14 Dec 2020 10:00:27 +0100 Subject: [PATCH 05/12] feat: add tps 020_08 and 020_09 --- .../020_06.robot | 1 + .../020_07.robot | 1 - .../020_08.robot | 31 +++++++++++++++++++ .../020_09.robot | 30 ++++++++++++++++++ 4 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_08.robot create mode 100644 TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_09.robot diff --git a/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_06.robot b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_06.robot index d9d1ac97..7da1f8f3 100644 --- a/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_06.robot +++ b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_06.robot @@ -12,4 +12,5 @@ Retrieve the temporal evolution of an entity with an invalid id Retrieve Temporal Representation Of Entity invalidUri Check Response Status Code Set To 400 + #TODO: update check on ProblemDetails element Check Response Body Containing Problem Details Element Containing Detail Element ${response['body']} \ No newline at end of file diff --git a/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_07.robot b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_07.robot index 9ffca690..6b049f9e 100644 --- a/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_07.robot +++ b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_07.robot @@ -12,6 +12,5 @@ Retrieve the temporal evolution of a non-existing entity Retrieve Temporal Representation Of Entity urn:ngsi-ld:Vehicle:unknowEntity Check Response Status Code Set To 404 - #TODO: update check on ProblemDetails element Check Response Body Containing Problem Details Element Containing Detail Element ${response['body']} \ No newline at end of file diff --git a/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_08.robot b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_08.robot new file mode 100644 index 00000000..7f6d6dc5 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_08.robot @@ -0,0 +1,31 @@ +*** Settings *** +Documentation Check that you cannot retrieve the temporal evolution of non-existing entity attributes +Resource ${EXECDIR}/resources/ApiUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Suite Setup Setup Initial Entities + +*** Variable *** +${vehicule_id_prefix}= urn:ngsi-ld:Vehicle: +${vehicle_payload_file}= vehicule-temporal-representation-sample.jsonld + +*** Test Case *** +Retrieve the temporal evolution of non-existing entity attributes + [Documentation] Check that you cannot retrieve the temporal evolution of non-existing entity attributes + [Tags] mandatory + + @{temporal_attributes_to_be_retrieved}= Create List unknownAttribute + Retrieve Temporal Representation Of Entity ${temporal_entity_representation_id} attrs=${temporal_attributes_to_be_retrieved} context=${ngsild_test_suite_context} + + Check Response Status Code Set To 404 + #TODO: update check on ProblemDetails element + Check Response Body Containing Problem Details Element Containing Detail Element ${response['body']} + + #TODO Call Delete Temporal Representation Of Entity + +*** Keywords *** +Setup Initial Entities + ${temporal_entity_representation_id}= Generate Random Entity Id ${vehicule_id_prefix} + Create Temporal Representation Of Entity ${vehicle_payload_file} ${temporal_entity_representation_id} + Set Suite Variable ${temporal_entity_representation_id} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_09.robot b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_09.robot new file mode 100644 index 00000000..1370c1b1 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_09.robot @@ -0,0 +1,30 @@ +*** Settings *** +Documentation Check that you cannot retrieve the temporal evolution of an entity with an invalid request content +Resource ${EXECDIR}/resources/ApiUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Suite Setup Setup Initial Entities + +*** Variable *** +${vehicule_id_prefix}= urn:ngsi-ld:Vehicle: +${vehicle_payload_file}= vehicule-temporal-representation-sample.jsonld + +*** Test Case *** +Retrieve the temporal evolution of an entity with an invalid request content + [Documentation] Check that you cannot retrieve the temporal evolution of an entity with an invalid request content + [Tags] mandatory + + Retrieve Temporal Representation Of Entity ${temporal_entity_representation_id} timerel=after context=${ngsild_test_suite_context} + + Check Response Status Code Set To 400 + #TODO: update check on ProblemDetails element + Check Response Body Containing Problem Details Element Containing Detail Element ${response['body']} + + #TODO Call Delete Temporal Representation Of Entity + +*** Keywords *** +Setup Initial Entities + ${temporal_entity_representation_id}= Generate Random Entity Id ${vehicule_id_prefix} + Create Temporal Representation Of Entity ${vehicle_payload_file} ${temporal_entity_representation_id} + Set Suite Variable ${temporal_entity_representation_id} -- GitLab From 3da28ecc6db83f30a467912573b8d056d6057093 Mon Sep 17 00:00:00 2001 From: Houcem Kacem Date: Mon, 14 Dec 2020 10:28:35 +0100 Subject: [PATCH 06/12] fix: fix check on ProblemDetails element in BatchEntities and RetrieveTemporalEvolutionOfEntity --- .../020_06.robot | 3 +-- .../020_07.robot | 3 +-- .../020_08.robot | 3 +-- .../020_09.robot | 3 +-- .../CreateBatchOfEntities/003_03.robot | 10 +++++----- .../DeleteBatchOfEntities/006_03.robot | 10 +++++----- .../UpdateBatchOfEntities/005_04.robot | 10 +++++----- .../UpsertBatchOfEntities/004_06.robot | 10 +++++----- resources/AssertionUtils.resource | 15 +++++++++------ resources/variables.py | 5 ++++- 10 files changed, 37 insertions(+), 35 deletions(-) diff --git a/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_06.robot b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_06.robot index 7da1f8f3..df11c013 100644 --- a/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_06.robot +++ b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_06.robot @@ -12,5 +12,4 @@ Retrieve the temporal evolution of an entity with an invalid id Retrieve Temporal Representation Of Entity invalidUri Check Response Status Code Set To 400 - #TODO: update check on ProblemDetails element - Check Response Body Containing Problem Details Element Containing Detail Element ${response['body']} \ No newline at end of file + Check Response Body Containing Problem Details Element ${response['body']} ${bad_request_error_type} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_07.robot b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_07.robot index 6b049f9e..060ebd69 100644 --- a/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_07.robot +++ b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_07.robot @@ -12,5 +12,4 @@ Retrieve the temporal evolution of a non-existing entity Retrieve Temporal Representation Of Entity urn:ngsi-ld:Vehicle:unknowEntity Check Response Status Code Set To 404 - #TODO: update check on ProblemDetails element - Check Response Body Containing Problem Details Element Containing Detail Element ${response['body']} \ No newline at end of file + Check Response Body Containing Problem Details Element ${response['body']} ${resource_not_found_error_type} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_08.robot b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_08.robot index 7f6d6dc5..74a46756 100644 --- a/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_08.robot +++ b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_08.robot @@ -19,8 +19,7 @@ Retrieve the temporal evolution of non-existing entity attributes Retrieve Temporal Representation Of Entity ${temporal_entity_representation_id} attrs=${temporal_attributes_to_be_retrieved} context=${ngsild_test_suite_context} Check Response Status Code Set To 404 - #TODO: update check on ProblemDetails element - Check Response Body Containing Problem Details Element Containing Detail Element ${response['body']} + Check Response Body Containing Problem Details Element ${response['body']} ${resource_not_found_error_type} #TODO Call Delete Temporal Representation Of Entity diff --git a/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_09.robot b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_09.robot index 1370c1b1..567cb4bf 100644 --- a/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_09.robot +++ b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_09.robot @@ -18,8 +18,7 @@ Retrieve the temporal evolution of an entity with an invalid request content Retrieve Temporal Representation Of Entity ${temporal_entity_representation_id} timerel=after context=${ngsild_test_suite_context} Check Response Status Code Set To 400 - #TODO: update check on ProblemDetails element - Check Response Body Containing Problem Details Element Containing Detail Element ${response['body']} + Check Response Body Containing Problem Details Element ${response['body']} ${bad_request_error_type} #TODO Call Delete Temporal Representation Of Entity 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 916fcd5c..655d49d1 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_03.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_03.robot @@ -5,17 +5,17 @@ Resource ${EXECDIR}/resources/AssertionUtils.resource Test Template Create Batch Entity With Invalid Request Scenarios -*** Test Cases *** FILENAME -InvalidJson batch/invalid-json-sample.jsonld -EmptyJson batch/empty-sample.jsonld +*** Test Cases *** FILENAME PROBLEM_TYPE +InvalidJson batch/invalid-json-sample.jsonld ${invalid_request_error_type} +EmptyJson batch/empty-sample.jsonld ${bad_request_error_type} *** Keywords *** Create Batch Entity With Invalid Request Scenarios - [Arguments] ${filename} + [Arguments] ${filename} ${problem_type} [Documentation] Check that you cannot create a batch of entities with an invalid request [Tags] mandatory 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} + Check RL Response Body Containing Problem Details Element ${response} ${problem_type} 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 ae664944..74aa568b 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/DeleteBatchOfEntities/006_03.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/DeleteBatchOfEntities/006_03.robot @@ -5,17 +5,17 @@ Resource ${EXECDIR}/resources/AssertionUtils.resource Test Template Batch Delete Entity With Invalid Request Scenarios -*** Test Cases *** FILENAME -InvalidJson batch/invalid-json-sample.jsonld -EmptyJson batch/empty-sample.jsonld +*** Test Cases *** FILENAME PROBLEM_TYPE +InvalidJson batch/invalid-json-sample.jsonld ${invalid_request_error_type} +EmptyJson batch/empty-sample.jsonld ${bad_request_error_type} *** Keywords *** Batch Delete Entity With Invalid Request Scenarios - [Arguments] ${filename} + [Arguments] ${filename} ${problem_type} [Documentation] Check that you cannot delete a batch of entities with an invalid request [Tags] mandatory 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} + Check RL Response Body Containing Problem Details Element ${response} ${problem_type} 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 2c7b8fd1..8aec7047 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/005_04.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/005_04.robot @@ -5,17 +5,17 @@ Resource ${EXECDIR}/resources/AssertionUtils.resource Test Template Batch Update Entity With Invalid Request Scenarios -*** Test Cases *** FILENAME -InvalidJson batch/invalid-json-sample.jsonld -InvalidJsonLd batch/invalid-json-ld-sample.jsonld +*** Test Cases *** FILENAME PROBLEM_TYPE +InvalidJson batch/invalid-json-sample.jsonld ${invalid_request_error_type} +InvalidJsonLd batch/invalid-json-ld-sample.jsonld ${bad_request_error_type} *** Keywords *** Batch Update Entity With Invalid Request Scenarios - [Arguments] ${filename} + [Arguments] ${filename} ${problem_type} [Documentation] Check that you cannot update a batch of entities with an invalid request [Tags] mandatory 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} + Check RL Response Body Containing Problem Details Element ${response} ${problem_type} 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 aae23c28..c727bc13 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/004_06.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/004_06.robot @@ -5,17 +5,17 @@ Resource ${EXECDIR}/resources/AssertionUtils.resource Test Template Batch Upsert Entity With Invalid Request Scenarios -*** Test Cases *** FILENAME -InvalidJson batch/invalid-json-sample.jsonld -InvalidJsonLd batch/invalid-json-ld-sample.jsonld +*** Test Cases *** FILENAME PROBLEM_TYPE +InvalidJson batch/invalid-json-sample.jsonld ${invalid_request_error_type} +InvalidJsonLd batch/invalid-json-ld-sample.jsonld ${bad_request_error_type} *** Keywords *** Batch Upsert Entity With Invalid Request Scenarios - [Arguments] ${filename} + [Arguments] ${filename} ${problem_type} [Documentation] Check that you cannot upsert a batch of entities with an invalid request [Tags] mandatory 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} + Check RL Response Body Containing Problem Details Element ${response} ${problem_type} diff --git a/resources/AssertionUtils.resource b/resources/AssertionUtils.resource index c27409d5..322b0e1a 100644 --- a/resources/AssertionUtils.resource +++ b/resources/AssertionUtils.resource @@ -41,14 +41,17 @@ Check Response Body Containing EntityTemporal element ${comparaison_result}= Compare Dictionaries Ignoring Keys ${response['body']} ${temporal_entity_representation} ${instance_id_regex_expr} Should Be True ${comparaison_result} msg=EntityTemporal Comparaison Failed -Check Response Body Containing Problem Details Element Containing Detail Element - [Arguments] ${response_body} - Should Not Be Empty ${response_body['detail']} +Check Response Body Containing Problem Details Element + [Arguments] ${response_body} ${expected_problem_type} + Should Be Equal ${response_body['type']} ${expected_problem_type} + Should Not Be Empty ${response_body['title']} -Check RL Response Body Containing Problem Details Element Containing Detail Element - [Arguments] ${response_body} +Check RL Response Body Containing Problem Details Element + [Arguments] ${response_body} ${expected_problem_type} ${json_response_body}= To Json ${response_body.content} - Should Not Be Empty ${json_response_body['detail']} + + Should Be Equal ${json_response_body['type']} ${expected_problem_type} + Should Not Be Empty ${json_response_body['title']} Assert response status code [Arguments] ${code} diff --git a/resources/variables.py b/resources/variables.py index 1917f8e8..1e422191 100644 --- a/resources/variables.py +++ b/resources/variables.py @@ -1,6 +1,9 @@ def get_variables(arg=None): variables = { 'url': 'http://10.5.1.214:9090/ngsi-ld/v1', - 'ngsild_test_suite_context': 'https://raw.githubusercontent.com/easy-global-market/ngsild-api-data-models/feature/add-json-ld-context-for-ngsi-ld-test-suite/ngsi-ld-test-suite/ngsi-ld-test-suite-context.jsonld' + 'ngsild_test_suite_context': 'https://raw.githubusercontent.com/easy-global-market/ngsild-api-data-models/feature/add-json-ld-context-for-ngsi-ld-test-suite/ngsi-ld-test-suite/ngsi-ld-test-suite-context.jsonld', + 'bad_request_error_type': 'https://uri.etsi.org/ngsi-ld/errors/BadRequestData', + 'invalid_request_error_type': 'https://uri.etsi.org/ngsi-ld/errors/InvalidRequest', + 'resource_not_found_error_type': 'https://uri.etsi.org/ngsi-ld/errors/ResourceNotFound' } return variables -- GitLab From c21432084150efea41fd4b1793bd309f42b4df41 Mon Sep 17 00:00:00 2001 From: Houcem Kacem Date: Mon, 14 Dec 2020 10:33:52 +0100 Subject: [PATCH 07/12] fix: add EOF --- .../RetrieveTemporalEvolutionOfEntity/020_04.robot | 2 +- .../RetrieveTemporalEvolutionOfEntity/020_05.robot | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_04.robot b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_04.robot index 5640f072..e0db4776 100644 --- a/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_04.robot +++ b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_04.robot @@ -33,4 +33,4 @@ Setup Initial Entities Create Temporal Representation Of Entity ${vehicle_payload_file} ${temporal_entity_representation_id} Set Suite Variable ${temporal_entity_representation_id} -#TODO Call Suite Teardown \ No newline at end of file +#TODO Call Suite Teardown diff --git a/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_05.robot b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_05.robot index 4681d8cd..9bf7b9fd 100644 --- a/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_05.robot +++ b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_05.robot @@ -32,4 +32,4 @@ Setup Initial Entities Create Temporal Representation Of Entity ${vehicle_payload_file} ${temporal_entity_representation_id} Set Suite Variable ${temporal_entity_representation_id} -#TODO Call Suite Teardown \ No newline at end of file +#TODO Call Suite Teardown -- GitLab From 00f261df141cf278d82680e85ed874111ab74d46 Mon Sep 17 00:00:00 2001 From: Houcem Kacem Date: Mon, 14 Dec 2020 14:34:51 +0100 Subject: [PATCH 08/12] use data driven approach for tp 020_09 --- .../RetrieveTemporalEvolutionOfEntity/020_09.robot | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_09.robot b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_09.robot index 567cb4bf..31fe9de8 100644 --- a/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_09.robot +++ b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_09.robot @@ -5,24 +5,30 @@ Resource ${EXECDIR}/resources/AssertionUtils.resource Resource ${EXECDIR}/resources/JsonUtils.resource Suite Setup Setup Initial Entities +Test Template Retrieve the temporal evolution of an entity with an invalid request content *** Variable *** ${vehicule_id_prefix}= urn:ngsi-ld:Vehicle: ${vehicle_payload_file}= vehicule-temporal-representation-sample.jsonld -*** Test Case *** +*** Test Cases *** TIMEREL TIME ENDTIME +After after ${EMPTY} ${EMPTY} +Before before ${EMPTY} ${EMPTY} +Between between 2020-08-01T12:00:00Z ${EMPTY} + +*** Keywords *** Retrieve the temporal evolution of an entity with an invalid request content + [Arguments] ${timerel} ${time} ${endTime} [Documentation] Check that you cannot retrieve the temporal evolution of an entity with an invalid request content [Tags] mandatory - Retrieve Temporal Representation Of Entity ${temporal_entity_representation_id} timerel=after context=${ngsild_test_suite_context} + Retrieve Temporal Representation Of Entity ${temporal_entity_representation_id} timerel=${timerel} time=${time} endTime=${endTime} Check Response Status Code Set To 400 Check Response Body Containing Problem Details Element ${response['body']} ${bad_request_error_type} #TODO Call Delete Temporal Representation Of Entity -*** Keywords *** Setup Initial Entities ${temporal_entity_representation_id}= Generate Random Entity Id ${vehicule_id_prefix} Create Temporal Representation Of Entity ${vehicle_payload_file} ${temporal_entity_representation_id} -- GitLab From d0932fa74d8e42277e91a04227dbcec9fd1b7ea8 Mon Sep 17 00:00:00 2001 From: Houcem Kacem Date: Mon, 14 Dec 2020 14:45:57 +0100 Subject: [PATCH 09/12] fix: fix timeAt and endTimeAt query parameters --- resources/ApiUtils.resource | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/ApiUtils.resource b/resources/ApiUtils.resource index 74348d6a..247b643f 100644 --- a/resources/ApiUtils.resource +++ b/resources/ApiUtils.resource @@ -119,8 +119,8 @@ Retrieve Temporal Representation Of Entity Run Keyword If ${attrs_length}>0 Set To Dictionary ${params} attrs=${attrs} Run Keyword If ${options_length}>0 Set To Dictionary ${params} options=${options} Run Keyword If '${timerel}'!='' Set To Dictionary ${params} timerel=${timerel} - Run Keyword If '${time}'!='' Set To Dictionary ${params} time=${time} - Run Keyword If '${endTime}'!='' Set To Dictionary ${params} endTime=${endTime} + Run Keyword If '${time}'!='' Set To Dictionary ${params} timeAt=${time} + Run Keyword If '${endTime}'!='' Set To Dictionary ${params} endTimeAt=${endTime} Run Keyword If '${lastN}'!='' Set To Dictionary ${params} lastN=${lastN} ${response}= GET ${TEMPORAL_ENTITIES_ENDPOINT_PATH}/${temporal_entity_representation_id} headers=${headers} query=${params} -- GitLab From 8afc9c347c4431e4984b44f3bc27ec79440005a4 Mon Sep 17 00:00:00 2001 From: Houcem Kacem Date: Mon, 14 Dec 2020 15:02:17 +0100 Subject: [PATCH 10/12] feat: call Delete Initial Entities in Suite Teardown --- .../RetrieveTemporalEvolutionOfEntity/020_01.robot | 6 ++++-- .../RetrieveTemporalEvolutionOfEntity/020_02.robot | 6 ++++-- .../RetrieveTemporalEvolutionOfEntity/020_03.robot | 6 ++++-- .../RetrieveTemporalEvolutionOfEntity/020_04.robot | 5 +++-- .../RetrieveTemporalEvolutionOfEntity/020_05.robot | 5 +++-- .../RetrieveTemporalEvolutionOfEntity/020_08.robot | 6 ++++-- .../RetrieveTemporalEvolutionOfEntity/020_09.robot | 6 ++++-- .../RetrieveTemporalEvolutionOfEntity/020_10.robot | 6 ++++-- resources/ApiUtils.resource | 7 +++++++ 9 files changed, 37 insertions(+), 16 deletions(-) diff --git a/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_01.robot b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_01.robot index 9bbe02f2..1fedda07 100644 --- a/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_01.robot +++ b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_01.robot @@ -5,6 +5,7 @@ Resource ${EXECDIR}/resources/AssertionUtils.resource Resource ${EXECDIR}/resources/JsonUtils.resource Suite Setup Setup Initial Entities +Suite Teardown Delete Initial Entities *** Variable *** ${vehicule_id_prefix}= urn:ngsi-ld:Vehicle: @@ -21,10 +22,11 @@ Retrieve the temporal evolution of an entity Check Response Status Code Set To 200 Check Response Body Containing EntityTemporal element ${vehicle_expectation_file} ${temporal_entity_representation_id} - #TODO Call Delete Temporal Representation Of Entity - *** Keywords *** Setup Initial Entities ${temporal_entity_representation_id}= Generate Random Entity Id ${vehicule_id_prefix} Create Temporal Representation Of Entity ${vehicle_payload_file} ${temporal_entity_representation_id} Set Suite Variable ${temporal_entity_representation_id} + +Delete Initial Entities + Delete Temporal Representation Of Entity ${temporal_entity_representation_id} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_02.robot b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_02.robot index 8031817d..54f83eb6 100644 --- a/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_02.robot +++ b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_02.robot @@ -5,6 +5,7 @@ Resource ${EXECDIR}/resources/AssertionUtils.resource Resource ${EXECDIR}/resources/JsonUtils.resource Suite Setup Setup Initial Entities +Suite Teardown Delete Initial Entities *** Variable *** ${vehicule_id_prefix}= urn:ngsi-ld:Vehicle: @@ -21,10 +22,11 @@ Retrieve the temporal evolution of an entity using a context Check Response Status Code Set To 200 Check Response Body Containing EntityTemporal element ${vehicle_expectation_file} ${temporal_entity_representation_id} - #TODO Call Delete Temporal Representation Of Entity - *** Keywords *** Setup Initial Entities ${temporal_entity_representation_id}= Generate Random Entity Id ${vehicule_id_prefix} Create Temporal Representation Of Entity ${vehicle_payload_file} ${temporal_entity_representation_id} Set Suite Variable ${temporal_entity_representation_id} + +Delete Initial Entities + Delete Temporal Representation Of Entity ${temporal_entity_representation_id} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_03.robot b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_03.robot index 47e1f163..b2b62855 100644 --- a/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_03.robot +++ b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_03.robot @@ -5,6 +5,7 @@ Resource ${EXECDIR}/resources/AssertionUtils.resource Resource ${EXECDIR}/resources/JsonUtils.resource Suite Setup Setup Initial Entities +Suite Teardown Delete Initial Entities *** Variable *** ${vehicule_id_prefix}= urn:ngsi-ld:Vehicle: @@ -22,10 +23,11 @@ Retrieve the temporal evolution of certain attributes of an entity Check Response Status Code Set To 200 Check Response Body Containing EntityTemporal element ${vehicle_expectation_file} ${temporal_entity_representation_id} - #TODO Call Delete Temporal Representation Of Entity - *** Keywords *** Setup Initial Entities ${temporal_entity_representation_id}= Generate Random Entity Id ${vehicule_id_prefix} Create Temporal Representation Of Entity ${vehicle_payload_file} ${temporal_entity_representation_id} Set Suite Variable ${temporal_entity_representation_id} + +Delete Initial Entities + Delete Temporal Representation Of Entity ${temporal_entity_representation_id} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_04.robot b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_04.robot index e0db4776..724aa696 100644 --- a/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_04.robot +++ b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_04.robot @@ -5,6 +5,7 @@ Resource ${EXECDIR}/resources/AssertionUtils.resource Resource ${EXECDIR}/resources/JsonUtils.resource Suite Setup Setup Initial Entities +Suite Teardown Delete Initial Entities Test Template Retrieve the temporal evolution of an entity matching the given NGSI-LD temporal query *** Variable *** @@ -27,10 +28,10 @@ Retrieve the temporal evolution of an entity matching the given NGSI-LD temporal Check Response Status Code Set To 200 Check Response Body Containing EntityTemporal element ${vehicle_expectation_file} ${temporal_entity_representation_id} - Setup Initial Entities ${temporal_entity_representation_id}= Generate Random Entity Id ${vehicule_id_prefix} Create Temporal Representation Of Entity ${vehicle_payload_file} ${temporal_entity_representation_id} Set Suite Variable ${temporal_entity_representation_id} -#TODO Call Suite Teardown +Delete Initial Entities + Delete Temporal Representation Of Entity ${temporal_entity_representation_id} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_05.robot b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_05.robot index 9bf7b9fd..3810a1c2 100644 --- a/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_05.robot +++ b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_05.robot @@ -5,6 +5,7 @@ Resource ${EXECDIR}/resources/AssertionUtils.resource Resource ${EXECDIR}/resources/JsonUtils.resource Suite Setup Setup Initial Entities +Suite Teardown Delete Initial Entities Test Template Retrieve the temporal evolution of the last N instances of entity attributes *** Variable *** @@ -26,10 +27,10 @@ Retrieve the temporal evolution of the last N instances of entity attributes Check Response Status Code Set To 200 Check Response Body Containing EntityTemporal element ${vehicle_expectation_file} ${temporal_entity_representation_id} - Setup Initial Entities ${temporal_entity_representation_id}= Generate Random Entity Id ${vehicule_id_prefix} Create Temporal Representation Of Entity ${vehicle_payload_file} ${temporal_entity_representation_id} Set Suite Variable ${temporal_entity_representation_id} -#TODO Call Suite Teardown +Delete Initial Entities + Delete Temporal Representation Of Entity ${temporal_entity_representation_id} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_08.robot b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_08.robot index 74a46756..b109dc1e 100644 --- a/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_08.robot +++ b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_08.robot @@ -5,6 +5,7 @@ Resource ${EXECDIR}/resources/AssertionUtils.resource Resource ${EXECDIR}/resources/JsonUtils.resource Suite Setup Setup Initial Entities +Suite Teardown Delete Initial Entities *** Variable *** ${vehicule_id_prefix}= urn:ngsi-ld:Vehicle: @@ -21,10 +22,11 @@ Retrieve the temporal evolution of non-existing entity attributes Check Response Status Code Set To 404 Check Response Body Containing Problem Details Element ${response['body']} ${resource_not_found_error_type} - #TODO Call Delete Temporal Representation Of Entity - *** Keywords *** Setup Initial Entities ${temporal_entity_representation_id}= Generate Random Entity Id ${vehicule_id_prefix} Create Temporal Representation Of Entity ${vehicle_payload_file} ${temporal_entity_representation_id} Set Suite Variable ${temporal_entity_representation_id} + +Delete Initial Entities + Delete Temporal Representation Of Entity ${temporal_entity_representation_id} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_09.robot b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_09.robot index 31fe9de8..c49cf962 100644 --- a/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_09.robot +++ b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_09.robot @@ -5,6 +5,7 @@ Resource ${EXECDIR}/resources/AssertionUtils.resource Resource ${EXECDIR}/resources/JsonUtils.resource Suite Setup Setup Initial Entities +Suite Teardown Delete Initial Entities Test Template Retrieve the temporal evolution of an entity with an invalid request content *** Variable *** @@ -27,9 +28,10 @@ Retrieve the temporal evolution of an entity with an invalid request content Check Response Status Code Set To 400 Check Response Body Containing Problem Details Element ${response['body']} ${bad_request_error_type} - #TODO Call Delete Temporal Representation Of Entity - Setup Initial Entities ${temporal_entity_representation_id}= Generate Random Entity Id ${vehicule_id_prefix} Create Temporal Representation Of Entity ${vehicle_payload_file} ${temporal_entity_representation_id} Set Suite Variable ${temporal_entity_representation_id} + +Delete Initial Entities + Delete Temporal Representation Of Entity ${temporal_entity_representation_id} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_10.robot b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_10.robot index 4c8f62bd..0813a452 100644 --- a/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_10.robot +++ b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_10.robot @@ -5,6 +5,7 @@ Resource ${EXECDIR}/resources/AssertionUtils.resource Resource ${EXECDIR}/resources/JsonUtils.resource Suite Setup Setup Initial Entities +Suite Teardown Delete Initial Entities *** Variable *** ${vehicule_id_prefix}= urn:ngsi-ld:Vehicle: @@ -22,10 +23,11 @@ Retrieve the temporal evolution of an entity with the simplified temporal repres Check Response Status Code Set To 200 Check Response Body Containing EntityTemporal element ${vehicle_expectation_file} ${temporal_entity_representation_id} - #TODO Call Delete Temporal Representation Of Entity - *** Keywords *** Setup Initial Entities ${temporal_entity_representation_id}= Generate Random Entity Id ${vehicule_id_prefix} Create Temporal Representation Of Entity ${vehicle_payload_file} ${temporal_entity_representation_id} Set Suite Variable ${temporal_entity_representation_id} + +Delete Initial Entities + Delete Temporal Representation Of Entity ${temporal_entity_representation_id} diff --git a/resources/ApiUtils.resource b/resources/ApiUtils.resource index 247b643f..73dd2b6a 100644 --- a/resources/ApiUtils.resource +++ b/resources/ApiUtils.resource @@ -127,3 +127,10 @@ Retrieve Temporal Representation Of Entity Output request Output response Set Test Variable ${response} + +Delete Temporal Representation Of Entity + [Arguments] ${temporal_entity_representation_id} + + ${response}= DELETE ${TEMPORAL_ENTITIES_ENDPOINT_PATH}/${temporal_entity_representation_id} + Output request + Output response -- GitLab From 7df9c3d777e5c393722ce4e8bf0add94f201c769 Mon Sep 17 00:00:00 2001 From: Houcem Kacem Date: Mon, 14 Dec 2020 17:52:25 +0100 Subject: [PATCH 11/12] fix: update check on ProblemDetails element --- .../020_06.robot | 3 ++- .../020_07.robot | 3 ++- .../020_08.robot | 3 ++- .../020_09.robot | 3 ++- .../CreateBatchOfEntities/003_03.robot | 7 ++++--- .../DeleteBatchOfEntities/006_03.robot | 7 ++++--- .../UpdateBatchOfEntities/005_04.robot | 7 ++++--- .../UpsertBatchOfEntities/004_06.robot | 7 ++++--- resources/ApiUtils.resource | 2 ++ resources/AssertionUtils.resource | 15 +++++++++------ resources/variables.py | 5 +---- 11 files changed, 36 insertions(+), 26 deletions(-) diff --git a/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_06.robot b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_06.robot index df11c013..9c591968 100644 --- a/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_06.robot +++ b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_06.robot @@ -12,4 +12,5 @@ Retrieve the temporal evolution of an entity with an invalid id Retrieve Temporal Representation Of Entity invalidUri Check Response Status Code Set To 400 - Check Response Body Containing Problem Details Element ${response['body']} ${bad_request_error_type} + Check Response Body Containing ProblemDetails Element Containing Type Element set to ${response} ${ERROR_TYPE_BAD_REQUEST_DATA} + Check Response Body Containing ProblemDetails Element Containing Title Element ${response} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_07.robot b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_07.robot index 060ebd69..2b5393ff 100644 --- a/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_07.robot +++ b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_07.robot @@ -12,4 +12,5 @@ Retrieve the temporal evolution of a non-existing entity Retrieve Temporal Representation Of Entity urn:ngsi-ld:Vehicle:unknowEntity Check Response Status Code Set To 404 - Check Response Body Containing Problem Details Element ${response['body']} ${resource_not_found_error_type} + Check Response Body Containing ProblemDetails Element Containing Type Element set to ${response} ${ERROR_TYPE_RESOURCE_NOT_FOUND} + Check Response Body Containing ProblemDetails Element Containing Title Element ${response} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_08.robot b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_08.robot index b109dc1e..20892e4a 100644 --- a/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_08.robot +++ b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_08.robot @@ -20,7 +20,8 @@ Retrieve the temporal evolution of non-existing entity attributes Retrieve Temporal Representation Of Entity ${temporal_entity_representation_id} attrs=${temporal_attributes_to_be_retrieved} context=${ngsild_test_suite_context} Check Response Status Code Set To 404 - Check Response Body Containing Problem Details Element ${response['body']} ${resource_not_found_error_type} + Check Response Body Containing ProblemDetails Element Containing Type Element set to ${response} ${ERROR_TYPE_RESOURCE_NOT_FOUND} + Check Response Body Containing ProblemDetails Element Containing Title Element ${response} *** Keywords *** Setup Initial Entities diff --git a/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_09.robot b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_09.robot index c49cf962..43c2a164 100644 --- a/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_09.robot +++ b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_09.robot @@ -26,7 +26,8 @@ Retrieve the temporal evolution of an entity with an invalid request content Retrieve Temporal Representation Of Entity ${temporal_entity_representation_id} timerel=${timerel} time=${time} endTime=${endTime} Check Response Status Code Set To 400 - Check Response Body Containing Problem Details Element ${response['body']} ${bad_request_error_type} + Check Response Body Containing ProblemDetails Element Containing Type Element set to ${response} ${ERROR_TYPE_BAD_REQUEST_DATA} + Check Response Body Containing ProblemDetails Element Containing Title Element ${response} Setup Initial Entities ${temporal_entity_representation_id}= Generate Random Entity Id ${vehicule_id_prefix} 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 655d49d1..e169e6fa 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_03.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_03.robot @@ -6,8 +6,8 @@ Resource ${EXECDIR}/resources/AssertionUtils.resource Test Template Create Batch Entity With Invalid Request Scenarios *** Test Cases *** FILENAME PROBLEM_TYPE -InvalidJson batch/invalid-json-sample.jsonld ${invalid_request_error_type} -EmptyJson batch/empty-sample.jsonld ${bad_request_error_type} +InvalidJson batch/invalid-json-sample.jsonld ${ERROR_TYPE_INVALID_REQUEST} +EmptyJson batch/empty-sample.jsonld ${ERROR_TYPE_BAD_REQUEST_DATA} *** Keywords *** Create Batch Entity With Invalid Request Scenarios @@ -18,4 +18,5 @@ Create Batch Entity With Invalid Request Scenarios Batch Request Entities From File create filename=${filename} Check RL Response Status Code Set To 400 - Check RL Response Body Containing Problem Details Element ${response} ${problem_type} + Check RL Response Body Containing ProblemDetails Element Containing Type Element set to ${response} ${problem_type} + Check RL Response Body Containing ProblemDetails Element Containing Title 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 74aa568b..1cdbba5b 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/DeleteBatchOfEntities/006_03.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/DeleteBatchOfEntities/006_03.robot @@ -6,8 +6,8 @@ Resource ${EXECDIR}/resources/AssertionUtils.resource Test Template Batch Delete Entity With Invalid Request Scenarios *** Test Cases *** FILENAME PROBLEM_TYPE -InvalidJson batch/invalid-json-sample.jsonld ${invalid_request_error_type} -EmptyJson batch/empty-sample.jsonld ${bad_request_error_type} +InvalidJson batch/invalid-json-sample.jsonld ${ERROR_TYPE_INVALID_REQUEST} +EmptyJson batch/empty-sample.jsonld ${ERROR_TYPE_BAD_REQUEST_DATA} *** Keywords *** Batch Delete Entity With Invalid Request Scenarios @@ -18,4 +18,5 @@ Batch Delete Entity With Invalid Request Scenarios Batch Request Entities From File delete filename=${filename} Check RL Response Status Code Set To 400 - Check RL Response Body Containing Problem Details Element ${response} ${problem_type} + Check RL Response Body Containing ProblemDetails Element Containing Type Element set to ${response} ${problem_type} + Check RL Response Body Containing ProblemDetails Element Containing Title Element ${response} 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 8aec7047..a3195d45 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/005_04.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/005_04.robot @@ -6,8 +6,8 @@ Resource ${EXECDIR}/resources/AssertionUtils.resource Test Template Batch Update Entity With Invalid Request Scenarios *** Test Cases *** FILENAME PROBLEM_TYPE -InvalidJson batch/invalid-json-sample.jsonld ${invalid_request_error_type} -InvalidJsonLd batch/invalid-json-ld-sample.jsonld ${bad_request_error_type} +InvalidJson batch/invalid-json-sample.jsonld ${ERROR_TYPE_INVALID_REQUEST} +InvalidJsonLd batch/invalid-json-ld-sample.jsonld ${ERROR_TYPE_BAD_REQUEST_DATA} *** Keywords *** Batch Update Entity With Invalid Request Scenarios @@ -18,4 +18,5 @@ Batch Update Entity With Invalid Request Scenarios Batch Request Entities From File update filename=${filename} Check RL Response Status Code Set To 400 - Check RL Response Body Containing Problem Details Element ${response} ${problem_type} + Check RL Response Body Containing ProblemDetails Element Containing Type Element set to ${response} ${problem_type} + Check RL Response Body Containing ProblemDetails Element Containing Title Element ${response} 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 21d5b6df..8bf80f0f 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/004_06.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/004_06.robot @@ -6,8 +6,8 @@ Resource ${EXECDIR}/resources/AssertionUtils.resource Test Template Batch Upsert Entity With Invalid Request Scenarios *** Test Cases *** FILENAME PROBLEM_TYPE -InvalidJson batch/invalid-json-sample.jsonld ${invalid_request_error_type} -InvalidJsonLd batch/invalid-json-ld-sample.jsonld ${bad_request_error_type} +InvalidJson batch/invalid-json-sample.jsonld ${ERROR_TYPE_INVALID_REQUEST} +InvalidJsonLd batch/invalid-json-ld-sample.jsonld ${ERROR_TYPE_BAD_REQUEST_DATA} *** Keywords *** Batch Upsert Entity With Invalid Request Scenarios @@ -18,4 +18,5 @@ Batch Upsert Entity With Invalid Request Scenarios Batch Request Entities From File upsert filename=${filename} Check RL Response Status Code Set To 400 - Check RL Response Body Containing Problem Details Element ${response} ${problem_type} \ No newline at end of file + Check RL Response Body Containing ProblemDetails Element Containing Type Element set to ${response} ${problem_type} + Check RL Response Body Containing ProblemDetails Element Containing Title Element ${response} diff --git a/resources/ApiUtils.resource b/resources/ApiUtils.resource index 8f563a4e..0bc8b223 100644 --- a/resources/ApiUtils.resource +++ b/resources/ApiUtils.resource @@ -19,6 +19,8 @@ ${CONTENT_TYPE_JSON} application/json ${CONTENT_TYPE_LD_JSON} application/ld+json ${ERROR_TYPE_BAD_REQUEST_DATA} https://uri.etsi.org/ngsi-ld/errors/BadRequestData +${ERROR_TYPE_INVALID_REQUEST} https://uri.etsi.org/ngsi-ld/errors/InvalidRequest +${ERROR_TYPE_RESOURCE_NOT_FOUND} https://uri.etsi.org/ngsi-ld/errors/ResourceNotFound ${response} diff --git a/resources/AssertionUtils.resource b/resources/AssertionUtils.resource index 3c0e9d86..0b31186a 100644 --- a/resources/AssertionUtils.resource +++ b/resources/AssertionUtils.resource @@ -46,18 +46,21 @@ Check Response Body Containing EntityTemporal element Should Be True ${comparaison_result} msg=EntityTemporal Comparaison Failed Check Response Body Containing ProblemDetails Element Containing Type Element set to - [Arguments] ${response_body} ${type} + [Arguments] ${response} ${type} Should Be Equal ${response['body']['type']} ${type} Check Response Body Containing ProblemDetails Element Containing Title Element - [Arguments] ${response_body} + [Arguments] ${response} Should Not Be Empty ${response['body']['title']} -Check RL Response Body Containing Problem Details Element - [Arguments] ${response_body} ${expected_problem_type} - ${json_response_body}= To Json ${response_body.content} +Check RL Response Body Containing ProblemDetails Element Containing Type Element set to + [Arguments] ${response} ${type} + ${json_response_body}= To Json ${response.content} + Should Be Equal ${json_response_body['type']} ${type} - Should Be Equal ${json_response_body['type']} ${expected_problem_type} +Check RL Response Body Containing ProblemDetails Element Containing Title Element + [Arguments] ${response} + ${json_response_body}= To Json ${response.content} Should Not Be Empty ${json_response_body['title']} Assert response status code diff --git a/resources/variables.py b/resources/variables.py index 1e422191..1917f8e8 100644 --- a/resources/variables.py +++ b/resources/variables.py @@ -1,9 +1,6 @@ def get_variables(arg=None): variables = { 'url': 'http://10.5.1.214:9090/ngsi-ld/v1', - 'ngsild_test_suite_context': 'https://raw.githubusercontent.com/easy-global-market/ngsild-api-data-models/feature/add-json-ld-context-for-ngsi-ld-test-suite/ngsi-ld-test-suite/ngsi-ld-test-suite-context.jsonld', - 'bad_request_error_type': 'https://uri.etsi.org/ngsi-ld/errors/BadRequestData', - 'invalid_request_error_type': 'https://uri.etsi.org/ngsi-ld/errors/InvalidRequest', - 'resource_not_found_error_type': 'https://uri.etsi.org/ngsi-ld/errors/ResourceNotFound' + 'ngsild_test_suite_context': 'https://raw.githubusercontent.com/easy-global-market/ngsild-api-data-models/feature/add-json-ld-context-for-ngsi-ld-test-suite/ngsi-ld-test-suite/ngsi-ld-test-suite-context.jsonld' } return variables -- GitLab From 47bb8e9ff02aef62dd564e0fca9f552f5813fd2d Mon Sep 17 00:00:00 2001 From: Houcem Kacem Date: Tue, 15 Dec 2020 10:08:20 +0100 Subject: [PATCH 12/12] refactor: rename time and endTime to timeAt and endTimeAt --- .../RetrieveTemporalEvolutionOfEntity/020_04.robot | 6 +++--- .../RetrieveTemporalEvolutionOfEntity/020_09.robot | 6 +++--- resources/ApiUtils.resource | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_04.robot b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_04.robot index 724aa696..b56fa289 100644 --- a/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_04.robot +++ b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_04.robot @@ -12,18 +12,18 @@ Test Template Retrieve the temporal evolution of an entity matching the given N ${vehicule_id_prefix}= urn:ngsi-ld:Vehicle: ${vehicle_payload_file}= vehicule-temporal-representation-sample.jsonld -*** Test Cases *** TIMEREL TIME ENDTIME VEHICLE_EXPECTATION_FILE +*** Test Cases *** TIMEREL TIMEAT ENDTIMEAT VEHICLE_EXPECTATION_FILE After after 2018-08-01T13:03:00Z ${EMPTY} vehicle-temporal-representation-020-04-01-expectation.jsonld Before before 2018-08-01T12:05:00Z ${EMPTY} vehicle-temporal-representation-020-04-02-expectation.jsonld Between between 2018-08-01T12:00:00Z 2018-08-01T13:00:00Z vehicle-temporal-representation-020-04-03-expectation.jsonld *** Keywords *** Retrieve the temporal evolution of an entity matching the given NGSI-LD temporal query - [Arguments] ${timerel} ${time} ${endTime} ${vehicle_expectation_file} + [Arguments] ${timerel} ${timeAt} ${endTimeAt} ${vehicle_expectation_file} [Documentation] Check that you can retrieve the temporal evolution of an entity matching the given NGSI-LD temporal query [Tags] mandatory - Retrieve Temporal Representation Of Entity ${temporal_entity_representation_id} timerel=${timerel} time=${time} endTime=${endTime} context=${ngsild_test_suite_context} + Retrieve Temporal Representation Of Entity ${temporal_entity_representation_id} timerel=${timerel} timeAt=${timeAt} endTimeAt=${endTimeAt} context=${ngsild_test_suite_context} Check Response Status Code Set To 200 Check Response Body Containing EntityTemporal element ${vehicle_expectation_file} ${temporal_entity_representation_id} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_09.robot b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_09.robot index 43c2a164..c67b3d1c 100644 --- a/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_09.robot +++ b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_09.robot @@ -12,18 +12,18 @@ Test Template Retrieve the temporal evolution of an entity with an invalid requ ${vehicule_id_prefix}= urn:ngsi-ld:Vehicle: ${vehicle_payload_file}= vehicule-temporal-representation-sample.jsonld -*** Test Cases *** TIMEREL TIME ENDTIME +*** Test Cases *** TIMEREL TIMEAT ENDTIMEAT After after ${EMPTY} ${EMPTY} Before before ${EMPTY} ${EMPTY} Between between 2020-08-01T12:00:00Z ${EMPTY} *** Keywords *** Retrieve the temporal evolution of an entity with an invalid request content - [Arguments] ${timerel} ${time} ${endTime} + [Arguments] ${timerel} ${timeAt} ${endTimeAt} [Documentation] Check that you cannot retrieve the temporal evolution of an entity with an invalid request content [Tags] mandatory - Retrieve Temporal Representation Of Entity ${temporal_entity_representation_id} timerel=${timerel} time=${time} endTime=${endTime} + Retrieve Temporal Representation Of Entity ${temporal_entity_representation_id} timerel=${timerel} timeAt=${timeAt} endTimeAt=${endTimeAt} Check Response Status Code Set To 400 Check Response Body Containing ProblemDetails Element Containing Type Element set to ${response} ${ERROR_TYPE_BAD_REQUEST_DATA} diff --git a/resources/ApiUtils.resource b/resources/ApiUtils.resource index 0bc8b223..13733600 100644 --- a/resources/ApiUtils.resource +++ b/resources/ApiUtils.resource @@ -129,7 +129,7 @@ Create Temporal Representation Of Entity Output response Retrieve Temporal Representation Of Entity - [Arguments] ${temporal_entity_representation_id} ${attrs}=${EMPTY} ${options}=${EMPTY} ${context}=${EMPTY} ${timerel}=${EMPTY} ${time}=${EMPTY} ${endTime}=${EMPTY} ${lastN}=${EMPTY} + [Arguments] ${temporal_entity_representation_id} ${attrs}=${EMPTY} ${options}=${EMPTY} ${context}=${EMPTY} ${timerel}=${EMPTY} ${timeAt}=${EMPTY} ${endTimeAt}=${EMPTY} ${lastN}=${EMPTY} ${attrs_length} = Get Length ${attrs} ${options_length} = Get Length ${options} &{headers}= Create Dictionary @@ -139,8 +139,8 @@ Retrieve Temporal Representation Of Entity Run Keyword If ${attrs_length}>0 Set To Dictionary ${params} attrs=${attrs} Run Keyword If ${options_length}>0 Set To Dictionary ${params} options=${options} Run Keyword If '${timerel}'!='' Set To Dictionary ${params} timerel=${timerel} - Run Keyword If '${time}'!='' Set To Dictionary ${params} timeAt=${time} - Run Keyword If '${endTime}'!='' Set To Dictionary ${params} endTimeAt=${endTime} + Run Keyword If '${timeAt}'!='' Set To Dictionary ${params} timeAt=${timeAt} + Run Keyword If '${endTimeAt}'!='' Set To Dictionary ${params} endTimeAt=${endTimeAt} Run Keyword If '${lastN}'!='' Set To Dictionary ${params} lastN=${lastN} ${response}= GET ${TEMPORAL_ENTITIES_ENDPOINT_PATH}/${temporal_entity_representation_id} headers=${headers} query=${params} -- GitLab