Testing Dropbox Datastore API on Android


I want to test my queries to the Dropbox Datastore API (http://www.dropbox.com/developers/datastore/docs/android) on Android. My idea was to start my app via Appium and then run some test code without letting Appium click any button. E.g. insert some data and check if it is was inserted correctly. For doing so I would need an instance of the running Activity (android.app.Activity). As far as I know there is a method called AppiumDriver.getCurrentActivity() but it only returns a String with the name of the Activity and there is no way to retrieve an instance of android.app.Activity.

Another approach would be to add the test code inside my app and run it by clicking a button. I don’t like this approach as I wouldn’t be able to see the result of each test in Appium. I’d need to write code for the outcome of the tests and not reuse much better code available already. Also the test code would be inside the app which is not ideal either.

I asked this question at the Dropbox Dev Forum already but was told that there is no standard way of testing my queries. And I tried using Robolectric and was running into issues, too. I asked a similar question on their forum already.


Is there a way to get an instance of android.app.Activity (or android.content.Context)?
Can one test Dropbox Datastore API on Android using Appium?

Regards, Benjamin Glatzeder