generated from camaraproject/Template_API_Repository
-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create Gherkin tests for Population Density Data #44
Merged
Merged
Changes from 1 commit
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
3f3e232
Create population-density-data.feature
jgarciahospital dd3221c
Delete code/Test_definitions/README.md
jgarciahospital 41cb40e
Typo fixing
jgarciahospital 6e74f3e
Updating Checklist with ATP link
jgarciahospital 6537942
Update population-density-data.feature
jgarciahospital 33fea08
typo correction
jgarciahospital 772156c
Update population-density-data.feature
jgarciahospital 888e853
Rename Population-Density-Data-API-Readiness-Checklist.md to populati…
jgarciahospital File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Typo here - When the request....must be on the next line There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. solved |
||
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 "<required_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 "<date_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 "<unsupported_credential_type>" | ||
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 | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and add:
And there is at least one item in response property "$.timedPopulationDensityData[*].cellPopulationDensityData[*].datatype" equal to "LOW_DENSITY" or "DENSITY_ESTIMATION"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to be solved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jgarciahospital : is it solved ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For me yes :) line 61
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks ludovic, solved then.