I was finally able to get this set up in Eclilpse.  IT DOES NOT WORK.
The Android TestSuiteBuilder is casting the tests to TestMethod and
TestCase in the 'build' method, and one of those casts is breaking the
JUnit4TestAdapter.  So while it is possible to run JUnit 4 tests on
JUnit 3 using the JUnit4TestAdapter, it seems you cannot do this on
Android itself (see stacktrace below).  Unless there is a workaround
that will somehow allow me to run the unit tests with a vanilla JUnit
3 runner, instead of having Android install it's own custom
android.test.InstrumentationTestRunner.  However, being new to Android
& Eclipse, I haven't been able to figure out how to have the Eclipse
run vanilla JUnit 3 on the device/emulator.  If anyone knows the
answer to this, I'd certainly appreciate it.


08-20 23:22:48.347: INFO/TestSuiteBuilder(358):
java.lang.ClassCastException: junit.framework.JUnit4TestAdapter
08-20 23:22:48.347: INFO/TestSuiteBuilder(358):     at
android.test.suitebuilder.TestSuiteBuilder.build(TestSuiteBuilder.java:
189)
08-20 23:22:48.347: INFO/TestSuiteBuilder(358):     at
android.test.InstrumentationTestRunner.onCreate(InstrumentationTestRunner.java:
373)
08-20 23:22:48.347: INFO/TestSuiteBuilder(358):     at
android.app.ActivityThread.handleBindApplication(ActivityThread.java:
4218)
08-20 23:22:48.347: INFO/TestSuiteBuilder(358):     at
android.app.ActivityThread.access$3000(ActivityThread.java:125)
08-20 23:22:48.347: INFO/TestSuiteBuilder(358):     at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:2071)
08-20 23:22:48.347: INFO/TestSuiteBuilder(358):     at
android.os.Handler.dispatchMessage(Handler.java:99)
08-20 23:22:48.347: INFO/TestSuiteBuilder(358):     at
android.os.Looper.loop(Looper.java:123)
08-20 23:22:48.347: INFO/TestSuiteBuilder(358):     at
android.app.ActivityThread.main(ActivityThread.java:4627)
08-20 23:22:48.347: INFO/TestSuiteBuilder(358):     at
java.lang.reflect.Method.invokeNative(Native Method)
08-20 23:22:48.347: INFO/TestSuiteBuilder(358):     at
java.lang.reflect.Method.invoke(Method.java:521)
08-20 23:22:48.347: INFO/TestSuiteBuilder(358):     at
com.android.internal.os.ZygoteInit
$MethodAndArgsCaller.run(ZygoteInit.java:868)
08-20 23:22:48.347: INFO/TestSuiteBuilder(358):     at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
08-20 23:22:48.347: INFO/TestSuiteBuilder(358):     at
dalvik.system.NativeStart.main(Native Method)

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to