Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android functional test; send geo location to emulator

Our android application is getting fairly big and we would like to use functional tests for our application to prevent regression. We are looking in to options to achieve this.

We make use of geo locations, so now we test the app by entering lat/long in DDMS. If we want to test this, it should be possible to set these geo locations programmatically.

Is there a framework that we can use to functional test our android app and also send these updates to our emulator?

like image 479
jgeerts Avatar asked Dec 20 '11 09:12

jgeerts


People also ask

How do I add current location to emulator?

Add a Simulated LocationClick the location on the map you want to simulate, and then press the lowercase L key. A dialog will appear with the message, “Simulated Location Set”. After a short time, the simulated location you set in the Editor will appear as a pink dot in the Android Emulator.

How set fake location in Android Emulator?

settings> system > developer optionsFind the option select mock location app Then select the app you downloaded from step 1.

How can I test my mock location?

Go to your “Settings”, “Systems”, “About Device” and tap multiple times on “Build number” and activate the Developer Mode. A new “Developer Options” menu will be available under “Settings” / “Systems” In the “Developer Options” menu, scroll down to “Debugging” and activate the “Allow mock locations”.


2 Answers

If you compile in Eclipse, you can fake the lat/lon in the android emulator:

  • Windows > Open perspective > Other.
  • Choose DDMS
  • Search Emulator control tab
  • Use the location control to send Latitude and Longitude whenever you want.
like image 171
vgonisanz Avatar answered Nov 15 '22 01:11

vgonisanz


I am facing the same problem. While this solution is not built into robotium, you should be able to make it into a utility that can be used in your unit tests.

Unit Testing Location Service

like image 37
trukvl Avatar answered Nov 15 '22 00:11

trukvl