Testing your application

Local testing

Local testing permits you to test the purchase of digital goods without making any network calls to the Payment Service server. During local testing, the Payment Service enables your application to simulate the purchase process. Testing your application locally is useful for verifying that your application deals with the results of a purchase the way you intend it to. To enable local testing, you must invoke PaymentSystem.setConnectionMode(PaymentSystem.CONNECTION_MODE_LOCAL) in your application.

Purchase attempts are always successful unless you manually change the result. You can use the following dialog box to test different purchase results, and to see the error messages that PaymentSystem throws. For details about the error messages, see Error messages.

You can use the following dialog box to specify whether or not a digital good has a subscription.

Keep in the mind the following when you test your application locally:

  • paymentSystem.getPrice() always returns a price of $3.99 for a digital good, and the digital good does not have a subscription.
  • You can buy a subscription for a digital good more than once. During live testing, you can buy a subscription for a digital good only once.

Live testing

Live testing permits you to test the purchase of digital goods against the live Payment Service server without being charged real money. To test your applications live, you must perform the following actions:

  • Make sure that you have access to the Payment Service server.
  • Install the BlackBerry App World storefront on the BlackBerry PlayBook tablet.
  • Add your application to the vendor portal for the BlackBerry App World storefront. Don't send your application to RIM for approval, but keep it in Draft state.
  • Add digital goods and a release bundle to your application in the vendor portal.

  • Register for a BlackBerry ID account at na.blackberry.com/id/.
  • Create a sandbox account by registering your BlackBerry ID in the vendor portal.

After you add your application and digital goods, you can download your application from BlackBerry App World and start testing the purchase process against the live Payment Service server.

By registering the BlackBerry ID with the vendor portal, you can use the BlackBerry ID to perform test purchases of applications, as well as digital goods within your applications. When you initiate a purchase, and log in using the BlackBerry ID that you registered with the vendor portal, you can simulate a real purchase without any charges to your account. The BlackBerry ID that you register with the vendor portal can be used only to purchase digital goods from the applications associated with your BlackBerry App World vendor account.

For more information about submitting applications and creating sandbox accounts, see the BlackBerry App World vendor documentation at www.blackberry.com/go/appworld/vendordocs/.

Creating a sandbox account

Before you make products available to BlackBerry PlayBook tablet users, you can test the purchase of your products and any digital goods that you sell within your products by creating a sandbox account. When you create a sandbox account, you specify the email address that is associated with a BlackBerry ID. You then use the BlackBerry ID to test the purchase of your products without being charged for the purchases.

When you test a purchase using a sandbox account, BlackBerry App World doesn't create a purchase record. If your application calls getExistingPurchases(true), the function doesn't return the purchases that you make using the sandbox account.

  1. On the vendor portal for the BlackBerry App World storefront, click Sandbox.
  2. Click Add New User.
  3. In the Email field, type the email address associated with a BlackBerry ID.
  4. In the Description field, type a description for the sandbox account.
  5. Click Create.

Download an application before you make it available for distribution

  • Add your application, a release bundle, and digital goods in the vendor portal for the BlackBerry App World (the application status can remain as Draft).
  • Create a sandbox account in the vendor portal using a BlackBerry ID.

If your application has any distribution restrictions (such as the BlackBerry device models or BlackBerry Device Software versions that it supports), make sure that the BlackBerry device that you download the application to is compatible with your application, otherwise you won't be able to locate your application in the BlackBerry App World storefron

tIf you purchase another vendor's application or digital goods using your BlackBerry ID account that is configured for testing, the transaction is real, not simulated, and your account is charged. You can simulate only the purchases of your own applications and digital goods.

  1. On the home screen of the BlackBerry PlayBook tablet, tap the BlackBerry App World icon.
  2. Swipe your finger from the bottom left corner of the screen toward the center of the screen to display the keyboard.
  3. Type tst. Tap Return.
  4. Open the browser on the tablet.
  5. In the address bar, type the location of the application that you want to test (for example, you can type http://appworld.blackberry.com/webstore/content/xxxxx, where xxxxx is the ID of the application).
  6. On the Details screen for your application, click Purchase.
  7. Complete the instructions on the screen to download the application.

You can use the same BlackBerry ID login information to purchase the digital goods that your application offers.