App Tester User Guide
The App Tester tool enables you to test Amazon In-App Purchasing (IAP) features before publishing your app to the Amazon Appstore. Once you have downloaded, installed, and set up the App Tester tool, you can start testing purchasing features in your app.
notifyFulfillment()call. This logic helps ensure that you have correctly implemented this part of the IAP SDK and only applies to App Tester, not production behavior.
If you have not already set up the App Tester for your app, see Install and Configure App Tester.
- Using App Tester
- Choose the IAP API
- Manage Users
- Configure API Response Settings
- Enable or Disable Your Notifications
- Manage Transactions
- View the IAP Items in Your JSON File
- Simulate Your Users' Experience
- Using App Tester to Test Your DRM
Using App Tester
Amazon App Tester is a tool (previously used only by IAP) to simulate authorization with the Appstore. Download the App Tester from here.
To use Amazon App Tester to test the license verification for your app:
Connect your computer to either a Fire TV or Fire tablet through ADB. See one of the following for details:
Set your app in sandbox mode using the following command:
adb shell setprop debug.amazon.sandboxmode debug
Sandbox mode constrains calls that would normally go to the Appstore client to route to the Amazon App Tester app instead. Use this mode only for testing locally.
- Uninstall any existing version of the Amazon App Tester, and then download it and open it on your Fire device.
Open Amazon App Tester and go to Appstore SDK APIs > DRM API Response Settings > GetLicense API. You will see the several license options that you can set:
Run your Fire TV or tablet app that contains DRM. Amazon App Tester will simulate responses about user's license status based on what you have selected in Amazon App Tester.
To exit sandbox mode, run the following:
adb shell setprop debug.amazon.sandboxmode none
Choose the IAP API
When you first launch the App Tester App, the landing page prompts you to choose the IAP API:
Tap the In-App Purchasing API prompt to begin.
The App Tester displays a list of navigation options for IAP API:
- User Account Settings: Configure the user test accounts for your app.
- API Response Settings: Configure the conditions and responses for your test cases.
- Notification Settings: Enable or disable the notifications that are added to the notification drawer.
- Manage Transactions: Manage the active IAP transactions for your app.
- IAP Items in JSON File: View the data that you added to the App Tester from your JSON file in an easily human-readable format.
You can log a user in and out, change users, and change the market place associated with a user. These options facilitate testing different scenarios with different users in different marketplaces.
To access the user management screen, select the IAP API from the App Tester landing page, then tap User Account Settings.
Log in and out
To toggle the current user between being logged in and logged out, under Status tap the Logged in or Logged Out option.
Change the current user
App Tester provides three different test user accounts. Test users are named Amazon User 1, Amazon User 2, and Amazon User 3.
To change users, look under Amazon User Id, and select the user Id that you want to use for testing.
Change user marketplace for the current user
App Tester provides you with the ability to test your app in different international markets. To change the market place associated with the current user, look under User Marketplace and select a new market. The following markets are available:
- US: United States of America
- GB: Great Britain
- DE: Germany
- ES: Spain
- FR: France
- IT: Italy
- JP: Japan
Configure API Response Settings
Use the API Response Settings tab to set the conditions and responses for your test calls to the IAP API:
When specifying a response, "Default" in the following sections simply means to use the existing default settings. "Default" is not an available setting itself. If you explicitly select a value, such as SUCCESSFUL or FAILED, the App Tester will return the selected value. For example,
getProductData will return SUCCESSFUL if the JSON file contains the requested SKU.
GetUserData will return FAILED if the user is set to Logged Out in User Account Settings.
The following table shows the available responses for the IAP APIs.
|API Name||Available Responses|
|GetProductData||Default, SUCCESSFUL, FAILED|
|GetPurchaseUpdates||Default, SUCCESSFUL, FAILED|
|GetUserData||Default, SUCCESSFUL, FAILED|
|Purchase||Default, SUCCESSFUL, FAILED, ALREADY_PURCHASED, INVALID_SKU|
Enable or Disable Your Notifications
Use the Notifications Settings tab to easily enable or disable the notifications that are added to the system's notification drawer.
The following image shows the Notification Settings tab:
The following notification settings are available:
Purchase Updates Notifications: By default, Amazon sends a notification when an app loads a purchase dialog but has never called
getPurchaseUpdates(). Amazon stops sending this notification after the app calls
getPurchaseUpdates()once. Use the Purchase Updates Notifications setting to toggle whether Amazon ever sends this notification.
Notify Fulfillment Notifications: By default, Amazon sends a notification if a user makes a purchase and the item is not fulfilled within 30 seconds. Use Notify Fulfillment Notifications to toggle this notification on or off.
Reset Purchase Updates: Resets the state indicating whether or not
getPurchaseUpdates()has been called.
Use the Manage Transactions tab to view, cancel, and delete purchase transactions for the current user. Cancelling and deleting transactions are helpful tools when testing entitlements and subscriptions. This tab displays all transactions for the current user.
The Manage Transactions tab contains the following information for each transaction:
- RECEIPT: Type of product purchased. Valid values for IAP are CONSUMABLE, ENTITLEMENT, and SUBSCRIPTION.
- RECEIPT ID: Unique identifier for the transaction.
- SOLD BY: App that sold the item.
- PURCHASED ON: Date that the item was purchased.
- STATUS: Transaction status. Valid values are PURCHASED or CANCELED. These App Tester values map to the IAP API values FULFILLED and UNAVAILABLE, respectively.
When an app calls
PurchasingService.notifyFulfillment(receiptId, FulfillmentResult.FULFILLED, the receipt shows up in the Manage Transactions section with status: FULFILLED.
From the Manage Transactions tab, you can perform the following tasks:
- Refresh the list of transactions for the current user.
- Delete all transactions for the current user.
- Cancel an individual transaction.
- Delete an individual transaction.
View the IAP Items in Your JSON File
To provide an easy way to view the IAP items in the JSON file that you configured in Installing and Configuring the App Tester, tap the IAP Items in JSON File tab. If you have correctly added a valid JSON file, the App Tester will parse and display the contents of the file under this tab.
If you have not correctly added a valid JSON file, this tab will either display an error message or will specify that the JSON file does not exist.
Simulate Your Users' Experience
In addition to providing responses to API requests, the App Tester can display purchase flow dialogs, just like a live, published app does. The benefit of this feature is that the dialogs can help you to evaluate the user experience for your app's purchase process.
App Tester displays two interstitial dialogs for each Purchase Request. The first dialog is a detail screen that shows the purchase price and other details, as shown in the following IAP example:
The second dialog is a "thank you" screen that a user must manually close by tapping the "X" button in the upper right-hand corner, as shown in the following IAP example:
AppTester uses the Logcat tool to capture details about your app's transactions and other API interactions. To use Logcat to view the logs generated while testing your app:
- Connect the Android device with your app and AppTester to a computer running Android Debug Bridge (ADB).
- Search for the tag "AmazonAppTester" to view the AppTester log entries.
If you are using the Eclipse DDMS development environment, you can filter App Tester generated log entries by entering
tag:AmazonAppTester into the filter text area in the Logcat tab.
Using App Tester to Test Your DRM
To test out DRM on a device, you will need to install Amazon App Tester (see above). Amazon App Tester is required to test the DRM functionality in your app.
Amazon App Tester provides a tab called "DRM API Response Settings" that allows you to simulate responses for different license statuses.
To use Amazon App Tester to test the license verification for your app, add the following
drm.ResponseReceiver to your app's AndroidManifest.xml file. If your app targets Android 12 or higher, you must explicitly set
true in the
ResponseReceiver as shown in the following example:
<application> ... <activity android:label="@string/app_name" android:name="com.amazon.sample.drm.MainActivity" android:exported="true"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <receiver android:name = "com.amazon.device.drm.ResponseReceiver" android:exported="true" android:permission = "com.amazon.drm.Permission.NOTIFY" > <intent-filter> <action android:name = "com.amazon.drm.NOTIFY" /> </intent-filter> </receiver> ... </application>
More details are also provided in the DRM Sample App.
Last updated: Sep 20, 2022