Commit 18c2aa90 authored by Andrea Il Grande's avatar Andrea Il Grande
Browse files

Merge branch 'develop' into dist-ops-query-entities

parents ffa92bae 38857502
Loading
Loading
Loading
Loading
+12 −2
Original line number Original line Diff line number Diff line
@@ -12,11 +12,14 @@ specification of the ETSI NGSI-LD API.
-   [Install the Test Suite](#install-the-test-suite)
-   [Install the Test Suite](#install-the-test-suite)
-   [Configure the test suite](#configure-the-test-suite)
-   [Configure the test suite](#configure-the-test-suite)
-   [Execute the NGSI-LD Test Suite](#execute-the-ngsi-ld-test-suite)
-   [Execute the NGSI-LD Test Suite](#execute-the-ngsi-ld-test-suite)
-   [Use the Test Suite Management (tsm) tool](#test-suite-management-tsm)
-   [Contribute to the Test Suite](#contribute-to-the-test-suite)
-   [Contribute to the Test Suite](#contribute-to-the-test-suite)
    -   [Install IDE (PyCharm)](#install-ide-pycharm)
    -   [Install IDE (PyCharm)](#install-ide-pycharm)
    -   [Develop a new Test Case](#develop-a-new-test-case)
    -   [Run configurations (PyCharm)](#run-configurations-pycharm)
    -   [Run configurations (PyCharm)](#run-configurations-pycharm)
    -   [Pre commit](#pre-commit)
    -   [Pre commit](#pre-commit)
-   [Tooling](#tooling)
-   [Tooling](#tooling)
-   [Coding style](#coding-style-of-test-suites)
-   [Frameworks and libraries used in the project](#frameworks-and-libraries-used-in-the-project)
-   [Frameworks and libraries used in the project](#frameworks-and-libraries-used-in-the-project)
-   [Useful links](#useful-links)   
-   [Useful links](#useful-links)   
-   [LICENSE](#license)
-   [LICENSE](#license)
@@ -111,7 +114,7 @@ execution of the following command in MacOS or Ubuntu:


In case of Windows, you need to execute the following command:
In case of Windows, you need to execute the following command:


```> .\.venv\scripts\activate.bat ```
```> .\venv\Scripts\activate.bat ```


Now, you can launch the tests with the following command in MacOS or Linux:
Now, you can launch the tests with the following command in MacOS or Linux:


@@ -364,10 +367,13 @@ In these cases, it is needed to provide the corresponding information in the Pyt
  - In `doc/analysis/requests.py` if it is an endpoint operation (in `self.op` with the list and position of parameters,
  - In `doc/analysis/requests.py` if it is an endpoint operation (in `self.op` with the list and position of parameters,
    in `self.description` to reference the method that pretty print the operation, and add the method that pretty prints
    in `self.description` to reference the method that pretty print the operation, and add the method that pretty prints
    the operation)
    the operation)
- When a new endpoint Keyword is created, additions have to be done in `doc/analysis/requests.py`:
  - Add corresponding entries in the `self.op` and `self.description` dictionaries in the initialization function of the `Requests` class
  - Implement the function generating the documentation related to the endpoint Keyword 
- When a new permutation is added in an existing Test Case, run the documentation generation script 
- When a new permutation is added in an existing Test Case, run the documentation generation script 
  (`python doc/generateDocumentationData.py {tc_id}`) for the Test Case and copy the generated JSON file in the 
  (`python doc/generateDocumentationData.py {tc_id}`) for the Test Case and copy the generated JSON file in the 
  folder containing all files for the given group and subgroup (`cp doc/results/{tc_id}.json doc/files/{group}/{subgroup}`)
  folder containing all files for the given group and subgroup (`cp doc/results/{tc_id}.json doc/files/{group}/{subgroup}`)
- When a new directory containing Test Cases is created, it has to be declared in `doc/generaterobotdata.py` along with
- When a new directory containing Test Cases is created, it has to be declared in `doc/analysis/generaterobotdata.py` along with
  its acronym
  its acronym


Finally, check that everything is OK by running the unit tests:
Finally, check that everything is OK by running the unit tests:
@@ -376,6 +382,10 @@ Finally, check that everything is OK by running the unit tests:
python -m unittest discover -s ./doc/tests -t ./doc
python -m unittest discover -s ./doc/tests -t ./doc
```
```


In order to help in investigating errors that can be encountered when generating the documentation, you can check in
the [Documentation generation troubleshoot document](Troubleshoot_Documentation_Generation.md) for further documentation
and tips.

### Run configurations (PyCharm)
### Run configurations (PyCharm)


Two sample configurations have been created:
Two sample configurations have been created:
+14 −6
Original line number Original line Diff line number Diff line
@@ -8,6 +8,7 @@ Resource ${EXECDIR}/resources/JsonUtils.resource


Suite Setup         Setup Initial Entity
Suite Setup         Setup Initial Entity
Suite Teardown      Delete Initial Entity
Suite Teardown      Delete Initial Entity
Test Template       Retrieve Detailed Representation Of Available Attribute




*** Variables ***
*** Variables ***
@@ -16,16 +17,23 @@ ${filename}= building-simple-attributes.json
${expectation_file}=        types/expectations/attribute-027-01.json
${expectation_file}=        types/expectations/attribute-027-01.json




*** Test Cases ***
*** Test Cases ***    ATTR_NAME
027_02_01 Retrieve Detailed Representation Of Available Attribute
027_02_01 WithCompactedAttributeName
    [Documentation]    Check that one can retrieve a list with a detailed representation of NGSI-LD attributes
    [Tags]    ed-attr    5_7_10
    [Tags]    ed-attr    5_7_10
    ${response}=    Retrieve Attribute    attribute_name=airQualityLevel    context=${ngsild_test_suite_context}
    airQualityLevel
    Check Response Status Code    200    ${response.status_code}
027_02_02 WithExpandedAttributeName
    Check Response Body Containing Attribute element    ${expectation_file}    ${response.json()}
    [Tags]    ed-attr    5_7_10
    https%3A%2F%2Fngsi-ld-test-suite%2Fcontext%23airQualityLevel




*** Keywords ***
*** Keywords ***
Retrieve Detailed Representation Of Available Attribute
    [Documentation]    Check that one can retrieve a list with a detailed representation of NGSI-LD attributes
    [Arguments]    ${attributeName}
    ${response}=    Retrieve Attribute    attribute_name=${attributeName}    context=${ngsild_test_suite_context}
    Check Response Status Code    200    ${response.status_code}
    Check Response Body Containing Attribute element    ${expectation_file}    ${response.json()}

Setup Initial Entity
Setup Initial Entity
    ${entity_id}=    Generate Random Entity Id    ${building_id_prefix}
    ${entity_id}=    Generate Random Entity Id    ${building_id_prefix}
    ${create_response}=    Create Entity Selecting Content Type
    ${create_response}=    Create Entity Selecting Content Type
+14 −6
Original line number Original line Diff line number Diff line
@@ -8,6 +8,7 @@ Resource ${EXECDIR}/resources/JsonUtils.resource


Suite Setup         Setup Initial Entities
Suite Setup         Setup Initial Entities
Suite Teardown      Delete Initial Entities
Suite Teardown      Delete Initial Entities
Test Template       Retrieve Detailed Representation Of Available Entity Type




*** Variables ***
*** Variables ***
@@ -16,16 +17,23 @@ ${filename}= building-simple-attributes.json
${expectation_file}=        types/expectations/entity-type-info-024-01.json
${expectation_file}=        types/expectations/entity-type-info-024-01.json




*** Test Cases ***
*** Test Cases ***    TYPE
024_02_01 Retrieve Detailed Representation Of Available Entity Type
024_02_01 WithCompactedType
    [Documentation]    Check that one can retrieve a detailed representation of a specified NGSI-LD entity type
    [Tags]    ed-type    5_7_7
    [Tags]    ed-type    5_7_7
    ${response}=    Retrieve Entity Type    type=Building    context=${ngsild_test_suite_context}
    Building
    Check Response Status Code    200    ${response.status_code}
024_02_02 WithExpandedType
    Check Response Body Containing EntityTypeInfo element    ${expectation_file}    ${response.json()}
    [Tags]    ed-type    5_7_7
    https%3A%2F%2Fngsi-ld-test-suite%2Fcontext%23Building




*** Keywords ***
*** Keywords ***
Retrieve Detailed Representation Of Available Entity Type
    [Documentation]    Check that one can retrieve a detailed representation of a specified NGSI-LD entity type
    [Arguments]    ${type}
    ${response}=    Retrieve Entity Type    type=${type}    context=${ngsild_test_suite_context}
    Check Response Status Code    200    ${response.status_code}
    Check Response Body Containing EntityTypeInfo element    ${expectation_file}    ${response.json()}

Setup Initial Entities
Setup Initial Entities
    ${first_entity_id}=    Generate Random Entity Id    ${building_id_prefix}
    ${first_entity_id}=    Generate Random Entity Id    ${building_id_prefix}
    ${second_entity_id}=    Generate Random Entity Id    ${building_id_prefix}
    ${second_entity_id}=    Generate Random Entity Id    ${building_id_prefix}
+2 −2
Original line number Original line Diff line number Diff line
@@ -15,7 +15,7 @@ ${building_id_prefix}= urn:ngsi-ld:Building:
${filename}=                building-location-attribute.jsonld
${filename}=                building-location-attribute.jsonld
${expectation_filename}=    building-geoproperty-query.jsonld
${expectation_filename}=    building-geoproperty-query.jsonld
${entity_type}=             https://ngsi-ld-test-suite/context#Building
${entity_type}=             https://ngsi-ld-test-suite/context#Building
${georal}=                  equals
${georel}=                  equals
${geometry}=                Point
${geometry}=                Point
${coordinates}=             [13.3986, 52.5547]
${coordinates}=             [13.3986, 52.5547]


@@ -30,7 +30,7 @@ ${coordinates}= [13.3986, 52.5547]
    ${response}=    Query Entities
    ${response}=    Query Entities
    ...    entity_types=${entity_types_to_be_retrieved}
    ...    entity_types=${entity_types_to_be_retrieved}
    ...    accept=${CONTENT_TYPE_LD_JSON}
    ...    accept=${CONTENT_TYPE_LD_JSON}
    ...    georel=${georal}
    ...    georel=${georel}
    ...    geometry=${geometry}
    ...    geometry=${geometry}
    ...    coordinates=${coordinates}
    ...    coordinates=${coordinates}


+3 −2
Original line number Original line Diff line number Diff line
@@ -22,9 +22,10 @@ ${entity_type}= https://ngsi-ld-test-suite/context#Building
    [Documentation]    Check that one can query one entity via POST Interaction based on id
    [Documentation]    Check that one can query one entity via POST Interaction based on id
    [Tags]    e-query    5_7_2
    [Tags]    e-query    5_7_2
    @{entities_ids_to_be_compared}=    Create List    ${first_entity_id}
    @{entities_ids_to_be_compared}=    Create List    ${first_entity_id}
    ${entity_selector}=    Create Dictionary    id=${first_entity_id}    type=${entity_type}
    @{entities}=    Create List    ${entity_selector}
    ${response}=    Query Entities Via POST
    ${response}=    Query Entities Via POST
    ...    entity_id=${first_entity_id}
    ...    entities=${entities}
    ...    entity_type=${entity_type}
    Check Response Status Code    200    ${response.status_code}
    Check Response Status Code    200    ${response.status_code}
    Check Response Body Containing List Containing Entity Elements
    Check Response Body Containing List Containing Entity Elements
    ...    ${expectation_filename}
    ...    ${expectation_filename}
Loading