Developer Console
Gracias por tu visita. Esta página solo está disponible en inglés.

Testing with mocks

Summary

Testing with mocks is a great alternative to validate your integration application functionality without a dependency on the Amazon team.

You can invoke the payload using any mechanism that you are familiar with, below are some options for consideration however you should follow the steps you are most comfortable with.

You can modify the payload to run test cases such as Duplicate request by keeping the same request id or Invalid payload by removing required parameter and finally happy path use cases.

Incoming calls from Amazon

1- Invoking the payload using an external tool: This allows you to call the API you have in your account and navigate the authorization layer of the API. Please follow your tool input process for the calls

2- Invoke using the API Gateway: test capability which allows you to iterate fast and validate any edge cases for the incoming payload. Sample payload below.

You can modify the payload to execute test cases such as duplicate carts, invalid SKU, etc by modifying the payload

Identity API

To validate the /v1/identity/identity-keys you can invoke the API test capability with variations of the payload. Sample below

{
    "requestId": "f324d09a-f605-4d58-b307-a34e6b47e7af",
    "identityKey": "SldPSU1BRzE4YmMwNTU0ZDA0NWE0OGIyOWFmYTllMmFhYWMxNGFl",
    "storeId": "sample-store-id",
    "authEvent": {
        "id": "11111858-0000-1213-1111-5af1791e9211",
        "timestamp": "2008-11-05T06:00:00Z",
        "location": "ENTRY"
    },
    "keyChannel": "OPTICAL"
}

To validate the /v1/identity/scan you can invoke the API test capability with variations of the payload. Sample below


{
  "requestId": "f324d09a-f605-4d58-b307-a34e6b47e7af",
  "storeId": "sample-store-id",
  "scanEvent": {
    "id": "f324d09a-f605-4d58-b307-a34e6b47e7af",
    "timestamp": "2024-04-25T13:03:14Z",
    "location": "ENTRY",
    "value": "f324d09a-f605-4d58-b307-a34e6b47e7af",
    "channel": "OPTICAL"
  }
}

Ordering API

{
  "requestId": "2997e9d1-3111-4971-9bff-b3903a0e7c87",
  "idempotentShoppingTripId": "41bc23b6-c9a8-41f4-8898-54120ddff5d9",
  "storeId": "sample-store-id",
  "shoppingTrip": {
    "startTime": "2022-11-29T16:13:26Z",
    "endTime": "2022-11-29T16:13:28Z",
    "authEvents":
    [
      {
        "id": "b49bee24-ae68-4bfd-bbbf-1793c4b6f40b",
        "eventTimestamp": 1741302201,
        "authLocation": "ENTRY",
        "payloadType": "FINANCIAL"
      },
      {
        "id": "e3a3ccdb-bdf0-4ca1-a164-02a9c3aa7045",
        "eventTimestamp": 1741302579,
        "authLocation": "MANUAL_IN_STORE",
        "payloadType": "SCAN_CODE",
        "scanResult": {
          "id": "abcd",
          "type": "LOYALTY"
        }
      }
    ]
  },
  "cartItems": [
    {
      "id": "sample-sku",
      "type": "SKU",
      "quantity": {
        "value": "1.0",
        "unit": "unit"
      }
    }
  ],
  "shopperIdentity": {
    "id": "12345678-9102-4dcc-83ba-7d1a8c736279"
  },
  "shopperDeviceId": "829ffe9d8d4d02fb767bee3a190f7d7e"
}

Outgoing call to Amazon services

Amazon has multiple services such as payment and catalog management services that might be a part of your Just WalkOut integration.

Following are samples of how to validate your calls back to Amazon systems where you can use mocks. Please note that you will need keep the mocks up-to-date with the Amazon functionality to ensure you do not miss any changes which result in defects

The following template demonstrates how a mock can be easily built to allow you to simulate and control the return from the Amazon systems during your testing to allow you to validate your integration.

For example, looking at the adjust method, you can see how it is setup to expect the format in our spec

You can modify the return of the adjust method model to return a happy path or any of the other possible returns described here in our spec for success and failure

Following sheet includes a set of test cases that are not comprehensive but will provide a set of use cases to test with your integration. Please follow your own testing process to validate the specifics of your integration.

The tests will provide the following coverage

  • Basic single item scenarios
  • Multiple item combinations
  • Quantity variations
  • Promotional item scenarios
  • Discount item scenarios
  • Mixed basket scenarios with multiple items and quantities

The test cases cover

  • Happy flow scenarios
  • Unhappy flow scenarios
  • Promotional scenarios
  • Regular price scenarios
  • Different customer profiles
  • Various product combinations and quantities