Commit c2521a99 authored by Benoit Orihuela's avatar Benoit Orihuela
Browse files

Merge branch 'feature/retrieve-temporal-evolution-of-entity-tests' into 'develop'

feat: add basic tests for retrieve temporal evolution of entity

See merge request !4
parents 925f5fa3 f96fc52d
Loading
Loading
Loading
Loading
+30 −0
Original line number Diff line number Diff line
*** Settings ***
Documentation   Check that you can retrieve the temporal evolution of an entity
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
${vehicle_expectation_file}=  vehicle-temporal-representation-020-01-expectation.jsonld

*** Test Case ***
Retrieve the temporal evolution of an entity
    [Documentation]  Check that you can retrieve the temporal evolution of an entity
    [Tags]  mandatory

    Retrieve Temporal Representation Of Entity   ${temporal_entity_representation_id}

    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}
+30 −0
Original line number Diff line number Diff line
*** Settings ***
Documentation   Check that you can retrieve the temporal evolution of an entity using a context
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
${vehicle_expectation_file}=  vehicle-temporal-representation-020-02-expectation.jsonld

*** Test Case ***
Retrieve the temporal evolution of an entity using a context
    [Documentation]  Check that you can retrieve the temporal evolution of an entity using a context
    [Tags]  mandatory

    Retrieve Temporal Representation Of Entity   ${temporal_entity_representation_id}   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}

    #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}
+31 −0
Original line number Diff line number Diff line
*** Settings ***
Documentation   Check that you can retrieve the temporal evolution of certain attributes of an entity
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
${vehicle_expectation_file}=  vehicle-temporal-representation-020-03-expectation.jsonld

*** Test Case ***
Retrieve the temporal evolution of certain attributes of an entity
    [Documentation]  Check that you can retrieve the temporal evolution of certain attributes of an entity
    [Tags]  mandatory

    @{temporal_attributes_to_be_retrieved}=  Create List   fuelLevel
    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  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}
+36 −0
Original line number Diff line number Diff line
*** Settings ***
Documentation   Check that you can retrieve the temporal evolution of an entity matching the given NGSI-LD temporal query
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 an entity matching the given NGSI-LD temporal query

*** Variable ***
${vehicule_id_prefix}=  urn:ngsi-ld:Vehicle:
${vehicle_payload_file}=  vehicule-temporal-representation-sample.jsonld

*** Test Cases ***                        TIMEREL       TIME                      ENDTIME                   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}
    [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}
    
    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
+31 −0
Original line number Diff line number Diff line
*** Settings ***
Documentation   Check that you can retrieve the temporal evolution of an entity with the simplified temporal representation
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
${vehicle_expectation_file}=  vehicle-temporal-representation-020-10-expectation.jsonld

*** Test Case ***
Retrieve the temporal evolution of an entity with the simplified temporal representation
    [Documentation]  Check that you can retrieve the temporal evolution of an entity with the simplified temporal representation
    [Tags]  mandatory

    @{options}=  Create List   temporalValues
    Retrieve Temporal Representation Of Entity   ${temporal_entity_representation_id}   options=${options}    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}

    #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}
Loading