Commit 302d09ee authored by Benoit Orihuela's avatar Benoit Orihuela
Browse files

feat: use data-driven features to test batch creation of entities

parent 306a0006
Loading
Loading
Loading
Loading
+14 −42
Original line number Diff line number Diff line
@@ -7,54 +7,26 @@ Library JSONLibrary
Library     String
Library     Collections

Test Template  Create Batch Entity Scenarios

*** Variable ***
${building_id_prefix}=  urn:ngsi-ld:Building:

*** Test Case ***
Create a batch of minimal entities
    [Documentation]  Check that you can create a batch of minimal entities
    [Tags]  mandatory

    ${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_created}=  Create List   ${first_entity}     ${second_entity}

    Batch Create Entities   @{entities_to_be_created}

    @{expected_entities_ids}=  Create List   ${first_entity_id}     ${second_entity_id}
    Check Response Status Code Set To  201
    Check Response Body Containing Array Of URIs set to   @{expected_entities_ids}

    Batch Delete Entities       @{expected_entities_ids}

Create a batch of entities having only simple properties
    [Documentation]  Check that you can create a batch of entities having only simple properties
    [Tags]  mandatory

    ${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-simple-attributes-sample.jsonld      ${first_entity_id}
    ${second_entity}=    Load Entity    building-simple-attributes-sample.jsonld      ${second_entity_id}
    @{entities_to_be_created}=  Create List   ${first_entity}     ${second_entity}

    Batch Create Entities   @{entities_to_be_created}

    @{expected_entities_ids}=  Create List   ${first_entity_id}     ${second_entity_id}
    Check Response Status Code Set To  201
    Check Response Body Containing Array Of URIs set to  @{expected_entities_ids}

    Batch Delete Entities       @{expected_entities_ids}
*** Test Cases ***                        FILENAME
MinimalEntity                             building-minimal-sample.jsonld
EntityWithSimpleProperties                building-simple-attributes-sample.jsonld
EntityWithRelationshipsProperties         building-relationship-of-property-sample.jsonld

Create a batch of entities having multiple attributes
    [Documentation]  Check that you can create a batch of entities having multiple attributes
    [Tags]  mandatory
*** Keywords ***
Create Batch Entity Scenarios
    [Arguments]  ${filename}
    [Documentation]  Check that you can create a batch of entities
    [Tags]  mandatory   entityOperations

    ${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-relationship-of-property-sample.jsonld      ${first_entity_id}
    ${second_entity}=    Load Entity    building-relationship-of-property-sample.jsonld      ${second_entity_id}
    ${first_entity}=    Load Entity    ${filename}      ${first_entity_id}
    ${second_entity}=    Load Entity    ${filename}      ${second_entity_id}
    @{entities_to_be_created}=  Create List   ${first_entity}     ${second_entity}

    Batch Create Entities   @{entities_to_be_created}