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

Geofencing feature file #181

Merged
merged 44 commits into from
Aug 30, 2024
Merged
Changes from 27 commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
ddfc1d4
Geofencing feature file
mdomale Apr 8, 2024
95bd04b
Update Geofencing.feature
mdomale Apr 15, 2024
bb2df50
Update Geofencing.feature
mdomale Jul 19, 2024
a5221b1
Update Geofencing.feature
mdomale Jul 19, 2024
296c111
Update Geofencing.feature
mdomale Jul 19, 2024
7507571
Merge branch 'camaraproject:main' into Feature-file-Geofencing
mdomale Aug 12, 2024
7b39f8a
Update Geofencing.feature
mdomale Aug 12, 2024
de6e32c
Update Geofencing.feature
mdomale Aug 12, 2024
a3d58ba
Update Geofencing.feature
mdomale Aug 12, 2024
b806c65
Update Geofencing.feature
mdomale Aug 12, 2024
422ca3c
Update Geofencing.feature
mdomale Aug 12, 2024
0a37af2
Update code/Test_definitions/Geofencing.feature
mdomale Aug 23, 2024
368ac66
Update code/Test_definitions/Geofencing.feature
mdomale Aug 23, 2024
ce8b897
Update Geofencing.feature
mdomale Aug 26, 2024
36ccd72
Update Geofencing.feature
mdomale Aug 26, 2024
e1faaac
Update Geofencing.feature
mdomale Aug 26, 2024
9e58ca3
Update Geofencing.feature
mdomale Aug 26, 2024
7951305
Update Geofencing.feature
mdomale Aug 27, 2024
104e848
Update Geofencing.feature
mdomale Aug 27, 2024
ae9e8bc
Update Geofencing.feature
mdomale Aug 27, 2024
62989db
Update Geofencing.feature
mdomale Aug 27, 2024
ab8471f
Update Geofencing.feature
mdomale Aug 27, 2024
e627cc9
Update code/Test_definitions/Geofencing.feature
mdomale Aug 27, 2024
88aed70
Update code/Test_definitions/Geofencing.feature
mdomale Aug 28, 2024
65919a0
Update code/Test_definitions/Geofencing.feature
mdomale Aug 28, 2024
7aafd88
Update Geofencing.feature
mdomale Aug 28, 2024
fc4b480
Update Geofencing.feature
mdomale Aug 28, 2024
ba17839
Update code/Test_definitions/Geofencing.feature
mdomale Aug 28, 2024
b9fd8c9
Update code/Test_definitions/Geofencing.feature
mdomale Aug 28, 2024
a2893a6
Update code/Test_definitions/Geofencing.feature
mdomale Aug 28, 2024
188c49c
Update code/Test_definitions/Geofencing.feature
mdomale Aug 28, 2024
38f1660
Update Geofencing.feature
mdomale Aug 28, 2024
9fcd8f1
Update Geofencing.feature
mdomale Aug 28, 2024
7d91a4a
Update Geofencing.feature
mdomale Aug 28, 2024
f26f845
Update Geofencing.feature
mdomale Aug 29, 2024
888f6ba
Update code/Test_definitions/Geofencing.feature
mdomale Aug 29, 2024
05186ee
Update code/Test_definitions/Geofencing.feature
mdomale Aug 29, 2024
91eb45e
Update code/Test_definitions/Geofencing.feature
mdomale Aug 29, 2024
cde7ad6
Update code/Test_definitions/Geofencing.feature
mdomale Aug 29, 2024
c449069
Update code/Test_definitions/Geofencing.feature
mdomale Aug 29, 2024
2e1fbae
Update code/Test_definitions/Geofencing.feature
mdomale Aug 29, 2024
2b337f7
Update code/Test_definitions/Geofencing.feature
mdomale Aug 29, 2024
7056453
Update code/Test_definitions/Geofencing.feature
mdomale Aug 29, 2024
bfe30d1
Update Geofencing.feature
mdomale Aug 29, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
297 changes: 297 additions & 0 deletions code/Test_definitions/Geofencing.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,297 @@
@Geofencing
Feature: Camara Geofencing Subscriptions API, v0.3.0 - Operations on subscriptions

# Input to be provided by the implementation to the tests
# References to OAS spec schemas refer to schemas specified in geofencing-subscriptions.yaml, version v0.3.0

Background: Common Geofencing Subscriptions setup
Given the resource "{apiroot}/geofencing-subscriptions/v0.3/" as geofencing base-url
And the header "Authorization" is set to a valid access token
And the header "x-correlator" is set to a UUID value

############################ Happy Path Scenarios########################
mdomale marked this conversation as resolved.
Show resolved Hide resolved
@geofencing_subscriptions_01_Create_geofencing_subscription_for_a_device
mdomale marked this conversation as resolved.
Show resolved Hide resolved
Scenario: Create geofencing subscription (sync creation)
Given that subscriptions are created synchronously
And a valid subscription request body
When the request "createSubscription" is sent
Then the response code is 201
mdomale marked this conversation as resolved.
Show resolved Hide resolved
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/Subscription"

mdomale marked this conversation as resolved.
Show resolved Hide resolved
@geofencing_subscriptions_02_Create_geofencing_subscription_for_a_device
mdomale marked this conversation as resolved.
Show resolved Hide resolved
Scenario: Create geofencing subscription (async creation)
Given that subscriptions are created asynchronously
And a valid subscription request body
When the request "createSubscription" is sent
Then the response 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 response body complies with the OAS schema at "#/components/schemas/SubscriptionAsync"

@geofencing_subscriptions_03_Operation_to_retrieve_list_of_subscriptions
Scenario: Get a list of subscriptions.
Given the request body is not available
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would set something like

Suggested change
Given the request body is not available
Given a client with subscriptions created

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jlurien I'm not sure what that means.. The case is here, that instead of a specific request body here we explicitly shouldn't have a request body.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jlurien IMO As we are keeping request body everywhere for creation of subscription then it makes sense to showcase no request body required for get list ,get & delete method .

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Saying that a request body is not available for an operation without request body is not needed, as we don't mention that query parameters are not available, etc. Only createSubscription requires it.

The suggestion for a client with subscriptions created is to tell the tester that this method should be tested for a client with subscriptions, otherwise the response would be [], which could be another scenario to test

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, I thought it's an equivalent to the empty body :-)
So basically a precondition, that already some subscriptions exist.
We could make 2 cases of it, one to return an empty list and one with subscriptions. Currently the evaluation is generic with "if any", but it could be more specific then.

Copy link
Collaborator

@jlurien jlurien Aug 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we can split this into 2 scenarios one with

Given a client with subscriptions created
response is an array of items complying with the schema

other

Given a client without subscriptions created
response is an empty array []

When the request "retrieveGeofencingSubscriptionList" is sent
Then the response 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 each item in the response body, if any, complies with the OAS schema at "/components/schemas/Subscription"
mdomale marked this conversation as resolved.
Show resolved Hide resolved

@geofencing_subscriptions_04_Operation_to_retrieve_subscription_based_on_an_existing_subscription-id
Scenario: Get a subscription based on existing subscription-id.
Given the request body is not available and path parameter "subscriptionId" is set to the identifier of an existing subscription
mdomale marked this conversation as resolved.
Show resolved Hide resolved
mdomale marked this conversation as resolved.
Show resolved Hide resolved
When the request "retrieveGeofencingSubscription" is sent
Then the response 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/Subscription"

@geofencing_subscriptions_05_Operation_to_delete_subscription_based_on_an_existing_subscription-id
Scenario: Delete a subscription based on existing subscription-id.
Given the request body is not available and path parameter "subscriptionId" is set to the identifier of an existing subscription
mdomale marked this conversation as resolved.
Show resolved Hide resolved
mdomale marked this conversation as resolved.
Show resolved Hide resolved
When the request "deleteGeofencingSubscription" is sent
Then the response code is 202 or 204
And the response header "x-correlator" has same value as the request header "x-correlator"
And if the response property $.status is 204 then response body is not available
And if the response property $.status is 202 then response body complies with the OAS schema at "/components/schemas/SubscriptionAsync"

@geofencing_subscriptions_06_Receive_notification_when_device_enters_geofence
Scenario: Receive notification for area-entered event
Given a valid subscription request body
And the request body property "$.area" is set to circle which covers location "Place1"
And the request body property "$.type" is "area-entered"
When the request "createSubscription" is sent
Then the response code is 201
Then the device entered location "Place1"
Then event notification "area-entered" is received on callback-url
And sink credentials are received as expected
And notification body complies with the OAS schema at "##/components/schemas/EventAreaEntered"
And type="org.camaraproject.geofencing-subscriptions.v0.area-entered"

@geofencing_subscriptions_07_receive_notification_when_device_leaves_geofence
Scenario: Receive notification for area-left event
Given a valid subscription request body
And the request body property "$.area" is set to circle which covers location "Place1"
And the request body property "$.type" is "area-left"
When the request "createSubscription" is sent
Then the response code is 201
Then the device left from location "Place1"
Then event notification "area-left" is received on callback-url
And sink credentials are received as expected
And notification body complies with the OAS schema at "##/components/schemas/EventAreaLeft"
And type="org.camaraproject.geofencing-subscriptions.v0.area-left"

@geofencing_subscriptions_08_subscriptionExpireTime
Scenario: Receive notification for subscription-ends event on expiry
Given a valid subscription request body
And the request body property "$.area" is set to circle which covers location "Place1"
And the request body property "$.type" is "area-left"
And the request body property "$.subscriptionExpireTime" set to smaller value
mdomale marked this conversation as resolved.
Show resolved Hide resolved
When the request "createSubscription" is sent
Then the response code is 201
Then the subscription is expired
Then event notification "subscription-ends" is received on callback-url
And notification body complies with the OAS schema at "##/components/schemas/EventSubscriptionEnds"
And type="org.camaraproject.geofencing-subscriptions.v0.subscription-ends"
And the response property "$.terminationReason" is "SUBSCRIPTION_EXPIRED"

@geofencing_subscriptions_09_subscriptionMaxEvents
Scenario: Receive notification for subscription-ends event on max events reached
Given a valid subscription request body
And the request body property "$.area" is set to circle which covers location "Place1"
And the request body property "$.type" is "area-left"
And the request body property "$.subscriptionMaxEvents" is set to 1
When the request "createSubscription" is sent
Then the response code is 201
Then the device left from location "Place1"
Then event notification "area-left" is received on callback-url
Then event notification "subscription-ends" is received on callback-url
And notification body complies with the OAS schema at "##/components/schemas/EventSubscriptionEnds"
And type="org.camaraproject.geofencing-subscriptions.v0.subscription-ends"And the response property "$.terminationReason" is "MAX_EVENTS_REACHED"

@geofencing_subscriptions_10_subscription_delete_event_validation
Scenario: Receive notification for subscription-ends event on deletion
Given a valid subscription request body
When the request "createSubscription" is sent
Then the response code is 201
When the request "deleteGeofencingSubscription" is sent
mdomale marked this conversation as resolved.
Show resolved Hide resolved
Then the response code is 202 or 204
Then event notification "subscription-ends" is received on callback-url
And notification body complies with the OAS schema at "##/components/schemas/EventSubscriptionEnds"
And type="org.camaraproject.geofencing-subscriptions.v0.subscription-ends"
And the response property "$.terminationReason" is "SUBSCRIPTION_DELETED"

########################### Error response scenarios############################################
@geofencing_subscriptions_11_create_geofencing_subscription_for_a_device_with_invalid_parameter
Scenario: Create geofencing subscription with invalid parameter
Given the request body is not compliant with the schema "/components/schemas/SubscriptionRequest"
When the request "createSubscription" is sent
Then the response code is 400
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

@geofencing_subscriptions_12_creation_of_subscription_with_expiry_time_in_past
Scenario: Expiry time in past
Given a valid subscription request body with expiry time in past
When the request "createSubscription" is sent
Then the response code is 400
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

@geofencing_subscription_13_creation_with_invalid_eventType
Scenario: Subscription creation with invalid event type
Given a valid subscription request body
And the request body property "$.types" is set to invalid value
When the request "createSubscription" is sent
Then the response property "$.status" is 400
And the response property "$.code" is "INVALID_ARGUMENT"
And the response property "$.message" contains a user friendly text

@geofencing_subscription_14_invalid_protocol
Scenario: Subscription creation with invalid protocol
Given a valid subscription request body
When the request "createSubscription" is sent
And "$.types"="org.camaraproject.geofencing-subscriptions.v0.area-entered"
And "$.protocol"<>"HTTP"
And "$.config.subscriptionDetail.phoneNumber" is set with with provided phoneNumber
And "$.sink" is set to provided callbackUrl
Then the response property "$.status" is 400
And the response property "$.code" is "INVALID_PROTOCOL"
And the response property "$.message" contains a user friendly text

@geofencing_subscription_15_invalid_credential
Scenario: Subscription creation with invalid credential
Given a valid subscription request body
When the request "createSubscription" is sent
And "$.types"="org.camaraproject.geofencing-subscriptions.v0.area-entered"
And "$.protocol"="HTTP"
And "$.config.subscriptionDetail.phoneNumber" is set with with provided phoneNumber
And "$.sink" is set to provided callbackUrl
And "$.sinkCredential.credentialType" <> "ACCESSTOKEN"
And "$.sinkCredential.accessTokenType" = "bearer"
And "$.sinkCredential.accessToken" is valued with a valid value
And "$.sinkCredential.accessTokenExpiresUtc" is valued with a valid value
Then the response property "$.status" is 400
And the response property "$.code" is "INVALID_CREDENTIAL"
And the response property "$.message" contains a user friendly text

@geofencing_subscription_16_invalid_token
mdomale marked this conversation as resolved.
Show resolved Hide resolved
Scenario: Subscription creation with invalid token
Given a valid subscription request body
When the request "createSubscription" is sent
And "$.types"="org.camaraproject.geofencing-subscriptions.v0.area-entered"
And "$.protocol"="HTTP"
And "$.sink" is set to provided callbackUrl
And "$.sinkCredential.credentialType" = "ACCESSTOKEN"
And "$.sinkCredential.accessTokenType" <> "bearer"
And "$.sinkCredential.accessToken" is valued with a valid value
And "$.sinkCredential.accessTokenExpiresUtc" is valued with a valid value
Then the response property "$.status" is 400
And the response property "$.code" is "INVALID_TOKEN"
And the response property "$.message" contains a user friendly text

@geofencing_subscriptions_17_no_authorization_header
Scenario: No Authorization header for create subscription
Given a valid subscription request body and header "Authorization" is not available
When the request "createSubscription" is sent
Then the response status code is 401
And the response property "$.status" is 401
And the response property "$.code" is "UNAUTHENTICATED"
And the response property "$.message" contains a user friendly text

@geofencing_subscriptions_18_expired_access_token
Scenario: Expired access token for create subscription
Given a valid subscription request body and header "Authorization" is expired
When the request "createSubscription" is sent
Then the response status code is 401
And the response property "$.status" is 401
And the response property "$.code" is "UNAUTHENTICATED"
And the response property "$.message" contains a user friendly text

@geofencing_subscriptions_19_invalid_access_token
Scenario: Invalid access token for create subscription
Given a valid subscription request body and header "Authorization" set to an invalid access token
When the request "createSubscription" 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

@geofencing_subscriptions_20_no_authorization_header
Scenario: No Authorization header for get subscription
Given the request body & header "Authorization" is not available and path parameter "subscriptionId" is set to the identifier of an existing subscription
When the request "retrieveGeofencingSubscription" is sent
Then the response status code is 401
And the response property "$.status" is 401
And the response property "$.code" is "UNAUTHENTICATED"
And the response property "$.message" contains a user friendly text

@geofencing_subscriptions_21_expired_access_token
Scenario: Expired access token for get subscription
Given the request body is not available and header "Authorization" is expired
When the request "retrieveGeofencingSubscription" is sent
Then the response status code is 401
And the response property "$.status" is 401
And the response property "$.code" is "UNAUTHENTICATED"
And the response property "$.message" contains a user friendly text

@geofencing_subscriptions_22_invalid_access_token
Scenario: Invalid access token for get subscription
Given the request body is not available and header "Authorization" set to an invalid access token
mdomale marked this conversation as resolved.
Show resolved Hide resolved
When the request "retrieveGeofencingSubscription" 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

@geofencing_subscriptions_23_no_authorization_header
Scenario: No Authorization header for delete subscription
Given a the request body and header "Authorization" is not available
When the request "deleteGeofencingSubscription" is sent
Then the response status code is 401
And the response property "$.status" is 401
And the response property "$.code" is "UNAUTHENTICATED"
And the response property "$.message" contains a user friendly text

@geofencing_subscriptions_24_expired_access_token
Scenario: Expired access token for delete subscription
Given a valid subscription request body and header "Authorization" is expired
When the request "deleteGeofencingSubscription" is sent
Then the response status code is 401
And the response property "$.status" is 401
And the response property "$.code" is "UNAUTHENTICATED"
And the response property "$.message" contains a user friendly text

@geofencing_subscriptions_25_invalid_access_token
Scenario: Invalid access token for delete subscription
Given a valid subscription request body and header "Authorization" set to an invalid access token
mdomale marked this conversation as resolved.
Show resolved Hide resolved
When the request "deleteGeofencingSubscription" 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

@geofencing_subscriptions_26_get_unknown_geofencing_subscription_for_a_device
Scenario: Get method for geofencing subscription with subscription-id unknown to the system
Given the request body is not available and path parameter "subscriptionId" is set to the value which is unknown to system
When the request "retrieveGeofencingSubscription" is sent
Then the response code is 404
And the response property "$.status" is 404
And the response property "$.code" is "NOT_FOUND"
And the response property "$.message" contains a user friendly text

@geofencing_subscriptions_27_delete_invalid_geofencing_subscription_for_a_device
Scenario: Delete geofencing subscription with unknown subscription-id to the system
Given the request body is not available and path parameter "subscriptionId" is set to the identifier for an non-existing subscription
When the request "deleteGeofencingSubscription" is sent
Then the response code is 404
And the response property "$.status" is 404
And the response property "$.code" is "NOT_FOUND"
And the response property "$.message" contains a user friendly text