Commit 3b9a64f0 authored by Ranim Naimi's avatar Ranim Naimi
Browse files

added permutation and suite setup

parent a0c0bdc2
Loading
Loading
Loading
Loading
+22 −21
Original line number Diff line number Diff line
@@ -6,7 +6,9 @@ Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.
Resource            ${EXECDIR}/resources/AssertionUtils.resource
Resource            ${EXECDIR}/resources/JsonUtils.resource

Suite Setup         Setup Entities
Suite Teardown      Delete Entities
Test Template       Check that the total number of matching results is returned if the count parameter is set to true


*** Variables ***
@@ -18,10 +20,28 @@ ${airQualityLevel}= airQualityLevel==6
${context}=                     https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld


*** Test Cases ***
019_07_01 Check that the total number of matching results is returned if the count parameter is set to true.
*** Test Cases ***    Q_PARAMETER    EXPECTED_STATUS    EXPECTED_COUNT
019_07_01 Check that the total number of matching results is returned if the count parameter is set to true and only the entity type is provided
    ${EMPTY}    200    2
019_07_02 Check that the total number of matching results is returned if the count parameter is set to true and a q parameter is provided
    ${airQualityLevel}    200    1


*** Keywords ***
Check that the total number of matching results is returned if the count parameter is set to true
    [Documentation]    If the count parameter is set to true the special HTTP header NGSILD-Results-Count is set in the response and it must contain the total number of matching results.
    [Tags]    e-query    6_3_13
    [Arguments]    ${q}    ${expected_status_code}    ${expected_count}
    ${response}=    Query Entities
    ...    entity_types=${entity_type}
    ...    q=${q}
    ...    count=${True}
    ...    context=${context}

    Check Response Status Code    ${expected_status_code}    ${response.status_code}
    Check Response Headers Containing NGSILD-Results-Count    ${expected_count}    ${response.headers}

Setup Entities
    ${first_entity_id}=    Generate Random Entity Id    ${building_id_prefix}
    Set Suite Variable    ${first_entity_id}
    ${create_response1}=    Create Entity Selecting Content Type
@@ -37,25 +57,6 @@ ${context}= https://forge.etsi.org/rep/cim/ngsi-ld-test-suit
    ...    ${CONTENT_TYPE_LD_JSON}
    Check Response Status Code    201    ${create_response2.status_code}

    ${response}=    Query Entities
    ...    entity_types=${entity_type}
    ...    count=${True}
    ...    context=${context}

    Check Response Status Code    200    ${response.status_code}

    Check Response Headers Containing NGSILD-Results-Count    2    ${response.headers}
    ${response}=    Query Entities
    ...    entity_types=${entity_type}
    ...    q=${airQualityLevel}
    ...    count=${True}
    ...    context=${context}

    Check Response Status Code    200    ${response.status_code}
    Check Response Headers Containing NGSILD-Results-Count    1    ${response.headers}


*** Keywords ***
Delete Entities
    Delete Entity by Id    ${first_entity_id}
    Delete Entity by Id    ${second_entity_id}