Developer Console

Test your App with App Tester

App Tester is a tool that allows testing Appstore SDK features in your apps during integration without publishing changes to the Appstore. The App Tester tool is an APK you can install on your test device that mimics the standard Appstore client APK built into all Fire TVs and tablets. App Tester handles your app requests, and can be used to test all 3 major functionalities (IAP, DRM, and SSI) offered as part of the Appstore SDK. App Tester maintains its own local data store, serving all requests through that, rather than affecting the production state of your test accounts or devices.

See App Tester User Guide for more details for how App Tester can be used to test In-App Purchasing (IAP) APIs.

The App Tester APK is included in the bundle of artifacts your Amazon contact has shared with you. However, it is typically distributed through the Amazon Appstore. Visit the Amazon App Tester link to download the APK for your devices.

Using App Tester for testing

Apps must activate Sandbox mode to test with App Tester. Connect to the device using ADB (Fire TV / Fire tablets) and run the following command.

adb shell setprop debug.amazon.sandboxmode debug

Install the App Tester signed APK provided to you, and open App Tester. To configure your tests, click on the Appstore SDK API's.

App Tester home page
App Tester home page
Appstore SDK features testable through App Tester
Appstore SDK features testable through App Tester

In the Appstore SDK API section, use Simple Sign-in API Response Settings and Manage Simple Sign-in links to configure and run SSI related tests.

Simple Sign-in API response settings

This section allows you to control what response App Tester should return to your app in Sandbox testing mode. App Tester will return a SUCCESSFUL response without manual intervention. Simple Sign-in APIs (getUserAndLinks() and linkUserAccount()) depend on the Simple Sign-in backend service. Simple Sign-in APIs (getUserAndLinks() and linkUserAccount()) depend on the Simple Sign-in backend service. The response for these APIs can be configured by using the following:

Simple Sign-in API response settings
Simple Sign-in API response settings

As you set up account linking from your app during testing in Sandbox mode, the state of linked accounts is stored in an App Tester local database. By default, the response to the getUserAndLinks() API is based on the current state of account linking from that database.

To test how your app handles specific scenarios, see how your API responds with certain output by configuring your response. You can use the screens below as a visual guide. See RequestId for a list of request status values.

Configuring response for the GetUserAndLinks API
Configuring response for the GetUserAndLinks API

Test using Mock responses

App Tester also allows the configuration of getUserAndLinks() to respond with mock responses generated on the fly without referring to the local database. This is useful if you don't want to go through the extra work of setting up linked accounts before testing the getUserAndLinks() API.

Select the “Mocked response for GetUserAndLinks” checkbox to enable this option (see screenshot below). You can choose the type of mocked response they want to receive based on the number of linked accounts they expect to be returned.

  • By default, “No linked accounts” is selected which would result in no linked accounts returned in the response.
  • When “One linked account” is selected, a response containing data for a single predefined linked account is returned.
  • When “Two linked accounts” is selected, a response containing data for two predefined linked accounts is returned.

Selecting this option won't clear any test data stored in the App Tester local database. Unselecting this checkbox will allow you to revert to testing using the test data stored in App Tester.

Configuring mock response for GetUserAndLinks API
Configuring mock response for GetUserAndLinks API

LinkUserAccount API

App Tester handles account linking requests locally with link tokens stored in its local database.

Similar to using the getUserAndLinks() API to test how your app handles specific scenarios, you set up the linkUserAccount() API to respond with your desired output by configuring the response you want to receive (see screenshot below). See RequestStatus for a list of request status values.

Configuring response for LinkUserAccount API
Configuring response for LinkUserAccount API

Since App Tester doesn't connect to the Appstore cloud, it doesn't have access to the app's Appstore private key. Therefore, it cannot decrypt the linkSigningKey provided in the new account linking request. As a result, SSI tokens returned from the getUserAndLinks() API in Sandbox mode are signed using an arbitrary private signing key. These tokens won't be verifiable using the app's real Appstore public key in your cloud.

Use App Tester to unit test your Appstore SDK integration during the early stages of development and leverage Live App Testing (LAT) for end-to-end testing. To test the end-to-end flow using App Tester, make additional changes to your backend to differentiate authentication requests originating from your app's debug versions and skip SSI token signature verification.

Troubleshooting App Tester

If you suspect App Tester is not correctly invoked for the SSI API calls from your app, check the following.

  • You are using the debug build of your APK for testing. App Tester will only work with a debug version of your app.
  • You are not an existing user of the Appstore SDK, and have previously installed an older version of App Tester. To resolve this, uninstall App Tester and install the latest version.
  • Sandbox mode has been activated successfully on your device. You can query the getSDKMode() method by the SimpleSignInService class in the Appstore SDK to determine the current mode of Appstore SDK. Possible return values from this method are:

    • SANDBOX
    • PRODUCTION
    • UNKNOWN

The SDK mode should be SANDBOX. If the SDK mode returns UNKNOWN. This indicates a problem with the Appstore SDK initialization within your app. Check if you have called SimpleSignInService#registerResponseHandler() to register your app context and response handler. See Step 2: Register a concrete implementation.

Managing Linked Accounts

You can delete linked accounts stored in the App Tester local database. Click “Unlink linked accounts” to clear all linked accounts for the current user.

Managing linked accounts
Managing linked accounts

Simulate Your Users' Experience

App Tester uses simulated implementations of user consent and login screens. Though these screens display the same details in the production screens in the app, the look and feel of these screens is quite different and unpolished compared to the app screens.

App Tester – Simulated User Consent Screen
App Tester – Simulated User Consent Screen
App Tester – Simulated Login Selection Screen
App Tester – Simulated Login Selection Screen

Last updated: Mar 13, 2023