From 3f3e232c5fb75016f2678cc8ee6507beb8b2bf4a Mon Sep 17 00:00:00 2001 From: Jorge Garcia Hospital <129095857+jgarciahospital@users.noreply.github.com> Date: Fri, 2 Aug 2024 13:25:08 +0200 Subject: [PATCH 1/8] Create population-density-data.feature --- .../population-density-data.feature | 277 ++++++++++++++++++ 1 file changed, 277 insertions(+) create mode 100644 code/Test_definitions/population-density-data.feature diff --git a/code/Test_definitions/population-density-data.feature b/code/Test_definitions/population-density-data.feature new file mode 100644 index 0000000..56ca55c --- /dev/null +++ b/code/Test_definitions/population-density-data.feature @@ -0,0 +1,277 @@ +Feature: CAMARA Population Density Data API, v0.1.1 + # Input to be provided by the implementation to the tester + # + # Implementation indications: + # * Geohash precisions allowed + # * Min start and end dates allowed + # * Max requested time period allowed + # * Max size of the response(Combination of area, startDate, endDate an precision requested) supported for a sync response + # * Max size of the response(Combination of area, startDate, endDate an precision requested) supported for an async response + # * Limitations about max complexity of requested area allowed + # + # Testing assets: + # * An Area within the supported region + # * An Area partially within the supported region + # * An Area outside the supported region + # + # References to OAS spec schemas refer to schemas specifies in population-density-data.yaml, version 0.1.0 + + Background: Common retrievePopulationDensity setup + Given an environment at "apiRoot" + And the resource "/population-density-data/v1/retrieve" + And the header "Content-Type" is set to "application/json" + And the header "Authorization" is set to a valid access token + And the header "x-correlator" is set to a UUID value + And the request body is set by default to a request body compliant with the schema + + # Happy path scenarios + + @population_density_data_01_supported_area_success_scenario + Scenario: Validate success response for a supported area request + Given the request body property "$.area" is set to a valid testing area within supported regions + And the request body property "$.startDate" is set to a valid testing future date + And the request body property "$.endDate" is set to a valid testing future date later than body property "$.startDate" + When the request "retrievePopulationDensity" is sent + Then the response status code is 200 + And the response header "Content-Type" is "application/json" + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response body complies with the OAS schema at "/components/schemas/PopulationDensityResponse" + And the response property "$.status" value is "SUPPORTED_AREA" + And the response property "$.timedPopulationDensityData[*].startTime" is equal to or later than request body property "$.startDate" + And the response property "$.timedPopulationDensityData[*].endTime" is equal to or earlier than request body property "$.endDate" + And the response property "$.timedPopulationDensityData[*].cellPopulationDensityData[*].populationDensityData.dataType.datatype" is equal to "LOW_DENSITY" or "DENSITY_ESTIMATION" + + @population_density_data_02_partial_area_success_scenario + Scenario: Validate success response for a partial supported area request + Given the request body property "$.area" is set to a valid testing area partially within supported regions + And the request body property "$.startDate" is set to a valid testing future date + And the request body property "$.endDate" is set to a valid testing future date later than body property "$.startDate" + When the request "retrievePopulationDensity" is sent + Then the response status code is 200 + And the response header "Content-Type" is "application/json" + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response body complies with the OAS schema at "/components/schemas/PopulationDensityResponse" + And the response property "$.status" value is "PART_OF_AREA_NOT_SUPPORTED" + And the response property "$.timedPopulationDensityData[*].startTime" is equal to or later than request body property "$.startDate" + And the response property "$.timedPopulationDensityData[*].endTime" is equal to or earlier than request body property "$.startDate" + And there is at least one item in response property "$.timedPopulationDensityData[*].cellPopulationDensityData[*].datatype" equal to "NO_DATA" + + @population_density_data_03_not_supported_area_success_scenario + Scenario: Validate success response for unsupported area request + Given the request body property "$.area" is set to a valid testing area outside supported regions + And the request body property "$.startDate" is set to a valid testing future date + And the request body property "$.endDate" is set to a valid testing future date later than body property "$.startDate" + When the request "retrievePopulationDensity" is sent + Then the response status code is 200 + And the response header "Content-Type" is "application/json" + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response body complies with the OAS schema at "/components/schemas/PopulationDensityResponse" + And the response property "$.status" value is "AREA_NOT_SUPPORTED" + And the response property "$.timedPopulationDensityData" is an empty array + + @population_density_data_04_webhook_success_scenario + Scenario: Validate success response for a request specifying a webhook + Given the request body property "$.area" is set to a valid testing area within supported regions + And the request body property "$.startDate" is set to a valid testing future date + And the request body property "$.endDate" is set to a valid testing future date later than body property "$.startDate" + And the request body property "$.webhook.notificationUrl" is set to a valid https callback address + When the request "retrievePopulationDensity" is sent + Then the response status code is 202 + And the response header "Content-Type" is "application/json" + And the response header "x-correlator" has same value as the request header "x-correlator" + And the request with the response body will be received in "$.webhook.notificationUrl" value + And the request body revieved in the webhook complies with the OAS schema at "/components/schemas/PopulationDensityResponse" + + @population_density_data_05_custom_precision_success_scenario + Scenario: Validate success response for a request specifying the precision of the geohashes + Given the request body property "$.area" is set to a valid testing area within supported regions + And the request body property "$.startDate" is set to a valid testing future date + And the request body property "$.endDate" is set to a valid testing future date later than body property "$.startDate" + And the request body property "$.precision" is set to a valid precision for the geohash response cells + When the request "retrievePopulationDensity" is sent + Then the response status code is 200 + And the response header "Content-Type" is "application/json" + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response body complies with the OAS schema at "/components/schemas/PopulationDensityResponse" + + # Generic errors + + @population_density_data_06_missing_required_property + Scenario Outline: Error response for missing required property in request body + Given the request body property "" is not included + When the request "retrievePopulationDensity" is sent + Then the response status code is 400 + And the response header "Content-Type" is "application/json" + And the response property "$.status" is 400 + And the response property "$.code" is "INVALID_ARGUMENT" + And the response property "$.message" contains a user friendly text + + Examples: + | required_property | + | $.area | + | $.startDate | + | $.endDate | + + @population_density_data_07_invalid_date_format + Scenario: Error 400 when the datetime format is not RFC-3339 + Given the request body property "" is not set to a valid RFC-3339 date-time + When the request "retrievePopulationDensity" is sent + Then the response status code is 400 + And the response header "Content-Type" is "application/json" + And the response property "$.status" is 400 + And the response property "$.code" is "INVALID_ARGUMENT" + And the response property "$.message" contains a user friendly text + + Examples: + | date_property | + | $.startDate | + | $.endDate | + + @population_density_data_08_invalid_precision + Scenario: Error 400 when precision is not a number between 1 and 12 + Given the request body property "$.precision" is not set to a number between 1 and 12 + When the request "retrievePopulationDensity" is sent + Then the response status code is 400 + And the response header "Content-Type" is "application/json" + And the response property "$.status" is 400 + And the response property "$.code" is "INVALID_ARGUMENT" + And the response property "$.message" contains a user friendly text + + + @population_density_data_09_empty_webhook + Scenario Outline: Error response for empty webhook in request body + Given the request body property "$.webhook" is set to "{}" + When the request "retrievePopulationDensity" is sent + Then the response status code is 400 + And the response header "Content-Type" is "application/json" + And the response property "$.status" is 400 + And the response property "$.code" is "INVALID_ARGUMENT" + And the response property "$.message" contains a user friendly text + + @population_density_data_10_expired_access_token + Scenario: Error response for expired access token + Given an expired access token + And the request body is set to a valid request body + When the request "retrievePopulationDensity" is sent + Then the response status code is 401 + And the response header "Content-Type" is "application/json" + And the response property "$.status" is 401 + And the response property "$.code" is "UNAUTHENTICATED" + And the response property "$.message" contains a user friendly text + + @population_density_data_11_invalid_access_token + Scenario: Error response for invalid access token + Given an invalid access token + And the request body is set to a valid request body + When the request "retrievePopulationDensity" is sent + Then the response status code is 401 + And the response header "Content-Type" is "application/json" + And the response property "$.status" is 401 + And the response property "$.code" is "UNAUTHENTICATED" + And the response property "$.message" contains a user friendly text + + @population_density_data_12_missing_authorization_header + Scenario: Error response for no header "Authorization" + Given the header "Authorization" is not sent + And the request body is set to a valid request body + When the request "retrievePopulationDensity" is sent + Then the response status code is 401 + And the response header "Content-Type" is "application/json" + And the response property "$.status" is 401 + And the response property "$.code" is "UNAUTHENTICATED" + And the response property "$.message" contains a user friendly text + + + # API Specific Errors + + @population_density_data_13_non_polygonal_area + Scenario: Error 400 when the requested area is not a polygon + Given the request body property "$.area.boundry" is set to an array of coordinates that does not form a polygon + When the request "retrievePopulationDensity" is sent + Then the response status code is 400 + And the response header "Content-Type" is "application/json" + And the response property "$.status" is 400 + And the response property "$.code" is "POPULATION_DENSITY_DATA.INVALID_AREA + And the response property "$.message" contains a user friendly text + + # An area that does not form a polygon is a straight line or a set of points with same coordinates. + @population_density_data_14_too_complex_area + Scenario: Error 400 when the requested area is too complex + Given the request body property "$.area.boundary" is set to an array of coordinates that form a too complex area + When the request "retrievePopulationDensity" is sent + Then the response status code is 400 + And the response header "Content-Type" is "application/json" + And the response property "$.status" is 400 + And the response property "$.code" is "POPULATION_DENSITY_DATA.INVALID_AREA + And the response property "$.message" contains a user friendly text + + @population_density_data_15_min_start_date_exceeded + Scenario: Error 400 when startDate is set to a date earlier than the minimum allowed + Given the request body property "$.startDate" is set to a date earlier than the minimum allowed + When the request "retrievePopulationDensity" is sent + Then the response status code is 400 + And the response header "Content-Type" is "application/json" + And the response property "$.status" is 400 + And the response property "$.code" is "POPULATION_DENSITY_DATA.MIN_STARTDATE_EXCEEDED + And the response property "$.message" contains a user friendly text + + @population_density_data_16_max_start_date_exceeded + Scenario: Error 400 when startDate is set to a date later than the maximum allowed + Given the request body property "$.startDate" is set to a date later than the maximum allowed + When the request "retrievePopulationDensity" is sent + Then the response status code is 400 + And the response header "Content-Type" is "application/json" + And the response property "$.status" is 400 + And the response property "$.code" is "POPULATION_DENSITY_DATA.MAX_STARTDATE_EXCEEDED + And the response property "$.message" contains a user friendly text + + @population_density_data_17_invalid_end_date + Scenario: Error 400 when endDate is set to a date earlier than startDate + Given the request body property "$.endDate" is set to a date earlier than request body property "$.startDate" + When the request "retrievePopulationDensity" is sent + Then the response status code is 400 + And the response header "Content-Type" is "application/json" + And the response property "$.status" is 400 + And the response property "$.code" is "POPULATION_DENSITY_DATA.INVALID_END_DATE + And the response property "$.message" contains a user friendly text + + @population_density_data_18_max_time_period_exceeded + Scenario: Error 400 when indicated time period is greater than the maximum allowed + Given the request body property "$.startDate" is set to a valid testing future + And the request body property "$.endDate" is set to a future date that exceeds the supported duration from the start date. + When the request "retrievePopulationDensity" is sent + Then the response status code is 400 + And the response header "Content-Type" is "application/json" + And the response property "$.status" is 400 + And the response property "$.code" is "POPULATION_DENSITY_DATA.MAX_TIME_PERIOD_EXCEEDED + And the response property "$.message" contains a user friendly text + + @population_density_data_19_unsupported_precision + Scenario: Error 400 when precision is set to a valid but not supported value + Given the request body property "$.precision" is set to a valid but not supported value + When the request "retrievePopulationDensity" is sent + Then the response status code is 400 + And the response header "Content-Type" is "application/json" + And the response property "$.status" is 400 + And the response property "$.code" is "POPULATION_DENSITY_DATA.UNSUPPORTED_PRECISION + And the response property "$.message" contains a user friendly text + + @population_density_data_20_too_big_synchronous_response + Scenario: Error 400 when the response is too big for a sync response + Given the request body properties "$.area.boundry", "$.startDate", "$.endDate" and "$.precision" are set to valid values but generate a response too big for a synchronous response + When the request "retrievePopulationDensity" is sent + Then the response status code is 400 + And the response header "Content-Type" is "application/json" + And the response property "$.status" is 400 + And the response property "$.code" is "POPULATION_DENSITY_DATA.UNSUPPORTED_SYNC_RESPONSE + And the response property "$.message" contains a user friendly text + + @population_density_data_21_too_big_request + Scenario: Error 400 when the response is too big for a sync adn async response + Given the request body properties "$.area.boundry", "$.startDate", "$.endDate" and "$.precision" are set to valid values but generate a response too big for a synchronous and asynchronous response + When the request "retrievePopulationDensity" is sent + Then the response status code is 400 + And the response header "Content-Type" is "application/json" + And the response property "$.status" is 400 + And the response property "$.code" is "POPULATION_DENSITY_DATA.UNSUPPPORTED_REQUEST + And the response property "$.message" contains a user friendly text From dd3221c2ae2aa7ea76f14fabd60937608ad8890a Mon Sep 17 00:00:00 2001 From: Jorge Garcia Hospital <129095857+jgarciahospital@users.noreply.github.com> Date: Fri, 2 Aug 2024 13:29:55 +0200 Subject: [PATCH 2/8] Delete code/Test_definitions/README.md --- code/Test_definitions/README.md | 1 - 1 file changed, 1 deletion(-) delete mode 100644 code/Test_definitions/README.md diff --git a/code/Test_definitions/README.md b/code/Test_definitions/README.md deleted file mode 100644 index 27a1f06..0000000 --- a/code/Test_definitions/README.md +++ /dev/null @@ -1 +0,0 @@ -This directory contains at least one `.feature` file containing test definitions for the repository API(s). From 41cb40ee5868b958783bcbb09f8c7a64803e9793 Mon Sep 17 00:00:00 2001 From: Jorge Garcia Hospital <129095857+jgarciahospital@users.noreply.github.com> Date: Wed, 21 Aug 2024 11:46:52 +0200 Subject: [PATCH 3/8] Typo fixing --- .../population-density-data.feature | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/code/Test_definitions/population-density-data.feature b/code/Test_definitions/population-density-data.feature index 56ca55c..6b620e7 100644 --- a/code/Test_definitions/population-density-data.feature +++ b/code/Test_definitions/population-density-data.feature @@ -14,7 +14,7 @@ Feature: CAMARA Population Density Data API, v0.1.1 # * An Area partially within the supported region # * An Area outside the supported region # - # References to OAS spec schemas refer to schemas specifies in population-density-data.yaml, version 0.1.0 + # References to OAS spec schemas refer to schemas specifies in population-density-data.yaml, version 0.1.1 Background: Common retrievePopulationDensity setup Given an environment at "apiRoot" @@ -113,7 +113,7 @@ Feature: CAMARA Population Density Data API, v0.1.1 | $.endDate | @population_density_data_07_invalid_date_format - Scenario: Error 400 when the datetime format is not RFC-3339 + Scenario Outline: Error 400 when the datetime format is not RFC-3339 Given the request body property "" is not set to a valid RFC-3339 date-time When the request "retrievePopulationDensity" is sent Then the response status code is 400 @@ -139,7 +139,7 @@ Feature: CAMARA Population Density Data API, v0.1.1 @population_density_data_09_empty_webhook - Scenario Outline: Error response for empty webhook in request body + Scenario: Error response for empty webhook in request body Given the request body property "$.webhook" is set to "{}" When the request "retrievePopulationDensity" is sent Then the response status code is 400 @@ -184,6 +184,7 @@ Feature: CAMARA Population Density Data API, v0.1.1 # API Specific Errors + # An area that does not form a polygon is a straight line or a set of points with same coordinates. @population_density_data_13_non_polygonal_area Scenario: Error 400 when the requested area is not a polygon Given the request body property "$.area.boundry" is set to an array of coordinates that does not form a polygon @@ -191,10 +192,9 @@ Feature: CAMARA Population Density Data API, v0.1.1 Then the response status code is 400 And the response header "Content-Type" is "application/json" And the response property "$.status" is 400 - And the response property "$.code" is "POPULATION_DENSITY_DATA.INVALID_AREA + And the response property "$.code" is "POPULATION_DENSITY_DATA.INVALID_AREA" And the response property "$.message" contains a user friendly text - # An area that does not form a polygon is a straight line or a set of points with same coordinates. @population_density_data_14_too_complex_area Scenario: Error 400 when the requested area is too complex Given the request body property "$.area.boundary" is set to an array of coordinates that form a too complex area @@ -202,27 +202,27 @@ Feature: CAMARA Population Density Data API, v0.1.1 Then the response status code is 400 And the response header "Content-Type" is "application/json" And the response property "$.status" is 400 - And the response property "$.code" is "POPULATION_DENSITY_DATA.INVALID_AREA + And the response property "$.code" is "POPULATION_DENSITY_DATA.INVALID_AREA" And the response property "$.message" contains a user friendly text @population_density_data_15_min_start_date_exceeded Scenario: Error 400 when startDate is set to a date earlier than the minimum allowed - Given the request body property "$.startDate" is set to a date earlier than the minimum allowed + Given the request body property "$.startDate" is set to a date earlier than the minimum allowed When the request "retrievePopulationDensity" is sent Then the response status code is 400 And the response header "Content-Type" is "application/json" And the response property "$.status" is 400 - And the response property "$.code" is "POPULATION_DENSITY_DATA.MIN_STARTDATE_EXCEEDED + And the response property "$.code" is "POPULATION_DENSITY_DATA.MIN_STARTDATE_EXCEEDED" And the response property "$.message" contains a user friendly text @population_density_data_16_max_start_date_exceeded Scenario: Error 400 when startDate is set to a date later than the maximum allowed - Given the request body property "$.startDate" is set to a date later than the maximum allowed + Given the request body property "$.startDate" is set to a date later than the maximum allowed When the request "retrievePopulationDensity" is sent Then the response status code is 400 And the response header "Content-Type" is "application/json" And the response property "$.status" is 400 - And the response property "$.code" is "POPULATION_DENSITY_DATA.MAX_STARTDATE_EXCEEDED + And the response property "$.code" is "POPULATION_DENSITY_DATA.MAX_STARTDATE_EXCEEDED" And the response property "$.message" contains a user friendly text @population_density_data_17_invalid_end_date @@ -232,18 +232,18 @@ Feature: CAMARA Population Density Data API, v0.1.1 Then the response status code is 400 And the response header "Content-Type" is "application/json" And the response property "$.status" is 400 - And the response property "$.code" is "POPULATION_DENSITY_DATA.INVALID_END_DATE + And the response property "$.code" is "POPULATION_DENSITY_DATA.INVALID_END_DATE" And the response property "$.message" contains a user friendly text @population_density_data_18_max_time_period_exceeded Scenario: Error 400 when indicated time period is greater than the maximum allowed - Given the request body property "$.startDate" is set to a valid testing future + Given the request body property "$.startDate" is set to a valid testing future And the request body property "$.endDate" is set to a future date that exceeds the supported duration from the start date. When the request "retrievePopulationDensity" is sent Then the response status code is 400 And the response header "Content-Type" is "application/json" And the response property "$.status" is 400 - And the response property "$.code" is "POPULATION_DENSITY_DATA.MAX_TIME_PERIOD_EXCEEDED + And the response property "$.code" is "POPULATION_DENSITY_DATA.MAX_TIME_PERIOD_EXCEEDED" And the response property "$.message" contains a user friendly text @population_density_data_19_unsupported_precision @@ -253,7 +253,7 @@ Feature: CAMARA Population Density Data API, v0.1.1 Then the response status code is 400 And the response header "Content-Type" is "application/json" And the response property "$.status" is 400 - And the response property "$.code" is "POPULATION_DENSITY_DATA.UNSUPPORTED_PRECISION + And the response property "$.code" is "POPULATION_DENSITY_DATA.UNSUPPORTED_PRECISION" And the response property "$.message" contains a user friendly text @population_density_data_20_too_big_synchronous_response @@ -263,7 +263,7 @@ Feature: CAMARA Population Density Data API, v0.1.1 Then the response status code is 400 And the response header "Content-Type" is "application/json" And the response property "$.status" is 400 - And the response property "$.code" is "POPULATION_DENSITY_DATA.UNSUPPORTED_SYNC_RESPONSE + And the response property "$.code" is "POPULATION_DENSITY_DATA.UNSUPPORTED_SYNC_RESPONSE" And the response property "$.message" contains a user friendly text @population_density_data_21_too_big_request @@ -273,5 +273,5 @@ Feature: CAMARA Population Density Data API, v0.1.1 Then the response status code is 400 And the response header "Content-Type" is "application/json" And the response property "$.status" is 400 - And the response property "$.code" is "POPULATION_DENSITY_DATA.UNSUPPPORTED_REQUEST + And the response property "$.code" is "POPULATION_DENSITY_DATA.UNSUPPPORTED_REQUEST" And the response property "$.message" contains a user friendly text From 6e74f3edccc5fffc682d19fc2c530b71c8fc9871 Mon Sep 17 00:00:00 2001 From: Jorge Garcia Hospital <129095857+jgarciahospital@users.noreply.github.com> Date: Wed, 21 Aug 2024 12:46:04 +0200 Subject: [PATCH 4/8] Updating Checklist with ATP link --- .../Population-Density-Data-API-Readiness-Checklist.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documentation/API_documentation/Population-Density-Data-API-Readiness-Checklist.md b/documentation/API_documentation/Population-Density-Data-API-Readiness-Checklist.md index 1c03f83..e721d49 100644 --- a/documentation/API_documentation/Population-Density-Data-API-Readiness-Checklist.md +++ b/documentation/API_documentation/Population-Density-Data-API-Readiness-Checklist.md @@ -10,7 +10,7 @@ Checklist for population-density-data 0.1.1-rc.1 in release r1.1 | 4 | API versioning convention applied | M | M | M | M | Y | | | 5 | API documentation | M | M | M | M | Y | Embed documentation into API spec - [link](/code/API_definitions/population-density-data.yaml) | | 6 | User stories | O | O | O | M | N | | -| 7 | Basic API test cases & documentation | O | M | M | M | Pending | | +| 7 | Basic API test cases & documentation | O | M | M | M | Y | [link](/code/Test_definitions/population-density-data.feature) | | 8 | Enhanced API test cases & documentation | O | O | O | M | N | | | 9 | Test result statement | O | O | O | M | N | | | 10 | API release numbering convention applied | M | M | M | M | Y | | From 6537942a964f4b8a022e15b111447f9438010e1f Mon Sep 17 00:00:00 2001 From: Jorge Garcia Hospital <129095857+jgarciahospital@users.noreply.github.com> Date: Thu, 5 Sep 2024 17:47:34 +0200 Subject: [PATCH 5/8] Update population-density-data.feature Including small typos correction and alignement of "$.sink" and "$.sinkCredentials" properties. --- .../population-density-data.feature | 91 +++++++++++++------ 1 file changed, 61 insertions(+), 30 deletions(-) diff --git a/code/Test_definitions/population-density-data.feature b/code/Test_definitions/population-density-data.feature index 6b620e7..191f27c 100644 --- a/code/Test_definitions/population-density-data.feature +++ b/code/Test_definitions/population-density-data.feature @@ -26,7 +26,7 @@ Feature: CAMARA Population Density Data API, v0.1.1 # Happy path scenarios - @population_density_data_01_supported_area_success_scenario + @population_density_data_retrievePopulationDensity_01_supported_area_success_scenario Scenario: Validate success response for a supported area request Given the request body property "$.area" is set to a valid testing area within supported regions And the request body property "$.startDate" is set to a valid testing future date @@ -39,9 +39,12 @@ Feature: CAMARA Population Density Data API, v0.1.1 And the response property "$.status" value is "SUPPORTED_AREA" And the response property "$.timedPopulationDensityData[*].startTime" is equal to or later than request body property "$.startDate" And the response property "$.timedPopulationDensityData[*].endTime" is equal to or earlier than request body property "$.endDate" - And the response property "$.timedPopulationDensityData[*].cellPopulationDensityData[*].populationDensityData.dataType.datatype" is equal to "LOW_DENSITY" or "DENSITY_ESTIMATION" + And the response property "$.timedPopulationDensityData[*].cellPopulationDensityData[*].populationDensityData[*].dataType" is equal to "LOW_DENSITY" or "DENSITY_ESTIMATION" + And for items with response property "$.timedPopulationDensityData[*].cellPopulationDensityData[*].populationDensityData[*].dataType" == "DENSITY_ESTIMATION", the response property "$.timedPopulationDensityData[*].cellPopulationDensityData[*].populationDensityData[*].minPplDensity" is included in the response + And for items with response property "$.timedPopulationDensityData[*].cellPopulationDensityData[*].populationDensityData[*].dataType" == "DENSITY_ESTIMATION", the response property "$.timedPopulationDensityData[*].cellPopulationDensityData[*].populationDensityData[*].pplDensity" is included in the response + And for items with response property "$.timedPopulationDensityData[*].cellPopulationDensityData[*].populationDensityData[*].dataType" == "DENSITY_ESTIMATION", the response property "$.timedPopulationDensityData[*].cellPopulationDensityData[*].populationDensityData[*].maxPplDensity" is included in the response - @population_density_data_02_partial_area_success_scenario + @population_density_data_retrievePopulationDensity_02_partial_area_success_scenario Scenario: Validate success response for a partial supported area request Given the request body property "$.area" is set to a valid testing area partially within supported regions And the request body property "$.startDate" is set to a valid testing future date @@ -55,8 +58,12 @@ Feature: CAMARA Population Density Data API, v0.1.1 And the response property "$.timedPopulationDensityData[*].startTime" is equal to or later than request body property "$.startDate" And the response property "$.timedPopulationDensityData[*].endTime" is equal to or earlier than request body property "$.startDate" And there is at least one item in response property "$.timedPopulationDensityData[*].cellPopulationDensityData[*].datatype" equal to "NO_DATA" + And there is at least one item in response property "$.timedPopulationDensityData[*].cellPopulationDensityData[*].datatype" equal to "LOW_DENSITY" or "DENSITY_ESTIMATION" + And for items with response property "$.timedPopulationDensityData[*].cellPopulationDensityData[*].populationDensityData[*].dataType" == "DENSITY_ESTIMATION", the response property "$.timedPopulationDensityData[*].cellPopulationDensityData[*].populationDensityData[*].minPplDensity" is included in the response + And for items with response property "$.timedPopulationDensityData[*].cellPopulationDensityData[*].populationDensityData[*].dataType" == "DENSITY_ESTIMATION", the response property "$.timedPopulationDensityData[*].cellPopulationDensityData[*].populationDensityData[*].pplDensity" is included in the response + And for items with response property "$.timedPopulationDensityData[*].cellPopulationDensityData[*].populationDensityData[*].dataType" == "DENSITY_ESTIMATION", the response property "$.timedPopulationDensityData[*].cellPopulationDensityData[*].populationDensityData[*].maxPplDensity" is included in the response - @population_density_data_03_not_supported_area_success_scenario + @population_density_data_retrievePopulationDensity_03_not_supported_area_success_scenario Scenario: Validate success response for unsupported area request Given the request body property "$.area" is set to a valid testing area outside supported regions And the request body property "$.startDate" is set to a valid testing future date @@ -69,20 +76,24 @@ Feature: CAMARA Population Density Data API, v0.1.1 And the response property "$.status" value is "AREA_NOT_SUPPORTED" And the response property "$.timedPopulationDensityData" is an empty array - @population_density_data_04_webhook_success_scenario - Scenario: Validate success response for a request specifying a webhook + @population_density_data_retrievePopulationDensity_04_async_success_scenario + Scenario: Validate success async response for a request when sink is provided Given the request body property "$.area" is set to a valid testing area within supported regions And the request body property "$.startDate" is set to a valid testing future date And the request body property "$.endDate" is set to a valid testing future date later than body property "$.startDate" - And the request body property "$.webhook.notificationUrl" is set to a valid https callback address - When the request "retrievePopulationDensity" is sent + And the request property "$.sink" is set to a URL when events can be monitored + And the request property "$.sinkCredentials.credentialType" is set to "ACCESSTOKEN" + And the request property "$.sinkCredentials.accessTokenType" is set to "bearer" + And the request property "$.sinkCredentials.accessToken" is set to a valid access token accepted by the events receiver + And the request property "$.sinkCredentials.accessTokenExpiresUtc" is set to a value long enough in the future When the request "retrievePopulationDensity" is sent Then the response status code is 202 And the response header "Content-Type" is "application/json" And the response header "x-correlator" has same value as the request header "x-correlator" - And the request with the response body will be received in "$.webhook.notificationUrl" value - And the request body revieved in the webhook complies with the OAS schema at "/components/schemas/PopulationDensityResponse" + And the request with the response body will be received at the address of the request property "$.sink" + And the request will have header "Authorization" set to "Bearer: " + the value of the request property "$.sinkCredentials.accessToken" + And the request body revieved complies with the OAS schema at "/components/schemas/PopulationDensityResponse" - @population_density_data_05_custom_precision_success_scenario + @population_density_data_retrievePopulationDensity_05_custom_precision_success_scenario Scenario: Validate success response for a request specifying the precision of the geohashes Given the request body property "$.area" is set to a valid testing area within supported regions And the request body property "$.startDate" is set to a valid testing future date @@ -96,7 +107,7 @@ Feature: CAMARA Population Density Data API, v0.1.1 # Generic errors - @population_density_data_06_missing_required_property + @population_density_data_retrievePopulationDensity_06_missing_required_property Scenario Outline: Error response for missing required property in request body Given the request body property "" is not included When the request "retrievePopulationDensity" is sent @@ -112,7 +123,7 @@ Feature: CAMARA Population Density Data API, v0.1.1 | $.startDate | | $.endDate | - @population_density_data_07_invalid_date_format + @population_density_data_retrievePopulationDensity_07_invalid_date_format Scenario Outline: Error 400 when the datetime format is not RFC-3339 Given the request body property "" is not set to a valid RFC-3339 date-time When the request "retrievePopulationDensity" is sent @@ -127,7 +138,7 @@ Feature: CAMARA Population Density Data API, v0.1.1 | $.startDate | | $.endDate | - @population_density_data_08_invalid_precision + @population_density_data_retrievePopulationDensity_08_invalid_precision Scenario: Error 400 when precision is not a number between 1 and 12 Given the request body property "$.precision" is not set to a number between 1 and 12 When the request "retrievePopulationDensity" is sent @@ -138,17 +149,37 @@ Feature: CAMARA Population Density Data API, v0.1.1 And the response property "$.message" contains a user friendly text - @population_density_data_09_empty_webhook - Scenario: Error response for empty webhook in request body - Given the request body property "$.webhook" is set to "{}" + # PLAIN and REFRESHTOKEN are considered in the schema so INVALID_ARGUMENT is not expected + @population_density_data_retrievePopulationDensity_09_invalid_sink_credential + Scenario Outline: Invalid credential + Given the request body property "$.sinkCredential.credentialType" is set to "" When the request "retrievePopulationDensity" is sent Then the response status code is 400 + And the response header "x-correlator" has same value as the request header "x-correlator" And the response header "Content-Type" is "application/json" And the response property "$.status" is 400 - And the response property "$.code" is "INVALID_ARGUMENT" + And the response property "$.code" is "INVALID_CREDENTIAL" + And the response property "$.message" contains a user friendly text + + Examples: + | unsupported_credential_type | + | PLAIN | + | REFRESHTOKEN | + + # Only "bearer" is considered in the schema so a generic schema validator may fail and generate a 400 INVALID_ARGUMENT without further distinction, + # and both could be accepted + @population_density_data_retrievePopulationDensity_10_sink_credential_invalid_token + Scenario: Invalid token + Given the request body property "$.sinkCredential.accessTokenType" is set to a value other than "bearer" + When the request "retrievePopulationDensity" is sent + Then the response status code is 400 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" + And the response property "$.status" is 400 + And the response property "$.code" is "INVALID_TOKEN" or "INVALID_ARGUMENT" And the response property "$.message" contains a user friendly text - @population_density_data_10_expired_access_token + @population_density_data_retrievePopulationDensity_10_expired_access_token Scenario: Error response for expired access token Given an expired access token And the request body is set to a valid request body @@ -159,7 +190,7 @@ Feature: CAMARA Population Density Data API, v0.1.1 And the response property "$.code" is "UNAUTHENTICATED" And the response property "$.message" contains a user friendly text - @population_density_data_11_invalid_access_token + @population_density_data_retrievePopulationDensity_11_invalid_access_token Scenario: Error response for invalid access token Given an invalid access token And the request body is set to a valid request body @@ -170,7 +201,7 @@ Feature: CAMARA Population Density Data API, v0.1.1 And the response property "$.code" is "UNAUTHENTICATED" And the response property "$.message" contains a user friendly text - @population_density_data_12_missing_authorization_header + @population_density_data_retrievePopulationDensity_12_missing_authorization_header Scenario: Error response for no header "Authorization" Given the header "Authorization" is not sent And the request body is set to a valid request body @@ -185,7 +216,7 @@ Feature: CAMARA Population Density Data API, v0.1.1 # API Specific Errors # An area that does not form a polygon is a straight line or a set of points with same coordinates. - @population_density_data_13_non_polygonal_area + @population_density_data_retrievePopulationDensity_13_non_polygonal_area Scenario: Error 400 when the requested area is not a polygon Given the request body property "$.area.boundry" is set to an array of coordinates that does not form a polygon When the request "retrievePopulationDensity" is sent @@ -195,7 +226,7 @@ Feature: CAMARA Population Density Data API, v0.1.1 And the response property "$.code" is "POPULATION_DENSITY_DATA.INVALID_AREA" And the response property "$.message" contains a user friendly text - @population_density_data_14_too_complex_area + @population_density_data_retrievePopulationDensity_14_too_complex_area Scenario: Error 400 when the requested area is too complex Given the request body property "$.area.boundary" is set to an array of coordinates that form a too complex area When the request "retrievePopulationDensity" is sent @@ -205,7 +236,7 @@ Feature: CAMARA Population Density Data API, v0.1.1 And the response property "$.code" is "POPULATION_DENSITY_DATA.INVALID_AREA" And the response property "$.message" contains a user friendly text - @population_density_data_15_min_start_date_exceeded + @population_density_data_retrievePopulationDensity_15_min_start_date_exceeded Scenario: Error 400 when startDate is set to a date earlier than the minimum allowed Given the request body property "$.startDate" is set to a date earlier than the minimum allowed When the request "retrievePopulationDensity" is sent @@ -215,7 +246,7 @@ Feature: CAMARA Population Density Data API, v0.1.1 And the response property "$.code" is "POPULATION_DENSITY_DATA.MIN_STARTDATE_EXCEEDED" And the response property "$.message" contains a user friendly text - @population_density_data_16_max_start_date_exceeded + @population_density_data_retrievePopulationDensity_16_max_start_date_exceeded Scenario: Error 400 when startDate is set to a date later than the maximum allowed Given the request body property "$.startDate" is set to a date later than the maximum allowed When the request "retrievePopulationDensity" is sent @@ -225,7 +256,7 @@ Feature: CAMARA Population Density Data API, v0.1.1 And the response property "$.code" is "POPULATION_DENSITY_DATA.MAX_STARTDATE_EXCEEDED" And the response property "$.message" contains a user friendly text - @population_density_data_17_invalid_end_date + @population_density_data_retrievePopulationDensity_17_invalid_end_date Scenario: Error 400 when endDate is set to a date earlier than startDate Given the request body property "$.endDate" is set to a date earlier than request body property "$.startDate" When the request "retrievePopulationDensity" is sent @@ -235,7 +266,7 @@ Feature: CAMARA Population Density Data API, v0.1.1 And the response property "$.code" is "POPULATION_DENSITY_DATA.INVALID_END_DATE" And the response property "$.message" contains a user friendly text - @population_density_data_18_max_time_period_exceeded + @population_density_data_retrievePopulationDensity_18_max_time_period_exceeded Scenario: Error 400 when indicated time period is greater than the maximum allowed Given the request body property "$.startDate" is set to a valid testing future And the request body property "$.endDate" is set to a future date that exceeds the supported duration from the start date. @@ -246,7 +277,7 @@ Feature: CAMARA Population Density Data API, v0.1.1 And the response property "$.code" is "POPULATION_DENSITY_DATA.MAX_TIME_PERIOD_EXCEEDED" And the response property "$.message" contains a user friendly text - @population_density_data_19_unsupported_precision + @population_density_data_retrievePopulationDensity_19_unsupported_precision Scenario: Error 400 when precision is set to a valid but not supported value Given the request body property "$.precision" is set to a valid but not supported value When the request "retrievePopulationDensity" is sent @@ -256,7 +287,7 @@ Feature: CAMARA Population Density Data API, v0.1.1 And the response property "$.code" is "POPULATION_DENSITY_DATA.UNSUPPORTED_PRECISION" And the response property "$.message" contains a user friendly text - @population_density_data_20_too_big_synchronous_response + @population_density_data_retrievePopulationDensity_20_too_big_synchronous_response Scenario: Error 400 when the response is too big for a sync response Given the request body properties "$.area.boundry", "$.startDate", "$.endDate" and "$.precision" are set to valid values but generate a response too big for a synchronous response When the request "retrievePopulationDensity" is sent @@ -266,7 +297,7 @@ Feature: CAMARA Population Density Data API, v0.1.1 And the response property "$.code" is "POPULATION_DENSITY_DATA.UNSUPPORTED_SYNC_RESPONSE" And the response property "$.message" contains a user friendly text - @population_density_data_21_too_big_request + @population_density_data_retrievePopulationDensity_21_too_big_request Scenario: Error 400 when the response is too big for a sync adn async response Given the request body properties "$.area.boundry", "$.startDate", "$.endDate" and "$.precision" are set to valid values but generate a response too big for a synchronous and asynchronous response When the request "retrievePopulationDensity" is sent From 33fea08e46bced14d2e3a2c7f7d11e1f2876a5f0 Mon Sep 17 00:00:00 2001 From: Jorge Garcia Hospital <129095857+jgarciahospital@users.noreply.github.com> Date: Thu, 5 Sep 2024 19:28:28 +0200 Subject: [PATCH 6/8] typo correction --- code/Test_definitions/population-density-data.feature | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/code/Test_definitions/population-density-data.feature b/code/Test_definitions/population-density-data.feature index 191f27c..d93fac0 100644 --- a/code/Test_definitions/population-density-data.feature +++ b/code/Test_definitions/population-density-data.feature @@ -85,7 +85,8 @@ Feature: CAMARA Population Density Data API, v0.1.1 And the request property "$.sinkCredentials.credentialType" is set to "ACCESSTOKEN" And the request property "$.sinkCredentials.accessTokenType" is set to "bearer" And the request property "$.sinkCredentials.accessToken" is set to a valid access token accepted by the events receiver - And the request property "$.sinkCredentials.accessTokenExpiresUtc" is set to a value long enough in the future When the request "retrievePopulationDensity" is sent + And the request property "$.sinkCredentials.accessTokenExpiresUtc" is set to a value long enough in the future + When the request "retrievePopulationDensity" is sent Then the response status code is 202 And the response header "Content-Type" is "application/json" And the response header "x-correlator" has same value as the request header "x-correlator" From 772156c986037ae8aedd7e562b55c1fba8cdc52c Mon Sep 17 00:00:00 2001 From: Jorge Garcia Hospital <129095857+jgarciahospital@users.noreply.github.com> Date: Fri, 6 Sep 2024 20:58:43 +0200 Subject: [PATCH 7/8] Update population-density-data.feature Fix API version --- code/Test_definitions/population-density-data.feature | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/Test_definitions/population-density-data.feature b/code/Test_definitions/population-density-data.feature index d93fac0..164f191 100644 --- a/code/Test_definitions/population-density-data.feature +++ b/code/Test_definitions/population-density-data.feature @@ -18,7 +18,7 @@ Feature: CAMARA Population Density Data API, v0.1.1 Background: Common retrievePopulationDensity setup Given an environment at "apiRoot" - And the resource "/population-density-data/v1/retrieve" + And the resource "/population-density-data/v0.1/retrieve" And the header "Content-Type" is set to "application/json" And the header "Authorization" is set to a valid access token And the header "x-correlator" is set to a UUID value From 888e8531d1de0753a0b1cadaf72b00ecb8ad4a14 Mon Sep 17 00:00:00 2001 From: Jorge Garcia Hospital <129095857+jgarciahospital@users.noreply.github.com> Date: Fri, 6 Sep 2024 21:00:41 +0200 Subject: [PATCH 8/8] Rename Population-Density-Data-API-Readiness-Checklist.md to population-density-data-API-Readiness-Checklist.md --- ...list.md => population-density-data-API-Readiness-Checklist.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename documentation/API_documentation/{Population-Density-Data-API-Readiness-Checklist.md => population-density-data-API-Readiness-Checklist.md} (100%) diff --git a/documentation/API_documentation/Population-Density-Data-API-Readiness-Checklist.md b/documentation/API_documentation/population-density-data-API-Readiness-Checklist.md similarity index 100% rename from documentation/API_documentation/Population-Density-Data-API-Readiness-Checklist.md rename to documentation/API_documentation/population-density-data-API-Readiness-Checklist.md