Preparing for automated testing
You must activate a new installation of a
BlackBerry
Dynamics
app before you can run automated tests. This requires a user identifier (typically an email address), an access key, and a password. The ATSL can read activation credentials from any file in JSON format with the .json extension in the application resource bundle. Each sample app in the SDK includes a file named credentials.json in the test target.For more information about the required content of the credentials file, see the
BBDAutomatedTestSupport
class in the reference documentation of the fetchCredentialsFromFileAtPath:
method. There are different options to prepare the file:
- Manually generate an access key for a user in theUEMor standaloneGood Controlmanagement 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.