Skip to content
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 8 commits into from
Sep 11, 2024
Prev Previous commit
Next Next commit
Typo fixing
  • Loading branch information
jgarciahospital authored Aug 21, 2024
commit 41cb40ee5868b958783bcbb09f8c7a64803e9793
32 changes: 16 additions & 16 deletions code/Test_definitions/population-density-data.feature
Original file line number Diff line number Diff line change
@@ -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 "<date_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,45 +184,45 @@ 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
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 "$.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 "$.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