[android-developers] Re: Running JUnit 4 Tests on Android Device

2010-08-22 Thread The.French.DJ
Just put the JUnit 4 jar before the Android jar in the classpath. This
will hide the JUnit 3 classes. Note that you must not use any Android
classes in your test! You will get Stub! exceptions if you do. If
you need a few basic Android classes in your tests (like Intent and
Bundle), add simple replacements to your test folder.

Try to separate testing close to Android with the Android testing
framework (JUnit 3 based), and core logic without Android framework
dependencies (using JUnit 4) and you're good to go..

Cheers,

tfdj


On Aug 16, 9:39 pm, Eric e...@alum.mit.edu wrote:
 Hello,

 As the first step of the port of my existing Java swing application to
 Android, I'd like to get the non-UI logic unit tests running on the
 Android device.  The unit tests are written against JUnit 4.  It looks
 like Android 2.2 comes with JUnit 3 as the default.  Is there an easy
 way (or any way) to bootstrap JUnit 4 as the test runner?

 I am using IDEA as my dev environment, but it doesn't appear there's
 any settings that will allow me to specify JUnit 4.

 - Eric

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


[android-developers] Re: Running JUnit 4 Tests on Android Device

2010-08-21 Thread LT
Wondering about this too...

On Aug 16, 12:39 pm, Eric e...@alum.mit.edu wrote:
 Hello,

 As the first step of the port of my existing Java swing application to
 Android, I'd like to get the non-UI logic unit tests running on the
 Android device.  The unit tests are written against JUnit 4.  It looks
 like Android 2.2 comes with JUnit 3 as the default.  Is there an easy
 way (or any way) to bootstrap JUnit 4 as the test runner?

 I am using IDEA as my dev environment, but it doesn't appear there's
 any settings that will allow me to specify JUnit 4.

 - Eric

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