as

Settings
Sign out
Notifications
Alexa
Amazon Appstore
AWS
Documentation
Support
Contact Us
My Cases
Docs
Resources
Ecommerce Plug-ins
Publish
Connect

Get Shopper Identity Testing

Summary

While the test cases below outline key testing scenarios, it should be supplemented with your organization's established testing best practices to ensure comprehensive coverage of any use cases not explicitly included in this test plan.

1. Test Case: Successful Identity Retrieval (200 Response)

Objective: Trigger successful shopper identity retrieval

{
  "storeId": "VALID_STORE_ID",
  "shopperId": {
    "id": "valid-shopper-id"
  }
}

Expected Response:

{
  "shopperEmail": "shopper@example.com"
}

2. Test Case: Bad Request - Invalid Store ID (400 Error)

Objective: Trigger "BadRequestException" for invalid storeId format

{
  "storeId": "INVALID@STORE#ID",
  "shopperId": {
    "id": "valid-shopper-id"
  }
}

Expected Response:

{
  "errorMsg": "BadRequestException"
}

3. Test Case: Bad Request - Missing Required Fields (400 Error)

Objective: Trigger "BadRequestException" for missing storeId

{
  "shopperId": {
    "id": "valid-shopper-id"
  }
}

Expected Response:

{
  "errorMsg": "BadRequestException"
}

4. Test Case: Bad Request - Missing Shopper ID (400 Error)

Objective: Trigger "BadRequestException" for missing shopperId

{
  "storeId": "VALID_STORE_ID"
}

Expected Response:

{
  "errorMsg": "BadRequestException"
}

5. Test Case: Bad Request - Missing Shopper ID Field (400 Error)

Objective: Trigger "BadRequestException" for missing id field in shopperId

{
  "storeId": "VALID_STORE_ID",
  "shopperId": {}
}

Expected Response:

{
  "errorMsg": "BadRequestException"
}

6. Test Case: Bad Request - Invalid Data Types (400 Error)

Objective: Trigger "BadRequestException" for incorrect data types

{
  "storeId": 12345,
  "shopperId": {
    "id": true
  }
}

Expected Response:

{
  "errorMsg": "BadRequestException"
}

7. Test Case: StoreId Format Validation (400 Error)

Objective: Test storeId pattern validation ^[0-9a-zA-Z_-]*$

{
  "storeId": "invalid@store#id!",
  "shopperId": {
    "id": "valid-shopper-id"
  }
}

Expected Response:

{
  "errorMsg": "BadRequestException"
}

8. Test Case: Shopper ID Format Validation (400 Error)

Objective: Test shopperId.id pattern validation ^[0-9a-zA-Z_.-]+$

{
  "storeId": "VALID_STORE_ID",
  "shopperId": {
    "id": "invalid@shopper#id!"
  }
}

Expected Response:

{
  "errorMsg": "BadRequestException"
}

9. Test Case: Field Length Validation - Store ID (400 Error)

Objective: Test storeId length limit (> 255 characters)

{
  "storeId": "A".repeat(256),
  "shopperId": {
    "id": "valid-shopper-id"
  }
}

Expected Response:

{
  "errorMsg": "BadRequestException"
}

10. Test Case: Field Length Validation - Shopper ID (400 Error)

Objective: Test shopperId.id length limit (> 255 characters)

{
  "storeId": "VALID_STORE_ID",
  "shopperId": {
    "id": "A".repeat(256)
  }
}

Expected Response:

{
  "errorMsg": "BadRequestException"
}

11. Test Case: Rate Limiting (429 Error)

Objective: Trigger "Too Many Requests" error

Test Method: Send multiple rapid requests to exceed rate limit

Expected Response:

{
  "errorMsg": "Too Many Requests"
}

Headers: Retry-After: 600

12. Test Case: Server Error (500 Error)

Objective: Trigger "ServiceException"

Test Method: This typically occurs during server issues or unhandled exceptions

Expected Response:

{
  "errorMsg": "ServiceException"
}

13. Test Case: Service Unavailable (503 Error)

Objective: Trigger "ServiceUnavailableException"

Test Method: Send request during maintenance or service downtime

Expected Response:

{
  "errorMsg": "Service temporarily unavailable",
  "retryAfter": "300"
}

14. Test Case: Empty String Values (400 Error)

Objective: Test empty string validation

{
  "storeId": "",
  "shopperId": {
    "id": ""
  }
}

15. Test Case: Null Values (400 Error)

Objective: Test null value handling

{
  "storeId": null,
  "shopperId": {
    "id": null
  }
}

16. Test Case: Whitespace Only Values (400 Error)

Objective: Test whitespace validation

{
  "storeId": "   ",
  "shopperId": {
    "id": "   "
  }
}

17. Test Case: Valid Shopper ID Characters (200 Response)

Objective: Test all valid characters in shopper ID pattern ^[0-9a-zA-Z_.-]+$

{
  "storeId": "VALID_STORE_ID",
  "shopperId": {
    "id": "shopper123_test.id-valid"
  }
}

18. Test Case: Unknown Shopper ID (200 Response)

Objective: Test with non-existent but valid format shopper ID

{
  "storeId": "VALID_STORE_ID",
  "shopperId": {
    "id": "unknown-shopper-id"
  }
}

Note: This may return empty response or specific error depending on implementation

Response Validation Test Cases

19. Test Case: Email Format Validation

Objective: Verify response email matches pattern ^[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+[.]+[A-Za-z]+$

Expected Response Fields:

  • shopperEmail: Valid email format, max 128 characters
  • Examples: "user@example.com", "test.email+tag@domain.co.uk"

20. Test Case: Email Length Validation

Objective: Verify response email doesn't exceed 128 characters

Test Execution Notes

  1. Rate Limiting: Use automated scripts to send 10+ rapid consecutive requests
  2. Field Validation: Test each validation rule individually
  3. Shopper Identity: Test with various shopper ID formats and lengths
  4. Response Validation: Verify email format compliance in successful responses
  5. Pattern Testing: Test boundary cases for regex patterns

Expected HTTP Status Codes Summary

  • 200: Successful identity retrieval (returns shopperEmail)
  • 400: Bad Request (validation errors, missing/invalid fields)
  • 429: Too Many Requests (rate limiting with Retry-After header)
  • 500: Internal Server Error (service exceptions)
  • 503: Service Unavailable (maintenance/downtime with retryAfter field)