Skip to main content

Testing Integration

Using Play Console, you can test your app with specific groups or open your test to Google Play users. Before starting the tests, you should check the following requirements.

Create a closed testing release to test pre-release versions of your app with a wider set of testers to gather more targeted feedback. Once you've tested with a smaller group of colleagues or trusted users, you can expand your test to an open release. On your Closed testing page, a Closed testing track will be available as your initial closed test. If needed, you can also create and name additional closed tracks.

If you're testing an existing app that you've published before, only users in your test group will receive an update for your closed version.

Requirements#

Email requirements#

Users need a Google Account (@gmail.com) or a Google Workspace account to join a test.

Monetization changes#

If you make changes to your app’s pricing, it affects your app's current and future versions across all tracks.

Country availability changes#

If you make any changes to the countries and regions your app is distributed in, it affects your app's current and future versions across all tracks.

Release#

You must test your app before you can release it to production. After publishing an open, closed, or internal test for the first time, it may take a few hours for your test link to be available to testers. If you publish additional changes, they may not be available for testers for several hours.

Add organizations to a test#

To add testers associated with an organization that uses managed Google Play, go to the Managed Google Play tab on your app's Advanced settings page (Setup > Advanced settings) and check the box next to "Turn on.” If your app is private, you also need to add the organization associated with your test to your targeted list.

Reviews#

Feedback from your test users won't affect your app's public rating. Paid apps: If you’re testing a paid app using an open or closed test, testers still need to purchase it. If you’re testing a paid app using an internal test, testers can install your app for free.

Closed Testing for Android Devices#

  • By opening the link in the google console on their phones, your test users will enable their google dependencies for the closed testing. You can open google dependencies by following the steps below. After this step, developers and testers can delete the application and install different versions. It is sufficient to perform this operation once for each user device.

    • Open your app on Google Play Console

    img

    • Open "Testing > Closing Testing" from the left menu. On the page that opens, go to the "Manage Track" section. Switch to the "Testers" tab in the "Track Summary". Then open the link for your android devices.

    img

    • Download your application to your phone with the help of this link. Then you can start your tests.
  • If you have any problems with the Purchase process for your test account, you can check whether you have done the following actions.

    • Test APK has the same versionCode as the one uploaded to developer console.
    • Test APK is signed with the same certificate(s) as the one uploaded to dev.console.
    • Test account (not developer) - is the main account on the device.
    • Test account is opted-in as a tester and it's linked to a valid payment method.

Sandbox Testing#

Making in-app purchases from a test account You don't need to make real purchases in order to test your subscriptions. You can make sure your subscriptions have been implemented correctly by using the sandbox environments. These environments will behave as the real stores, without incurring any costs.

Appmate#

Appmate allows testers to purchase using its own payment screen without going to platforms. It defines your test users through the Appmate console, and the transactions made by the users are automatically filtered as sandbox users, and you can easily test without using google or huawei purchasing interfaces. The products you buy are not saved in the stores, but you can see the purchases made on the console.

Create A Test User#

  • Open the Appmate-Console and click on the Sandbox section on the left menu.
console_tester1console_tester2

Create UserId Relation#

  • Send the user you created to the createUserIdRelation api as request parameter. This user will be registered as the master user. You can add more relation. After you add a master user, other relations are added as sub-users.
private fun createUserIdRelation(masterUserId: String) {PurchaseClient.instance.createUserIdRelation(masterUserId,object : ReceivedDataListener<UserRelation, GenericError> {
    override fun onSucceeded(data: UserRelation) {    }
    override fun onError(error: GenericError) {    }
})}

Delete Master Relation#

  • You can delete master reletion with deleteMasterUserIdRelation api.
PurchaseClient.instance.deleteMasterUserIdRelation(masterUserId,object : ReceivedDataListener<Boolean, GenericError> {     override fun onSucceeded(data: Boolean) {    }
    override fun onError(error: GenericError) {    }
})

Delete SubUser Relation#

  • You can delete subUser reletions with deleteSubUserIdRelation api.
PurchaseClient.instance.deleteSubUserIdRelation(subUserId,object : ReceivedDataListener<Boolean, GenericError> {     override fun onSucceeded(data: Boolean) {    }
    override fun onError(error: GenericError) {    }
})

Make a Purchase#

  • When you want to buy a product with an appmate sandbox test account, you will not see the Google or Huawei purchase interface. Instead, you'll see the Appmate purchase interface.appmate_purchase1

Purchase Tracking#

After a purchase is successful, you should be able to view the transaction immediately in the Appmate > Transactions.

transaction_for_huawei

Google Play Store#

Test Device Selection#

For testing during development, Google recommends using license testers to run the scenarios described in this topic.

important

If you are using an emulator, make sure it has Google Play Services installed.

Create A Close Track#

  • Create a test user. You can only use the first user you log in to on your Android device as a test user.
note

You can change the user you log on for the first time by simply restoring your device to factory settings

  • Open Google Play Console

  • Click Setup > License testing. Add here the account you are using in your real device (the account you are logged in with).

play_store_license_testing
  • Your app has been published to the open, closed, internal test, or production track. We recommend publishing your app to the internal test track. Make sure that your testers are also eligible to receive your release by following the instructions for managing testers by email address or using Google Groups.
  • If you haven’t created a closed track yet, you can create one in the Closed testing section of the Testing menu.
play_store_close_testing
  • Add testers for your app.
play_store_close_testing_testers
  • By clicking Create email list, you can create an email list to test your application.
play_store_create_testers
  • Open the Opt-in URL in your testing device (or any browser that's logged in with that testing user) to make the user a tester. You can send the URL to your device via email, for example.

  • Make the release available in at least one country If your app is completely new, you may need to make your app available to your country/region. To do this, go to Testing > Closed testing, click on your test track, and go to Countries / regions to add countries and regions.

important
You Must Open the Opt-in URL

Opening the opt-in URL marks your Play account for testing. If you don't complete this step, products will not load.

important
Check Your Application ID

Often developers will use a different application ID for their test builds. This will cause you problems since Google Play Services uses the application ID to find your in-app purchases.

important
Add a PIN to the test device if needed

There are cases where a test user may be allowed to purchase consumables, but not subscriptions, if the test device does not have a PIN. This may manifest in a cryptic "Something went wrong" message. Make sure that the test device has a PIN, and that the device is logged into Google Play Store.

  • You must open one of these urls while signed in with the Play account you're testing with. Opening the link in the browser will show a web similar to this, with a become tester button. Press that button and your user will be able to make testing purchases on your testing device.
play_store_copy_link

Upload A Signed APK To The Closed Track#

Generate a signed APK or use Android App Bundle to upload a signed APK to the alpha track you just created. You don’t even need to roll out the release.

Make A Purchase#

  • Before you can make a purchase, make sure your release has been approved and available.
  • Make sure that your testers are also eligible to receive your release by following the instructions for managing testers by email address or using Google Groups.
play_store_available_test
  • Build and run your app on your test device (you don't need to sign it). You should be able to complete all purchases.

Purchase Tracking#

After a purchase is successful, you should be able to view the transaction immediately in the Appmate > Transactions. If the purchase does not appear in the Transactions.

play_store_transactions
  • Test APK has the same versionCode as the one uploaded to developer console.
  • Test APK is signed with the same certificate(s) as the one uploaded to dev.console.
  • Test account (not developer) - is the main account on the device.
  • Test account is opted-in as a tester and it's linked to a valid payment method.

Test In-app Billing And Subscriptions#

You're able to purchase your own app, in-app item, or subscription as a test purchase. Once you've set up application licensing, authorized users can also purchase in-app products and subscriptions without charging the users’ accounts.

When making a purchase from a license test user, you will see two choices for payment method: "Test card, always approves" "Test card, always declines" Before they can be tested, your in-app products and subscriptions need to be published.

Huawei App Gallery#

Sandbox testing allows you to complete end-to-end testing without real payments when you connect to HUAWEI IAP for joint debugging. You can configure test accounts in AppGallery Connect and allow these testers to perform sandbox testing.

note

Currently, the sandbox testing supports the app integrated with HMS Core SDK 3.0 or later, and the to-be-tested device must be installed with HMS Core (APK) 3.0 or later. If the payment API of HMS Core SDK 2.0 is used for testing, real payments will be made.

Preparing for Sandbox Testing#

  • Sign in to AppGallery Connect and click Users and permissions.
  • Go to Sandbox > Test accounts and click Add.
app_gallery_create_user
  • Enter your test account information and click OK
note

A test account must be a registered HUAWEI ID.

app_gallery_add_test_account
  • Add test accounts, which are real HUAWEI IDs, under Users and permissions in AppGallery Connect.

  • Configure a sandbox testing version. If the app package you want to test has never been released in AppGallery Connect, make sure that its versionCode is greater than 0. For an app package once released in AppGallery Connect, the versionCode of the package to be tested must be greater than that of the released one.

Troubleshooting Sandbox Access Issues#

  • If you fail to access the sandbox, please refer to Preparing for Sandbox Testing to check whether:
  • Your test account has been added in AppGallery Connect
  • The app version meets the requirement

Testing Non-subscription Payments#

  • You can sign in using a configured test account, and install the app to be tested. When a request is initiated to purchase a one-time product, HUAWEI IAP detects that the user is a test user, skips the payment step, and displays a message indicating that the payment is successful.

  • The purchase process in the sandbox testing environment is the same as that in the official environment. The receipt information generated in HUAWEI IAP contains the purchaseType field which has a value 0, indicating that the purchase is a sandbox testing record. When the HMS Core (APK) version is earlier than 4.0.2.300, once a one-time purchase order is created in the sandbox environment, its payment has been completed. The purchase is successful even if you cancel the payment. In the sandbox testing environment, to facilitate testing, you can purchase a non-consumable product, consume it, and then purchase another. When the checkout screen is opened in the sandbox testing scenario, a dialog box with a sandbox icon is displayed. A sandbox icon is displayed on both the checkout screen and the successful purchase screen.

note

If no screen shown in the preceding figure is displayed, the transaction is not involved in the sandbox testing. If you continue the test, real payments will be made. Check whether the two conditions of the sandbox testing are met. You can also use the IapClient.isSandboxActivated or HMSIAP.isSandboxActivated API to check whether the sandbox environment is available.

Sandbox testing for non-subscription on a phone:

app_gallery_non_con_payment_1app_gallery_non_con_payment_2app_gallery_non_con_payment_3

Sandbox testing for non-subscription on a HUAWEI Vision:

app_gallery_non_con_payment_4app_gallery_non_con_payment_5app_gallery_non_con_payment_6

Testing Subscription Renewal#

The purchase process of subscriptions is similar to that of one-time products. The only difference is that subscriptions have more details to consider, such as the subscription renewal result (successful or failed) and subscription period. Test subscriptions renew much faster than actual subscriptions. For example, the actual subscription period is 1 week, while the test subscription will renew every 3 minutes.

Real TimeTest Time
1 week3 minutes
1 month5 minutes
2 months10 minutes
3 months15 minutes
6 months30 minutes
1 year1 hour

To purchase a subscription, you need to sign a contract and add a bank card, but you will not be charged. In the sandbox testing environment, the payType parameter has a fixed value of 0. No real payments will happen during auto-renewal processing. Instead, HUAWEI IAP directly returns a billing success. In the sandbox testing environment, a subscription is automatically renewed five times after purchase and then cancelled. The user needs to manually resume the subscription, if necessary. Note, however, that this resume operation only makes one subscription period work, and no recurring will happen. Simply, after five times, the user will get only one subscription period by each resume operation. When the checkout screen is opened in the sandbox testing scenario, a dialog box with a sandbox icon is displayed. A sandbox icon is displayed on both the checkout screen and the successful purchase screen.

Sandbox testing for subscription on a phone:

app_gallery_subs_payment_1app_gallery_subs_payment_2app_gallery_subs_payment_3

Sandbox testing for subscription on a HUAWEI Vision:

app_gallery_subs_payment_4app_gallery_subs_payment_5app_gallery_subs_payment_6

Purchase Tracking#

After a purchase is successful, you should be able to view the transaction immediately in the Appmate > Transactions.

transaction_for_huawei