Instrumenting Android Apps I
You don’t need Eclipse or Android Studio to instrument your apps. The easy way is to configure a TestedApp and let TestComplete handle instrumenting. This works nicely if the app version doesn’t change often.
Here are steps to instrument the sample Android Gallery app that installs with TestComplete:
- Right-click the TestedApps node and select Add > New Item.
-
Select Android Application from the list.
-
Add the path to the DrivenGallery.apk file. You can find DrivenGallery.apk in the TestComplete Samples directory. Leave the defaults and click the Next button.
-
Click the Instrument the application link.
-
Leave the Backup the original.apk file checkbox selected and click the Next button. This will make a copy of the un-instrumented file.
-
Leave the Sign the application using the debug certificate radio button selected. Click the Finish button.
The app appears in the TestedApps list.
Using Android TestedApps
If you click the Instrument button, TestComplete will report that the app is already instrumented. If you right-click the item in the TestedApp list and click Run Selected, the app loads and executes on your connected Android device
Note: If the Mobile Screen prompts to install Test Agent, go ahead and click the Enable link.
The Mobile Screen activates and shows what the screen looks like on the device. From here you can see all the Android elements in the Object Browser or use the Object Spy on the Mobile Screen directly. The screenshot shows how the Object Spy cross hairs select an element on the screen. The Android element properties and methods are listed, the same as any web or desktop app. You can highlight, map or store elements, just as you would with any other application.
You can also deploy and run your app on a connected device using script. The code follows the same format used for desktop and web TestedApps:
TestedApps.DrivenGallery.Run();
Wrap Up
You can instrument in the TestComplete UI by adding a TestedApp for Android Applications. The wizard records the path of the app package file, handles backup, and instruments the package file. You an deploy and run your app to connected devices directly from the TestedApp list in the UI or kick off the app from script.
Tomorrow we’ll use script to instrument an app. If your app file changes frequently or you need to automate instrumentation as part of continuous integration or other batch process, then scripting is the way to go. See you then.
The post Instrumenting Android Apps I appeared first on Falafel Software Blog.