Commits (30)
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Generate Documentation Data" type="PythonConfigurationType" factoryName="Python">
<module name="ngsi-ld-test-suite" />
<option name="ENV_FILES" value="" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs>
......
......@@ -2,22 +2,22 @@ Copyright 2021 ETSI
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors
may be used to endorse or promote products derived from this software without
3. Neither the name of the copyright holder nor the names of its contributors
may be used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
OF THE POSSIBILITY OF SUCH DAMAGE.
......@@ -84,6 +84,20 @@ Docker host.
``` ifconfig docker0 | grep inet | awk '{print $2}' ``` and that IP is the one that you need to use for
notification purposes.
Optionally, there are some extra variables that can be used during the generation of execution results of the Test
Case with a specific Robot Listener class to automatically generate a GitHub Issue in the GitHub repository of the
Context Broker of a failed Test Case. In case that you cannot or do not want to use this functionality, delete those
variables from the file.
As an explanation of the process, the GitHub Issue will be created if there is no other issue in the repository with
the same name or there is an issue with the same name, but it is not closed.
In order to create these issues, the [GitHub REST API](https://docs.github.com/en/rest) is used. For this purpose,
the authentication process is using a personal access token. The needed variables are the following:
* `github_owner`: Your GitHub user account.
* `github_broker_repo` : The corresponding URL of the Context Broker repository.
* `github_token` : Your personal access token. Please take a look to the GitHub documentation if you want to generate
your own [personal access token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens).
## Execute the NGSI-LD Test Suite
......@@ -131,6 +145,103 @@ test launch command followed by the file name.
> > .venv\scripts\deactivate.bat
> ```
## Test Suite Management (tsm)
The `tsm` script is designed to facilitate the selection and execution of the Test Suite, especially if not all the
endpoints of the API have been implemented for a specific Context Broker. This script provides a set of commands
to enable or disable Test Cases, Robot Test Suites or Collections (Robot Test Suite Groups), visualize the current
status of the different Test Cases, execute the selected Test Cases and perform other related operations as described
below.
The `tsm` script generates a pickle file named `tsm.pkl`, which stores the tuples list corresponding to each Test Case
with the following information:
(switch, running status, Test Case long name)
where the values and their meaning are the following:
* **switch**:
* `ON`: the Test Case is on, which means that it will be executed by the script.
* `OFF`: the Test Case is off, and therefore is not selected to be executed by the script.
* `MISSING`: the Test Case is not anymore in the Test Suite Structure. An update operation should be run to update
the `tsm.pkl` with the current set of available Test Cases in the filesystem.
* `NEW`: new Test Case discovered by the tsm after an update operation.
* **status**:
* `PASSED`: the robot framework executes the Test Case with result PASS.
* `FAILED`: the robot framework executes the Test Case with result FAIL.
* `PENDING`: the Test Case is pending to be executed by the robot framework.
* **test case long name**: the Test Case long name set by robot framework based on the Robot Test Suite number and
the Test Case name (e.g., NGSILD.032 02.032_02_01 Delete Unknown Subscription)
### Installation
The `tsm` script is integrated with arguments auto-completion for bash, therefore it is needed the installation of
the argcomplete python package on your system:
pip install argcomplete
and to enable the completion after the installation executing the following command:
activate-global-python-argcomplete
and then
eval "$(register-python-argcomplete tsm)"
Now, it is possible to autocomplete the commands and show possible options executing the script. Also –help argument
is available to obtain more information about the options.
### Execution
The tsm cases update command updates the `tsm.pkl` file with all the Robot Test Suite under the local path. If the
pickle file does not exist, it is created. After the creation of this file, it is possible to execute the script
to maintain and run the selected Test Cases from the pickle file. The list of commands is the following:
* **Test Cases (cases)**
* Switch ON Test Cases
tsm cases on [test_cases]
* Switch OFF Test Cases
tsm cases off [test_cases]
tsm cases off "NGSILD.032 01.032_01_02 InvalidId"
* List Test Cases based on the specific flag.
tsm cases list [on, off, missing, new, passed, failed, pending, all]
tsm cases list ./TP/NGSI-LD/CommonBehaviours
* Run Test Cases that are enabled
tsm cases run [on, off, missing, new, passed, failed, pending, [test_cases]]
tsm cases run NGSILD.048\ 01.048_01_06\ Endpoint\ post\ /temporal/entities/
tsm cases run pending
* Update the pickle file with the current Test Cases
tsm cases update
* Clean Test Cases, remove the Test Cases that were marked as MISSING
tsm cases clean
* **Robot Test Suites (suites)**
* Switch ON Robot Test Suites
tsm suites on [suites]
* Switch OFF Robot Test Suites
tsm suites off [suites]
* **Test Collections (collections)**
* Switch ON Test Collections
tsm collections on [collections]
tsm collections on ./TP/NGSI-LD/CommonBehaviours
* Switch OFF Test Collections
tsm collections off [collections]
## Contribute to the Test Suite
......@@ -324,7 +435,18 @@ And, if you want to generate a documentation for the Test Cases:
```$ python3 -m robot.testdoc TP/NGSI-LD api_docs/TestCases.html```
### Coding Style of Test Suites
## Generate output file details only for failed tests
It is possible to generate a report only for the failed tests through the use of a specific listener in the execution
of the robot framework. For example, if you want to execute the test suite number 043 and generate the report, you can
execute the following command:
```robot --listener libraries/ErrorListener.py --outputdir ./results ./TP/NGSI-LD/CommonBehaviours/043.robot```
It will generate a specific `errors.log` file into the `results` folder with the description of the different steps
developed and the mismatched observed on them.
## Coding Style of Test Suites
And if you want to tidy (code style) the Test Suites:
......
......@@ -29,7 +29,7 @@ ${content_type}= application/json
*** Test Cases ***
045_01_01 Endpoint /entities/{entityId}
[Documentation] Verify that on a GET HTTP request if nothing is specified on the Accept header, "application/json" is assumed (/entities/{entityId})
[Tags] e-query 6_3_4
[Tags] e-query cb-get 6_3_4
${id}= Generate Random Entity Id ${building_id_prefix}
${response}= Create Entity Selecting Content Type
... ${building_filename}
......@@ -47,7 +47,7 @@ ${content_type}= application/json
045_01_02 Endpoint /subscriptions/{subscriptionId}
[Documentation] Verify that on a GET HTTP request if nothing is specified on the Accept header, "application/json" is assumed (/subscriptions/{subscriptionId})
[Tags] sub-retrieve 6_3_4
[Tags] sub-retrieve cb-get 6_3_4
${id}= Generate Random Entity Id ${subscription_id_prefix}
${response}= Create Subscription ${id} ${subscription_filename} ${CONTENT_TYPE_LD_JSON}
Check Response Status Code 201 ${response.status_code}
......@@ -61,7 +61,7 @@ ${content_type}= application/json
045_01_03 Endpoint /csourceRegistrations/
[Documentation] Verify that on a GET HTTP request if nothing is specified on the Accept header, "application/json" is assumed (/csourceRegistrations/)
[Tags] csr-query 6_3_4
[Tags] csr-query cb-get 6_3_4
${registration_id}= Generate Random Entity Id ${registration_id_prefix}
${payload}= Load JSON From File ${EXECDIR}/data/${registration_filename}
${updated_payload}= Update Value To JSON ${payload} $..id ${registration_id}
......@@ -79,7 +79,7 @@ ${content_type}= application/json
045_01_04 Endpoint /temporal/entities
[Documentation] Verify that on a GET HTTP request if nothing is specified on the Accept header, "application/json" is assumed (/temporal/entities)
[Tags] te-query 6_3_4
[Tags] te-query cb-get 6_3_4
${temporal_entity_representation_id}= Generate Random Entity Id ${tea_id_prefix}
${response}= Create Or Update Temporal Representation Of Entity Selecting Content Type
... temporal_entity_representation_id=${temporal_entity_representation_id}
......
......@@ -24,7 +24,7 @@ ${registration_filename}= csourceRegistrations/context-source-registration
*** Test Cases ***
043_01_01 Create entity
[Documentation] Verify receiving 503 – LdContextNotAvailable error if remote JSON-LD @context cannot be retrieved (Create entity)
[Tags] e-create 5_2_2
[Tags] e-create cb-ldcontext 5_2_2
${entity_id}= Generate Random Entity Id ${building_id_prefix}
${response}= Create Entity Selecting Content Type
... ${building_filename}
......@@ -39,7 +39,7 @@ ${registration_filename}= csourceRegistrations/context-source-registration
043_01_02 Create subscription
[Documentation] Verify receiving 503 – LdContextNotAvailable error if remote JSON-LD @context cannot be retrieved (Create subscription)
[Tags] sub-create 5_2_2
[Tags] sub-create cb-ldcontext 5_2_2
${subscription_id}= Generate Random Entity Id ${subscription_id_prefix}
${response}= Create Subscription ${subscription_id} ${subscription_filename} ${CONTENT_TYPE_LD_JSON}
Check Response Status Code ${expected_status_code} ${response.status_code}
......@@ -51,7 +51,7 @@ ${registration_filename}= csourceRegistrations/context-source-registration
043_01_03 Create Temporal Representation of Entities
[Documentation] Verify receiving 503 – LdContextNotAvailable error if remote JSON-LD @context cannot be retrieved (Create Temporal Representation of Entities)
[Tags] te-create 5_2_2
[Tags] te-create cb-ldcontext 5_2_2
${temporal_entity_representation_id}= Generate Random Entity Id ${tea_id_prefix}
${response}= Create Or Update Temporal Representation Of Entity Selecting Content Type
... temporal_entity_representation_id=${temporal_entity_representation_id}
......@@ -66,7 +66,7 @@ ${registration_filename}= csourceRegistrations/context-source-registration
043_01_04 Batch entity create
[Documentation] Verify receiving 503 – LdContextNotAvailable error if remote JSON-LD @context cannot be retrieved (Batch entity create)
[Tags] be-create 5_2_2
[Tags] be-create cb-ldcontext 5_2_2
${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_filename} ${first_entity_id}
......@@ -83,7 +83,7 @@ ${registration_filename}= csourceRegistrations/context-source-registration
043_01_05 Create context source registration
[Documentation] Verify receiving 503 – LdContextNotAvailable error if remote JSON-LD @context cannot be retrieved (Create context source registration)
[Tags] csr-create 5_2_2
[Tags] csr-create cb-ldcontext 5_2_2
${registration_id}= Generate Random Entity Id ${registration_id_prefix}
${payload}= Load JSON From File ${EXECDIR}/data/${registration_filename}
${updated_payload}= Update Value To JSON ${payload} $..id ${registration_id}
......
......@@ -19,7 +19,7 @@ ${attribute_id}= brandName
*** Test Cases ***
044_01_01 endpoint /entities/{entityId}/attrs/{attrId}
[Documentation] Verify that PATCH HTTP requests can be done with "application/merge-patch+json" as Content-Type
[Tags] ea-partial-update 6_3_4
[Tags] ea-partial-update cb-mergepatch 6_3_4
${response}= Partial Update Entity Attributes
... entityId=${entity_id}
... attributeId=${attribute_id}
......
......@@ -19,7 +19,7 @@ ${subscription_fragment}= subscriptions/fragments/subscription-update-samp
*** Test Cases ***
044_02_01 Endpoint /subscriptions/{subscriptionId}
[Documentation] Verify that PATCH HTTP requests can be done with "application/merge-patch+json" as Content-Type
[Tags] sub-update 6_3_4
[Tags] sub-update cb-mergepatch 6_3_4
${response}= Update Subscription
... ${subscription_id}
... ${subscription_fragment}
......
......@@ -21,7 +21,7 @@ ${subscription_id_prefix}= urn:ngsi-ld:Subscription:
*** Test Cases ***
049_01_01 Endpoint get /entities/{entityId}
[Documentation] Verify throwing 406 HTTP status code (Not Acceptable Media Type) if the "Accept" header does not imply "application/json" nor "application/ld+json" (get /entities/{entityId})
[Tags] e-query 6_3_4
[Tags] e-query cb-noacceptable-medtype 6_3_4
${entity_id}= Generate Random Entity Id ${building_id_prefix}
${response}= Query Entity
... id=${entity_id}
......@@ -31,7 +31,7 @@ ${subscription_id_prefix}= urn:ngsi-ld:Subscription:
049_01_02 Endpoint get /subscriptions/{subscriptionId}
[Documentation] Verify throwing 406 HTTP status code (Not Acceptable Media Type) if the "Accept" header does not imply "application/json" nor "application/ld+json" (get /subscriptions/{subscriptionId})
[Tags] sub-retrieve 6_3_4
[Tags] sub-retrieve cb-noacceptable-medtype 6_3_4
${id}= Generate Random Entity Id ${subscription_id_prefix}
${response}= Retrieve Subscription
... id=${id}
......@@ -41,19 +41,19 @@ ${subscription_id_prefix}= urn:ngsi-ld:Subscription:
049_01_03 Endpoint get /csourceRegistrations/
[Documentation] Verify throwing 406 HTTP status code (Not Acceptable Media Type) if the "Accept" header does not imply "application/json" nor "application/ld+json" (get /csourceRegistrations/)
[Tags] csr-query 6_3_4
[Tags] csr-query cb-noacceptable-medtype 6_3_4
${response}= Query Context Source Registrations With Return type=Building accept=${accept}
Check Response Status Code ${status_code} ${response.status_code}
049_01_04 Endpoint get /csourceSubscriptions/
[Documentation] Verify throwing 406 HTTP status code (Not Acceptable Media Type) if the "Accept" header does not imply "application/json" nor "application/ld+json" (get /csourceSubscriptions/)
[Tags] csrsub-query 6_3_4
[Tags] csrsub-query cb-noacceptable-medtype 6_3_4
${response}= Query Context Source Registration Subscriptions accept=${accept}
Check Response Status Code ${status_code} ${response.status_code}
049_01_05 Endpoint get /temporal/entities
[Documentation] Verify throwing 406 HTTP status code (Not Acceptable Media Type) if the "Accept" header does not imply "application/json" nor "application/ld+json" (get /temporal/entities)
[Tags] te-query 6_3_4
[Tags] te-query cb-noacceptable-medtype 6_3_4
${entity_types_to_be_retrieved}= Catenate SEPARATOR=, Vehicle
${response}= Query Temporal Representation Of Entities
... entity_types=${entity_types_to_be_retrieved}
......
......@@ -17,7 +17,7 @@ ${subscription_id_prefix}= urn:ngsi-ld:Subscription:
*** Test Cases ***
049_02_01 Retrieve subscription by id
[Documentation] Verify throwing 406 HTTP status code (Not Acceptable Media Type) if the "Accept" header is "application/geo+json" for operations different than "Retrieve Entity" and "Query Entity" (get /subscriptions/{subscriptionId})
[Tags] sub-retrieve 6_3_4
[Tags] sub-retrieve cb-noacceptable-medtype 6_3_4
${id}= Generate Random Entity Id ${subscription_id_prefix}
${response}= Retrieve Subscription
... id=${id}
......@@ -26,7 +26,7 @@ ${subscription_id_prefix}= urn:ngsi-ld:Subscription:
049_02_02 Query temporal entities
[Documentation] Verify throwing 406 HTTP status code (Not Acceptable Media Type) if the "Accept" header is "application/geo+json" for operations different than "Retrieve Entity" and "Query Entity" (get /temporal/entities)
[Tags] te-query 6_3_4
[Tags] te-query cb-noacceptable-medtype 6_3_4
${entity_types_to_be_retrieved}= Catenate SEPARATOR=, Vehicle
${response}= Query Temporal Representation Of Entities
... entity_types=${entity_types_to_be_retrieved}
......@@ -37,6 +37,6 @@ ${subscription_id_prefix}= urn:ngsi-ld:Subscription:
049_02_03 Query context source registration
[Documentation] Verify throwing 406 HTTP status code (Not Acceptable Media Type) if the "Accept" header is "application/geo+json" for operations different than "Retrieve Entity" and "Query Entity" (get /csourceRegistrations)
[Tags] csr-query 6_3_4
[Tags] csr-query cb-noacceptable-medtype 6_3_4
${response}= Query Context Source Registrations With Return type=Building accept=${accept}
Check Response Status Code ${status_code} ${response.status_code}
......@@ -26,7 +26,7 @@ ${content_type}= application/xml
*** Test Cases ***
048_01_01 Endpoint patch /entities/{entityId}/attrs/{attrId}
[Documentation] Verify throwing 415 HTTP status code (Unsupported Media Type) if "Content-Type" header is not "application/json" or "application/ld+json" (patch /entities/{entityId}/attrs/{attrId})
[Tags] ea-partial-update 6_3_4
[Tags] ea-partial-update cb-unsupport-medtype 6_3_4
${entity_id}= Generate Random Entity Id ${vehicle_id_prefix}
${response}= Partial Update Entity Attributes
... entityId=${entity_id}
......@@ -38,7 +38,7 @@ ${content_type}= application/xml
048_01_02 Endpoint patch /subscriptions/{subscriptionId}
[Documentation] Verify throwing 415 HTTP status code (Unsupported Media Type) if "Content-Type" header is not "application/json" or "application/ld+json" (patch /subscriptions/{subscriptionId})
[Tags] sub-update 6_3_4
[Tags] sub-update cb-unsupport-medtype 6_3_4
${id}= Generate Random Entity Id ${subscription_id_prefix}
${response}= Update Subscription ${id} ${subscription_fragment} ${content_type}
Check Response Status Code 415 ${response.status_code}
......@@ -46,7 +46,7 @@ ${content_type}= application/xml
048_01_03 Endpoint post /entities/
[Documentation] Verify throwing 415 HTTP status code (Unsupported Media Type) if "Content-Type" header is not "application/json" or "application/ld+json" (post /entities/)
[Tags] e-create 6_3_4
[Tags] e-create cb-unsupport-medtype 6_3_4
${entity_id}= Generate Random Entity Id ${building_id_prefix}
${response}= Create Entity Selecting Content Type
... ${building_filename}
......@@ -57,7 +57,7 @@ ${content_type}= application/xml
048_01_04 Endpoint post /subscriptions/
[Documentation] Verify throwing 415 HTTP status code (Unsupported Media Type) if "Content-Type" header is not "application/json" or "application/ld+json" (post /subscriptions/)
[Tags] sub-create 6_3_4
[Tags] sub-create cb-unsupport-medtype 6_3_4
${subscriptions_id}= Generate Random Entity Id ${subscription_id_prefix}
${response}= Create Subscription ${subscriptions_id} ${subscription_filename} ${content_type}
Check Response Status Code 415 ${response.status_code}
......@@ -65,7 +65,7 @@ ${content_type}= application/xml
048_01_05 Endpoint post /entityOperations/create
[Documentation] Verify throwing 415 HTTP status code (Unsupported Media Type) if "Content-Type" header is not "application/json" or "application/ld+json" (post /entityOperations/create)
[Tags] be-create 6_3_4
[Tags] be-create cb-unsupport-medtype 6_3_4
${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_filename} ${first_entity_id}
......@@ -78,7 +78,7 @@ ${content_type}= application/xml
048_01_06 Endpoint post /temporal/entities/
[Documentation] Verify throwing 415 HTTP status code (Unsupported Media Type) if "Content-Type" header is not "application/json" or "application/ld+json" (post /temporal/entities/)
[Tags] te-create 6_3_4
[Tags] te-create cb-unsupport-medtype 6_3_4
${temporal_entity_representation_id}= Generate Random Entity Id ${tea_id_prefix}
${response}= Create Or Update Temporal Representation Of Entity Selecting Content Type
... temporal_entity_representation_id=${temporal_entity_representation_id}
......
*** Settings ***
Documentation Check that you can query several entities based on scopes
Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource
Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource
Resource ${EXECDIR}/resources/AssertionUtils.resource
Resource ${EXECDIR}/resources/JsonUtils.resource
Suite Setup Setup Initial Entities
Suite Teardown Delete Entities
Test Template Query several entities based on scopes
*** Variables ***
${building_id_prefix}= urn:ngsi-ld:Building:
${entity_one_scope}= building-minimal-with-one-scope.json
${entity_many_scopes}= building-minimal-with-many-scopes.json
${entity_type}= https://ngsi-ld-test-suite/context#Building
*** Test Cases *** SCOPEQ EXPECTED_COUNT
019_01_06 QueryWithFullScope
[Tags] e-query 4_19 since_v1.5.1
/Madrid/Gardens/ParqueNorte ${2}
019_01_06 QueryWithPlusMatching
[Tags] e-query 4_19 since_v1.5.1
/Madrid/+/ParqueNorte ${2}
019_01_06 QueryWithHashMatching
[Tags] e-query 4_19 since_v1.5.1
/CompanyA/# ${1}
019_01_06 QueryNonEmptyScope
[Tags] e-query 4_19 since_v1.5.1
/# ${2}
019_01_06 QueryWithAndScope
[Tags] e-query 4_19 since_v1.5.1
/Madrid/Gardens/ParqueNorte;/CompanyA/OrganizationB/UnitC ${1}
019_01_06 QueryWithOrScope
[Tags] e-query 4_19 since_v1.5.1
/Madrid/Gardens/ParqueNorte,/CompanyA/OrganizationB/UnitC ${2}
*** Keywords ***
Query several entities based on scopes
[Documentation] Check that you can query several entities based on scopes
[Arguments] ${scopeq} ${expected_count}
${response}= Query Entities
... scopeq=${scopeq}
... entity_types=${entity_type}
Check Response Status Code 200 ${response.status_code}
Check Response Body Containing Number Of Entities ${entity_type} ${expected_count} ${response.json()}
Setup Initial Entities
${entity_one_scope_id}= Generate Random Entity Id ${building_id_prefix}
Set Suite Variable ${entity_one_scope_id}
Create Entity Selecting Content Type
... ${entity_one_scope}
... ${entity_one_scope_id}
... ${CONTENT_TYPE_JSON}
... ${ngsild_test_suite_context}
${entity_many_scopes_id}= Generate Random Entity Id ${building_id_prefix}
Set Suite Variable ${entity_many_scopes_id}
Create Entity Selecting Content Type
... ${entity_many_scopes}
... ${entity_many_scopes_id}
... ${CONTENT_TYPE_JSON}
... ${ngsild_test_suite_context}
Delete Entities
Delete Entity by Id ${entity_one_scope_id}
Delete Entity by Id ${entity_many_scopes_id}
*** Settings ***
Documentation Query entities with Entity Type Selection Language.
Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource
Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource
Resource ${EXECDIR}/resources/AssertionUtils.resource
Resource ${EXECDIR}/resources/JsonUtils.resource
Suite Setup Setup Initial Entities
Suite Teardown Delete Initial Entities
Test Template Query entities using Entity Type Selection Language
*** Variables ***
${entity_id_prefix} urn:ngsi-ld:MultiTypes:
${first_entity_filename} building-simple-attributes-sample.jsonld
${second_entity_filename} building-with-different-type-sample.jsonld
${third_entity_filename} building-with-two-types-sample.jsonld
${building_entity_type} Building
${parking_entity_type} Parking
${tourist_destination_entity_type} TouristDestination
*** Test Cases *** ENTITY_TYPES_SELECTION EXPECTED_ENTITIES_IDS
019_08_01 query with one type ${building_entity_type} ${first_entity_id},${third_entity_id}
019_08_02 query with the AND operator (${building_entity_type};${tourist_destination_entity_type}) ${third_entity_id}
019_08_03 query with the OR operator ${building_entity_type},${parking_entity_type} ${first_entity_id},${second_entity_id},${third_entity_id}
019_08_04 different query with the OR operator ${parking_entity_type},${tourist_destination_entity_type} ${second_entity_id},${third_entity_id}
019_08_05 query with two operators (${building_entity_type};${parking_entity_type}),${tourist_destination_entity_type} ${third_entity_id}
*** Keywords ***
Query entities using Entity Type Selection Language
[Documentation] Query entities with Entity Type Selection Language.
[Tags] e-query 4_17 5_7_2 since_v1.5.1
[Arguments] ${entity_types_selection} ${expected_entities_ids}
${entities_ids}= Split String ${expected_entities_ids} ,
@{entities_ids_list}= Create List ${entities_ids}
${response}= Query Entities
... entity_types=${entity_types_selection}
... context=${ngsild_test_suite_context}
Check Response Status Code 200 ${response.status_code}
Check Response Body Containing Entities URIS set to
... @{entities_ids_list}
... ${response.json()}
Setup Initial Entities
${first_entity_id}= Generate Random Entity Id ${entity_id_prefix}
Set Suite Variable ${first_entity_id}
${create_response1}= Create Entity Selecting Content Type
... ${first_entity_filename}
... ${first_entity_id}
... ${CONTENT_TYPE_LD_JSON}
Check Response Status Code 201 ${create_response1.status_code}
${second_entity_id}= Generate Random Entity Id ${entity_id_prefix}
Set Suite Variable ${second_entity_id}
${create_response2}= Create Entity Selecting Content Type
... ${second_entity_filename}
... ${second_entity_id}
... ${CONTENT_TYPE_LD_JSON}
Check Response Status Code 201 ${create_response2.status_code}
${third_entity_id}= Generate Random Entity Id ${entity_id_prefix}
Set Suite Variable ${third_entity_id}
${create_response3}= Create Entity Selecting Content Type
... ${third_entity_filename}
... ${third_entity_id}
... ${CONTENT_TYPE_LD_JSON}
Check Response Status Code 201 ${create_response3.status_code}
Delete Initial Entities
Delete Entity by Id ${first_entity_id}
Delete Entity by Id ${second_entity_id}
Delete Entity by Id ${third_entity_id}
*** Settings ***
Documentation Check that you can retrieve an entity using Language Filter
Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource
Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource
Resource ${EXECDIR}/resources/AssertionUtils.resource
Resource ${EXECDIR}/resources/JsonUtils.resource
Suite Setup Create Initial Entity
Suite Teardown Delete Created Entity
Test Template Retrieve Entity With Language Filter
*** Variables ***
${building_id_prefix}= urn:ngsi-ld:Building:
${filename}= building-language-property-sample.jsonld
*** Test Cases *** LANGUAGE_FILTER OPTIONS EXPECTATION_FILENAME
018_07_01 Retrieve an entity using a specific natural language
[Tags] e-retrieve 5_7_1 4_15 since_v1.4.1
fr ${EMPTY} building-language-property-fr-filter.jsonld
018_07_02 Retrieve an entity using multiple natural languages with no ranked preference
[Tags] e-retrieve 5_7_1 4_15 since_v1.4.1
fr-CH,fr ${EMPTY} building-language-property-fr-filter.jsonld
018_07_03 Retrieve an entity with any supported language
[Tags] e-retrieve 5_7_1 4_15 since_v1.4.1
* ${EMPTY} building-language-property-any-language-filter.jsonld
018_07_04 Retrieve an entity using multiple natural languages with ranked preferences
[Tags] e-retrieve 5_7_1 4_15 since_v1.4.1
fr-CH,fr;q=0.9,en;q=0.8,*;q=0.5 ${EMPTY} building-language-property-fr-filter.jsonld
018_07_05 Retrieve an entity using a specific natural language with simplified representation
[Tags] e-retrieve 5_7_1 4_15 since_v1.4.1
fr keyValues building-language-property-fr-filter-simplified.jsonld
018_07_06 Retrieve an entity with any supported language with simplified representation
[Tags] e-retrieve 5_7_1 4_15 since_v1.4.1
* keyValues building-language-property-any-language-filter-simplified.jsonld
*** Keywords ***
Retrieve Entity With Language Filter
[Documentation] Check that you can retrieve an entity using Language Filter
[Arguments] ${language_filter} ${options} ${expectation_filename}
${response}= Query Entity
... id=${entity_id}
... accept=${CONTENT_TYPE_LD_JSON}
... context=${ngsild_test_suite_context}
... options=${options}
... lang=${language_filter}
Check Response Status Code 200 ${response.status_code}
Check Response Body Containing Entity element
... ${expectation_filename}
... ${entity_id}
... ${response.json()}
... ${True}
Create Initial Entity
${entity_id}= Generate Random Entity Id ${building_id_prefix}
Set Suite Variable ${entity_id}
${response}= Create Entity Selecting Content Type
... ${filename}
... ${entity_id}
... ${CONTENT_TYPE_LD_JSON}
Check Response Status Code 201 ${response.status_code}
Delete Created Entity
Delete Entity by Id ${entity_id}
*** Settings ***
Documentation Check that you can retrieve the temporal evolution of an entity with the aggregated temporal representation
Resource ${EXECDIR}/resources/ApiUtils/TemporalContextInformationConsumption.resource
Resource ${EXECDIR}/resources/ApiUtils/TemporalContextInformationProvision.resource
Resource ${EXECDIR}/resources/AssertionUtils.resource
Resource ${EXECDIR}/resources/JsonUtils.resource
Suite Setup Create Temporal Entity
Suite Teardown Delete Initial Temporal Entity
Test Template Retrieve the temporal evolution of an entity with the aggregated temporal representation
*** Variables ***
${vehicule_id_prefix}= urn:ngsi-ld:Vehicle:
${vehicle_payload_file}= 2020-08-vehicule-temporal-representation-sample.jsonld
*** Test Cases *** AGGRMETHODS AGGRPERIODDURATION ATTRS VEHICLE_EXPECTATION_FILE
020_11_01 One aggregate method aggregated by one hour duration
[Tags] te-retrieve 5_7_3 4_5_19 since_v1.4.1
avg PT1H ${EMPTY} vehicle-temporal-representation-020-11-01-expectation.json
020_11_02 One aggregate method aggregated by one hour duration asking for one attribute
[Tags] te-retrieve 5_7_3 4_5_19 since_v1.4.1
avg PT1H fuelLevel vehicle-temporal-representation-020-11-02-expectation.json
020_11_03 Multiple aggregate methods aggregated by one hour duration
[Tags] te-retrieve 5_7_3 4_5_19 since_v1.4.1
avg,max PT1H ${EMPTY} vehicle-temporal-representation-020-11-03-expectation.json
020_11_04 Multiple aggregate methods aggregated by one day duration
[Tags] te-retrieve 5_7_3 4_5_19 since_v1.4.1
min,max P1D ${EMPTY} vehicle-temporal-representation-020-11-04-expectation.json
*** Keywords ***
Retrieve the temporal evolution of an entity with the aggregated temporal representation
[Documentation] Check that you can retrieve the temporal evolution of an entity with the aggregated temporal representation
[Arguments] ${aggrmethods} ${aggrperiodduration} ${attrs} ${vehicle_expectation_file}
@{options}= Create List aggregatedValues
${response}= Retrieve Temporal Representation Of Entity
... temporal_entity_representation_id=${temporal_entity_representation_id}
... attrs=${attrs}
... options=${options}
... aggrMethods=${aggrmethods}
... aggrPeriodDuration=${aggrperiodduration}
... context=${ngsild_test_suite_context}
Check Response Status Code 200 ${response.status_code}
Check Response Body Containing EntityTemporal element
... ${vehicle_expectation_file}
... ${temporal_entity_representation_id}
... ${response.json()}
Create Temporal Entity
${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 Temporal Entity
Delete Temporal Representation Of Entity ${temporal_entity_representation_id}
*** Settings ***
Documentation Check that you can retrieve the temporal evolution of an entity with a LanguageProperty property
Resource ${EXECDIR}/resources/ApiUtils/TemporalContextInformationConsumption.resource
Resource ${EXECDIR}/resources/ApiUtils/TemporalContextInformationProvision.resource
Resource ${EXECDIR}/resources/AssertionUtils.resource
Resource ${EXECDIR}/resources/JsonUtils.resource
Suite Setup Create Temporal Entity
Suite Teardown Delete Initial Temporal Entity
Test Template Retrieve Temporal Entity
*** Variables ***
${vehicule_id_prefix}= urn:ngsi-ld:Vehicle:
${vehicle_payload_file}= vehicle-language-property-temporal-representation-sample.jsonld
*** Test Cases *** REPRESENTATION EXPECTATION_FILENAME
020_12_01 Retrieve the normalized temporal representation of an entity with a LanguageProperty property
[Tags] te-retrieve 5_7_3 4_5_7 4_5_18 since_v1.4.1
${EMPTY} vehicle-language-property-normalized-temporal-representation-expectation.jsonld
020_12_02 Retrieve the simplified temporal representation of an entity with a LanguageProperty property
[Tags] te-retrieve 5_7_3 4_5_9 4_5_18 since_v1.4.1
temporalValues vehicle-language-property-simplified-temporal-representation-expectation.jsonld
*** Keywords ***
Retrieve Temporal Entity
[Documentation] Check that you can retrieve the temporal evolution of an entity with a LanguageProperty property
[Arguments] ${representation} ${expectation_filename}
${response}= Retrieve Temporal Representation Of Entity
... temporal_entity_representation_id=${temporal_entity_representation_id}
... options=${representation}
... context=${ngsild_test_suite_context}
Check Response Status Code 200 ${response.status_code}
Check Response Body Containing EntityTemporal element
... ${expectation_filename}
... ${temporal_entity_representation_id}
... ${response.json()}
Create Temporal Entity
${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 Temporal Entity
Delete Temporal Representation Of Entity ${temporal_entity_representation_id}
*** Settings ***
Documentation Check that you can create a batch of entities where two have the same id
Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource
Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource
Resource ${EXECDIR}/resources/AssertionUtils.resource
Resource ${EXECDIR}/resources/JsonUtils.resource
Test Teardown Delete Entities
*** Variables ***
${building_id_prefix}= urn:ngsi-ld:Building:
*** Test Cases ***
003_10_01 Create a batch of three valid entities where two have the same id
[Documentation] Check that you can create a batch of entities where two have the same id
[Tags] be-create 5_6_7 since_v1.5.1
${first_entity_id}= Generate Random Entity Id ${building_id_prefix}
Set Suite Variable ${first_entity_id}
${second_entity_id}= Generate Random Entity Id ${building_id_prefix}
Set Suite Variable ${second_entity_id}
${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} ${first_entity}
${response}= Batch Create Entities @{entities_to_be_created}
@{expected_successful_entities_ids}= Create List ${first_entity_id} ${second_entity_id}
Set Test Variable @{expected_successful_entities_ids}
@{expected_failed_entities_ids}= Create List ${first_entity_id}
&{expected_batch_operation_result}= Create Batch Operation Result
... ${expected_successful_entities_ids}
... ${expected_failed_entities_ids}
Check Response Status Code 207 ${response.status_code}
Check Response Body Containing Batch Operation Result ${expected_batch_operation_result} ${response.json()}
*** Keywords ***
Delete Entities
${response}= Batch Delete Entities
... entities_ids_to_be_deleted=@{expected_successful_entities_ids}
*** Settings ***
Documentation Check that you can delete a batch of entities with the same id
Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource
Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource
Resource ${EXECDIR}/resources/AssertionUtils.resource
Resource ${EXECDIR}/resources/JsonUtils.resource
Test Setup Setup Initial Entity
*** Variables ***
${building_id_prefix}= urn:ngsi-ld:Building:
*** Test Cases ***
006_04_01 Delete a batch of existing entities with the same id
[Documentation] Check that you can delete a batch entities with the same id
[Tags] be-delete 5_6_10 since_v1.5.1
${new_entity_id}= Generate Random Entity Id ${building_id_prefix}
@{entities_ids_to_be_deleted}= Create List ${entity_id} ${entity_id}
${response}= Batch Delete Entities entities_ids_to_be_deleted=@{entities_ids_to_be_deleted}
@{expected_successful_entities_ids}= Create List ${entity_id}
@{expected_failed_entities_ids}= Create List ${entity_id}
&{response1}= Create Batch Operation Result
... ${expected_successful_entities_ids}
... ${expected_failed_entities_ids}
Check Response Status Code 207 ${response.status_code}
Check Response Body Containing Batch Operation Result ${response1} ${response.json()}
*** Keywords ***
Setup Initial Entity
${entity_id}= Generate Random Entity Id ${building_id_prefix}
Create Entity building-simple-attributes-sample.jsonld ${entity_id}
Set Test Variable ${entity_id}
*** Settings ***
Documentation Check that you can upsert a batch of entities where two have the same id
Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource
Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource
Resource ${EXECDIR}/resources/AssertionUtils.resource
Resource ${EXECDIR}/resources/JsonUtils.resource
Test Teardown Delete Entities
*** Variables ***
${building_id_prefix}= urn:ngsi-ld:Building:
*** Test Cases ***
004_07_01 Upsert a batch of three valid entities where two have the same id
[Documentation] Check that you can upsert a batch of where two have the same id
[Tags] be-upsert 5_6_8 since_v1.5.1
${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} ${first_entity}
${response}= Batch Upsert Entities @{entities_to_be_upserted}
@{expected_successful_entities_ids}= Create List ${first_entity_id} ${second_entity_id}
Set Test Variable @{expected_successful_entities_ids}
Check Response Status Code 201 ${response.status_code}
Check Response Body Containing Array Of URIs set to ${expected_successful_entities_ids} ${response.json()}
*** Keywords ***
Delete Entities
${response}= Batch Delete Entities
... entities_ids_to_be_deleted=@{expected_successful_entities_ids}
......@@ -17,7 +17,7 @@ ${building_id_prefix}= urn:ngsi-ld:Building:
*** Test Cases *** FILENAME CONTENT_TYPE
001_01_01 MinimalEntity
[Tags] e-create 5_6_1
building-minimal-without-context-sample.jsonld application/json
building-minimal-sample.json application/json
001_01_02 EntityWithSimpleProperties
[Tags] e-create 5_6_1
building-simple-attributes-sample.jsonld application/ld+json
......
......@@ -16,7 +16,7 @@ Test Template Create Entity With Invalid Request Scenarios
empty-sample.jsonld ${ERROR_TYPE_INVALID_REQUEST}
001_02_03 EntityWithNoContext
[Tags] e-create 5_6_1
building-minimal-without-context-sample.jsonld ${ERROR_TYPE_BAD_REQUEST_DATA}
building-minimal-sample.json ${ERROR_TYPE_BAD_REQUEST_DATA}
*** Keywords ***
......