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 20 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
179 changes: 179 additions & 0 deletions code/Test_definitions/Geofencing.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,179 @@
@Geofencing
Feature: Camara Geofencing Subscriptions API ,v0.3.0 - Operations on subscriptions
mdomale marked this conversation as resolved.
Show resolved Hide resolved

# 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

@geofencing_subscriptions_01_Create_geofencing_subscription_for_a_device
mdomale marked this conversation as resolved.
Show resolved Hide resolved
Scenario: Create geofencing subscription
mdomale marked this conversation as resolved.
Show resolved Hide resolved
mdomale marked this conversation as resolved.
Show resolved Hide resolved
Given a valid subscription request body
mdomale marked this conversation as resolved.
Show resolved Hide resolved
When the request "createSubscription" is sent
mdomale marked this conversation as resolved.
Show resolved Hide resolved
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_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_03_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_04_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 response property $.status is 204 then response body is not available
mdomale marked this conversation as resolved.
Show resolved Hide resolved


@geofencing_subscriptions_05_Create_invalid_geofencing_subscription_for_a_device
Scenario: Create geofencing subscription with invalid parameter
Given a valid subscription request body with invalid parameter
mdomale marked this conversation as resolved.
Show resolved Hide resolved
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_06_Get_unknown_geofencing_subscription_for_a_device
Scenario: Get geofencing subscription with subscription-id unknown to the system
Given the request body is not available and path parameter "subscriptionId" is set to the identifier of a unknown to subscription
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
Given the request body is not available and path parameter "subscriptionId" is set to the identifier of a unknown to subscription
Given the path parameter "subscriptionId" is set to a value not corresponding to an existing subscription

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_07_Delete_invalid_geofencing_subscription_for_a_device
Scenario: Delete geofencing subscription with invalid parameter
mdomale marked this conversation as resolved.
Show resolved Hide resolved
Given the request body is not available and path parameter "subscriptionId" is set to the identifier of an non-existing subscription
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
Given the request body is not available and path parameter "subscriptionId" is set to the identifier of an non-existing subscription
Given the path parameter "subscriptionId" is set to a value not corresponding to an 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


@geofencing_subscriptions_08_creation_of_subscription_for_subscribed_expired_time_in_past
Scenario: Subscribed expire time in past for geofencing subscription
Given a valid subscription request body with expire time in past
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
Given a valid subscription request body with expire time in past
Given a valid subscription request body with subscriptionExpireTime in the 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_subscriptions_09_Get_Event_Details_of_subscription_entered
Scenario: Subscription creation when service have area-entered event
Copy link
Collaborator

Choose a reason for hiding this comment

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

If we wanted to test that event is received when the device enters in some area I would write it as:

Scenario: Events are received for a created subscription for area-entered event
Given an existing subscription to area-entered for a device and an area
When the device enters the area
Then an event is received in the subscription callback url
And the event request body complies with the schema at "/components/schemas/EventAreaEntered"

More scenarios could be added to test the other type of events

That's a minimum. An enhanced scenario should validate that properties make sense, authorization is according to the subscription sink credentials, etc

Given a valid subscription request body
##Geofence should be created
When the request "createSubscription" is sent
Then the device entered to "Place2" from "Place1"
Then event notification "area-entered" is received on callback-url
mdomale marked this conversation as resolved.
Show resolved Hide resolved

@geofencing_subscriptions_10_Get_Event_Details_of_subscription_left
Scenario: Subscription creation when service have area-left event
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same comments as above

Given a valid subscription request body
When the request "createSubscription" is sent
Then the device left from "Place1" to "Place2"
Then event notification "area-left" is received on callback-url
mdomale marked this conversation as resolved.
Show resolved Hide resolved


@geofencing_subscriptions_11_Get_invalid_geofencing_subscription_for_a_device
Scenario: Get geofencing subscription with invalid subscription-id format
Given the request body is not available and path parameter "subscriptionId" is set to the identifier with invalid subscription-id which is in invalid format
When the request "retrieveGeofencingSubscription" 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_Delete_invalid_geofencing_subscription_for_a_device
Scenario: Get geofencing subscription with invalid subscription-id format
mdomale marked this conversation as resolved.
Show resolved Hide resolved
Given the request body is not available and path parameter "subscriptionId" is set to the identifier of a non-existing subscription which is in invalid format
When the request "deleteGeofencingSubscription" 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_13_no_authorization_header
Scenario: No Authorization header
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_14_expired_access_token
Scenario: Expired access token
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_15_invalid_access_token
Scenario: Invalid access token
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 "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_16_sink_credentials
Scenario: Validate that the subscribed events are received in the sink, with the right sinkCredential, for those situations specified in the API.
mdomale marked this conversation as resolved.
Show resolved Hide resolved
Given a valid subscription request body with "sink" and "sinkcredentials"
When the request "createSubscription" is sent
Then the response code is 201 and subscription is created
Then the event details are observed on notifications-url
And the subscribed event received on notifications-callback-url & sink credentials are as expected

@geofencing_subscriptions_17_subscriptionExpireTime
Scenario: For subscriptions that provide subscriptionExpireTime, validate that the subscribed events are not longer received after the expiration time.
Given a valid subscription request body and for less $.duration
When the request "createSubscription" is sent
Then the subscription is expired
And no event notifications received on callback-url when device enters or leaves geofence
mdomale marked this conversation as resolved.
Show resolved Hide resolved

@geofencing_subscriptions_18_subscriptionMaxEvents
Scenario: For subscriptions that provide subscriptionMaxEvents, validate that the subscribed events are not longer received after the maximum events limit is reached.
mdomale marked this conversation as resolved.
Show resolved Hide resolved
Given a valid subscription request body
When the request "createSubscription" is sent
Then the maxevents are already triggered for available subscription
And no event notifications received on callback-url when device enters or leaves geofence
mdomale marked this conversation as resolved.
Show resolved Hide resolved


@geofencing_subscriptions_19_subscription_delete_event_validation
Scenario: Validate that after a subscription is deleted, the subscribed events are not longer received.
mdomale marked this conversation as resolved.
Show resolved Hide resolved
Given the request body is not available and path parameter "subscriptionId" is set to the identifier of an existing subscription
When the request "deleteGeofencingSubscription" is sent
Then no event notifications received on callback-url for the device
mdomale marked this conversation as resolved.
Show resolved Hide resolved