Skip Navigation

Automated testing with the 
BlackBerry Dynamics
 sample apps

The sample apps included in the 
BlackBerry Dynamics SDK
 have been integrated with the 
BlackBerry Dynamics
 Automated Test Support Library (ATSL). Each sample app includes test code that executes automated tests of processing and behavior.
You can use the integration of the ATSL in any sample app as a guide for integrating the library with your own 
BlackBerry Dynamics
 apps. Note the following details about the ATSL integration:
Item
Description
Build target for testing
Each app has an 
androidTest
 build target that the 
Android
 Plugin for 
Gradle
 can use. For more information about the 
Android
 Plugin for 
Gradle
, see Android Studio: Configure your build.
Code for JUnit tests
The test code is located in the sub-directory 
<sample_app>
/tests/com/good/gd/example/securesql/test/.
The code is based on JUnit4. You can run tests with 
AndroidJUnitRunner
Use of ATSL for interaction with 
BlackBerry Dynamics
 screens
The test code uses helper functions in the ATSL. For example, the code calls the 
GDAutomatedTestSupport.provisionGDApp()
 method, which executes the entire activation process.
You can run ATSL helper functions in the JUnit assertion programming interface. For example: 
assertTrue(GDAutomatedTestSupport.provisionGDApp());
This assertion will fail if activation fails. 
Use of ATSL for general interactions
The test code also uses helper functions in the ATSL for general interactions, such as checking that an item exists in the user interface and then interacting with that item. The ATSL functions handle this by using UIAutomator.
Broadcast receiver for authorization events
The test code registers a broadcast receiver that receives authorization events from the 
BlackBerry Dynamics SDK
. Broadcast receiver registration supports multiple receiver classes and doesn’t block 
GDStateListener
 or 
GDAppEventListener
 implementations, if any. The broadcast receiver code is in the 
GDSDKStateReceiver
 class.