Preparing for automated testing
As part of your automated testing you must activate a new installation of your
BlackBerry
Dynamics
app or log in to an already activated app. This requires a user identifier (typically an email address), an access key, and a password. The ATSL can read activation or login credentials from a file in JSON format in the application resource bundle.The file does not have any naming restrictions and must contain a single object with the following fields:
- GD_TEST_PROVISION_EMAIL: String that specifies the user's email address
- GD_TEST_PROVISION_ACCESS_KEY: String that specifies the access key
- GD_TEST_PROVISION_PASSWORD: String that specifies the user's password after provisioning or during login
- GD_TEST_UNLOCK_KEY: Specifies the unlock key, if necessary (optional)
For example:
{ "GD_TEST_PROVISION_EMAIL": "user@acme.com", "GD_TEST_PROVISION_ ACCESS_KEY": "012345678901234", "GD_TEST_PROVISION_PASSWORD": "abcd" }
There are different options to prepare the file:
- Manually generate an access key for a user in the management console, then manually edit the file.
- Manually generate and store a number of access keys in advance, then automatically edit the file and consume a key from the store.
- Automatically generate an access key, and optionally a user, with the BlackBerry Web Services APIs, then automatically edit the file.
Use the option that best suits your needs, based on your access to the management console and administrator level permissions, your familiarity with the BlackBerry Web Services APIs, and your preference for using a new activation for every test or running subsequent tests on the same app as an upgrade.
Please note the following:
- In the JSON file, the access key and unlock key have to be 15 characters and cannot have dashes.
- Automated testing works in Enterprise Simulation mode, but will have the same restrictions (for example, the app cannot connect to any back-end servers).
- There is currently aniOSknown issue where automated tests can fail because the keyboard disappears occasionally in the simulator.
- InXcode8.3 and later, the XCTests framework executes tests in a random order, as a best practice. Tests should be self-contained and independent.
- EveryBlackBerry Dynamicsapp needs a one-time initialization to complete activation. To ensure that this is executed first, define a dedicated test method that executesBlackBerry Dynamicsactivation and have that activation test executed in isolation.
- The source code is provided in Objective-C. If any of the app or test code is written inSwift, you must configure the code according toApplestandards for mixingSwiftand Objective-C.