Skip to content

Commit

Permalink
New version more aligned with the approved guidelines
Browse files Browse the repository at this point in the history
  • Loading branch information
jlurien committed Jun 17, 2024
1 parent 3320160 commit a4d4787
Showing 1 changed file with 44 additions and 118 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@ Feature: CAMARA Device location verification API, v0.2.0 - Operation verifyLocat
# Input to be provided by the imnplementation to the tester
#
# Implementation indications:
# * identifier_types_unsupported: List of device identifier types which are not supported, among: phoneNumber, networkAccessIdentifier, ipv4Address, ipv6Address
# * device_not_applicable: A device object identifying a device commercialized by the implemenation for which the service is not applicable
# * List of device identifier types which are not supported, among: phoneNumber, networkAccessIdentifier, ipv4Address, ipv6Address
#
# Environment variables:
# * api_root: API root of the server URL
# * locatable_device: A device object which location is known by the network when connected. To test all scenarios, at least 2 valid devices are needed
# * known_latitude: The latitude where locatable_device is known to be located
# * known_longitude | The longitude where locatable_device is known to be located
# Testing assets:
# * A device object which location is known by the network when connected. To test all scenarios, at least 2 valid devices are needed
# * The known location of the testing devices
# * A device object identifying a device commercialized by the implemenation for which the service is not applicable, if any
#
# References to OAS spec schemas refer to schemas specifies in location-verification.yaml, version 0.2.0

Expand All @@ -20,34 +18,28 @@ Feature: CAMARA Device location verification API, v0.2.0 - Operation verifyLocat
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

# This first scenario serves as a minimum, not testing any specific verificationResult
@location_verification_01_generic_success_scenario
Scenario: Common validations for any sucess scenario
# Valid testing device and default request body compliant with the schema
Given the request body property "$.device" is set to config_var: "locatable_device"
Given the request body property "$.device" is set to a valid testing device supported by the service
And the request body is set to a valid request body
When the HTTP "POST" request 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"
# The response has to comply with the generic response schema which is part of the spec
And the response body complies with the OAS schema at "/components/schemas/VerifyLocationResponse"
# Additionally any success response has to comply with implementation guidelines
And if response property "$.lastLocationTime" does not exists then "$.verificationResult" is "UNKNOWN"
# Additionally any success response has to comply with some constraints not documented in the schema
And if the response property "$.lastLocationTime" does not exists then "$.verificationResult" is "UNKNOWN"
And the response property "$.matchRate" exists only if "$.verificationResult" is "PARTIAL"

# The following succeess scenarios test that service is working as expected in terms of quality
# TBD the level of testing for successs scenarios
# Scenarios testing specific situations for the device location

@location_verification_02_known_location_for_device_no_maxAge
Scenario: Known location of a device without specifying maxAge
Given the testing device is connected to the network
And the request body property "$.device" is set to config_var: "locatable_device"
And the request body property "$.area.areaType" is set to: "CIRCLE"
And the request body property "$.area.center.latitude" is set to config_var: "known_latitude"
And the request body property "$.area.center.longitude" is set to config_var: "known_longitude"
And the request body property "$.area.radius" is set to: 10000
Given the request body property "$.device" is set to a valid testing device located by the network
And the request body property "$.area" is set to the known location of the device
And the request body property "$.maxAge" is not included
When the HTTP "POST" request is sent
Then the response status code is 200
Expand All @@ -58,71 +50,26 @@ Feature: CAMARA Device location verification API, v0.2.0 - Operation verifyLocat
And the response property "$.lastLocationTime" exists
And the response property "$.matchRate" exists only if "$.verificationResult" is "PARTIAL"


@location_verification_03_known_location_for_device_with_maxAge
Scenario Outline: Known location of a device specifying maxAge
# Alternative, setting request body with a JSON object
# maxAge is set to fixed value, it could be tested with several values in an Scenario Outline
Given the testing device is connected to the network
And the request body is set to:
"""
{
"device": <config_var:locatable_device>,
"area": {
"areaType": "CIRCLE",
"center": {
"latitude": <config_var:known_latitude>,
"longitude": <config_var:known_longitude>
},
"radius": 10000
},
"maxAge": 600
}
"""
Given the request body property "$.device" is set to a valid testing device located by the network
And the request body property "$.area" is set to the known location of the device
And the request body property "$.maxAge" is included
When the HTTP "POST" request 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/VerifyLocationResponse"
# Alternative, specifying additional response validations with a JSON schema, which has to be complied additionally
And the response body complies with JSON schema:
"""
{
"type": "object",
"properties": {
"verificationResult": {
"enum": [
"TRUE",
"PARTIAL"
]
}
},
"required": [
"lastLocationTime"
],
"dependentSchemas": {
"matchRate": {
"properties": {
"verificationResult": {
"enum": [
"PARTIAL"
]
}
}
}
}
}
"""
And the response property "$.lastLocationTime" value is not older than 600 seconds from the request time
And the response property "$.verificationResult" is one of: ["TRUE", "PARTIAL"]
And the response property "$.matchRate" exists only if "$.verificationResult" is "PARTIAL"
And the response property "$.lastLocationTime" value is not older than the value of "$.maxAge" in the request

@location_verification_04_false_location_for_device_with_maxAge
# Input area set to a value where the device is not located for sure
Scenario: False location of a device specifying maxAge
Given the testing device is connected to the network
And the request body property "$.device" is set to config_var: "locatable_device"
And the request body property "$.area.areaType" is set to: "CIRCLE"
And the request body property "$.area.center.latitude" is set to: 0
And the request body property "$.area.center.longitude" is set to: 0
And the request body property "$.area.radius" is set to: 10000

@location_verification_04_false_location_for_device
Scenario: False location of a device
Given the request body property "$.device" is set to a valid testing device located by the network
And the request body property "$.area" is set to a wrong location of the device
When the HTTP "POST" request is sent
Then the response status code is 200
And the response header "Content-Type" is "application/json"
Expand All @@ -132,23 +79,21 @@ Feature: CAMARA Device location verification API, v0.2.0 - Operation verifyLocat
And the response property "$.lastLocationTime" exists
And the response property "$.matchRate" does not exist

@location_verification_05_unknown_location_for_device_with_maxAge
# Input area can be kept to the default value as recent device location is not known by the network

@location_verification_05_unknown_location_for_device
Scenario: Unknown location of a device specifying maxAge
Given the testing device is not connected to the network for more than 60 seconds
And request body property "$.device" is set to config_var: "locatable_device"
And the request body property "$.maxAge" is set to: 60
Given the request body property "$.device" is set to a valid testing device which is not connected to the network for some time
And the request body property "$.maxAge" is set to a value shorter than that time
When the HTTP "POST" request 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/VerifyLocationResponse"
And the response property "$.verificationResult" is "UNKNOWN"
And the response property "$.lastLocationTime" if exists has a value older than 60 seconds from the request time
And the response property "$.lastLocationTime" if exists has a value older the value of "$.maxAge" in the request
And the response property "$.matchRate" does not exist

# Generic device errors. Scenarios common to several APIs could be maintained in Commonalities
# And get specific test numbers
# Error scenarios for object device

@location_verification_10_device_empty
Scenario Outline: The device value is an empty object
Expand All @@ -159,7 +104,7 @@ Feature: CAMARA Device location verification API, v0.2.0 - Operation verifyLocat
And the response property "$.code" is "INVALID_ARGUMENT"
And the response property "$.message" contains a user friendly text

@location_verification_11_device_schema_compliant
@location_verification_11_device_identifiers_not_schema_compliant
# Test every type of identifier even if not supported by the implementation
Scenario Outline: Some device identifier value does not comply with the schema
Given the request body property "<device_identifier>" does not comply with the OAS schema at "<oas_spec_schema>"
Expand All @@ -176,30 +121,10 @@ Feature: CAMARA Device location verification API, v0.2.0 - Operation verifyLocat
| $.device.ipv6Address | /components/schemas/DeviceIpv4Addr |
| $.device.networkIdentifier | /components/schemas/DeviceIpv6Address |

@location_verification_11.1_device_phoneNumber_schema_compliant
# Example of the scenario above with a higher level of specification
# TBD if test plan has to provide specific testing values to provoke an error
Scenario Outline: Device identifier phoneNumber value does not comply with the schema
Given the request body property "$.device.phoneNumber" is set to: <phone_number_value>
When the HTTP "POST" request is sent
Then the response status 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

Examples:
| phone_number_value |
| string_value |
| 1234567890 |
| +12334foo22222 |
| +00012230304913849 |
| 123 |
| ++49565456787 |

@location_verification_12_device_identifiers_unsupported
Scenario: None of the provided device identifiers is supported by the implementation
Given that config_var "identifier_types_unsupported" is not empty
And the request body property "$.device" only includes properties in config_var "identifier_types_unsupported"
Given that some type of device identifiers are not supported by the implementation
And the request body property "$.device" only includes device identifiers not supported by the implementation
When the HTTP "POST" request is sent
Then the response status code is 422
And the response property "$.status" is 422
Expand All @@ -208,7 +133,7 @@ Feature: CAMARA Device location verification API, v0.2.0 - Operation verifyLocat

@location_verification_13_device_not_found
Scenario: Some identifier cannot be matched to a device
Given the request body property "$.device" is set to a value compliant to the OAS schema at "/components/schemas/Device" which does not identify a valid device
Given the request body property "$.device" is compliant with the request body schema but does not identify a valid device
When the HTTP "POST" request is sent
Then the response status code is 404
And the response property "$.status" is 404
Expand All @@ -217,9 +142,8 @@ Feature: CAMARA Device location verification API, v0.2.0 - Operation verifyLocat

@location_verification_14_device_identifiers_mismatch
Scenario: Device identifiers mismatch
# To test this, at least 2 types of identifiers have to be provided, e.g. a phoneNumber and the IP address of a device associated to a different phoneNumber
Given that config_var "identifier_types_unsupported" contains at most 2 items
And the request body property "$.device" is set to several identifiers, each of them identifying a valid device
Given that al least 2 types of device identifiers are supported by the implementation
And the request body property "$.device" includes several identifiers, each of them identifying a valid but different device
When the HTTP "POST" request is sent
Then the response status code is 422
And the response property "$.status" is 422
Expand All @@ -229,8 +153,8 @@ Feature: CAMARA Device location verification API, v0.2.0 - Operation verifyLocat
@location_verification_15_device_token_mismatch
Scenario: Inconsistent access token context for the device
# To test this, a token have to be obtained for a different device
Given the request body property "$.device" is set to config_var: "locatable_device"
And the header "Authorization" is set to a valid access token identifying a different device
Given the request body property "$.device" is set to a valid testing device
And the header "Authorization" is set to a valid access token emitted for a different device
When the HTTP "POST" request is sent
Then the response status code is 403
And the response property "$.status" is 403
Expand All @@ -239,9 +163,8 @@ Feature: CAMARA Device location verification API, v0.2.0 - Operation verifyLocat

@location_verification_16_device_not_supported
Scenario: Service not available for the device
Given that config_var "device_not_applicable" is not empty
And the request body property "$.device" is set to config_var: "device_not_applicable"
And the header "Authorization" is set to a valid access token identifying a different device
Given that service is not supported for all devices commercialized by the operator
And the request body property "$.device" is set to a valid device for which the service is not applicable
When the HTTP "POST" request is sent
Then the response status code is 422
And the response property "$.status" is 422
Expand Down Expand Up @@ -270,7 +193,7 @@ Feature: CAMARA Device location verification API, v0.2.0 - Operation verifyLocat

# Other specific 400 errors

@location_verification_400.3_other_input_properties_schema_compliant
@location_verification_400.3_other_input_properties_schema_not_compliant
# Test other input properties in addition to device
Scenario Outline: Input property values doe not comply with the schema
Given the request body property "<input_property>" does not comply with the OAS schema at <oas_spec_schema>
Expand Down Expand Up @@ -312,6 +235,7 @@ Feature: CAMARA Device location verification API, v0.2.0 - Operation verifyLocat
@location_verification_401.1_no_authorization_header
Scenario: No Authorization header
Given the header "Authorization" is removed
And the request body is set to a valid request body
When the HTTP "POST" request is sent
Then the response status code is 401
And the response property "$.status" is 401
Expand All @@ -321,6 +245,7 @@ Feature: CAMARA Device location verification API, v0.2.0 - Operation verifyLocat
@location_verification_401.2_expired_access_token
Scenario: Expired access token
Given the header "Authorization" is set to an expired access token
And the request body is set to a valid request body
When the HTTP "POST" request is sent
Then the response status code is 401
And the response property "$.status" is 401
Expand All @@ -330,6 +255,7 @@ Feature: CAMARA Device location verification API, v0.2.0 - Operation verifyLocat
@location_verification_401.3_invalid_access_token
Scenario: Invalid access token
Given the header "Authorization" is set to an invalid access token
And the request body is set to a valid request body
When the HTTP "POST" request is sent
Then the response status code is 401
And the response header "Content-Type" is "application/json"
Expand Down

0 comments on commit a4d4787

Please sign in to comment.