views:

142

answers:

1

Following the "Hello, World" and "Hello, Testing" tutorials I created an android application created with Eclipse, along with a corresponding Android Test Project.

The tests run fine... once. After that, in order for me to run the tests again, I have to close the emulator.

If I don't close the emulator, the Eclipse console get stuck on "Installing instrumentation android.test.InstrumentationTestRunner on device emulator-5554"... Nothing happens after that.

Here's the output from my program on the second run:

[HelloTest] ------------------------------
[HelloTest] Android Launch!
[HelloTest] adb is running normally.
[HelloTest] Performing android.test.InstrumentationTestRunner JUnit launch
[HelloTest] Automatic Target Mode: using existing emulator 'emulator-5554' running compatible AVD 'FakePhone'
[HelloTest] Uploading HelloTest.apk onto device 'emulator-5554'
[HelloTest] Installing HelloTest.apk...
[HelloTest] Success!
[HelloTest] Project dependency found, installing: Hello
[Hello] Application already deployed. No need to reinstall. 
[HelloTest] Launching instrumentation android.test.InstrumentationTestRunner on device emulator-5554

As you can see it stops at "Launching Instrumentation"... I've also run "adb logcat" and not seen anything interesting.

I've been told to exit out of the application under test in the emulator in order to run the test again. Unfortunately the emulator doesn't have the app pulled up (it's in the normal "locked" position and when unlocked brings up the home screen) and even if I do pull it up then exit, it doesn't seem to let me run my tests again.

All the example videos and tutorials all stop at the first run of a test. I have yet to see anyone anywhere run a test a second time!

+1  A: 

Found in Dev Guide

"As you update your code, you periodically package and install it on the emulator. The emulator preserves the application and its state data across restarts, in a user-data disk partition. To ensure that the application runs properly as you update it, you may need to delete the emulator's user-data partition. To do so, start the emulator with the -wipe-data option. For more information about the user-data partition and other emulator storage, see Working with Emulator Disk Images."

Bactos
This didn't work for me. Maybe I did it wrong. Does it work for you..?
Gabriel
It has worked for me yes. Are you wiping the data before you update the application?
Bactos
I used the flag mentioned when starting the emulator and tried running the tests via eclipse like usual. Keep in mind also I haven't even changed the app or the test, I just want to run them again without closing the emulator and waiting two minutes to try again. It's faster and easier to just redeploy my app by itself and click around instead.
Gabriel
Have you seen the http://developer.android.com/guide/developing/testing/testing_eclipse.html and followed it? What have you been using as a guide?
Bactos
Yes, I've followed that guide.
Gabriel