Need help in running the android junit test case for andriod APIDemo in eclipse

by Xavier Ducrohet » Fri, 30 Jan 2009 10:12:55 GMT


Sponsored Links
 ou will never really be able to just use the default Run as JUnit test action.

This is because this setups up the tests to run using the system
library of the project which, for Android project, is android.jar.
android.jar in the SDK is only stubbed methods/classes, and contains no code.

You can run unit tests by setting up Eclipse using the follow
instructions: http://code.google.com/android/kb/troubleshooting.html#addjunit

Note that this will only work for tests not using the Android APIs.

If you wish to run true android test, please use instrumentations
running on the device.
See
http://code.google.com/android/reference/android/test/InstrumentationTestRunner.html
for more information.

The information from Diego to setup the test runners for ApiDemos is
good, except that you don't need to create a new project and copy
things over, you can simply create a project for the existing source
(you will need to link the apidemos project in your build path).

Xav

On Thu, Jan 29, 2009 at 5:44 PM, ying...@gmail.com <ying...@gmail.com> wrote:

--~--~---------~--~----~------------~-------~--~----~



Need help in running the android junit test case for andriod APIDemo in eclipse

by ying lcs » Fri, 30 Jan 2009 10:25:45 GMT


 n Thu, Jan 29, 2009 at 6:12 PM, Xavier Ducrohet <x...@google.com> wrote:
Thanks. But most likely most of my classes will use android APIs, so
using this to unit-test is not that common, right?
Or I am mis-understanding the condition.
I would like to have 1 way to unit-test my android code.






Thank you. I have followed Diego instructions, and I finally get that to work.
But you mention that there a way not to create a new project.
Can you please tell me how to do that?

I have create an 'apidemos' project in eclipse, but the 'tests'
directory is not in the build path. Hence they are not compile.

So what should I do to run the code 'tests' code without creating a
new project like Diego described.

Thank you for any tips.



--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


Need help in running the android junit test case for andriod APIDemo in eclipse

by Xavier Ducrohet » Fri, 30 Jan 2009 10:31:50 GMT


 sing the "new android project" wizard, you can create a project from
existing source.
This is probably what you used to create a project for ApiDemos. Just
use it again for the tests project (point the wizard to
<sdk>/samples/ApiDemos/tests).

The compilation problem is because the tests project doesn't know the
ApiDemos classes until you tell it where they are.
Right click the tests project in the package Explorer and choose Build
Path > Configure Build Path.
In the "Projects" tab, click Add and choose your ApiDemos project.

Because deployment of instrumentation projects is not supported in ADT
you will have install ApiDemos and your test project manually.

We do intend to improve this workflow in the future.

Xav

On Thu, Jan 29, 2009 at 6:25 PM, ying lcs <ying...@gmail.com> wrote:

--~--~---------~--~----~------------~-------~--~----~



Need help in running the android junit test case for andriod APIDemo in eclipse

by ying lcs » Sat, 31 Jan 2009 04:17:36 GMT


 hank you.  Xavier,

Can you please tell me if this will run other vanilla junit test
cases? The ones just inherit from Junit framework, not the ones which
are sub-classed from Google TestCase classes?

Thank you.

On Thu, Jan 29, 2009 at 6:31 PM, Xavier Ducrohet <x...@google.com> wrote:

--~--~---------~--~----~------------~-------~--~----~



Need help in running the android junit test case for andriod APIDemo in eclipse

by ying lcs » Sat, 31 Jan 2009 06:21:13 GMT


 i,

I tried that again, but it does not work now, for some reason.

I did load 'ApiDemos' project first, but I don't see the 'Test for Api
Demo' in the 'Instrumentation.' screen.
Then, I manually load the 'ApiDemosTest2' project again, I still don't
see the 'Test for Api Demo'.

But from the Eclipse output, I do see that both apk has been installed.

Any idea why it does not work?
Thank you for any help.

[2009-01-30 14:09:26 - ApiDemos] HOME is up on device 'emulator-5554'
[2009-01-30 14:09:26 - ApiDemos] Uploading ApiDemos.apk onto device
'emulator-5554'
[2009-01-30 14:09:28 - ApiDemos] Installing ApiDemos.apk...
[2009-01-30 14:09:37 - ApiDemos] Success!
[2009-01-30 14:09:38 - ApiDemos] Starting activity
com.example.android.apis.ApiDemos on device
[2009-01-30 14:09:39 - ApiDemos] ActivityManager: Starting: Intent {
comp={com.example.android.apis/com.example.android.apis.ApiDemos} }
[2009-01-30 14:09:39 - ApiDemos] Attempting to connect debugger to
'com.example.android.apis' on port 8613
[2009-01-30 14:15:00 - ApiDemosTest2] ------------------------------
[2009-01-30 14:15:00 - ApiDemosTest2] Android Launch!
[2009-01-30 14:15:00 - ApiDemosTest2] adb is running normally.
[2009-01-30 14:15:00 - ApiDemosTest2] Launching:
com.example.android.apis.tests.Dummy
[2009-01-30 14:15:00 - ApiDemosTest2] Automatic Target Mode: using
existing emulator: emulator-5554
[2009-01-30 14:15:00 - ApiDemosTest2] Uploading ApiDemosTest2.apk onto
device 'emulator-5554'
[2009-01-30 14:15:00 - ApiDemosTest2] Installing ApiDemosTest2.apk...
[2009-01-30 14:15:03 - ApiDemosTest2] Success!
[2009-01-30 14:15:03 - ApiDemosTest2] Starting activity
com.example.android.apis.tests.Dummy on device
[2009-01-30 14:15:04 - ApiDemosTest2] ActivityManager: Starting:
Intent {
comp={com.example.android.apis.tests/com.example.android.apis.tests.Dummy}
}
[2009-01-30 14:15:04 - ApiDemosTest2] Attempting to connect debugger
to 'com.example.android.apis.tests' on port 8617


On Thu, Jan 29, 2009 at 6:31 PM, Xavier Ducrohet <x...@google.com> wrote:

--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. enabling Wifi (managed mode) when wi-fi tethering (in Soft AP mode)

Hi,

I would like to enable Soft AP mode and Wi-fi Managed mode (as a
station - STA) simultaneously on Android. Basically, Android 2.2
(Froyo) and higher have app, which can enable Tethering over Wifi
based on Soft AP, but allows tethering only over 3G. Association with
any wi-fi during tethering is not allowed!
I would like to have ON both Wi-fi modes simultaneously on one
physical radio, thus my Nexus device will be associated as a STA with
some real wi-fi access point (AP) and meanwhile will work as soft AP
for other devices! (e.g. I can stream something from internet coming
from real AP and relay this streaming to other device associated with
my soft AP)
(I know it is not very common scenario, but i need this configuration
for some service testing and demos)
I would like to ask you whether it is possible to configure one radio
interface to work simultaneously in two modes?
If I understood correctly to wpa_supplicant functionality, it allows
control drivers through by wpa_supplicant.conf file. But I do not know
whether I can configure two virtual interfaces to be ON at the same
time (e.g. wlan0 and wlan1) (The smarphones which I am using have
Android 2.2 (rooted) and Wi-fi chip is Broadcom 4329 which supports
wpa_supplicant feature).

Thank you very much.

Best regards,

Martin

-- 

2. problem android and eclipse

I installed eclipse 3.6 (helios) and jdk 1.6.24
I installed ADT plugin in eclipse and I have configured
up here is good, but when you start eclipse an error message appears:
"failed to initialize Monitor thread: unable to ESTABLISH loopback
connection"
I searched the net too much, I could not get out
can you help me please??

-- 
*********************************************
Cordialement
Salma DAMMAK
Elve ingnieur, GI3-ISI
Ecole Nationale d'Ingnieurs de Sfax
Route de Soukra Km 4, Sfax-Tunisie
Tl: 74 45 00 42
      23 21 86 38
E-mail: dammak.sa...@gmail.com
           dammak_sa...@yahoo.fr

-- 

3. Playing media files via Monkey

4. Android SAXParser Malformed XMl error

5. How to use opencv in android application in Mac OS??

6. how to unblock logcat

7. Is there any way to unsubscribe from "https://review.source.android.com/"?