[android-developers] Re: POJO junit test in an Android project

2010-08-11 Thread Doug
I've set up Android test projects for my POJOs (or any code that
doesn't depend on Android) and run them within Eclipse with no trouble
(if that's what you're asking).  You have to be tricky about the run
configuration you use the launch the tests, though.

-- 
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: POJO junit test in an Android project

2010-08-10 Thread ko5tik


On Aug 10, 3:39 am, doug doug_a...@yahoo.com wrote:
 Oh well, It doesn't seem that the Eclipse plug-in would even run a
 test case subclassed directly from junit.framework.TestCase.  How do
 folks test POJOs in Android then?

Which junit.framework.TestCase you are using?   One coming from
android library
will be just a stub

I use jMockit to mock everything android in my testcases, and junit
coming from somewhere else

-- 
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: POJO junit test in an Android project

2010-08-10 Thread A. Elk
The JUnit TestCase in Android should work.

By default, the Eclipse plug-in will not build tests/ or its
subdirectories into your application's .apk.

I recommend you have one project for your main application, and
another *project* for your test package. Notice that two different
projects in Eclipse can point to the same directory structure. The
project for your main application will point to root/src, root/
res, etc. The project for your test package will point to root/tests/
src, root/tests/res, etc. The same value of root is used for both
projects.

You can do this with the Android New Project wizard or Android New
Test Project wizard (in SDK 2.2 at least). When you create the test
project's location, uncheck default location and then enter root/
tests

What problem are you running into when you try to run a test package
containing subclasses of junit.framework.TestCase? You need to run it
with InstrumentationTestRunner. See the Android 2.2 documentation
Testing and Instrumentation and also Testing in Eclipse, with ADT.
Or, you can use AndroidTestCase, which extends
junit.framework.TestCase.


On Aug 10, 4:33 am, ko5tik kpriblo...@yahoo.com wrote:
 On Aug 10, 3:39 am, doug doug_a...@yahoo.com wrote:

  Oh well, It doesn't seem that the Eclipse plug-in would even run a
  test case subclassed directly from junit.framework.TestCase.  How do
  folks test POJOs in Android then?

 Which junit.framework.TestCase you are using?   One coming from
 android library
 will be just a stub

 I use jMockit to mock everything android in my testcases, and junit
 coming from somewhere else

-- 
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: POJO junit test in an Android project

2010-08-10 Thread doug
Thanks for the reply.  Test cases derived from Android
junit.framework.TestCase still need the emulator to run.  But I should
have known better.  Dalvik is not a JVM so of course it would be
impossible to test Android code with tools written for JVM because
Java class engineering would not apply to Dalvik.

doug

-- 
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: POJO junit test in an Android project

2010-08-09 Thread doug
Oh well, It doesn't seem that the Eclipse plug-in would even run a
test case subclassed directly from junit.framework.TestCase.  How do
folks test POJOs in Android then?

Thanks,
doug

-- 
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