-1

I wrote some test cases for a standard browser app using instrumentationtestcase packages for an android phone.

i am able to run the tests when the phone is connected to pc ..

is there a way to include these test cases in the app in such a way that these test cases are run when an activity is invoked!!

thanks in advance

dinesh
  • 3
  • 1

2 Answers2

0

You could use something like Adb Wireless (requires root) which lets you run and test your applications (from the IDE) but without having a cable.

If what you want is running tests by invoking something from the device... then I don't know if it's possible. But at least it seems very useless... what's the point of running JUnit tests if you cannot see what failed?

Cristian
  • 198,401
  • 62
  • 356
  • 264
  • Thank you Cristian.. its to test the stability of the phone and not for the application testing.. when the phone is connected to usb it takes additional power through the usb.. to prevent it i dnt want it to be connected to the pc.. – dinesh Jul 13 '11 at 06:34
0

I would say yes if I have understood your question correctly.

There is "Dev Tools" available in Android emulator. You just need to create emulator in Eclipse. Then you need to fetch/install this application from emulator to your connected device. After that you install your test project in your device. Then you will be able to run that test project independent of your PC by selecting it from Instrumentation menu option of Dev Tools.

Following are the commands (you can change paths accordingly): To copy from a running emulator to connected device, execute: adb -e pull /system/app/Development.apk ./Development.apk

To copies the .apk file into the current directory. Then install it on your connected device with: adb -d install Development.apk

Hope this was your problem and required solution.

Sick
  • 11
  • 2
  • This is about testing another application. It does not require root. This post is useful for many of us looking to execute their tests directly on device without connecting it to PC. Just install project and test project on your device and execute tests. – Sick Aug 15 '11 at 10:04