codingecho

日々の体験などを書いてます

The test cases for In-App Purchase on iOS

I came up to implement In-App Purchase on iOS with Unity. I looked for the test cases for In-App Purchase, however, couldn't find their cases. Therefore, I memorize the test cases I checked myself.

At first, please read In-App Purchase Best Practice. We should implement your In-App Purchase according to this document.

For instance, I implement below list:

  • Add a transaction queue observer at application launch
  • Query the App Store for product information before presenting your app’s store UI

Figure 1 shows the process, second of the list, from showing available products to purchasing them.

Figure 1.

  1. Retrieve product identifiers from a data store
  2. Request products from Apple Store
  3. Show available products on an app

Below, the test cases I checked. the left side of the table are test cases and the right side is expected results.

Purchasing and Subscribing test cases

Test case Expected result
Show a product list scene The product list scene shows buyable products
Buy products All products can buy
Close an app in the middle of a purchasing The item corresponds to the purchased product is given the user next launch
Disconnect internet connection in the middle of a purchasing The items correspond to the purchased are given the user next startup
Purchase a subscription product in advance. Switch an Apple account to another one on the same Device The purchased subscription product must get unbuyable
Purchase a subscription product by the same Apple account on deferent devices (purchase a product on Device-A, then purchase it on Device-B) Must purchase the product on Device-A and must not purchase it on Device-B
Purchase a subscription product with the same Apple account among two devices Must purchase the product on both devices
Purchase a subscription product in advance and close the app completely. Wait until the subscription is updated by Apple Store and launch the app Must give the user the items corresponding to the subscribed product

Restoring

Implement a restoring product for subscription products.

Test case Expected result
Restore the subscription after the subscription product is renewed The app gives the items that corresponding to the subscription to the user | Buy a subscription product with the same Apple account. Restore Device-A, next Device-B
Buy a subscription product in advance. Use both of devices, Device-A and Device-B. Then restore Device-A next Device-B An app gives the items corresponding to the subscription to Device-A, although it doesn’t on Device-B
Launch an app after closing the app in the middle of Restoring Purchased Products Do not execute unprocessed transactions
Sign out from App Store, then launch an app The user is prompted to sign in App Store if unprocessed transactions are existed
Tap Buy a product button multiple times Show only one In-App Purchase dialog
Use unregistered product identifiers in iTunes connect that it's in part of an app's buyable item list Do not show the unregistered products in app's item list